| [ Index ] |
PHP Cross Reference of zeList |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Edit Tags Administration Panel. 4 * 5 * @package WordPress 6 * @subpackage Administration 7 */ 8 9 /** WordPress Administration Bootstrap */ 10 11 if(!$_GET['noheader']) require_once('admin.php'); 12 13 $title = __('Tags'); 14 15 wp_reset_vars( array('action', 'tag') ); 16 //if($_POST) { echo '<pre>'.print_r($_POST,1).'</pre>'; die();} 17 18 if ( isset( $_GET['action'] ) && isset($_GET['delete_tags']) && ( 'delete' == $_GET['action'] || 'delete' == $_GET['action2'] ) ) 19 $action = 'bulk-delete'; 20 21 switch($action) { 22 23 case 'addtag': 24 25 check_admin_referer('add-tag'); 26 27 if ( !current_user_can('manage_categories') ) 28 wp_die(__('Cheatin’ uh?')); 29 30 $ret = wp_insert_term($_POST['name'], 'link_tag', $_POST); 31 if ( $ret && !is_wp_error( $ret ) ) { 32 wp_redirect(ZELIST_ADMIN_URL_TAGS.'&message=1#addtag'); 33 } else { 34 wp_redirect(ZELIST_ADMIN_URL_TAGS.'&message=4#addtag'); 35 } 36 exit; 37 break; 38 39 case 'delete': 40 $tag_ID = (int) $_GET['tag_ID']; 41 check_admin_referer('delete-tag_' . $tag_ID); 42 43 if ( !current_user_can('manage_categories') ) 44 wp_die(__('Cheatin’ uh?')); 45 46 wp_delete_term( $tag_ID, 'link_tag'); 47 48 wp_redirect(ZELIST_ADMIN_URL_TAGS.'&message=2'); 49 exit; 50 51 break; 52 53 case 'bulk-delete': 54 check_admin_referer('bulk-tags'); 55 56 if ( !current_user_can('manage_categories') ) 57 wp_die(__('Cheatin’ uh?')); 58 59 $tags = $_GET['delete_tags']; 60 foreach( (array) $tags as $tag_ID ) { 61 wp_delete_term( $tag_ID, 'link_tag'); 62 } 63 64 $location = ZELIST_ADMIN_URL_TAGS; 65 if ( $referer = wp_get_referer() ) { 66 if ( false !== strpos($referer, ZELIST_ADMIN_URL_TAGS) ) 67 $location = $referer; 68 } 69 70 $location = add_query_arg('message', 6, $location); 71 wp_redirect($location); 72 exit; 73 74 break; 75 76 case 'edit': 77 $title = __('Edit Tag'); 78 79 require_once ('admin-header.php'); 80 $tag_ID = (int) $_GET['tag_ID']; 81 82 $tag = get_term($tag_ID, 'link_tag', OBJECT, 'edit'); 83 include(ZELIST_ADMIN_PATH_EDIT_TAG_FORM); 84 //include('edit-tag-form.php'); 85 86 break; 87 88 case 'editedtag': 89 $tag_ID = (int) $_POST['tag_ID']; 90 check_admin_referer('update-tag_' . $tag_ID); 91 92 if ( !current_user_can('manage_categories') ) 93 wp_die(__('Cheatin’ uh?')); 94 95 $ret = wp_update_term($tag_ID, 'link_tag', $_POST); 96 97 $location = ZELIST_ADMIN_URL_TAGS; 98 if ( $referer = wp_get_original_referer() ) { 99 if ( false !== strpos($referer, ZELIST_ADMIN_URL_TAGS) ) 100 $location = $referer; 101 } 102 103 if ( $ret && !is_wp_error( $ret ) ) 104 $location = add_query_arg('message', 3, $location); 105 else 106 $location = add_query_arg('message', 5, $location); 107 108 wp_redirect($location); 109 exit; 110 break; 111 112 default: 113 114 if ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) { 115 wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) ); 116 exit; 117 } 118 119 $can_manage = current_user_can('manage_categories'); 120 121 wp_enqueue_script('admin-tags'); 122 if ( $can_manage ) 123 wp_enqueue_script('inline-edit-tax'); 124 125 if(!$_GET['noheader']) require_once ('admin-header.php'); 126 127 $messages[1] = __('Tag added.'); 128 $messages[2] = __('Tag deleted.'); 129 $messages[3] = __('Tag updated.'); 130 $messages[4] = __('Tag not added.'); 131 $messages[5] = __('Tag not updated.'); 132 $messages[6] = __('Tags deleted.'); ?> 133 134 <div class="wrap nosubsub"> 135 <?php screen_icon(); ?> 136 <h2><?php echo wp_specialchars( $title ); 137 if ( isset($_GET['s']) && $_GET['s'] ) 138 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', wp_specialchars( stripslashes($_GET['s']) ) ); ?> 139 </h2> 140 141 <?php if ( isset($_GET['message']) && ( $msg = (int) $_GET['message'] ) ) : ?> 142 <div id="message" class="updated fade"><p><?php echo $messages[$msg]; ?></p></div> 143 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']); 144 endif; ?> 145 146 147 <form class="search-form" action="" method="get"> 148 <input type="hidden" name="page" value="zelist/admin/tags.php" /> 149 <p class="search-box"> 150 <label class="hidden" for="tag-search-input"><?php _e( 'Search Tags' ); ?>:</label> 151 <input type="text" class="search-input" id="tag-search-input" name="s" value="<?php _admin_search_query(); ?>" /> 152 <input type="submit" value="<?php _e( 'Search Tags' ); ?>" class="button" /> 153 </p> 154 </form> 155 <br class="clear" /> 156 157 <div id="col-container"> 158 159 <div id="col-right"> 160 <div class="col-wrap"> 161 <form id="posts-filter" action="" method="get"> 162 <input type="hidden" name="page" value="zelist/admin/tags.php" /> 163 <input type="hidden" name="noheader" value="1" /> 164 <div class="tablenav"> 165 <?php 166 $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0; 167 if ( empty($pagenum) ) 168 $pagenum = 1; 169 170 $tagsperpage = apply_filters("tagsperpage",20); 171 172 $page_links = paginate_links( array( 173 'base' => add_query_arg( 'pagenum', '%#%' ), 174 'format' => '', 175 'prev_text' => __('«'), 176 'next_text' => __('»'), 177 'total' => ceil(wp_count_terms('link_tag') / $tagsperpage), 178 'current' => $pagenum 179 )); 180 181 if ( $page_links ) 182 echo "<div class='tablenav-pages'>$page_links</div>"; 183 ?> 184 185 <div class="alignleft actions"> 186 <select name="action"> 187 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option> 188 <option value="delete"><?php _e('Delete'); ?></option> 189 </select> 190 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" /> 191 <?php wp_nonce_field('bulk-tags'); ?> 192 </div> 193 194 <br class="clear" /> 195 </div> 196 197 <div class="clear"></div> 198 199 <table class="widefat tag fixed" cellspacing="0"> 200 <thead> 201 <tr> 202 <?php print_column_headers('edit-link-tags'); ?> 203 </tr> 204 </thead> 205 206 <tfoot> 207 <tr> 208 <?php print_column_headers('edit-link-tags', false); ?> 209 </tr> 210 </tfoot> 211 212 <tbody id="the-list" class="list:tag"> 213 <?php 214 215 $searchterms = isset( $_GET['s'] ) ? trim( $_GET['s'] ) : ''; 216 217 $count = link_tag_rows( $pagenum, $tagsperpage, $searchterms ); 218 ?> 219 </tbody> 220 </table> 221 222 <div class="tablenav"> 223 <?php 224 if ( $page_links ) 225 echo "<div class='tablenav-pages'>$page_links</div>"; 226 ?> 227 228 <div class="alignleft actions"> 229 <select name="action2"> 230 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option> 231 <option value="delete"><?php _e('Delete'); ?></option> 232 </select> 233 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" /> 234 </div> 235 236 <br class="clear" /> 237 </div> 238 239 <br class="clear" /> 240 </form> 241 </div> 242 </div><!-- /col-right --> 243 244 <div id="col-left"> 245 <div class="col-wrap"> 246 247 <div class="tagcloud"> 248 <h3><?php _e('Popular Tags'); ?></h3> 249 <?php 250 if ( $can_manage ) 251 wp_link_tag_cloud(array('link' => 'edit')); 252 else 253 wp_link_tag_cloud(); 254 ?> 255 </div> 256 257 <?php if ( $can_manage ) { 258 do_action('add_tag_form_pre'); ?> 259 260 <div class="form-wrap"> 261 <h3><?php _e('Add a New Tag'); ?></h3> 262 <div id="ajax-response"></div> 263 <form name="addtag" id="addtag" method="post" action="<?php echo ZELIST_ADMIN_URL_TAGS; ?>&noheader=1" class="add:the-list: validate"> 264 <input type="hidden" name="noheader" value="1" /> 265 <input type="hidden" name="action" value="addtag" /> 266 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('add-tag'); ?> 267 268 <div class="form-field form-required"> 269 <label for="name"><?php _e('Tag name') ?></label> 270 <input name="name" id="name" type="text" value="" size="40" aria-required="true" /> 271 <p><?php _e('The name is how the tag appears on your site.'); ?></p> 272 </div> 273 274 <div class="form-field"> 275 <label for="slug"><?php _e('Tag slug') ?></label> 276 <input name="slug" id="slug" type="text" value="" size="40" /> 277 <p><?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p> 278 </div> 279 280 <p class="submit"><input type="submit" class="button" name="submit" value="<?php _e('Add Tag'); ?>" /></p> 281 <?php do_action('add_tag_form'); ?> 282 </form></div> 283 <?php } ?> 284 285 </div> 286 </div><!-- /col-left --> 287 288 </div><!-- /col-container --> 289 </div><!-- /wrap --> 290 291 <script type="text/javascript"> 292 /* <![CDATA[ */ 293 (function($){ 294 $(document).ready(function(){ 295 $('#doaction, #doaction2').click(function(){ 296 if ( $('select[name^="action"]').val() == 'delete' ) { 297 var m = '<?php echo js_escape(__("You are about to delete the selected tags.\n 'Cancel' to stop, 'OK' to delete.")); ?>'; 298 return showNotice.warn(m); 299 } 300 }); 301 }); 302 })(jQuery); 303 /* ]]> */ 304 </script> 305 306 <?php inline_edit_term_row('edit-tags'); ?> 307 308 <?php 309 break; 310 } 311 312 include('admin-footer.php'); 313 314 ?>
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 |