~canonical-sysadmins/wordpress/4.8.1

« back to all changes in this revision

Viewing changes to wp-admin/edit-tags.php

  • Committer: Barry Price
  • Date: 2016-08-17 04:50:12 UTC
  • mfrom: (1.1.18 upstream)
  • Revision ID: barry.price@canonical.com-20160817045012-qfui81zhqnqv2ba9
Merge WP4.6 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
require_once( dirname( __FILE__ ) . '/admin.php' );
11
11
 
12
12
if ( ! $taxnow )
13
 
        wp_die( __( 'Invalid taxonomy' ) );
 
13
        wp_die( __( 'Invalid taxonomy.' ) );
14
14
 
15
15
$tax = get_taxonomy( $taxnow );
16
16
 
17
17
if ( ! $tax )
18
 
        wp_die( __( 'Invalid taxonomy' ) );
 
18
        wp_die( __( 'Invalid taxonomy.' ) );
19
19
 
20
20
if ( ! in_array( $tax->name, get_taxonomies( array( 'show_ui' => true ) ) ) ) {
21
 
   wp_die( __( 'You are not allowed to manage these items.' ) );
 
21
   wp_die( __( 'Sorry, you are not allowed to manage these items.' ) );
22
22
}
23
23
 
24
24
if ( ! current_user_can( $tax->cap->manage_terms ) ) {
25
25
        wp_die(
26
26
                '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
27
 
                '<p>' . __( 'You are not allowed to manage these items.' ) . '</p>',
 
27
                '<p>' . __( 'Sorry, you are not allowed to manage these items.' ) . '</p>',
28
28
                403
29
29
        );
30
30
}
71
71
        if ( ! current_user_can( $tax->cap->edit_terms ) ) {
72
72
                wp_die(
73
73
                        '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
74
 
                        '<p>' . __( 'You are not allowed to add this item.' ) . '</p>',
 
74
                        '<p>' . __( 'Sorry, you are not allowed to add this item.' ) . '</p>',
75
75
                        403
76
76
                );
77
77
        }
111
111
        if ( ! current_user_can( $tax->cap->delete_terms ) ) {
112
112
                wp_die(
113
113
                        '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
114
 
                        '<p>' . __( 'You are not allowed to delete this item.' ) . '</p>',
 
114
                        '<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>',
115
115
                        403
116
116
                );
117
117
        }
128
128
        if ( ! current_user_can( $tax->cap->delete_terms ) ) {
129
129
                wp_die(
130
130
                        '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
131
 
                        '<p>' . __( 'You are not allowed to delete these items.' ) . '</p>',
 
131
                        '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>',
132
132
                        403
133
133
                );
134
134
        }
171
171
        if ( ! current_user_can( $tax->cap->edit_terms ) ) {
172
172
                wp_die(
173
173
                        '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
174
 
                        '<p>' . __( 'You are not allowed to edit this item.' ) . '</p>',
 
174
                        '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
175
175
                        403
176
176
                );
177
177
        }
205
205
        if ( ! empty( $_REQUEST['paged'] ) ) {
206
206
                $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location );
207
207
        }
208
 
        wp_redirect( $location );
 
208
 
 
209
        /**
 
210
         * Filters the taxonomy redirect destination URL.
 
211
         *
 
212
         * @since 4.6.0
 
213
         * 
 
214
         * @param string $location The destination URL.
 
215
         * @param object $tax      The taxonomy object.
 
216
         */
 
217
        wp_redirect( apply_filters( 'redirect_term_location', $location, $tax ) );
209
218
        exit;
210
219
}
211
220
 
288
297
if ( ! current_user_can( $tax->cap->edit_terms ) ) {
289
298
        wp_die(
290
299
                '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
291
 
                '<p>' . __( 'You are not allowed to edit this item.' ) . '</p>',
 
300
                '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>',
292
301
                403
293
302
        );
294
303
}
321
330
endif; ?>
322
331
<div id="ajax-response"></div>
323
332
 
324
 
<form class="search-form" method="get">
 
333
<form class="search-form wp-clearfix" method="get">
325
334
<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
326
335
<input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" />
327
336
 
328
337
<?php $wp_list_table->search_box( $tax->labels->search_items, 'tag' ); ?>
329
338
 
330
339
</form>
331
 
<br class="clear" />
332
 
 
333
 
<div id="col-container">
334
 
 
335
 
<div id="col-right">
336
 
<div class="col-wrap">
337
 
<form id="posts-filter" method="post">
338
 
<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" />
339
 
<input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" />
340
 
 
341
 
<?php $wp_list_table->display(); ?>
342
 
 
343
 
<br class="clear" />
344
 
</form>
345
 
 
346
 
<?php if ( 'category' == $taxonomy ) : ?>
347
 
<div class="form-wrap">
348
 
<p>
349
 
        <?php
350
 
        echo '<strong>' . __( 'Note:' ) . '</strong><br />';
351
 
        printf(
352
 
                /* translators: %s: default category */
353
 
                __( 'Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category %s.' ),
354
 
                /** This filter is documented in wp-includes/category-template.php */
355
 
                '<strong>' . apply_filters( 'the_category', get_cat_name( get_option( 'default_category') ) ) . '</strong>'
356
 
        );
357
 
        ?>
358
 
</p>
359
 
<?php if ( current_user_can( 'import' ) ) : ?>
360
 
<p><?php printf( __( 'Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.' ), esc_url( $import_link ) ) ?></p>
361
 
<?php endif; ?>
362
 
</div>
363
 
<?php elseif ( 'post_tag' == $taxonomy && current_user_can( 'import' ) ) : ?>
364
 
<div class="form-wrap">
365
 
<p><?php printf( __( 'Tags can be selectively converted to categories using the <a href="%s">tag to category converter</a>.' ), esc_url( $import_link ) ) ;?></p>
366
 
</div>
367
 
<?php endif;
368
 
 
369
 
/**
370
 
 * Fires after the taxonomy list table.
371
 
 *
372
 
 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
373
 
 *
374
 
 * @since 3.0.0
375
 
 *
376
 
 * @param string $taxonomy The taxonomy name.
377
 
 */
378
 
do_action( "after-{$taxonomy}-table", $taxonomy );
379
 
?>
380
 
 
381
 
</div>
382
 
</div><!-- /col-right -->
 
340
 
 
341
<div id="col-container" class="wp-clearfix">
383
342
 
384
343
<div id="col-left">
385
344
<div class="col-wrap">
386
345
 
387
346
<?php
388
347
 
389
 
if ( !is_null( $tax->labels->popular_items ) ) {
390
 
        if ( current_user_can( $tax->cap->edit_terms ) )
391
 
                $tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'post_type' => $post_type, 'echo' => false, 'link' => 'edit' ) );
392
 
        else
393
 
                $tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'echo' => false ) );
394
 
 
395
 
        if ( $tag_cloud ) :
396
 
        ?>
397
 
<div class="tagcloud">
398
 
<h2><?php echo $tax->labels->popular_items; ?></h2>
399
 
<?php echo $tag_cloud; unset( $tag_cloud ); ?>
400
 
</div>
401
 
<?php
402
 
endif;
403
 
}
404
 
 
405
348
if ( current_user_can($tax->cap->edit_terms) ) {
406
349
        if ( 'category' == $taxonomy ) {
407
350
                /**
493
436
        );
494
437
 
495
438
        /**
496
 
         * Filter the taxonomy parent drop-down on the Edit Term page.
 
439
         * Filters the taxonomy parent drop-down on the Edit Term page.
497
440
         *
498
441
         * @since 3.7.0
499
442
         * @since 4.2.0 Added `$context` parameter.
597
540
do_action( "{$taxonomy}_add_form", $taxonomy );
598
541
?>
599
542
</form></div>
600
 
<?php } ?>
 
543
<?php }
 
544
 
 
545
if ( ! is_null( $tax->labels->popular_items ) ) {
 
546
        if ( current_user_can( $tax->cap->edit_terms ) ) {
 
547
                $tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'post_type' => $post_type, 'echo' => false, 'link' => 'edit' ) );
 
548
        } else {
 
549
                $tag_cloud = wp_tag_cloud( array( 'taxonomy' => $taxonomy, 'echo' => false ) );
 
550
        }
 
551
 
 
552
        if ( $tag_cloud ) :
 
553
        ?>
 
554
<div class="tagcloud">
 
555
<h2><?php echo $tax->labels->popular_items; ?></h2>
 
556
<?php echo $tag_cloud; unset( $tag_cloud ); ?>
 
557
</div>
 
558
<?php
 
559
        endif;
 
560
}
 
561
 
 
562
?>
601
563
 
602
564
</div>
603
565
</div><!-- /col-left -->
604
566
 
 
567
<div id="col-right">
 
568
<div class="col-wrap">
 
569
<form id="posts-filter" method="post">
 
570
<input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>" />
 
571
<input type="hidden" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" />
 
572
 
 
573
<?php $wp_list_table->display(); ?>
 
574
 
 
575
</form>
 
576
 
 
577
<?php if ( 'category' == $taxonomy ) : ?>
 
578
<div class="form-wrap edit-term-notes">
 
579
<p>
 
580
        <?php
 
581
        echo '<strong>' . __( 'Note:' ) . '</strong><br />';
 
582
        printf(
 
583
                /* translators: %s: default category */
 
584
                __( 'Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category %s.' ),
 
585
                /** This filter is documented in wp-includes/category-template.php */
 
586
                '<strong>' . apply_filters( 'the_category', get_cat_name( get_option( 'default_category') ) ) . '</strong>'
 
587
        );
 
588
        ?>
 
589
</p>
 
590
<?php if ( current_user_can( 'import' ) ) : ?>
 
591
<p><?php printf( __( 'Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.' ), esc_url( $import_link ) ) ?></p>
 
592
<?php endif; ?>
 
593
</div>
 
594
<?php elseif ( 'post_tag' == $taxonomy && current_user_can( 'import' ) ) : ?>
 
595
<div class="form-wrap edit-term-notes">
 
596
<p><?php printf( __( 'Tags can be selectively converted to categories using the <a href="%s">tag to category converter</a>.' ), esc_url( $import_link ) ) ;?></p>
 
597
</div>
 
598
<?php endif;
 
599
 
 
600
/**
 
601
 * Fires after the taxonomy list table.
 
602
 *
 
603
 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
 
604
 *
 
605
 * @since 3.0.0
 
606
 *
 
607
 * @param string $taxonomy The taxonomy name.
 
608
 */
 
609
do_action( "after-{$taxonomy}-table", $taxonomy );
 
610
?>
 
611
 
 
612
</div>
 
613
</div><!-- /col-right -->
 
614
 
605
615
</div><!-- /col-container -->
606
616
</div><!-- /wrap -->
607
617