[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-admin/ -> edit-link-form.php (source)

   1  <?php
   2  /**
   3   * Edit links form for inclusion in administration panels.
   4   *
   5   * @package WordPress
   6   * @subpackage Administration
   7   */
   8  
   9  // Don't load directly.
  10  if ( ! defined( 'ABSPATH' ) ) {
  11      die( '-1' );
  12  }
  13  
  14  if ( ! empty( $link_id ) ) {
  15      /* translators: %s: URL to Links screen. */
  16      $heading      = sprintf( __( '<a href="%s">Links</a> / Edit Link' ), 'link-manager.php' );
  17      $submit_text  = __( 'Update Link' );
  18      $form_name    = 'editlink';
  19      $nonce_action = 'update-bookmark_' . $link_id;
  20  } else {
  21      /* translators: %s: URL to Links screen. */
  22      $heading      = sprintf( __( '<a href="%s">Links</a> / Add New Link' ), 'link-manager.php' );
  23      $submit_text  = __( 'Add Link' );
  24      $form_name    = 'addlink';
  25      $nonce_action = 'add-bookmark';
  26  }
  27  
  28  require_once ABSPATH . 'wp-admin/includes/meta-boxes.php';
  29  
  30  add_meta_box( 'linksubmitdiv', __( 'Save' ), 'link_submit_meta_box', null, 'side', 'core' );
  31  add_meta_box( 'linkcategorydiv', __( 'Categories' ), 'link_categories_meta_box', null, 'normal', 'core' );
  32  add_meta_box( 'linktargetdiv', __( 'Target' ), 'link_target_meta_box', null, 'normal', 'core' );
  33  add_meta_box( 'linkxfndiv', __( 'Link Relationship (XFN)' ), 'link_xfn_meta_box', null, 'normal', 'core' );
  34  add_meta_box( 'linkadvanceddiv', __( 'Advanced' ), 'link_advanced_meta_box', null, 'normal', 'core' );
  35  
  36  /** This action is documented in wp-admin/includes/meta-boxes.php */
  37  do_action( 'add_meta_boxes', 'link', $link );
  38  
  39  /**
  40   * Fires when link-specific meta boxes are added.
  41   *
  42   * @since 3.0.0
  43   *
  44   * @param object $link Link object.
  45   */
  46  do_action( 'add_meta_boxes_link', $link );
  47  
  48  /** This action is documented in wp-admin/includes/meta-boxes.php */
  49  do_action( 'do_meta_boxes', 'link', 'normal', $link );
  50  /** This action is documented in wp-admin/includes/meta-boxes.php */
  51  do_action( 'do_meta_boxes', 'link', 'advanced', $link );
  52  /** This action is documented in wp-admin/includes/meta-boxes.php */
  53  do_action( 'do_meta_boxes', 'link', 'side', $link );
  54  
  55  add_screen_option(
  56      'layout_columns',
  57      array(
  58          'max'     => 2,
  59          'default' => 2,
  60      )
  61  );
  62  
  63  get_current_screen()->add_help_tab(
  64      array(
  65          'id'      => 'overview',
  66          'title'   => __( 'Overview' ),
  67          'content' =>
  68          '<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>' .
  69          '<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 do not use in the Screen Options tab, or minimize boxes by clicking on the title bar of the box.' ) . '</p>' .
  70          '<p>' . __( 'XFN stands for <a href="https://gmpg.org/xfn/">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>',
  71      )
  72  );
  73  
  74  get_current_screen()->set_help_sidebar(
  75      '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
  76      '<p>' . __( '<a href="https://codex.wordpress.org/Links_Add_New_Screen">Documentation on Creating Links</a>' ) . '</p>' .
  77      '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
  78  );
  79  
  80  require_once ABSPATH . 'wp-admin/admin-header.php';
  81  ?>
  82  
  83  <div class="wrap">
  84  <h1 class="wp-heading-inline">
  85  <?php
  86  echo esc_html( $title );
  87  ?>
  88  </h1>
  89  
  90  <a href="link-add.php" class="page-title-action"><?php echo esc_html_x( 'Add New', 'link' ); ?></a>
  91  
  92  <hr class="wp-header-end">
  93  
  94  <?php if ( isset( $_GET['added'] ) ) : ?>
  95  <div id="message" class="updated notice is-dismissible"><p><?php _e( 'Link added.' ); ?></p></div>
  96  <?php endif; ?>
  97  
  98  <form name="<?php echo esc_attr( $form_name ); ?>" id="<?php echo esc_attr( $form_name ); ?>" method="post" action="link.php">
  99  <?php
 100  if ( ! empty( $link_added ) ) {
 101      echo $link_added;
 102  }
 103  
 104  wp_nonce_field( $nonce_action );
 105  wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
 106  wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
 107  ?>
 108  
 109  <div id="poststuff">
 110  
 111  <div id="post-body" class="metabox-holder columns-<?php echo ( 1 === get_current_screen()->get_columns() ) ? '1' : '2'; ?>">
 112  <div id="post-body-content">
 113  <div id="namediv" class="postbox">
 114  <h2 class="postbox-header"><label for="link_name"><?php _ex( 'Name', 'link name' ); ?></label></h2>
 115  <div class="inside">
 116      <input type="text" name="link_name" size="30" maxlength="255" value="<?php echo esc_attr( $link->link_name ); ?>" id="link_name" />
 117      <p><?php _e( 'Example: Nifty blogging software' ); ?></p>
 118  </div>
 119  </div>
 120  
 121  <div id="addressdiv" class="postbox">
 122  <h2 class="postbox-header"><label for="link_url"><?php _e( 'Web Address' ); ?></label></h2>
 123  <div class="inside">
 124      <input type="text" name="link_url" size="30" maxlength="255" class="code" value="<?php echo esc_attr( $link->link_url ); ?>" id="link_url" />
 125      <p><?php _e( 'Example: <code>https://wordpress.org/</code> &#8212; do not forget the <code>https://</code>' ); ?></p>
 126  </div>
 127  </div>
 128  
 129  <div id="descriptiondiv" class="postbox">
 130  <h2 class="postbox-header"><label for="link_description"><?php _e( 'Description' ); ?></label></h2>
 131  <div class="inside">
 132      <input type="text" name="link_description" size="30" maxlength="255" value="<?php echo isset( $link->link_description ) ? esc_attr( $link->link_description ) : ''; ?>" id="link_description" />
 133      <p><?php _e( 'This will be shown when someone hovers over the link in the blogroll, or optionally below the link.' ); ?></p>
 134  </div>
 135  </div>
 136  </div><!-- /post-body-content -->
 137  
 138  <div id="postbox-container-1" class="postbox-container">
 139  <?php
 140  
 141  /** This action is documented in wp-admin/includes/meta-boxes.php */
 142  do_action( 'submitlink_box' );
 143  $side_meta_boxes = do_meta_boxes( 'link', 'side', $link );
 144  
 145  ?>
 146  </div>
 147  <div id="postbox-container-2" class="postbox-container">
 148  <?php
 149  
 150  do_meta_boxes( null, 'normal', $link );
 151  
 152  do_meta_boxes( null, 'advanced', $link );
 153  
 154  ?>
 155  </div>
 156  <?php
 157  
 158  if ( $link_id ) :
 159      ?>
 160  <input type="hidden" name="action" value="save" />
 161  <input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
 162  <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id; ?>" />
 163  <?php else : ?>
 164  <input type="hidden" name="action" value="add" />
 165  <?php endif; ?>
 166  
 167  </div>
 168  </div>
 169  
 170  </form>
 171  </div>


Generated: Thu Nov 21 01:00:03 2024 Cross-referenced by PHPXref 0.7.1