home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Blogs / wordpress2.6.exe / wordpress2.6 / wp-admin / edit-link-form.php < prev    next >
Encoding:
PHP Script  |  2008-05-31  |  14.6 KB  |  317 lines

  1. <?php
  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;
  7. } else {
  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';
  12. }
  13.  
  14. function xfn_check($class, $value = '', $deprecated = '') {
  15.     global $link;
  16.  
  17.     $link_rel = $link->link_rel;
  18.     $rels = preg_split('/\s+/', $link_rel);
  19.  
  20.     if ('' != $value && in_array($value, $rels) ) {
  21.         echo ' checked="checked"';
  22.     }
  23.  
  24.     if ('' == $value) {
  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"';
  29.     }
  30. }
  31. ?>
  32.  
  33. <?php echo $form ?>
  34. <?php wp_nonce_field($nonce_action); ?>
  35. <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
  36.  
  37. <div class="wrap">
  38. <h2><?php echo $heading; ?></h2>
  39.  
  40. <div id="poststuff">
  41.  
  42. <div class="submitbox" id="submitlink">
  43.  
  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>
  47. <?php } ?>
  48. </div>
  49.  
  50. <div class="inside">
  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>
  52. </div>
  53.  
  54. <p class="submit">
  55. <input type="submit" class="button button-highlighted" name="save" value="<?php _e('Save'); ?>" tabindex="4" />
  56. <?php
  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>";
  59. ?>
  60. </p>
  61.  
  62. <div class="side-info">
  63. <h5><?php _e('Related') ?></h5>
  64.  
  65. <ul>
  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'); ?>
  70. </ul>
  71. </div>
  72. <?php do_action('submitlink_box'); ?>
  73. </div>
  74.  
  75. <div id="post-body">
  76. <div id="namediv" class="stuffbox">
  77. <h3><label for="link_name"><?php _e('Name') ?></label></h3>
  78. <div class="inside">
  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'); ?>
  81. </div>
  82. </div>
  83.  
  84. <div id="addressdiv" class="stuffbox">
  85. <h3><label for="link_url"><?php _e('Web Address') ?></label></h3>
  86. <div class="inside">
  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>'); ?>
  89. </div>
  90. </div>
  91.  
  92. <div id="descriptiondiv" class="stuffbox">
  93. <h3><label for="link_description"><?php _e('Description') ?></label></h3>
  94. <div class="inside">
  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.'); ?>
  97. </div>
  98. </div>
  99.  
  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>
  109.     </p>
  110. </div>
  111.  
  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>
  115. </ul>
  116.  
  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); ?>
  120.     </ul>
  121. </div>
  122.  
  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'); ?>
  126.     </ul>
  127. </div>
  128. <?php
  129. }
  130. add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', 'link', 'normal', 'core');
  131. ?>
  132.  
  133. <?php do_meta_boxes('link', 'normal', $link); ?>
  134.  
  135. <h2><?php _e('Advanced Options'); ?></h2>
  136.  
  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>
  148. </fieldset>
  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>
  150. <?php
  151. }
  152. add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', 'link', 'advanced', 'core');
  153.  
  154. function link_xfn_meta_box($link) {
  155. ?>
  156. <table class="editform" style="width: 100%;" cellspacing="2" cellpadding="5">
  157.     <tr>
  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>
  160.     </tr>
  161.     <tr>
  162.         <td colspan="2">
  163.             <table cellpadding="3" cellspacing="5" class="form-table">
  164.                 <tr>
  165.                     <th scope="row"> <?php _e('identity') ?> </th>
  166.                     <td><fieldset><legend class="hidden"> <?php _e('identity') ?> </legend>
  167.                         <label for="me">
  168.                         <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
  169.                         <?php _e('another web address of mine') ?></label>
  170.                     </fieldset></td>
  171.                 </tr>
  172.                 <tr>
  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>
  179.                         <label for="friend">
  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>
  183.                     </fieldset></td>
  184.                 </tr>
  185.                 <tr>
  186.                     <th scope="row"> <?php _e('physical') ?> </th>
  187.                     <td><fieldset><legend class="hidden"> <?php _e('physical') ?> </legend>
  188.                         <label for="met">
  189.                         <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />
  190.                         <?php _e('met') ?></label>
  191.                     </fieldset></td>
  192.                 </tr>
  193.                 <tr>
  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>
  202.                     </fieldset></td>
  203.                 </tr>
  204.                 <tr>
  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>
  216.                     </fieldset></td>
  217.                 </tr>
  218.                 <tr>
  219.                     <th scope="row"> <?php _e('family') ?> </th>
  220.                     <td><fieldset><legend class="hidden"> <?php _e('family') ?> </legend>
  221.                         <label for="child">
  222.                         <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?>  />
  223.                         <?php _e('child') ?></label>
  224.                         <label for="kin">
  225.                         <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?>  />
  226.                         <?php _e('kin') ?></label>
  227.                         <label for="parent">
  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>
  233.                         <label for="spouse">
  234.                         <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> />
  235.                         <?php _e('spouse') ?></label>
  236.                         <label for="family">
  237.                         <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
  238.                         <?php _e('none') ?></label>
  239.                     </fieldset></td>
  240.                 </tr>
  241.                 <tr>
  242.                     <th scope="row"> <?php _e('romantic') ?> </th>
  243.                     <td><fieldset><legend class="hidden"> <?php _e('romantic') ?> </legend>
  244.                         <label for="muse">
  245.                         <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />
  246.                         <?php _e('muse') ?></label>
  247.                         <label for="crush">
  248.                         <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />
  249.                         <?php _e('crush') ?></label>
  250.                         <label for="date">
  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>
  256.                     </fieldset></td>
  257.                 </tr>
  258.             </table>
  259.         </td>
  260.     </tr>
  261. </table>
  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>
  263. <?php
  264. }
  265. add_meta_box('linkxfndiv', __('Link Relationship (XFN)'), 'link_xfn_meta_box', 'link', 'advanced', 'core');
  266.  
  267. function link_advanced_meta_box($link) {
  268. ?>
  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>
  273.     </tr>
  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>
  277.     </tr>
  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>
  281.     </tr>
  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">
  285.         <?php
  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>');
  291.             }
  292.         ?></select> <?php _e('(Leave at 0 for no rating.)') ?>
  293.         </td>
  294.     </tr>
  295. </table>
  296. <?php
  297. }
  298. add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', 'link', 'advanced', 'core');
  299.  
  300. do_meta_boxes('link', 'advanced', $link);
  301.  
  302. if ( $link_id ) : ?>
  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 ?>" />
  307. <?php else: ?>
  308. <input type="hidden" name="action" value="add" />
  309. <?php endif; ?>
  310.  
  311. </div>
  312. </div>
  313.  
  314. </div>
  315.  
  316. </form>
  317.