[ Index ]

WordPress Cross Reference

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


Generated: Tue Mar 25 01:41:18 2014 WordPress honlapkészítés: online1.hu