11 die('-1'); |
11 die('-1'); |
12 |
12 |
13 if ( ! empty($link_id) ) { |
13 if ( ! empty($link_id) ) { |
14 $heading = sprintf( __( '<a href="%s">Links</a> / Edit Link' ), 'link-manager.php' ); |
14 $heading = sprintf( __( '<a href="%s">Links</a> / Edit Link' ), 'link-manager.php' ); |
15 $submit_text = __('Update Link'); |
15 $submit_text = __('Update Link'); |
16 $form = '<form name="editlink" id="editlink" method="post" action="link.php">'; |
16 $form_name = 'editlink'; |
17 $nonce_action = 'update-bookmark_' . $link_id; |
17 $nonce_action = 'update-bookmark_' . $link_id; |
18 } else { |
18 } else { |
19 $heading = sprintf( __( '<a href="%s">Links</a> / Add New Link' ), 'link-manager.php' ); |
19 $heading = sprintf( __( '<a href="%s">Links</a> / Add New Link' ), 'link-manager.php' ); |
20 $submit_text = __('Add Link'); |
20 $submit_text = __('Add Link'); |
21 $form = '<form name="addlink" id="addlink" method="post" action="link.php">'; |
21 $form_name = 'addlink'; |
22 $nonce_action = 'add-bookmark'; |
22 $nonce_action = 'add-bookmark'; |
23 } |
23 } |
24 |
24 |
25 require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' ); |
25 require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' ); |
26 |
26 |
28 add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', null, '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', 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'); |
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'); |
31 add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', null, 'normal', 'core'); |
32 |
32 |
33 do_action('add_meta_boxes', 'link', $link); |
33 /** This action is documented in wp-admin/edit-form-advanced.php */ |
34 do_action('add_meta_boxes_link', $link); |
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 ); |
35 |
44 |
36 /** This action is documented in wp-admin/edit-form-advanced.php */ |
45 /** This action is documented in wp-admin/edit-form-advanced.php */ |
37 do_action('do_meta_boxes', 'link', 'normal', $link); |
46 do_action( 'do_meta_boxes', 'link', 'normal', $link ); |
38 /** This action is documented in wp-admin/edit-form-advanced.php */ |
47 /** This action is documented in wp-admin/edit-form-advanced.php */ |
39 do_action('do_meta_boxes', 'link', 'advanced', $link); |
48 do_action( 'do_meta_boxes', 'link', 'advanced', $link ); |
40 /** This action is documented in wp-admin/edit-form-advanced.php */ |
49 /** This action is documented in wp-admin/edit-form-advanced.php */ |
41 do_action('do_meta_boxes', 'link', 'side', $link); |
50 do_action( 'do_meta_boxes', 'link', 'side', $link ); |
42 |
51 |
43 add_screen_option('layout_columns', array('max' => 2, 'default' => 2) ); |
52 add_screen_option('layout_columns', array('max' => 2, 'default' => 2) ); |
44 |
53 |
45 get_current_screen()->add_help_tab( array( |
54 get_current_screen()->add_help_tab( array( |
46 'id' => 'overview', |
55 'id' => 'overview', |
51 '<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>' |
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>' |
52 ) ); |
61 ) ); |
53 |
62 |
54 get_current_screen()->set_help_sidebar( |
63 get_current_screen()->set_help_sidebar( |
55 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
64 '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
56 '<p>' . __( '<a href="http://codex.wordpress.org/Links_Add_New_Screen" target="_blank">Documentation on Creating Links</a>' ) . '</p>' . |
65 '<p>' . __( '<a href="https://codex.wordpress.org/Links_Add_New_Screen" target="_blank">Documentation on Creating Links</a>' ) . '</p>' . |
57 '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
66 '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
58 ); |
67 ); |
59 |
68 |
60 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
69 require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
61 ?> |
70 ?> |
62 |
71 |
63 <div class="wrap"> |
72 <div class="wrap"> |
64 <?php screen_icon(); ?> |
|
65 <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> |
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> |
66 |
74 |
67 <?php if ( isset( $_GET['added'] ) ) : ?> |
75 <?php if ( isset( $_GET['added'] ) ) : ?> |
68 <div id="message" class="updated"><p><?php _e('Link added.'); ?></p></div> |
76 <div id="message" class="updated notice is-dismissible"><p><?php _e('Link added.'); ?></p></div> |
69 <?php endif; ?> |
77 <?php endif; ?> |
70 |
78 |
|
79 <form name="<?php echo esc_attr( $form_name ); ?>" id="<?php echo esc_attr( $form_name ); ?>" method="post" action="link.php"> |
71 <?php |
80 <?php |
72 if ( !empty($form) ) |
81 if ( ! empty( $link_added ) ) { |
73 echo $form; |
|
74 if ( !empty($link_added) ) |
|
75 echo $link_added; |
82 echo $link_added; |
|
83 } |
76 |
84 |
77 wp_nonce_field( $nonce_action ); |
85 wp_nonce_field( $nonce_action ); |
78 wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); |
86 wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); |
79 wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?> |
87 wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?> |
80 |
88 |
84 <div id="post-body-content"> |
92 <div id="post-body-content"> |
85 <div id="namediv" class="stuffbox"> |
93 <div id="namediv" class="stuffbox"> |
86 <h3><label for="link_name"><?php _ex('Name', 'link name') ?></label></h3> |
94 <h3><label for="link_name"><?php _ex('Name', 'link name') ?></label></h3> |
87 <div class="inside"> |
95 <div class="inside"> |
88 <input type="text" name="link_name" size="30" maxlength="255" value="<?php echo esc_attr($link->link_name); ?>" id="link_name" /> |
96 <input type="text" name="link_name" size="30" maxlength="255" value="<?php echo esc_attr($link->link_name); ?>" id="link_name" /> |
89 <p><?php _e('Example: Nifty blogging software'); ?></p> |
97 <p><?php _e('Example: Nifty blogging software'); ?></p> |
90 </div> |
98 </div> |
91 </div> |
99 </div> |
92 |
100 |
93 <div id="addressdiv" class="stuffbox"> |
101 <div id="addressdiv" class="stuffbox"> |
94 <h3><label for="link_url"><?php _e('Web Address') ?></label></h3> |
102 <h3><label for="link_url"><?php _e('Web Address') ?></label></h3> |
95 <div class="inside"> |
103 <div class="inside"> |
96 <input type="text" name="link_url" size="30" maxlength="255" class="code" value="<?php echo esc_attr($link->link_url); ?>" id="link_url" /> |
104 <input type="text" name="link_url" size="30" maxlength="255" class="code" value="<?php echo esc_attr($link->link_url); ?>" id="link_url" /> |
97 <p><?php _e('Example: <code>http://wordpress.org/</code> — don’t forget the <code>http://</code>'); ?></p> |
105 <p><?php _e('Example: <code>http://wordpress.org/</code> — don’t forget the <code>http://</code>'); ?></p> |
98 </div> |
106 </div> |
99 </div> |
107 </div> |
100 |
108 |
101 <div id="descriptiondiv" class="stuffbox"> |
109 <div id="descriptiondiv" class="stuffbox"> |
102 <h3><label for="link_description"><?php _e('Description') ?></label></h3> |
110 <h3><label for="link_description"><?php _e('Description') ?></label></h3> |
103 <div class="inside"> |
111 <div class="inside"> |
104 <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" /> |
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" /> |
105 <p><?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?></p> |
113 <p><?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?></p> |
106 </div> |
114 </div> |
107 </div> |
115 </div> |
108 </div><!-- /post-body-content --> |
116 </div><!-- /post-body-content --> |
109 |
117 |
110 <div id="postbox-container-1" class="postbox-container"> |
118 <div id="postbox-container-1" class="postbox-container"> |
111 <?php |
119 <?php |
112 |
120 |
113 do_action('submitlink_box'); |
121 /** This action is documented in wp-admin/includes/meta-boxes.php */ |
|
122 do_action( 'submitlink_box' ); |
114 $side_meta_boxes = do_meta_boxes( 'link', 'side', $link ); |
123 $side_meta_boxes = do_meta_boxes( 'link', 'side', $link ); |
115 |
124 |
116 ?> |
125 ?> |
117 </div> |
126 </div> |
118 <div id="postbox-container-2" class="postbox-container"> |
127 <div id="postbox-container-2" class="postbox-container"> |