web/wp-admin/edit-link-form.php
changeset 194 32102edaa81b
parent 136 bde1974c263b
child 204 09a1c134465b
equal deleted inserted replaced
193:2f6f6f7551ca 194:32102edaa81b
    20 	$submit_text = __('Add Link');
    20 	$submit_text = __('Add Link');
    21 	$form = '<form name="addlink" id="addlink" method="post" action="link.php">';
    21 	$form = '<form name="addlink" id="addlink" method="post" action="link.php">';
    22 	$nonce_action = 'add-bookmark';
    22 	$nonce_action = 'add-bookmark';
    23 }
    23 }
    24 
    24 
    25 require_once('includes/meta-boxes.php');
    25 require_once('./includes/meta-boxes.php');
    26 
    26 
    27 add_meta_box('linksubmitdiv', __('Save'), 'link_submit_meta_box', 'link', 'side', 'core');
    27 add_meta_box('linksubmitdiv', __('Save'), 'link_submit_meta_box', null, 'side', 'core');
    28 add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', 'link', 'normal', 'core');
    28 add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', null, 'normal', 'core');
    29 add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', 'link', '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', 'link', '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', 'link', 'normal', 'core');
    31 add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', null, 'normal', 'core');
       
    32 
       
    33 do_action('add_meta_boxes', 'link', $link);
       
    34 do_action('add_meta_boxes_link', $link);
    32 
    35 
    33 do_action('do_meta_boxes', 'link', 'normal', $link);
    36 do_action('do_meta_boxes', 'link', 'normal', $link);
    34 do_action('do_meta_boxes', 'link', 'advanced', $link);
    37 do_action('do_meta_boxes', 'link', 'advanced', $link);
    35 do_action('do_meta_boxes', 'link', 'side', $link);
    38 do_action('do_meta_boxes', 'link', 'side', $link);
    36 
    39 
       
    40 add_screen_option('layout_columns', array('max' => 2, 'default' => 2) );
       
    41 
       
    42 get_current_screen()->add_help_tab( array(
       
    43 	'id'      => 'overview',
       
    44 	'title'   => __('Overview'),
       
    45 	'content' =>
       
    46 	'<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>' .
       
    47 	'<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>' .
       
    48 	'<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>'
       
    49 ) );
       
    50 
       
    51 get_current_screen()->set_help_sidebar(
       
    52 	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
       
    53 	'<p>' . __( '<a href="http://codex.wordpress.org/Links_Add_New_Screen" target="_blank">Documentation on Creating Links</a>' ) . '</p>' .
       
    54 	'<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
       
    55 );
       
    56 
    37 require_once ('admin-header.php');
    57 require_once ('admin-header.php');
       
    58 ?>
    38 
    59 
    39 ?>
       
    40 <div class="wrap">
    60 <div class="wrap">
    41 <?php screen_icon(); ?>
    61 <?php screen_icon(); ?>
    42 <h2><?php echo esc_html( $title ); ?></h2>
    62 <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>
    43 
    63 
    44 <?php if ( isset( $_GET['added'] ) ) : ?>
    64 <?php if ( isset( $_GET['added'] ) ) : ?>
    45 <div id="message" class="updated fade"><p><?php _e('Link added.'); ?></p></div>
    65 <div id="message" class="updated"><p><?php _e('Link added.'); ?></p></div>
    46 <?php endif; ?>
    66 <?php endif; ?>
    47 
    67 
    48 <?php
    68 <?php
    49 if ( !empty($form) )
    69 if ( !empty($form) )
    50 	echo $form;
    70 	echo $form;
    53 
    73 
    54 wp_nonce_field( $nonce_action );
    74 wp_nonce_field( $nonce_action );
    55 wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
    75 wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
    56 wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
    76 wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
    57 
    77 
    58 <div id="poststuff" class="metabox-holder<?php echo 2 == $screen_layout_columns ? ' has-right-sidebar' : ''; ?>">
    78 <div id="poststuff">
    59 
    79 
    60 <div id="side-info-column" class="inner-sidebar">
    80 <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
    61 <?php
       
    62 
       
    63 do_action('submitlink_box');
       
    64 $side_meta_boxes = do_meta_boxes( 'link', 'side', $link );
       
    65 
       
    66 ?>
       
    67 </div>
       
    68 
       
    69 <div id="post-body">
       
    70 <div id="post-body-content">
    81 <div id="post-body-content">
    71 <div id="namediv" class="stuffbox">
    82 <div id="namediv" class="stuffbox">
    72 <h3><label for="link_name"><?php _e('Name') ?></label></h3>
    83 <h3><label for="link_name"><?php _ex('Name', 'link name') ?></label></h3>
    73 <div class="inside">
    84 <div class="inside">
    74 	<input type="text" name="link_name" size="30" tabindex="1" value="<?php echo esc_attr($link->link_name); ?>" id="link_name" />
    85 	<input type="text" name="link_name" size="30" tabindex="1" value="<?php echo esc_attr($link->link_name); ?>" id="link_name" />
    75     <p><?php _e('Example: Nifty blogging software'); ?></p>
    86     <p><?php _e('Example: Nifty blogging software'); ?></p>
    76 </div>
    87 </div>
    77 </div>
    88 </div>
    89 <div class="inside">
   100 <div class="inside">
    90 	<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" />
   101 	<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" />
    91     <p><?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?></p>
   102     <p><?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?></p>
    92 </div>
   103 </div>
    93 </div>
   104 </div>
       
   105 </div><!-- /post-body-content -->
    94 
   106 
       
   107 <div id="postbox-container-1" class="postbox-container">
    95 <?php
   108 <?php
    96 
   109 
    97 do_meta_boxes('link', 'normal', $link);
   110 do_action('submitlink_box');
       
   111 $side_meta_boxes = do_meta_boxes( 'link', 'side', $link );
    98 
   112 
    99 do_meta_boxes('link', 'advanced', $link);
   113 ?>
       
   114 </div>
       
   115 <div id="postbox-container-2" class="postbox-container">
       
   116 <?php
       
   117 
       
   118 do_meta_boxes(null, 'normal', $link);
       
   119 
       
   120 do_meta_boxes(null, 'advanced', $link);
       
   121 
       
   122 ?>
       
   123 </div>
       
   124 <?php
   100 
   125 
   101 if ( $link_id ) : ?>
   126 if ( $link_id ) : ?>
   102 <input type="hidden" name="action" value="save" />
   127 <input type="hidden" name="action" value="save" />
   103 <input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
   128 <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); ?>" />
   129 <input type="hidden" name="order_by" value="<?php echo esc_attr($order_by); ?>" />
   107 <input type="hidden" name="action" value="add" />
   132 <input type="hidden" name="action" value="add" />
   108 <?php endif; ?>
   133 <?php endif; ?>
   109 
   134 
   110 </div>
   135 </div>
   111 </div>
   136 </div>
   112 </div>
       
   113 
   137 
   114 </form>
   138 </form>
   115 </div>
   139 </div>