~canonical-sysadmins/wordpress/4.8.1

« back to all changes in this revision

Viewing changes to wp-admin/includes/class-wp-plugins-list-table.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:
104
104
                if ( ! is_multisite() || ( $screen->in_admin( 'network' ) && current_user_can( 'manage_network_plugins' ) ) ) {
105
105
 
106
106
                        /**
107
 
                         * Filter whether to display the advanced plugins list table.
 
107
                         * Filters whether to display the advanced plugins list table.
108
108
                         *
109
109
                         * There are two types of advanced plugins - must-use and drop-ins -
110
110
                         * which can be used in a single site or Multisite network.
140
140
                if ( ! $screen->in_admin( 'network' ) ) {
141
141
                        $show = current_user_can( 'manage_network_plugins' );
142
142
                        /**
143
 
                         * Filter whether to display network-active plugins alongside plugins active for the current site.
 
143
                         * Filters whether to display network-active plugins alongside plugins active for the current site.
144
144
                         *
145
145
                         * This also controls the display of inactive network-only plugins (plugins with
146
146
                         * "Network: true" in the plugin header).
246
246
 
247
247
                $total_this_page = $totals[ $status ];
248
248
 
 
249
                $js_plugins = array();
 
250
                foreach ( $plugins as $key => $list ) {
 
251
                        $js_plugins[ $key ] = array_keys( (array) $list );
 
252
                }
 
253
 
 
254
                wp_localize_script( 'updates', '_wpUpdatesItemCounts', array(
 
255
                        'plugins' => $js_plugins,
 
256
                ) );
 
257
 
249
258
                if ( ! $orderby ) {
250
259
                        $orderby = 'Name';
251
260
                } else {
333
342
        }
334
343
 
335
344
        /**
 
345
         * Displays the search box.
 
346
         *
 
347
         * @since 4.6.0
 
348
         * @access public
 
349
         *
 
350
         * @param string $text     The 'submit' button label.
 
351
         * @param string $input_id ID attribute value for the search input field.
 
352
         */
 
353
        public function search_box( $text, $input_id ) {
 
354
                if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) {
 
355
                        return;
 
356
                }
 
357
 
 
358
                $input_id = $input_id . '-search-input';
 
359
 
 
360
                if ( ! empty( $_REQUEST['orderby'] ) ) {
 
361
                        echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
 
362
                }
 
363
                if ( ! empty( $_REQUEST['order'] ) ) {
 
364
                        echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
 
365
                }
 
366
                ?>
 
367
                <p class="search-box">
 
368
                        <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label>
 
369
                        <input type="search" id="<?php echo esc_attr( $input_id ); ?>" class="wp-filter-search" name="s" value="<?php _admin_search_query(); ?>" placeholder="<?php esc_attr_e( 'Search installed plugins...' ); ?>"/>
 
370
                        <?php submit_button( $text, 'button hide-if-js', '', false, array( 'id' => 'search-submit' ) ); ?>
 
371
                </p>
 
372
                <?php
 
373
        }
 
374
 
 
375
        /**
336
376
         *
337
377
         * @global string $status
338
378
         * @return array
560
600
                                if ( $is_active ) {
561
601
                                        if ( current_user_can( 'manage_network_plugins' ) ) {
562
602
                                                /* translators: %s: plugin name */
563
 
                                                $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( __( 'Network deactivate %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Deactivate' ) . '</a>';
 
603
                                                $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Network Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Deactivate' ) . '</a>';
564
604
                                                }
565
605
                                } else {
566
606
                                        if ( current_user_can( 'manage_network_plugins' ) ) {
567
607
                                                /* translators: %s: plugin name */
568
 
                                                $actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( __( 'Network Activate %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Activate' ) . '</a>';
 
608
                                                $actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Activate' ) . '</a>';
569
609
                                        }
570
610
                                        if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) {
571
611
                                                /* translators: %s: plugin name */
572
 
                                                $actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( __( 'Delete %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>';
 
612
                                                $actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>';
573
613
                                        }
574
614
                                }
575
615
                        } else {
583
623
                                        );
584
624
                                } elseif ( $is_active ) {
585
625
                                        /* translators: %s: plugin name */
586
 
                                        $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( __( 'Deactivate %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Deactivate' ) . '</a>';
 
626
                                        $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Deactivate' ) . '</a>';
587
627
                                } else {
588
628
                                        /* translators: %s: plugin name */
589
 
                                        $actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( __( 'Activate %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Activate' ) . '</a>';
 
629
                                        $actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Activate' ) . '</a>';
590
630
 
591
631
                                        if ( ! is_multisite() && current_user_can( 'delete_plugins' ) ) {
592
632
                                                /* translators: %s: plugin name */
593
 
                                                $actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( __( 'Delete %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>';
 
633
                                                $actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&amp;checked[]=' . $plugin_file . '&amp;plugin_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>';
594
634
                                        }
595
635
                                } // end if $is_active
596
636
 
607
647
                if ( $screen->in_admin( 'network' ) ) {
608
648
 
609
649
                        /**
610
 
                         * Filter the action links displayed for each plugin in the Network Admin Plugins list table.
 
650
                         * Filters the action links displayed for each plugin in the Network Admin Plugins list table.
611
651
                         *
612
652
                         * The default action links for the Network plugins list table include
613
653
                         * 'Network Activate', 'Network Deactivate', 'Edit', and 'Delete'.
625
665
                        $actions = apply_filters( 'network_admin_plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
626
666
 
627
667
                        /**
628
 
                         * Filter the list of action links displayed for a specific plugin in the Network Admin Plugins list table.
 
668
                         * Filters the list of action links displayed for a specific plugin in the Network Admin Plugins list table.
629
669
                         *
630
670
                         * The dynamic portion of the hook name, $plugin_file, refers to the path
631
671
                         * to the plugin file, relative to the plugins directory.
645
685
                } else {
646
686
 
647
687
                        /**
648
 
                         * Filter the action links displayed for each plugin in the Plugins list table.
 
688
                         * Filters the action links displayed for each plugin in the Plugins list table.
649
689
                         *
650
690
                         * The default action links for the site plugins list table include
651
691
                         * 'Activate', 'Deactivate', and 'Edit', for a network site, and
664
704
                        $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
665
705
 
666
706
                        /**
667
 
                         * Filter the list of action links displayed for a specific plugin in the Plugins list table.
 
707
                         * Filters the list of action links displayed for a specific plugin in the Plugins list table.
668
708
                         *
669
709
                         * The dynamic portion of the hook name, $plugin_file, refers to the path
670
710
                         * to the plugin file, relative to the plugins directory.
757
797
                                        }
758
798
 
759
799
                                        /**
760
 
                                         * Filter the array of row meta for each plugin in the Plugins list table.
 
800
                                         * Filters the array of row meta for each plugin in the Plugins list table.
761
801
                                         *
762
802
                                         * @since 2.8.0
763
803
                                         *
776
816
                                        echo "</div></td>";
777
817
                                        break;
778
818
                                default:
779
 
                                        $classes = "$column_name column-$column_name$class";
 
819
                                        $classes = "$column_name column-$column_name $class";
780
820
 
781
821
                                        echo "<td class='$classes{$extra_classes}'>";
782
822