-
+ C6CA0857A2B4EF3E34586AB128BD6AFD3E0ED1176406E6823249F498365D5BA8EFE10F48F1495635AE6D14A2D5B4FEF6957A5D7038D21813B1EE1209AC8A1C38
mp-wp/wp-admin/edit-link-form.php
(0 . 0)(1 . 420)
11384 <?php
11385 /**
11386 * Edit links form for inclusion in administration panels.
11387 *
11388 * @package WordPress
11389 * @subpackage Administration
11390 */
11391
11392 if ( ! empty($link_id) ) {
11393 $heading = sprintf( __( '<a href="%s">Links</a> / Edit Link' ), 'link-manager.php' );
11394 $submit_text = __('Update Link');
11395 $form = '<form name="editlink" id="editlink" method="post" action="link.php">';
11396 $nonce_action = 'update-bookmark_' . $link_id;
11397 } else {
11398 $heading = sprintf( __( '<a href="%s">Links</a> / Add New Link' ), 'link-manager.php' );
11399 $submit_text = __('Add Link');
11400 $form = '<form name="addlink" id="addlink" method="post" action="link.php">';
11401 $nonce_action = 'add-bookmark';
11402 }
11403
11404 /**
11405 * Display checked checkboxes attribute for xfn microformat options.
11406 *
11407 * @since 1.0.1
11408 *
11409 * @param string $class
11410 * @param string $value
11411 * @param mixed $deprecated Not used.
11412 */
11413 function xfn_check($class, $value = '', $deprecated = '') {
11414 global $link;
11415
11416 $link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
11417 $rels = preg_split('/\s+/', $link_rel);
11418
11419 if ('' != $value && in_array($value, $rels) ) {
11420 echo ' checked="checked"';
11421 }
11422
11423 if ('' == $value) {
11424 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"';
11425 if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"';
11426 if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"';
11427 if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
11428 }
11429 }
11430
11431 /**
11432 * Display link create form fields.
11433 *
11434 * @since 2.7.0
11435 *
11436 * @param object $link
11437 */
11438 function link_submit_meta_box($link) {
11439 ?>
11440 <div class="submitbox" id="submitlink">
11441
11442 <div id="minor-publishing">
11443
11444 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
11445 <div style="display:none;">
11446 <input type="submit" name="save" value="<?php echo attribute_escape( __('Save') ); ?>" />
11447 </div>
11448
11449 <div id="minor-publishing-actions">
11450 <div id="preview-action">
11451 <?php if ( !empty($link->link_id) ) { ?>
11452 <a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank" tabindex="4"><?php _e('Visit Link'); ?></a>
11453 <?php } ?>
11454 </div>
11455 <div class="clear"></div>
11456 </div>
11457
11458 <div id="misc-publishing-actions">
11459 <div class="misc-pub-section misc-pub-section-last">
11460 <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>
11461 </div>
11462 </div>
11463
11464 </div>
11465
11466 <div id="major-publishing-actions">
11467 <?php do_action('post_submitbox_start'); ?>
11468 <div id="delete-action">
11469 <?php
11470 if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?>
11471 <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 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;"><?php _e('Delete'); ?></a>
11472 <?php } ?>
11473 </div>
11474
11475 <div id="publishing-action">
11476 <?php if ( !empty($link->link_id) ) { ?>
11477 <input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="<?php _e('Update Link') ?>" />
11478 <?php } else { ?>
11479 <input name="save" type="submit" class="button-primary" id="publish" tabindex="4" accesskey="p" value="<?php _e('Add Link') ?>" />
11480 <?php } ?>
11481 </div>
11482 <div class="clear"></div>
11483 </div>
11484 <?php do_action('submitlink_box'); ?>
11485 <div class="clear"></div>
11486 </div>
11487 <?php
11488 }
11489 add_meta_box('linksubmitdiv', __('Save'), 'link_submit_meta_box', 'link', 'side', 'core');
11490
11491 /**
11492 * Display link categories form fields.
11493 *
11494 * @since 2.6.0
11495 *
11496 * @param object $link
11497 */
11498 function link_categories_meta_box($link) { ?>
11499 <div id="category-adder" class="wp-hidden-children">
11500 <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4>
11501 <p id="link-category-add" class="wp-hidden-child">
11502 <label class="hidden" for="newcat"><?php _e( '+ Add New Category' ); ?></label>
11503 <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" aria-required="true" />
11504 <input type="button" id="category-add-sumbit" class="add:categorychecklist:linkcategorydiv button" value="<?php _e( 'Add' ); ?>" />
11505 <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
11506 <span id="category-ajax-response"></span>
11507 </p>
11508 </div>
11509
11510 <ul id="category-tabs">
11511 <li class="ui-tabs-selected"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li>
11512 <li class="hide-if-no-js"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li>
11513 </ul>
11514
11515 <div id="categories-all" class="ui-tabs-panel">
11516 <ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
11517 <?php
11518 if ( isset($link->link_id) )
11519 wp_link_category_checklist($link->link_id);
11520 else
11521 wp_link_category_checklist();
11522 ?>
11523 </ul>
11524 </div>
11525
11526 <div id="categories-pop" class="ui-tabs-panel" style="display: none;">
11527 <ul id="categorychecklist-pop" class="categorychecklist form-no-clear">
11528 <?php wp_popular_terms_checklist('link_category'); ?>
11529 </ul>
11530 </div>
11531 <?php
11532 }
11533 add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', 'link', 'normal', 'core');
11534
11535 /**
11536 * Display form fields for changing link target.
11537 *
11538 * @since 2.6.0
11539 *
11540 * @param object $link
11541 */
11542 function link_target_meta_box($link) { ?>
11543 <fieldset><legend class="hidden"><?php _e('Target') ?></legend>
11544 <label for="link_target_blank" class="selectit">
11545 <input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
11546 <code>_blank</code></label><br />
11547 <label for="link_target_top" class="selectit">
11548 <input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
11549 <code>_top</code></label><br />
11550 <label for="link_target_none" class="selectit">
11551 <input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> />
11552 <?php _e('none') ?></label>
11553 </fieldset>
11554 <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>
11555 <?php
11556 }
11557 add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', 'link', 'normal', 'core');
11558
11559 /**
11560 * Display xfn form fields.
11561 *
11562 * @since 2.6.0
11563 *
11564 * @param object $link
11565 */
11566 function link_xfn_meta_box($link) {
11567 ?>
11568 <table class="editform" style="width: 100%;" cellspacing="2" cellpadding="5">
11569 <tr>
11570 <th style="width: 20%;" scope="row"><label for="link_rel"><?php _e('rel:') ?></label></th>
11571 <td style="width: 80%;"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo ( isset( $link->link_rel ) ? $link->link_rel : ''); ?>" /></td>
11572 </tr>
11573 <tr>
11574 <td colspan="2">
11575 <table cellpadding="3" cellspacing="5" class="form-table">
11576 <tr>
11577 <th scope="row"> <?php _e('identity') ?> </th>
11578 <td><fieldset><legend class="hidden"> <?php _e('identity') ?> </legend>
11579 <label for="me">
11580 <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
11581 <?php _e('another web address of mine') ?></label>
11582 </fieldset></td>
11583 </tr>
11584 <tr>
11585 <th scope="row"> <?php _e('friendship') ?> </th>
11586 <td><fieldset><legend class="hidden"> <?php _e('friendship') ?> </legend>
11587 <label for="contact">
11588 <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label>
11589 <label for="acquaintance">
11590 <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> /> <?php _e('acquaintance') ?></label>
11591 <label for="friend">
11592 <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php _e('friend') ?></label>
11593 <label for="friendship">
11594 <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php _e('none') ?></label>
11595 </fieldset></td>
11596 </tr>
11597 <tr>
11598 <th scope="row"> <?php _e('physical') ?> </th>
11599 <td><fieldset><legend class="hidden"> <?php _e('physical') ?> </legend>
11600 <label for="met">
11601 <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />
11602 <?php _e('met') ?></label>
11603 </fieldset></td>
11604 </tr>
11605 <tr>
11606 <th scope="row"> <?php _e('professional') ?> </th>
11607 <td><fieldset><legend class="hidden"> <?php _e('professional') ?> </legend>
11608 <label for="co-worker">
11609 <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />
11610 <?php _e('co-worker') ?></label>
11611 <label for="colleague">
11612 <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />
11613 <?php _e('colleague') ?></label>
11614 </fieldset></td>
11615 </tr>
11616 <tr>
11617 <th scope="row"> <?php _e('geographical') ?> </th>
11618 <td><fieldset><legend class="hidden"> <?php _e('geographical') ?> </legend>
11619 <label for="co-resident">
11620 <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />
11621 <?php _e('co-resident') ?></label>
11622 <label for="neighbor">
11623 <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> />
11624 <?php _e('neighbor') ?></label>
11625 <label for="geographical">
11626 <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
11627 <?php _e('none') ?></label>
11628 </fieldset></td>
11629 </tr>
11630 <tr>
11631 <th scope="row"> <?php _e('family') ?> </th>
11632 <td><fieldset><legend class="hidden"> <?php _e('family') ?> </legend>
11633 <label for="child">
11634 <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?> />
11635 <?php _e('child') ?></label>
11636 <label for="kin">
11637 <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?> />
11638 <?php _e('kin') ?></label>
11639 <label for="parent">
11640 <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> />
11641 <?php _e('parent') ?></label>
11642 <label for="sibling">
11643 <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> />
11644 <?php _e('sibling') ?></label>
11645 <label for="spouse">
11646 <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> />
11647 <?php _e('spouse') ?></label>
11648 <label for="family">
11649 <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
11650 <?php _e('none') ?></label>
11651 </fieldset></td>
11652 </tr>
11653 <tr>
11654 <th scope="row"> <?php _e('romantic') ?> </th>
11655 <td><fieldset><legend class="hidden"> <?php _e('romantic') ?> </legend>
11656 <label for="muse">
11657 <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />
11658 <?php _e('muse') ?></label>
11659 <label for="crush">
11660 <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />
11661 <?php _e('crush') ?></label>
11662 <label for="date">
11663 <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />
11664 <?php _e('date') ?></label>
11665 <label for="romantic">
11666 <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />
11667 <?php _e('sweetheart') ?></label>
11668 </fieldset></td>
11669 </tr>
11670 </table>
11671 </td>
11672 </tr>
11673 </table>
11674 <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>
11675 <?php
11676 }
11677 add_meta_box('linkxfndiv', __('Link Relationship (XFN)'), 'link_xfn_meta_box', 'link', 'normal', 'core');
11678
11679 /**
11680 * Display advanced link options form fields.
11681 *
11682 * @since 2.6.0
11683 *
11684 * @param object $link
11685 */
11686 function link_advanced_meta_box($link) {
11687 ?>
11688 <table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
11689 <tr class="form-field">
11690 <th valign="top" scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>
11691 <td><input type="text" name="link_image" id="link_image" size="50" value="<?php echo ( isset( $link->link_image ) ? $link->link_image : ''); ?>" style="width: 95%" /></td>
11692 </tr>
11693 <tr class="form-field">
11694 <th valign="top" scope="row"><label for="rss_uri"><?php _e('RSS Address') ?></label></th>
11695 <td><input name="link_rss" type="text" id="rss_uri" value="<?php echo ( isset( $link->link_rss ) ? $link->link_rss : ''); ?>" size="50" style="width: 95%" /></td>
11696 </tr>
11697 <tr class="form-field">
11698 <th valign="top" scope="row"><label for="link_notes"><?php _e('Notes') ?></label></th>
11699 <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>
11700 </tr>
11701 <tr class="form-field">
11702 <th valign="top" scope="row"><label for="link_rating"><?php _e('Rating') ?></label></th>
11703 <td><select name="link_rating" id="link_rating" size="1">
11704 <?php
11705 for ($r = 0; $r < 10; $r++) {
11706 echo(' <option value="'.$r.'" ');
11707 if ( isset($link->link_rating) && $link->link_rating == $r)
11708 echo 'selected="selected"';
11709 echo('>'.$r.'</option>');
11710 }
11711 ?></select> <?php _e('(Leave at 0 for no rating.)') ?>
11712 </td>
11713 </tr>
11714 </table>
11715 <?php
11716 }
11717 add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', 'link', 'normal', 'core');
11718
11719 do_action('do_meta_boxes', 'link', 'normal', $link);
11720 do_action('do_meta_boxes', 'link', 'advanced', $link);
11721 do_action('do_meta_boxes', 'link', 'side', $link);
11722
11723 require_once ('admin-header.php');
11724
11725 ?>
11726
11727
11728 <div class="wrap">
11729 <?php screen_icon(); ?>
11730 <h2><?php echo wp_specialchars( $title ); ?></h2>
11731
11732 <?php if ( isset( $_GET['added'] ) ) : ?>
11733 <div id="message" class="updated fade"><p><?php _e('Link added.'); ?></p></div>
11734 <?php endif; ?>
11735
11736 <?php
11737 if ( !empty($form) )
11738 echo $form;
11739 if ( !empty($link_added) )
11740 echo $link_added;
11741
11742 wp_nonce_field( $nonce_action );
11743 wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
11744 wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); ?>
11745
11746 <div id="poststuff" class="metabox-holder">
11747
11748 <div id="side-info-column" class="inner-sidebar">
11749 <?php
11750
11751 do_action('submitlink_box');
11752 $side_meta_boxes = do_meta_boxes( 'link', 'side', $link );
11753
11754 ?>
11755 </div>
11756
11757 <div id="post-body" class="<?php echo $side_meta_boxes ? 'has-sidebar' : ''; ?>">
11758 <div id="post-body-content" class="has-sidebar-content">
11759 <div id="namediv" class="stuffbox">
11760 <h3><label for="link_name"><?php _e('Name') ?></label></h3>
11761 <div class="inside">
11762 <input type="text" name="link_name" size="30" tabindex="1" value="<?php echo $link->link_name; ?>" id="link_name" />
11763 <p><?php _e('Example: Nifty blogging software'); ?></p>
11764 </div>
11765 </div>
11766
11767 <div id="addressdiv" class="stuffbox">
11768 <h3><label for="link_url"><?php _e('Web Address') ?></label></h3>
11769 <div class="inside">
11770 <input type="text" name="link_url" size="30" tabindex="1" value="<?php echo $link->link_url; ?>" id="link_url" />
11771 <p><?php _e('Example: <code>http://wordpress.org/</code> — don’t forget the <code>http://</code>'); ?></p>
11772 </div>
11773 </div>
11774
11775 <div id="descriptiondiv" class="stuffbox">
11776 <h3><label for="link_description"><?php _e('Description') ?></label></h3>
11777 <div class="inside">
11778 <input type="text" name="link_description" size="30" tabindex="1" value="<?php echo isset($link->link_description) ? $link->link_description : ''; ?>" id="link_description" />
11779 <p><?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?></p>
11780 </div>
11781 </div>
11782
11783 <?php
11784
11785 do_meta_boxes('link', 'normal', $link);
11786
11787 do_meta_boxes('link', 'advanced', $link);
11788
11789 if ( $link_id ) : ?>
11790 <input type="hidden" name="action" value="save" />
11791 <input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
11792 <input type="hidden" name="order_by" value="<?php echo attribute_escape($order_by); ?>" />
11793 <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
11794 <?php else: ?>
11795 <input type="hidden" name="action" value="add" />
11796 <?php endif; ?>
11797
11798 </div>
11799 </div>
11800 </div>
11801
11802 </form>
11803 </div>