Make WordPress Core

Ticket #34117: 34117.diff

File 34117.diff, 5.2 KB (added by johnbillion, 9 years ago)
  • src/wp-admin/includes/class-wp-plugins-list-table.php

     
    530530                        }
    531531                } // end if $context
    532532
    533                 $prefix = $screen->in_admin( 'network' ) ? 'network_admin_' : '';
     533                $actions = array_filter( $actions );
     534
     535                if ( $screen->in_admin( 'network' ) ) {
    534536
    535537                /**
    536                  * Filter the action links displayed for each plugin in the Plugins list table.
    537                  *
    538                  * The dynamic portion of the hook name, `$prefix`, refers to the context the
    539                  * action links are displayed in. The 'network_admin_' prefix is used if the
    540                  * current screen is the Network plugins list table. The prefix is empty ('')
    541                  * if the current screen is the site plugins list table.
     538                 * Filter the action links displayed for each plugin in the Network Admin Plugins list table.
    542539                 *
    543540                 * The default action links for the Network plugins list table include
    544541                 * 'Network Activate', 'Network Deactivate', 'Edit', and 'Delete'.
    545542                 *
     543                 * @since 3.1.0
     544                 *
     545                 * @param array  $actions     An array of plugin action links.
     546                 * @param string $plugin_file Path to the plugin file relative to the plugins directory.
     547                 * @param array  $plugin_data An array of plugin data.
     548                 * @param string $context     The plugin context. Defaults are 'All', 'Active',
     549                 *                            'Inactive', 'Recently Activated', 'Upgrade',
     550                 *                            'Must-Use', 'Drop-ins', 'Search'.
     551                 */
     552                $actions = apply_filters( 'network_admin_plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
     553
     554                /**
     555                 * Filter the list of action links displayed for a specific plugin in the Network Admin Plugins list table.
     556                 *
     557                 * The dynamic portion of the hook name, $plugin_file, refers to the path
     558                 * to the plugin file, relative to the plugins directory.
     559                 *
     560                 * @since 3.1.0
     561                 *
     562                 * @param array  $actions     An array of plugin action links.
     563                 * @param string $plugin_file Path to the plugin file relative to the plugins directory.
     564                 * @param array  $plugin_data An array of plugin data.
     565                 * @param string $context     The plugin context. Defaults are 'All', 'Active',
     566                 *                            'Inactive', 'Recently Activated', 'Upgrade',
     567                 *                            'Must-Use', 'Drop-ins', 'Search'.
     568                 */
     569                $actions = apply_filters( "network_admin_plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context );
     570
     571                } else {
     572
     573                /**
     574                 * Filter the action links displayed for each plugin in the Plugins list table.
     575                 *
    546576                 * The default action links for the site plugins list table include
    547577                 * 'Activate', 'Deactivate', and 'Edit', for a network site, and
    548578                 * 'Activate', 'Deactivate', 'Edit', and 'Delete' for a single site.
     
    550580                 * @since 2.5.0
    551581                 *
    552582                 * @param array  $actions     An array of plugin action links.
    553                  * @param string $plugin_file Path to the plugin file.
     583                 * @param string $plugin_file Path to the plugin file relative to the plugins directory.
    554584                 * @param array  $plugin_data An array of plugin data.
    555585                 * @param string $context     The plugin context. Defaults are 'All', 'Active',
    556586                 *                            'Inactive', 'Recently Activated', 'Upgrade',
    557587                 *                            'Must-Use', 'Drop-ins', 'Search'.
    558588                 */
    559                 $actions = apply_filters( $prefix . 'plugin_action_links', array_filter( $actions ), $plugin_file, $plugin_data, $context );
     589                $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
    560590
    561591                /**
    562                  * Filter the list of action links displayed for a specific plugin.
     592                 * Filter the list of action links displayed for a specific plugin in the Plugins list table.
    563593                 *
    564                  * The first dynamic portion of the hook name, $prefix, refers to the context
    565                  * the action links are displayed in. The 'network_admin_' prefix is used if the
    566                  * current screen is the Network plugins list table. The prefix is empty ('')
    567                  * if the current screen is the site plugins list table.
    568                  *
    569                  * The second dynamic portion of the hook name, $plugin_file, refers to the path
     594                 * The dynamic portion of the hook name, $plugin_file, refers to the path
    570595                 * to the plugin file, relative to the plugins directory.
    571596                 *
    572597                 * @since 2.7.0
    573598                 *
    574599                 * @param array  $actions     An array of plugin action links.
    575                  * @param string $plugin_file Path to the plugin file.
     600                 * @param string $plugin_file Path to the plugin file relative to the plugins directory.
    576601                 * @param array  $plugin_data An array of plugin data.
    577602                 * @param string $context     The plugin context. Defaults are 'All', 'Active',
    578603                 *                            'Inactive', 'Recently Activated', 'Upgrade',
    579604                 *                            'Must-Use', 'Drop-ins', 'Search'.
    580605                 */
    581                 $actions = apply_filters( $prefix . "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context );
     606                $actions = apply_filters( "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context );
     607
     608                }
    582609
    583610                $class = $is_active ? 'active' : 'inactive';
    584611                $checkbox_id =  "checkbox_" . md5($plugin_data['Name']);