PageRenderTime 40ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 1ms

/wp-admin/edit-link-form.php

https://bitbucket.org/matyhaty/senses-avj-printclub
PHP | 139 lines | 105 code | 27 blank | 7 comment | 8 complexity | e41fba4716171653ec19e6acdd81f474 MD5 | raw file
Possible License(s): AGPL-1.0, LGPL-2.1, GPL-2.0
  1. <?php
  2. /**
  3. * Edit links form for inclusion in administration panels.
  4. *
  5. * @package WordPress
  6. * @subpackage Administration
  7. */
  8. // don't load directly
  9. if ( !defined('ABSPATH') )
  10. die('-1');
  11. if ( ! empty($link_id) ) {
  12. $heading = sprintf( __( '<a href="%s">Links</a> / Edit Link' ), 'link-manager.php' );
  13. $submit_text = __('Update Link');
  14. $form = '<form name="editlink" id="editlink" method="post" action="link.php">';
  15. $nonce_action = 'update-bookmark_' . $link_id;
  16. } else {
  17. $heading = sprintf( __( '<a href="%s">Links</a> / Add New Link' ), 'link-manager.php' );
  18. $submit_text = __('Add Link');
  19. $form = '<form name="addlink" id="addlink" method="post" action="link.php">';
  20. $nonce_action = 'add-bookmark';
  21. }
  22. require_once('./includes/meta-boxes.php');
  23. add_meta_box('linksubmitdiv', __('Save'), 'link_submit_meta_box', null, 'side', 'core');
  24. add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', null, 'normal', 'core');
  25. add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', null, 'normal', 'core');
  26. add_meta_box('linkxfndiv', __('Link Relationship (XFN)'), 'link_xfn_meta_box', null, 'normal', 'core');
  27. add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', null, 'normal', 'core');
  28. do_action('add_meta_boxes', 'link', $link);
  29. do_action('add_meta_boxes_link', $link);
  30. do_action('do_meta_boxes', 'link', 'normal', $link);
  31. do_action('do_meta_boxes', 'link', 'advanced', $link);
  32. do_action('do_meta_boxes', 'link', 'side', $link);
  33. add_screen_option('layout_columns', array('max' => 2, 'default' => 2) );
  34. get_current_screen()->add_help_tab( array(
  35. 'id' => 'overview',
  36. 'title' => __('Overview'),
  37. 'content' =>
  38. '<p>' . __( 'You can add or edit links on this screen by entering information in each of the boxes. Only the link&#8217;s web address and name (the text you want to display on your site as the link) are required fields.' ) . '</p>' .
  39. '<p>' . __( 'The boxes for link name, web address, and description have fixed positions, while the others may be repositioned using drag and drop. You can also hide boxes you don&#8217;t use in the Screen Options tab, or minimize boxes by clicking on the title bar of the box.' ) . '</p>' .
  40. '<p>' . __( 'XFN stands for <a href="http://gmpg.org/xfn/" target="_blank">XHTML Friends Network</a>, which is optional. WordPress allows the generation of XFN attributes to show how you are related to the authors/owners of the site to which you are linking.' ) . '</p>'
  41. ) );
  42. get_current_screen()->set_help_sidebar(
  43. '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
  44. '<p>' . __( '<a href="http://codex.wordpress.org/Links_Add_New_Screen" target="_blank">Documentation on Creating Links</a>' ) . '</p>' .
  45. '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
  46. );
  47. require_once ('admin-header.php');
  48. ?>
  49. <div class="wrap">
  50. <?php screen_icon(); ?>
  51. <h2><?php echo esc_html( $title ); ?> <a href="link-add.php" class="add-new-h2"><?php echo esc_html_x('Add New', 'link'); ?></a></h2>
  52. <?php if ( isset( $_GET['added'] ) ) : ?>
  53. <div id="message" class="updated"><p><?php _e('Link added.'); ?></p></div>
  54. <?php endif; ?>
  55. <?php
  56. if ( !empty($form) )
  57. echo $form;
  58. if ( !empty($link_added) )
  59. echo $link_added;
  60. wp_nonce_field( $nonce_action );
  61. wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
  62. wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
  63. <div id="poststuff">
  64. <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
  65. <div id="post-body-content">
  66. <div id="namediv" class="stuffbox">
  67. <h3><label for="link_name"><?php _ex('Name', 'link name') ?></label></h3>
  68. <div class="inside">
  69. <input type="text" name="link_name" size="30" tabindex="1" value="<?php echo esc_attr($link->link_name); ?>" id="link_name" />
  70. <p><?php _e('Example: Nifty blogging software'); ?></p>
  71. </div>
  72. </div>
  73. <div id="addressdiv" class="stuffbox">
  74. <h3><label for="link_url"><?php _e('Web Address') ?></label></h3>
  75. <div class="inside">
  76. <input type="text" name="link_url" size="30" class="code" tabindex="1" value="<?php echo esc_attr($link->link_url); ?>" id="link_url" />
  77. <p><?php _e('Example: <code>http://wordpress.org/</code> &#8212; don&#8217;t forget the <code>http://</code>'); ?></p>
  78. </div>
  79. </div>
  80. <div id="descriptiondiv" class="stuffbox">
  81. <h3><label for="link_description"><?php _e('Description') ?></label></h3>
  82. <div class="inside">
  83. <input type="text" name="link_description" size="30" tabindex="1" value="<?php echo isset($link->link_description) ? esc_attr($link->link_description) : ''; ?>" id="link_description" />
  84. <p><?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?></p>
  85. </div>
  86. </div>
  87. </div><!-- /post-body-content -->
  88. <div id="postbox-container-1" class="postbox-container">
  89. <?php
  90. do_action('submitlink_box');
  91. $side_meta_boxes = do_meta_boxes( 'link', 'side', $link );
  92. ?>
  93. </div>
  94. <div id="postbox-container-2" class="postbox-container">
  95. <?php
  96. do_meta_boxes(null, 'normal', $link);
  97. do_meta_boxes(null, 'advanced', $link);
  98. ?>
  99. </div>
  100. <?php
  101. if ( $link_id ) : ?>
  102. <input type="hidden" name="action" value="save" />
  103. <input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
  104. <input type="hidden" name="order_by" value="<?php echo esc_attr($order_by); ?>" />
  105. <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
  106. <?php else: ?>
  107. <input type="hidden" name="action" value="add" />
  108. <?php endif; ?>
  109. </div>
  110. </div>
  111. </form>
  112. </div>