author | Anthony Ly <anthonyly.com@gmail.com> |
Wed, 19 Dec 2012 17:46:52 -0800 | |
changeset 204 | 09a1c134465b |
parent 194 | 32102edaa81b |
permissions | -rw-r--r-- |
136 | 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 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
25 |
require_once('./includes/meta-boxes.php'); |
136 | 26 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
27 |
add_meta_box('linksubmitdiv', __('Save'), 'link_submit_meta_box', null, 'side', 'core'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
28 |
add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', null, 'normal', 'core'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
29 |
add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', null, 'normal', 'core'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
30 |
add_meta_box('linkxfndiv', __('Link Relationship (XFN)'), 'link_xfn_meta_box', null, 'normal', 'core'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
31 |
add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', null, 'normal', 'core'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
32 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
33 |
do_action('add_meta_boxes', 'link', $link); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
34 |
do_action('add_meta_boxes_link', $link); |
136 | 35 |
|
36 |
do_action('do_meta_boxes', 'link', 'normal', $link); |
|
37 |
do_action('do_meta_boxes', 'link', 'advanced', $link); |
|
38 |
do_action('do_meta_boxes', 'link', 'side', $link); |
|
39 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
40 |
add_screen_option('layout_columns', array('max' => 2, 'default' => 2) ); |
136 | 41 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
42 |
get_current_screen()->add_help_tab( array( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
43 |
'id' => 'overview', |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
44 |
'title' => __('Overview'), |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
45 |
'content' => |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
46 |
'<p>' . __( 'You can add or edit links on this screen by entering information in each of the boxes. Only the link’s web address and name (the text you want to display on your site as the link) are required fields.' ) . '</p>' . |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
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’t use in the Screen Options tab, or minimize boxes by clicking on the title bar of the box.' ) . '</p>' . |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
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>' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
49 |
) ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
50 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
51 |
get_current_screen()->set_help_sidebar( |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
52 |
'<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
53 |
'<p>' . __( '<a href="http://codex.wordpress.org/Links_Add_New_Screen" target="_blank">Documentation on Creating Links</a>' ) . '</p>' . |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
54 |
'<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
55 |
); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
56 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
57 |
require_once ('admin-header.php'); |
136 | 58 |
?> |
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
59 |
|
136 | 60 |
<div class="wrap"> |
61 |
<?php screen_icon(); ?> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
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> |
136 | 63 |
|
64 |
<?php if ( isset( $_GET['added'] ) ) : ?> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
65 |
<div id="message" class="updated"><p><?php _e('Link added.'); ?></p></div> |
136 | 66 |
<?php endif; ?> |
67 |
||
68 |
<?php |
|
69 |
if ( !empty($form) ) |
|
70 |
echo $form; |
|
71 |
if ( !empty($link_added) ) |
|
72 |
echo $link_added; |
|
73 |
||
74 |
wp_nonce_field( $nonce_action ); |
|
75 |
wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); |
|
76 |
wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?> |
|
77 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
78 |
<div id="poststuff"> |
136 | 79 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
80 |
<div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>"> |
136 | 81 |
<div id="post-body-content"> |
82 |
<div id="namediv" class="stuffbox"> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
83 |
<h3><label for="link_name"><?php _ex('Name', 'link name') ?></label></h3> |
136 | 84 |
<div class="inside"> |
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
85 |
<input type="text" name="link_name" size="30" value="<?php echo esc_attr($link->link_name); ?>" id="link_name" /> |
136 | 86 |
<p><?php _e('Example: Nifty blogging software'); ?></p> |
87 |
</div> |
|
88 |
</div> |
|
89 |
||
90 |
<div id="addressdiv" class="stuffbox"> |
|
91 |
<h3><label for="link_url"><?php _e('Web Address') ?></label></h3> |
|
92 |
<div class="inside"> |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
93 |
<input type="text" name="link_url" size="30" class="code" value="<?php echo esc_attr($link->link_url); ?>" id="link_url" /> |
136 | 94 |
<p><?php _e('Example: <code>http://wordpress.org/</code> — don’t forget the <code>http://</code>'); ?></p> |
95 |
</div> |
|
96 |
</div> |
|
97 |
||
98 |
<div id="descriptiondiv" class="stuffbox"> |
|
99 |
<h3><label for="link_description"><?php _e('Description') ?></label></h3> |
|
100 |
<div class="inside"> |
|
204
09a1c134465b
man wordpress + plugins order post + slideshow
Anthony Ly <anthonyly.com@gmail.com>
parents:
194
diff
changeset
|
101 |
<input type="text" name="link_description" size="30" value="<?php echo isset($link->link_description) ? esc_attr($link->link_description) : ''; ?>" id="link_description" /> |
136 | 102 |
<p><?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?></p> |
103 |
</div> |
|
104 |
</div> |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
105 |
</div><!-- /post-body-content --> |
136 | 106 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
107 |
<div id="postbox-container-1" class="postbox-container"> |
136 | 108 |
<?php |
109 |
||
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
110 |
do_action('submitlink_box'); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
111 |
$side_meta_boxes = do_meta_boxes( 'link', 'side', $link ); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
112 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
113 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
114 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
115 |
<div id="postbox-container-2" class="postbox-container"> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
116 |
<?php |
136 | 117 |
|
194
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
118 |
do_meta_boxes(null, 'normal', $link); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
119 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
120 |
do_meta_boxes(null, 'advanced', $link); |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
121 |
|
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
122 |
?> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
123 |
</div> |
32102edaa81b
MAJ wordpress et ajout de plugin
Anthony Ly <anthonyly.com@gmail.com>
parents:
136
diff
changeset
|
124 |
<?php |
136 | 125 |
|
126 |
if ( $link_id ) : ?> |
|
127 |
<input type="hidden" name="action" value="save" /> |
|
128 |
<input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" /> |
|
129 |
<input type="hidden" name="order_by" value="<?php echo esc_attr($order_by); ?>" /> |
|
130 |
<input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" /> |
|
131 |
<?php else: ?> |
|
132 |
<input type="hidden" name="action" value="add" /> |
|
133 |
<?php endif; ?> |
|
134 |
||
135 |
</div> |
|
136 |
</div> |
|
137 |
||
138 |
</form> |
|
139 |
</div> |