| [ Index ] |
PHP Cross Reference of zeList |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Link Management Administration Panel. 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 9 /** Load WordPress Administration Bootstrap */ 10 require_once ('admin.php'); 11 12 // Handle bulk deletes 13 if ( isset($_GET['action']) && isset($_GET['linkcheck']) ) { 14 check_admin_referer('bulk-bookmarks'); 15 $doaction = $_GET['action'] ? $_GET['action'] : $_GET['action2']; 16 17 if ( ! current_user_can('manage_links') ) 18 wp_die( __('You do not have sufficient permissions to edit the links for this blog.') ); 19 20 if ( 'delete' == $doaction ) { 21 foreach ( (array) $_GET['linkcheck'] as $link_id ) { 22 $link_id = absint($link_id); 23 if($link_id) { 24 $count++; 25 wp_delete_link($link_id); 26 } 27 28 } 29 $location = wp_get_referer()."&$doaction=$count"; 30 wp_redirect( $location ); 31 exit; 32 } 33 elseif($doaction && in_array($doaction,array('publish','pending','deny'))) { 34 $count = 0; 35 36 foreach ( (array) $_GET['linkcheck'] as $link_id ) { 37 $link_id = absint($link_id); 38 if($link_id) { 39 link_status($link_id,$doaction); 40 $count++; 41 } 42 } 43 $location = wp_get_referer()."&$doaction=$count"; 44 wp_redirect( $location ); 45 exit; 46 } 47 } elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) { 48 wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) ); 49 exit; 50 } 51 52 wp_reset_vars(array('action', 'cat_id', 'link_tag','link_owner', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', 'notes', 'linkcheck[]','link_rss','wrong_description')); 53 54 if ( empty($cat_id) ) $cat_id = 'all'; 55 56 if ( empty($order_by) ) $order_by = 'order_name'; 57 58 $title = __('Edit Links'); 59 $this_file = $parent_file = 'link-manager.php'; 60 include_once ("./admin-header.php"); 61 62 if (!current_user_can('manage_links')) 63 wp_die(__("You do not have sufficient permissions to edit the links for this blog.")); 64 65 switch ($order_by) { 66 case 'order_id' : 67 $sqlorderby = 'id'; 68 break; 69 case 'order_url' : 70 $sqlorderby = 'url'; 71 break; 72 case 'order_desc' : 73 $sqlorderby = 'description'; 74 break; 75 case 'order_owner' : 76 $sqlorderby = 'owner'; 77 break; 78 case 'order_rating' : 79 $sqlorderby = 'rating'; 80 break; 81 case 'order_name' : 82 default : 83 $sqlorderby = 'name'; 84 break; 85 } ?> 86 87 <div class="wrap nosubsub"><?php screen_icon(); ?> 88 <h2><?php echo wp_specialchars( $title ); 89 if ( isset($_GET['s']) && $_GET['s'] ) 90 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', wp_specialchars( stripslashes($_GET['s']) ) ); ?> 91 </h2> 92 93 <?php if ( isset($_GET['deleted']) ) : ?> 94 <div id="message" class="updated fade"> 95 <p><?php 96 $deleted = (int) $_GET['deleted']; 97 printf(__ngettext('%s link deleted.', '%s links deleted', $deleted), $deleted); 98 ?></p> 99 </div> 100 <?php 101 $_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']); 102 endif; ?> 103 104 <?php if ( isset($_GET['denied']) ) : ?> 105 <div id="message" class="updated fade"> 106 <p><strong><?php _e('Link denied.','zelist'); ?></strong> <?php 107 $link_id = absint($_GET['denied']); 108 printf(__('<a href="%s">Publish again</a>','zelist'),wp_nonce_url(ZELIST_ADMIN_URL_LINK."&noheader=1&action=publish&link_id=$link_id", 'publish-bookmark_' . $link_id)); 109 ?></p> 110 </div> 111 <?php 112 $_SERVER['REQUEST_URI'] = remove_query_arg(array('denied'), $_SERVER['REQUEST_URI']); 113 endif; ?> 114 115 <?php if ( isset($_GET['deny']) ) : ?> 116 <div id="message" class="updated fade"> 117 <p><strong><?php printf(__('%d links denied','zelist'),absint($_GET['deny'])); ?></strong></p> 118 </div> 119 <?php 120 $_SERVER['REQUEST_URI'] = remove_query_arg(array('deny'), $_SERVER['REQUEST_URI']); 121 endif; ?> 122 123 124 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted','denied','published','pending','deny','publish'), $_SERVER['REQUEST_URI']); 125 ?> 126 127 <form class="search-form" action="" method="get"> 128 <?php if(!isset($_GET['page'])) : ?><input type="hidden" name="page" value="zelist/admin/link-manager.php" /><?php endif; ?> 129 <input type="hidden" name="noheader" value="1" /> 130 <input type="hidden" name="link_status" value="<?php if(isset($_GET['link_status'])) echo $_GET['link_status']; ?>" /> 131 <p class="search-box"><label class="hidden" for="link-search-input"><?php _e( 'Search Links' ); ?>:</label> 132 <input type="hidden" name="page" value="zelist/admin/link-manager.php" /> 133 <input type="text" class="search-input" id="link-search-input" name="s" value="<?php _admin_search_query(); ?>" /> 134 <input type="submit" value="<?php _e( 'Search Links' ); ?>" class="button" /> 135 </p> 136 </form> 137 <br class="clear" /> 138 139 <form id="links-filter" action="" method="get"> 140 <input type="hidden" name="page" value="zelist/admin/link-manager.php" /> 141 <input type="hidden" name="noheader" value="1" /> 142 <ul class="subsubsub"> 143 <?php 144 145 list($link_stati, $avail_link_stati) = wp_edit_links_query(); 146 147 $status_links = array(); 148 $num_links = wp_count_links(); 149 $link_status = $_GET['link_status']; 150 $class = empty( $_GET['link_status'] ) ? ' class="current"' : ''; 151 $status_links[] = 152 "<li><a href='".ZELIST_ADMIN_URL_MANAGER."' $class>" . sprintf( __ngettext( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $num_links->total ), number_format_i18n( $num_links->total ) ) . '</a>'; 153 154 foreach ( $link_stati as $status => $label ) { 155 $class = ''; 156 if ( !in_array( $status, $avail_link_stati ) ) continue; 157 if ( empty( $num_links->$status ) ) continue; 158 if ( isset($_GET['link_status']) && $status == $_GET['link_status'] ) $class = ' class="current"'; 159 if(current_user_can($status.'_links')) 160 $status_links[] = "<li class='link-$status'><a href='".ZELIST_ADMIN_URL_MANAGER."&link_status=$status' $class>" . sprintf( __ngettext( $label[2][0], $label[2][1], $num_links->$status,'zelist' ), number_format_i18n( $num_links->$status ) ) . '</a>'; 161 // else 162 // $status_links[] = "<li class='link-$status'><a $class>" . sprintf( __ngettext( $label[2][0], $label[2][1], $num_links->$status ), number_format_i18n( $num_links->$status ) ) . '</a>'; 163 } 164 if($num_links->link_rss > 0) { 165 $class = ($link_rss) ? ' class="current"': ''; 166 $status_links[] = "<li><a href='".ZELIST_ADMIN_URL_MANAGER."&link_rss=1' $class>".__('RSS','zelist')."</a>($num_links->link_rss)</li>"; 167 } 168 if($num_links->wrong_description > 0) { 169 $class = ($wrong_description) ? ' class="current"': ''; 170 $status_links[] = "<li><a href='".ZELIST_ADMIN_URL_MANAGER."&wrong_description=1' $class>".__('Wrong description','zelist')."</a>($num_links->wrong_description)</li>"; 171 } 172 173 echo implode( " |</li>\n", $status_links ) . '</li>'; 174 unset( $status_links ); ?> 175 </ul> 176 177 <div class="tablenav"> 178 179 <?php 180 if ( 'all' == $cat_id ) $cat_id = ''; 181 if(!isset($links_per_page)) $links_per_page = 20; 182 $paged = (isset($_GET['paged'])) ? $_GET['paged'] : 1; 183 $link_owner = (isset($_GET['link_owner'])) ? $_GET['link_owner'] : false; 184 185 $args = array( 186 'link_category' => $cat_id, 187 'link_owner' => $link_owner, 188 'link_tag' => $link_tag, 189 'link_rss' => (isset($_GET['link_rss'])) ? 1 : 0, 190 'wrong_description' => (isset($_GET['wrong_description'])) ? 1 : 0, 191 'hide_invisible' => 0, 192 'orderby' => 'updated', 193 'order' => 'DESC', 194 'hide_empty' => 0, 195 'link_status' => $link_status, 196 'limit' => $links_per_page, 197 'paged' => $paged, 198 'offset' => ($paged - 1) * $links_per_page, 199 'links_per_page' => $links_per_page, 200 ); 201 202 if ( !empty($_GET['s']) ) $args['ls'] = $_GET['s']; 203 204 $links = query_links( $args ); 205 global $zelist_query; 206 207 $page_links = paginate_links( array( 208 'base' => add_query_arg( 'paged', '%#%' ), 209 'format' => '', 210 'prev_text' => __('«'), 211 'next_text' => __('»'), 212 'total' => $zelist_query->max_num_pages, 213 'current' => $paged, 214 )); 215 ?> 216 <?php if(current_user_can('manage_links')) : ?> 217 <div class="alignleft actions"><select name="action"> 218 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option> 219 <option value="publish"><?php _e('Publish','zelist'); ?></option> 220 <option value="delete"><?php _e('Delete','zelist'); ?></option> 221 <option value="deny"><?php _e('Deny','zelist'); ?></option> 222 <option value="pending"><?php _e('Back to review','zelist'); ?></option> 223 </select> 224 <input type="hidden" name="link_status" value="<?php echo $link_status; ?>" /> 225 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" /> 226 <?php endif; ?> 227 228 <?php 229 $args = array( 230 'type' => 'link', 231 'selected' => ($cat_id == 'all') ? '' : $cat_id, 232 'hide_empty' => 1, 233 'name' => 'cat_id', 234 'order_by' => 'name', 235 'hierarchical' => true, 236 'show_option_all' => __('View all Categories'), 237 ); 238 wp_dropdown_categories($args); ?> 239 <input type="submit" id="post-query-submit" value="<?php _e('Filter'); ?>" class="button-secondary" /> 240 </div> 241 242 243 <?php 244 if ( $page_links ) { ?> 245 <div class="tablenav-pages"><?php 246 $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s', 247 number_format_i18n( ( $paged - 1 ) * $links_per_page + 1 ), 248 number_format_i18n( min( $paged * $links_per_page, $zelist_query->found_links ) ), 249 number_format_i18n( $zelist_query->found_links ), 250 $page_links 251 ); 252 echo $page_links_text; 253 ?></div> 254 <?php } ?> <br class="clear" /> 255 </div> 256 257 <div class="clear"></div> 258 259 <?php 260 261 if ( $links ) { 262 $link_columns = get_column_headers('link-manager'); 263 $hidden = get_hidden_columns('link-manager'); 264 ?> <?php wp_nonce_field('bulk-bookmarks') ?> 265 <table id="link-manager" class="widefat fixed" cellspacing="0"> 266 <thead> 267 <tr> 268 <?php print_column_headers('link-manager'); ?> 269 </tr> 270 </thead> 271 272 <tfoot> 273 <tr> 274 <?php print_column_headers('link-manager', false); ?> 275 </tr> 276 </tfoot> 277 278 <tbody> 279 <?php link_rows($links); ?> 280 </tbody> 281 </table> 282 283 <?php 284 // @TODO inline_link_row() 285 } else { ?> 286 <p><?php _e('No links found.') ?></p> 287 <?php } ?> 288 289 <div class="tablenav"> 290 291 <?php if(current_user_can('manage_links')) : ?> 292 <div class="alignleft actions"><select name="action2"> 293 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option> 294 <option value="publish"><?php _e('Publish','zelist'); ?></option> 295 <option value="delete"><?php _e('Delete','zelist'); ?></option> 296 <option value="deny"><?php _e('Deny','zelist'); ?></option> 297 <option value="pending"><?php _e('Back to review','zelist'); ?></option> 298 </select> 299 <input type="hidden" name="link_status" value="<?php echo $link_status; ?>" /> 300 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" /> 301 <?php endif; ?> 302 </div> 303 304 305 306 307 <?php 308 if ( $page_links ) { ?> 309 <div class="tablenav-pages"><?php 310 $page_links_text = sprintf( '<span class="displaying-num">' . __( 'Displaying %s–%s of %s' ) . '</span>%s', 311 number_format_i18n( ( $paged - 1 ) * $links_per_page + 1 ), 312 number_format_i18n( min( $paged * $links_per_page, $zelist_query->found_links ) ), 313 number_format_i18n( $zelist_query->found_links ), 314 $page_links 315 ); 316 echo $page_links_text; 317 ?></div> 318 <?php } ?> 319 <br class="clear" /> 320 321 </div> 322 323 </form> 324 325 <?php inline_edit_link(); ?> 326 327 </div><!-- // wrap --> 328 329
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sat May 30 23:51:06 2009 | Cross-referenced by PHPXref 0.7 |