-
+ 833B9F3F31940BD4A8C6B81DF47B3E75FAEC7310AA7A956E2C0F2C77F94B10C87DA4A8ED357F50B33EB06275B1849FB664FC4ACF0D0538C55EFB91F9C1DE70AF
mp-wp/wp-admin/edit-tags.php
(0 . 0)(1 . 306)
12719 <?php
12720 /**
12721 * Edit Tags Administration Panel.
12722 *
12723 * @package WordPress
12724 * @subpackage Administration
12725 */
12726
12727 /** WordPress Administration Bootstrap */
12728 require_once('admin.php');
12729
12730 $title = __('Tags');
12731
12732 wp_reset_vars( array('action', 'tag') );
12733
12734 if ( isset( $_GET['action'] ) && isset($_GET['delete_tags']) && ( 'delete' == $_GET['action'] || 'delete' == $_GET['action2'] ) )
12735 $action = 'bulk-delete';
12736
12737 switch($action) {
12738
12739 case 'addtag':
12740
12741 check_admin_referer('add-tag');
12742
12743 if ( !current_user_can('manage_categories') )
12744 wp_die(__('Cheatin’ uh?'));
12745
12746 $ret = wp_insert_term($_POST['name'], 'post_tag', $_POST);
12747 if ( $ret && !is_wp_error( $ret ) ) {
12748 wp_redirect('edit-tags.php?message=1#addtag');
12749 } else {
12750 wp_redirect('edit-tags.php?message=4#addtag');
12751 }
12752 exit;
12753 break;
12754
12755 case 'delete':
12756 $tag_ID = (int) $_GET['tag_ID'];
12757 check_admin_referer('delete-tag_' . $tag_ID);
12758
12759 if ( !current_user_can('manage_categories') )
12760 wp_die(__('Cheatin’ uh?'));
12761
12762 wp_delete_term( $tag_ID, 'post_tag');
12763
12764 wp_redirect('edit-tags.php?message=2');
12765 exit;
12766
12767 break;
12768
12769 case 'bulk-delete':
12770 check_admin_referer('bulk-tags');
12771
12772 if ( !current_user_can('manage_categories') )
12773 wp_die(__('Cheatin’ uh?'));
12774
12775 $tags = $_GET['delete_tags'];
12776 foreach( (array) $tags as $tag_ID ) {
12777 wp_delete_term( $tag_ID, 'post_tag');
12778 }
12779
12780 $location = 'edit-tags.php';
12781 if ( $referer = wp_get_referer() ) {
12782 if ( false !== strpos($referer, 'edit-tags.php') )
12783 $location = $referer;
12784 }
12785
12786 $location = add_query_arg('message', 6, $location);
12787 wp_redirect($location);
12788 exit;
12789
12790 break;
12791
12792 case 'edit':
12793 $title = __('Edit Tag');
12794
12795 require_once ('admin-header.php');
12796 $tag_ID = (int) $_GET['tag_ID'];
12797
12798 $tag = get_term($tag_ID, 'post_tag', OBJECT, 'edit');
12799 include('edit-tag-form.php');
12800
12801 break;
12802
12803 case 'editedtag':
12804 $tag_ID = (int) $_POST['tag_ID'];
12805 check_admin_referer('update-tag_' . $tag_ID);
12806
12807 if ( !current_user_can('manage_categories') )
12808 wp_die(__('Cheatin’ uh?'));
12809
12810 $ret = wp_update_term($tag_ID, 'post_tag', $_POST);
12811
12812 $location = 'edit-tags.php';
12813 if ( $referer = wp_get_original_referer() ) {
12814 if ( false !== strpos($referer, 'edit-tags.php') )
12815 $location = $referer;
12816 }
12817
12818 if ( $ret && !is_wp_error( $ret ) )
12819 $location = add_query_arg('message', 3, $location);
12820 else
12821 $location = add_query_arg('message', 5, $location);
12822
12823 wp_redirect($location);
12824 exit;
12825 break;
12826
12827 default:
12828
12829 if ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) {
12830 wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) );
12831 exit;
12832 }
12833
12834 $can_manage = current_user_can('manage_categories');
12835
12836 wp_enqueue_script('admin-tags');
12837 if ( $can_manage )
12838 wp_enqueue_script('inline-edit-tax');
12839
12840 require_once ('admin-header.php');
12841
12842 $messages[1] = __('Tag added.');
12843 $messages[2] = __('Tag deleted.');
12844 $messages[3] = __('Tag updated.');
12845 $messages[4] = __('Tag not added.');
12846 $messages[5] = __('Tag not updated.');
12847 $messages[6] = __('Tags deleted.'); ?>
12848
12849 <div class="wrap nosubsub">
12850 <?php screen_icon(); ?>
12851 <h2><?php echo wp_specialchars( $title );
12852 if ( isset($_GET['s']) && $_GET['s'] )
12853 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', wp_specialchars( stripslashes($_GET['s']) ) ); ?>
12854 </h2>
12855
12856 <?php if ( isset($_GET['message']) && ( $msg = (int) $_GET['message'] ) ) : ?>
12857 <div id="message" class="updated fade"><p><?php echo $messages[$msg]; ?></p></div>
12858 <?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
12859 endif; ?>
12860
12861 <form class="search-form" action="" method="get">
12862 <p class="search-box">
12863 <label class="hidden" for="tag-search-input"><?php _e( 'Search Tags' ); ?>:</label>
12864 <input type="text" class="search-input" id="tag-search-input" name="s" value="<?php _admin_search_query(); ?>" />
12865 <input type="submit" value="<?php _e( 'Search Tags' ); ?>" class="button" />
12866 </p>
12867 </form>
12868 <br class="clear" />
12869
12870 <div id="col-container">
12871
12872 <div id="col-right">
12873 <div class="col-wrap">
12874 <form id="posts-filter" action="" method="get">
12875 <div class="tablenav">
12876 <?php
12877 $pagenum = isset( $_GET['pagenum'] ) ? absint( $_GET['pagenum'] ) : 0;
12878 if ( empty($pagenum) )
12879 $pagenum = 1;
12880
12881 $tagsperpage = apply_filters("tagsperpage",20);
12882
12883 $page_links = paginate_links( array(
12884 'base' => add_query_arg( 'pagenum', '%#%' ),
12885 'format' => '',
12886 'prev_text' => __('«'),
12887 'next_text' => __('»'),
12888 'total' => ceil(wp_count_terms('post_tag') / $tagsperpage),
12889 'current' => $pagenum
12890 ));
12891
12892 if ( $page_links )
12893 echo "<div class='tablenav-pages'>$page_links</div>";
12894 ?>
12895
12896 <div class="alignleft actions">
12897 <select name="action">
12898 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
12899 <option value="delete"><?php _e('Delete'); ?></option>
12900 </select>
12901 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction" id="doaction" class="button-secondary action" />
12902 <?php wp_nonce_field('bulk-tags'); ?>
12903 </div>
12904
12905 <br class="clear" />
12906 </div>
12907
12908 <div class="clear"></div>
12909
12910 <table class="widefat tag fixed" cellspacing="0">
12911 <thead>
12912 <tr>
12913 <?php print_column_headers('edit-tags'); ?>
12914 </tr>
12915 </thead>
12916
12917 <tfoot>
12918 <tr>
12919 <?php print_column_headers('edit-tags', false); ?>
12920 </tr>
12921 </tfoot>
12922
12923 <tbody id="the-list" class="list:tag">
12924 <?php
12925
12926 $searchterms = isset( $_GET['s'] ) ? trim( $_GET['s'] ) : '';
12927
12928 $count = tag_rows( $pagenum, $tagsperpage, $searchterms );
12929 ?>
12930 </tbody>
12931 </table>
12932
12933 <div class="tablenav">
12934 <?php
12935 if ( $page_links )
12936 echo "<div class='tablenav-pages'>$page_links</div>";
12937 ?>
12938
12939 <div class="alignleft actions">
12940 <select name="action2">
12941 <option value="" selected="selected"><?php _e('Bulk Actions'); ?></option>
12942 <option value="delete"><?php _e('Delete'); ?></option>
12943 </select>
12944 <input type="submit" value="<?php _e('Apply'); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
12945 </div>
12946
12947 <br class="clear" />
12948 </div>
12949
12950 <br class="clear" />
12951 </form>
12952 </div>
12953 </div><!-- /col-right -->
12954
12955 <div id="col-left">
12956 <div class="col-wrap">
12957
12958 <div class="tagcloud">
12959 <h3><?php _e('Popular Tags'); ?></h3>
12960 <?php
12961 if ( $can_manage )
12962 wp_tag_cloud(array('link' => 'edit'));
12963 else
12964 wp_tag_cloud();
12965 ?>
12966 </div>
12967
12968 <?php if ( $can_manage ) {
12969 do_action('add_tag_form_pre'); ?>
12970
12971 <div class="form-wrap">
12972 <h3><?php _e('Add a New Tag'); ?></h3>
12973 <div id="ajax-response"></div>
12974 <form name="addtag" id="addtag" method="post" action="edit-tags.php" class="add:the-list: validate">
12975 <input type="hidden" name="action" value="addtag" />
12976 <?php wp_original_referer_field(true, 'previous'); wp_nonce_field('add-tag'); ?>
12977
12978 <div class="form-field form-required">
12979 <label for="name"><?php _e('Tag name') ?></label>
12980 <input name="name" id="name" type="text" value="" size="40" aria-required="true" />
12981 <p><?php _e('The name is how the tag appears on your site.'); ?></p>
12982 </div>
12983
12984 <div class="form-field">
12985 <label for="slug"><?php _e('Tag slug') ?></label>
12986 <input name="slug" id="slug" type="text" value="" size="40" />
12987 <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>
12988 </div>
12989
12990 <p class="submit"><input type="submit" class="button" name="submit" value="<?php _e('Add Tag'); ?>" /></p>
12991 <?php do_action('add_tag_form'); ?>
12992 </form></div>
12993 <?php } ?>
12994
12995 </div>
12996 </div><!-- /col-left -->
12997
12998 </div><!-- /col-container -->
12999 </div><!-- /wrap -->
13000
13001 <script type="text/javascript">
13002 /* <![CDATA[ */
13003 (function($){
13004 $(document).ready(function(){
13005 $('#doaction, #doaction2').click(function(){
13006 if ( $('select[name^="action"]').val() == 'delete' ) {
13007 var m = '<?php echo js_escape(__("You are about to delete the selected tags.\n 'Cancel' to stop, 'OK' to delete.")); ?>';
13008 return showNotice.warn(m);
13009 }
13010 });
13011 });
13012 })(jQuery);
13013 /* ]]> */
13014 </script>
13015
13016 <?php inline_edit_term_row('edit-tags'); ?>
13017
13018 <?php
13019 break;
13020 }
13021
13022 include('admin-footer.php');
13023
13024 ?>