2 if ( ! empty($link_id) ) {
3 $heading = __('Edit Link');
4 $submit_text = __('Save Changes');
5 $form = '<form name="editlink" id="editlink" method="post" action="link.php">';
6 $nonce_action = 'update-bookmark_' . $link_id;
8 $heading = __('Add Link');
9 $submit_text = __('Add Link');
10 $form = '<form name="addlink" id="addlink" method="post" action="link.php">';
11 $nonce_action = 'add-bookmark';
14 function xfn_check($class, $value = '', $deprecated = '') {
17 $link_rel = $link->link_rel;
18 $rels = preg_split('/\s+/', $link_rel);
20 if ('' != $value && in_array($value, $rels) ) {
21 echo ' checked="checked"';
25 if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"';
26 if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"';
27 if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"';
28 if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
34 <?php wp_nonce_field($nonce_action); ?>
35 <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
38 <h2><?php echo $heading; ?></h2>
42 <div class="submitbox" id="submitlink">
44 <div id="previewview">
45 <?php if ( !empty($link_id) ) { ?>
46 <a href="<?php echo $link->link_url; ?>" target="_blank"><?php _e('Visit Link'); ?></a>
51 <p><label for="link_private" class="selectit"><input id="link_private" name="link_visible" type="checkbox" value="N" <?php checked($link->link_visible, 'N'); ?> /> <?php _e('Keep this link private') ?></label></p>
55 <input type="submit" class="button button-highlighted" name="save" value="<?php _e('Save'); ?>" tabindex="4" />
57 if ( ( 'edit' == $action) && current_user_can('manage_links') )
58 echo "<a class='submitdelete' href='" . wp_nonce_url("link.php?action=delete&link_id=$link_id", 'delete-bookmark_' . $link_id) . "' onclick=\"if ( confirm('" . js_escape( sprintf( __("You are about to delete this link '%s'\n'Cancel' to stop, 'OK' to delete."), $link->link_name )) . "') ) { return true;}return false;\">" . __('Delete link') . "</a>";
62 <div class="side-info">
63 <h5><?php _e('Related') ?></h5>
66 <li><a href="link-manager.php"><?php _e('Manage All Links') ?></a></li>
67 <li><a href="edit-link-categories.php"><?php _e('Manage All Link Categories') ?></a></li>
68 <li><a href="link-import.php"><?php _e('Import Links') ?></a></li>
69 <?php do_action('link_relatedlinks_list'); ?>
72 <?php do_action('submitlink_box'); ?>
76 <div id="namediv" class="stuffbox">
77 <h3><label for="link_name"><?php _e('Name') ?></label></h3>
79 <input type="text" name="link_name" size="30" tabindex="1" value="<?php echo $link->link_name; ?>" id="link_name" /><br />
80 <?php _e('Example: Nifty blogging software'); ?>
84 <div id="addressdiv" class="stuffbox">
85 <h3><label for="link_url"><?php _e('Web Address') ?></label></h3>
87 <input type="text" name="link_url" size="30" tabindex="1" value="<?php echo $link->link_url; ?>" id="link_url" /><br />
88 <?php _e('Example: <code>http://wordpress.org/</code> — don’t forget the <code>http://</code>'); ?>
92 <div id="descriptiondiv" class="stuffbox">
93 <h3><label for="link_description"><?php _e('Description') ?></label></h3>
95 <input type="text" name="link_description" size="30" tabindex="1" value="<?php echo $link->link_description; ?>" id="link_description" /><br />
96 <?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?>
100 <?php function link_categories_meta_box($link) { ?>
101 <div id="category-adder" class="wp-hidden-children">
102 <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4>
103 <p id="link-category-add" class="wp-hidden-child">
104 <label class="hidden" for="newcat"><?php _e( '+ Add New Category' ); ?></label>
105 <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" aria-required="true" />
106 <input type="button" id="category-add-sumbit" class="add:categorychecklist:linkcategorydiv button" value="<?php _e( 'Add' ); ?>" />
107 <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
108 <span id="category-ajax-response"></span>
112 <ul id="category-tabs">
113 <li class="ui-tabs-selected"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li>
114 <li class="wp-no-js-hidden"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li>
117 <div id="categories-all" class="ui-tabs-panel">
118 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
119 <?php wp_link_category_checklist($link->link_id); ?>
123 <div id="categories-pop" class="ui-tabs-panel" style="display: none;">
124 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear">
125 <?php wp_popular_terms_checklist('link_category'); ?>
130 add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', 'link', 'normal', 'core');
133 <?php do_meta_boxes('link', 'normal', $link); ?>
135 <h2><?php _e('Advanced Options'); ?></h2>
137 <?php function link_target_meta_box($link) { ?>
138 <fieldset><legend class="hidden"><?php _e('Target') ?></legend>
139 <label for="link_target_blank" class="selectit">
140 <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
141 <code>_blank</code></label><br />
142 <label for="link_target_top" class="selectit">
143 <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo(($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
144 <code>_top</code></label><br />
145 <label for="link_target_none" class="selectit">
146 <input id="link_target_none" type="radio" name="link_target" value="" <?php echo(($link->link_target == '') ? 'checked="checked"' : ''); ?> />
147 <?php _e('none') ?></label>
149 <p><?php _e('Choose the frame your link targets. Essentially this means if you choose <code>_blank</code> your link will open in a new window.'); ?></p>
152 add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', 'link', 'advanced', 'core');
154 function link_xfn_meta_box($link) {
156 <table class="editform" style="width: 100%;" cellspacing="2" cellpadding="5">
158 <th style="width: 20%;" scope="row"><label for="link_rel"><?php _e('rel:') ?></label></th>
159 <td style="width: 80%;"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo $link->link_rel; ?>" /></td>
163 <table cellpadding="3" cellspacing="5" class="form-table">
165 <th scope="row"> <?php _e('identity') ?> </th>
166 <td><fieldset><legend class="hidden"> <?php _e('identity') ?> </legend>
168 <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
169 <?php _e('another web address of mine') ?></label>
173 <th scope="row"> <?php _e('friendship') ?> </th>
174 <td><fieldset><legend class="hidden"> <?php _e('friendship') ?> </legend>
175 <label for="contact">
176 <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label>
177 <label for="acquaintance">
178 <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> /> <?php _e('acquaintance') ?></label>
180 <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php _e('friend') ?></label>
181 <label for="friendship">
182 <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php _e('none') ?></label>
186 <th scope="row"> <?php _e('physical') ?> </th>
187 <td><fieldset><legend class="hidden"> <?php _e('physical') ?> </legend>
189 <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />
190 <?php _e('met') ?></label>
194 <th scope="row"> <?php _e('professional') ?> </th>
195 <td><fieldset><legend class="hidden"> <?php _e('professional') ?> </legend>
196 <label for="co-worker">
197 <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />
198 <?php _e('co-worker') ?></label>
199 <label for="colleague">
200 <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />
201 <?php _e('colleague') ?></label>
205 <th scope="row"> <?php _e('geographical') ?> </th>
206 <td><fieldset><legend class="hidden"> <?php _e('geographical') ?> </legend>
207 <label for="co-resident">
208 <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />
209 <?php _e('co-resident') ?></label>
210 <label for="neighbor">
211 <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> />
212 <?php _e('neighbor') ?></label>
213 <label for="geographical">
214 <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
215 <?php _e('none') ?></label>
219 <th scope="row"> <?php _e('family') ?> </th>
220 <td><fieldset><legend class="hidden"> <?php _e('family') ?> </legend>
222 <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?> />
223 <?php _e('child') ?></label>
225 <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?> />
226 <?php _e('kin') ?></label>
228 <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> />
229 <?php _e('parent') ?></label>
230 <label for="sibling">
231 <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> />
232 <?php _e('sibling') ?></label>
234 <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> />
235 <?php _e('spouse') ?></label>
237 <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
238 <?php _e('none') ?></label>
242 <th scope="row"> <?php _e('romantic') ?> </th>
243 <td><fieldset><legend class="hidden"> <?php _e('romantic') ?> </legend>
245 <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />
246 <?php _e('muse') ?></label>
248 <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />
249 <?php _e('crush') ?></label>
251 <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />
252 <?php _e('date') ?></label>
253 <label for="romantic">
254 <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />
255 <?php _e('sweetheart') ?></label>
262 <p><?php _e('If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out <a href="http://gmpg.org/xfn/">XFN</a>.'); ?></p>
265 add_meta_box('linkxfndiv', __('Link Relationship (XFN)'), 'link_xfn_meta_box', 'link', 'advanced', 'core');
267 function link_advanced_meta_box($link) {
269 <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
270 <tr class="form-field">
271 <th valign="top" scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>
272 <td><input type="text" name="link_image" id="link_image" size="50" value="<?php echo $link->link_image; ?>" style="width: 95%" /></td>
274 <tr class="form-field">
275 <th valign="top" scope="row"><label for="rss_uri"><?php _e('RSS Address') ?></label></th>
276 <td><input name="link_rss" type="text" id="rss_uri" value="<?php echo $link->link_rss; ?>" size="50" style="width: 95%" /></td>
278 <tr class="form-field">
279 <th valign="top" scope="row"><label for="link_notes"><?php _e('Notes') ?></label></th>
280 <td><textarea name="link_notes" id="link_notes" cols="50" rows="10" style="width: 95%"><?php echo $link->link_notes; ?></textarea></td>
282 <tr class="form-field">
283 <th valign="top" scope="row"><label for="link_rating"><?php _e('Rating') ?></label></th>
284 <td><select name="link_rating" id="link_rating" size="1">
286 for ($r = 0; $r < 10; $r++) {
287 echo(' <option value="'.$r.'" ');
288 if ($link->link_rating == $r)
289 echo 'selected="selected"';
290 echo('>'.$r.'</option>');
292 ?></select> <?php _e('(Leave at 0 for no rating.)') ?>
298 add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', 'link', 'advanced', 'core');
300 do_meta_boxes('link', 'advanced', $link);
303 <input type="hidden" name="action" value="save" />
304 <input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
305 <input type="hidden" name="order_by" value="<?php echo attribute_escape($order_by); ?>" />
306 <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
308 <input type="hidden" name="action" value="add" />