Changeset 11815 for trunk/wp-admin/edit-link-form.php
- Timestamp:
- 08/14/2009 05:37:40 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-link-form.php
r11768 r11815 23 23 } 24 24 25 /** 26 * Display checked checkboxes attribute for xfn microformat options. 27 * 28 * @since 1.0.1 29 * 30 * @param string $class 31 * @param string $value 32 * @param mixed $deprecated Not used. 33 */ 34 function xfn_check($class, $value = '', $deprecated = '') { 35 global $link; 25 require_once('includes/meta-boxes.php'); 36 26 37 $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';38 $rels = preg_split('/\s+/', $link_rel);39 40 if ('' != $value && in_array($value, $rels) ) {41 echo ' checked="checked"';42 }43 44 if ('' == $value) {45 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"';46 if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"';47 if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"';48 if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';49 }50 }51 52 /**53 * Display link create form fields.54 *55 * @since 2.7.056 *57 * @param object $link58 */59 function link_submit_meta_box($link) {60 ?>61 <div class="submitbox" id="submitlink">62 63 <div id="minor-publishing">64 65 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>66 <div style="display:none;">67 <input type="submit" name="save" value="<?php esc_attr_e('Save'); ?>" />68 </div>69 70 <div id="minor-publishing-actions">71 <div id="preview-action">72 <?php if ( !empty($link->link_id) ) { ?>73 <a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank" tabindex="4"><?php _e('Visit Link'); ?></a>74 <?php } ?>75 </div>76 <div class="clear"></div>77 </div>78 79 <div id="misc-publishing-actions">80 <div class="misc-pub-section misc-pub-section-last">81 <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>82 </div>83 </div>84 85 </div>86 87 <div id="major-publishing-actions">88 <?php do_action('post_submitbox_start'); ?>89 <div id="delete-action">90 <?php91 if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?>92 <a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&link_id=$link->link_id", 'delete-bookmark_' . $link->link_id); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf(__("You are about to delete this link '%s'\n 'Cancel' to stop, 'OK' to delete."), $link->link_name )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>93 <?php } ?>94 </div>95 96 <div id="publishing-action">97 <?php if ( !empty($link->link_id) ) { ?>98 <input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="<?php esc_attr_e('Update Link') ?>" />99 <?php } else { ?>100 <input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="<?php esc_attr_e('Add Link') ?>" />101 <?php } ?>102 </div>103 <div class="clear"></div>104 </div>105 <?php do_action('submitlink_box'); ?>106 <div class="clear"></div>107 </div>108 <?php109 }110 27 add_meta_box('linksubmitdiv', __('Save'), 'link_submit_meta_box', 'link', 'side', 'core'); 111 112 /**113 * Display link categories form fields.114 *115 * @since 2.6.0116 *117 * @param object $link118 */119 function link_categories_meta_box($link) { ?>120 <ul id="category-tabs">121 <li class="tabs"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li>122 <li class="hide-if-no-js"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li>123 </ul>124 125 <div id="categories-all" class="tabs-panel">126 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">127 <?php128 if ( isset($link->link_id) )129 wp_link_category_checklist($link->link_id);130 else131 wp_link_category_checklist();132 ?>133 </ul>134 </div>135 136 <div id="categories-pop" class="tabs-panel" style="display: none;">137 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear">138 <?php wp_popular_terms_checklist('link_category'); ?>139 </ul>140 </div>141 142 <div id="category-adder" class="wp-hidden-children">143 <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4>144 <p id="link-category-add" class="wp-hidden-child">145 <label class="screen-reader-text" for="newcat"><?php _e( '+ Add New Category' ); ?></label>146 <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" />147 <input type="button" id="category-add-submit" class="add:categorychecklist:linkcategorydiv button" value="<?php esc_attr_e( 'Add' ); ?>" />148 <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>149 <span id="category-ajax-response"></span>150 </p>151 </div>152 <?php153 }154 28 add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', 'link', 'normal', 'core'); 155 156 /**157 * Display form fields for changing link target.158 *159 * @since 2.6.0160 *161 * @param object $link162 */163 function link_target_meta_box($link) { ?>164 <fieldset><legend class="screen-reader-text"><span><?php _e('Target') ?></span></legend>165 <p><label for="link_target_blank" class="selectit">166 <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />167 <?php _e('<code>_blank</code> - new window or tab.'); ?></label></p>168 <p><label for="link_target_top" class="selectit">169 <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />170 <?php _e('<code>_top</code> - current window or tab, with no frames.'); ?></label></p>171 <p><label for="link_target_none" class="selectit">172 <input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> />173 <?php _e('<code>_none</code> - same window or tab.'); ?></label></p>174 </fieldset>175 <p><?php _e('Choose the target frame for your link.'); ?></p>176 <?php177 }178 29 add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', 'link', 'normal', 'core'); 179 180 /**181 * Display xfn form fields.182 *183 * @since 2.6.0184 *185 * @param object $link186 */187 function link_xfn_meta_box($link) {188 ?>189 <table class="editform" style="width: 100%;" cellspacing="2" cellpadding="5">190 <tr>191 <th style="width: 20%;" scope="row"><label for="link_rel"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('rel:') ?></label></th>192 <td style="width: 80%;"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo ( isset( $link->link_rel ) ? esc_attr($link->link_rel) : ''); ?>" /></td>193 </tr>194 <tr>195 <td colspan="2">196 <table cellpadding="3" cellspacing="5" class="form-table">197 <tr>198 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?> </th>199 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?> </span></legend>200 <label for="me">201 <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />202 <?php _e('another web address of mine') ?></label>203 </fieldset></td>204 </tr>205 <tr>206 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?> </th>207 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friendship') ?> </span></legend>208 <label for="contact">209 <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('contact') ?></label>210 <label for="acquaintance">211 <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('acquaintance') ?></label>212 <label for="friend">213 <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('friend') ?></label>214 <label for="friendship">215 <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>216 </fieldset></td>217 </tr>218 <tr>219 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?> </th>220 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('physical') ?> </span></legend>221 <label for="met">222 <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />223 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('met') ?></label>224 </fieldset></td>225 </tr>226 <tr>227 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?> </th>228 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('professional') ?> </span></legend>229 <label for="co-worker">230 <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />231 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('co-worker') ?></label>232 <label for="colleague">233 <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />234 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('colleague') ?></label>235 </fieldset></td>236 </tr>237 <tr>238 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?> </th>239 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('geographical') ?> </span></legend>240 <label for="co-resident">241 <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />242 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('co-resident') ?></label>243 <label for="neighbor">244 <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> />245 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('neighbor') ?></label>246 <label for="geographical">247 <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />248 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>249 </fieldset></td>250 </tr>251 <tr>252 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?> </th>253 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('family') ?> </span></legend>254 <label for="child">255 <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?> />256 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('child') ?></label>257 <label for="kin">258 <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?> />259 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('kin') ?></label>260 <label for="parent">261 <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> />262 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('parent') ?></label>263 <label for="sibling">264 <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> />265 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('sibling') ?></label>266 <label for="spouse">267 <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> />268 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('spouse') ?></label>269 <label for="family">270 <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />271 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('none') ?></label>272 </fieldset></td>273 </tr>274 <tr>275 <th scope="row"> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?> </th>276 <td><fieldset><legend class="screen-reader-text"><span> <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('romantic') ?> </span></legend>277 <label for="muse">278 <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />279 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('muse') ?></label>280 <label for="crush">281 <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />282 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('crush') ?></label>283 <label for="date">284 <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />285 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('date') ?></label>286 <label for="romantic">287 <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />288 <?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('sweetheart') ?></label>289 </fieldset></td>290 </tr>291 </table>292 </td>293 </tr>294 </table>295 <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>296 <?php297 }298 30 add_meta_box('linkxfndiv', __('Link Relationship (XFN)'), 'link_xfn_meta_box', 'link', 'normal', 'core'); 299 300 /**301 * Display advanced link options form fields.302 *303 * @since 2.6.0304 *305 * @param object $link306 */307 function link_advanced_meta_box($link) {308 ?>309 <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">310 <tr class="form-field">311 <th valign="top" scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>312 <td><input type="text" name="link_image" class="code" id="link_image" size="50" value="<?php echo ( isset( $link->link_image ) ? esc_attr($link->link_image) : ''); ?>" style="width: 95%" /></td>313 </tr>314 <tr class="form-field">315 <th valign="top" scope="row"><label for="rss_uri"><?php _e('RSS Address') ?></label></th>316 <td><input name="link_rss" class="code" type="text" id="rss_uri" value="<?php echo ( isset( $link->link_rss ) ? esc_attr($link->link_rss) : ''); ?>" size="50" style="width: 95%" /></td>317 </tr>318 <tr class="form-field">319 <th valign="top" scope="row"><label for="link_notes"><?php _e('Notes') ?></label></th>320 <td><textarea name="link_notes" id="link_notes" cols="50" rows="10" style="width: 95%"><?php echo ( isset( $link->link_notes ) ? $link->link_notes : ''); ?></textarea></td>321 </tr>322 <tr class="form-field">323 <th valign="top" scope="row"><label for="link_rating"><?php _e('Rating') ?></label></th>324 <td><select name="link_rating" id="link_rating" size="1">325 <?php326 for ($r = 0; $r < 10; $r++) {327 echo(' <option value="'. esc_attr($r) .'" ');328 if ( isset($link->link_rating) && $link->link_rating == $r)329 echo 'selected="selected"';330 echo('>'.$r.'</option>');331 }332 ?></select> <?php _e('(Leave at 0 for no rating.)') ?>333 </td>334 </tr>335 </table>336 <?php337 }338 31 add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', 'link', 'normal', 'core'); 339 32
Note: See TracChangeset
for help on using the changeset viewer.