| [ Index ] |
WordPress Source Cross Reference |
[Summary view] [Print] [Text view]
1 <?php 2 3 4 // Links 5 // Copyright (C) 2002, 2003 Mike Little -- mike@zed1.com 6 7 require_once ('admin.php'); 8 9 $title = __('Manage Bookmarks'); 10 $this_file = $parent_file = 'link-manager.php'; 11 wp_enqueue_script( 'listman' ); 12 13 wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]')); 14 15 if (empty ($cat_id)) 16 $cat_id = 'all'; 17 18 if (empty ($order_by)) 19 $order_by = 'order_name'; 20 21 $title = __('Manage Bookmarks'); 22 include_once ("./admin-header.php"); 23 24 if (!current_user_can('manage_links')) 25 wp_die(__("You do not have sufficient permissions to edit the bookmarks for this blog.")); 26 27 switch ($order_by) { 28 case 'order_id' : 29 $sqlorderby = 'id'; 30 break; 31 case 'order_url' : 32 $sqlorderby = 'url'; 33 break; 34 case 'order_desc' : 35 $sqlorderby = 'description'; 36 break; 37 case 'order_owner' : 38 $sqlorderby = 'owner'; 39 break; 40 case 'order_rating' : 41 $sqlorderby = 'rating'; 42 break; 43 case 'order_name' : 44 default : 45 $sqlorderby = 'name'; 46 break; 47 } 48 ?> 49 <script type="text/javascript"> 50 <!-- 51 function checkAll(form) 52 { 53 for (i = 0, n = form.elements.length; i < n; i++) { 54 if(form.elements[i].type == "checkbox") { 55 if(form.elements[i].checked == true) 56 form.elements[i].checked = false; 57 else 58 form.elements[i].checked = true; 59 } 60 } 61 } 62 //--> 63 </script> 64 65 <?php 66 if ( isset($_GET['deleted']) ) { 67 echo '<div style="background-color: rgb(207, 235, 247);" id="message" class="updated fade"><p>'; 68 $deleted = (int) $_GET['deleted']; 69 printf(__('%s bookmarks deleted.'), $deleted); 70 echo '</p></div>'; 71 } 72 ?> 73 74 <div class="wrap"> 75 76 <h2><?php _e('Blogroll Management'); ?></h2> 77 <p><?php _e('Here you add links to sites that you visit often and share them on your blog. When you have a list of links in your sidebar to other blogs, it’s called a “blogroll.”'); ?></p> 78 <form id="cats" method="get" action=""> 79 <p>Currently showing 80 <?php $categories = get_categories("hide_empty=1&type=link"); ?> 81 <select name="cat_id"> 82 <option value="all" <?php echo ($cat_id == 'all') ? " selected='selected'" : ''; ?>><?php _e('All') ?></option> 83 <?php foreach ($categories as $cat): ?> 84 <option value="<?php echo $cat->cat_ID; ?>"<?php echo ($cat->cat_ID == $cat_id) ? " selected='selected'" : ''; ?>><?php echo wp_specialchars($cat->cat_name); ?> 85 </option> 86 <?php endforeach; ?> 87 </select> 88 links ordered by 89 <select name="order_by"> 90 <option value="order_id" <?php if ($order_by == 'order_id') echo " selected='selected'";?>><?php _e('Bookmark ID') ?></option> 91 <option value="order_name" <?php if ($order_by == 'order_name') echo " selected='selected'";?>><?php _e('Name') ?></option> 92 <option value="order_url" <?php if ($order_by == 'order_url') echo " selected='selected'";?>><?php _e('Address') ?></option> 93 </select> 94 <input type="submit" name="action" value="<?php _e('Update »') ?>" /></p> 95 </form> 96 97 <form id="links" method="post" action="link.php"> 98 <?php wp_nonce_field('bulk-bookmarks') ?> 99 <input type="hidden" name="link_id" value="" /> 100 <input type="hidden" name="action" value="" /> 101 <input type="hidden" name="order_by" value="<?php echo wp_specialchars($order_by, 1); ?>" /> 102 <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" /> 103 <table class="widefat"> 104 <thead> 105 <tr> 106 <th width="15%" style="text-align: left"><?php _e('Name') ?></th> 107 <th style="text-align: left"><?php _e('URI') ?></th> 108 <th style="text-align: left"><?php _e('Categories') ?></th> 109 <th><?php _e('rel') ?></th> 110 <th><?php _e('Visible') ?></th> 111 <th colspan="2"><?php _e('Action') ?></th> 112 <th><input type="checkbox" onclick="checkAll(document.getElementById('links'));" /></th> 113 </tr> 114 </thead> 115 <tbody id="the-list"> 116 <?php 117 if ( 'all' == $cat_id ) 118 $cat_id = ''; 119 $links = get_bookmarks("category=$cat_id&hide_invisible=0&orderby=$sqlorderby&hide_empty=0"); 120 if ($links) 121 foreach ($links as $link) { 122 $link->link_name = wp_specialchars($link->link_name); 123 $link->link_description = wp_specialchars($link->link_description); 124 $link->link_url = wp_specialchars($link->link_url); 125 $link->link_category = wp_get_link_cats($link->link_id); 126 $short_url = str_replace('http://', '', $link->link_url); 127 $short_url = str_replace('www.', '', $short_url); 128 if ('/' == substr($short_url, -1)) 129 $short_url = substr($short_url, 0, -1); 130 if (strlen($short_url) > 35) 131 $short_url = substr($short_url, 0, 32).'...'; 132 133 $visible = ($link->link_visible == 'Y') ? __('Yes') : __('No'); 134 ++ $i; 135 $style = ($i % 2) ? '' : ' class="alternate"'; 136 ?> 137 <tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>> 138 <td><strong><?php echo $link->link_name; ?></strong><br /> 139 <?php 140 141 142 echo $link->link_description . "</td>"; 143 echo "<td><a href=\"$link->link_url\" title=\"".sprintf(__('Visit %s'), $link->link_name)."\">$short_url</a></td>"; 144 ?> 145 <td> 146 <?php 147 148 $cat_names = array(); 149 foreach ($link->link_category as $category) { 150 $cat_name = get_the_category_by_ID($category); 151 $cat_name = wp_specialchars($cat_name); 152 if ( $cat_id != $category ) 153 $cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>"; 154 $cat_names[] = $cat_name; 155 } 156 echo implode(', ', $cat_names); 157 ?> 158 </td> 159 <td><?php echo $link->link_rel; ?></td> 160 <td align='center'><?php echo $visible; ?></td> 161 <?php 162 163 echo '<td><a href="link.php?link_id='.$link->link_id.'&action=edit" class="edit">'.__('Edit').'</a></td>'; 164 echo '<td><a href="' . wp_nonce_url('link.php?link_id='.$link->link_id.'&action=delete', 'delete-bookmark_' . $link->link_id ) . '"'." onclick=\"return deleteSomething( 'link', $link->link_id , '".sprintf(__("You are about to delete the "%s" bookmark to %s.\\n"Cancel" to stop, "OK" to delete."), js_escape($link->link_name), js_escape($link->link_url)).'\' );" class="delete">'.__('Delete').'</a></td>'; 165 echo '<td align="center"><input type="checkbox" name="linkcheck[]" value="'.$link->link_id.'" /></td>'; 166 echo "\n </tr>\n"; 167 } 168 ?> 169 </tbody> 170 </table> 171 172 <div id="ajax-response"></div> 173 174 <p class="submit"><input type="submit" class="button" name="deletebookmarks" id="deletebookmarks" value="<?php _e('Delete Checked Bookmarks') ?> »" onclick="return confirm('<?php _e("You are about to delete these bookmarks permanently \\n \'Cancel\' to stop, \'OK\' to delete.") ?>')" /></p> 175 </form> 176 </div> 177 178 <?php include ('admin-footer.php'); ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sat Jul 15 11:57:04 2006 | Courtesy of Taragana |