Make WordPress Core

Changeset 34786


Ignore:
Timestamp:
10/02/2015 11:43:20 PM (9 years ago)
Author:
johnbillion
Message:

Remove the unnecessary dynamic prefix used in the plugin_action_links filter name, and in those of its brethren. This way, network_admin_plugin_action_links gets listed as a separate filter.

Fixes #34117

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-plugins-list-table.php

    r34778 r34786  
    531531        } // end if $context
    532532
    533         $prefix = $screen->in_admin( 'network' ) ? 'network_admin_' : '';
    534 
    535         /**
    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.
    542          *
    543          * The default action links for the Network plugins list table include
    544          * 'Network Activate', 'Network Deactivate', 'Edit', and 'Delete'.
    545          *
    546          * The default action links for the site plugins list table include
    547          * 'Activate', 'Deactivate', and 'Edit', for a network site, and
    548          * 'Activate', 'Deactivate', 'Edit', and 'Delete' for a single site.
    549          *
    550          * @since 2.5.0
    551          *
    552          * @param array  $actions     An array of plugin action links.
    553          * @param string $plugin_file Path to the plugin file.
    554          * @param array  $plugin_data An array of plugin data.
    555          * @param string $context     The plugin context. Defaults are 'All', 'Active',
    556          *                            'Inactive', 'Recently Activated', 'Upgrade',
    557          *                            'Must-Use', 'Drop-ins', 'Search'.
    558          */
    559         $actions = apply_filters( $prefix . 'plugin_action_links', array_filter( $actions ), $plugin_file, $plugin_data, $context );
    560 
    561         /**
    562          * Filter the list of action links displayed for a specific plugin.
    563          *
    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
    570          * to the plugin file, relative to the plugins directory.
    571          *
    572          * @since 2.7.0
    573          *
    574          * @param array  $actions     An array of plugin action links.
    575          * @param string $plugin_file Path to the plugin file.
    576          * @param array  $plugin_data An array of plugin data.
    577          * @param string $context     The plugin context. Defaults are 'All', 'Active',
    578          *                            'Inactive', 'Recently Activated', 'Upgrade',
    579          *                            'Must-Use', 'Drop-ins', 'Search'.
    580          */
    581         $actions = apply_filters( $prefix . "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context );
     533        $actions = array_filter( $actions );
     534
     535        if ( $screen->in_admin( 'network' ) ) {
     536
     537            /**
     538             * Filter the action links displayed for each plugin in the Network Admin Plugins list table.
     539             *
     540             * The default action links for the Network plugins list table include
     541             * 'Network Activate', 'Network Deactivate', 'Edit', and 'Delete'.
     542             *
     543             * @since 3.1.0 As `{$prefix}_plugin_action_links`
     544             * @since 4.4.0
     545             *
     546             * @param array  $actions     An array of plugin action links.
     547             * @param string $plugin_file Path to the plugin file relative to the plugins directory.
     548             * @param array  $plugin_data An array of plugin data.
     549             * @param string $context     The plugin context. Defaults are 'All', 'Active',
     550             *                            'Inactive', 'Recently Activated', 'Upgrade',
     551             *                            'Must-Use', 'Drop-ins', 'Search'.
     552             */
     553            $actions = apply_filters( 'network_admin_plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
     554
     555            /**
     556             * Filter the list of action links displayed for a specific plugin in the Network Admin Plugins list table.
     557             *
     558             * The dynamic portion of the hook name, $plugin_file, refers to the path
     559             * to the plugin file, relative to the plugins directory.
     560             *
     561             * @since 3.1.0 As `{$prefix}_plugin_action_links_{$plugin_file}`
     562             * @since 4.4.0
     563             *
     564             * @param array  $actions     An array of plugin action links.
     565             * @param string $plugin_file Path to the plugin file relative to the plugins directory.
     566             * @param array  $plugin_data An array of plugin data.
     567             * @param string $context     The plugin context. Defaults are 'All', 'Active',
     568             *                            'Inactive', 'Recently Activated', 'Upgrade',
     569             *                            'Must-Use', 'Drop-ins', 'Search'.
     570             */
     571            $actions = apply_filters( "network_admin_plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context );
     572
     573        } else {
     574
     575            /**
     576             * Filter the action links displayed for each plugin in the Plugins list table.
     577             *
     578             * The default action links for the site plugins list table include
     579             * 'Activate', 'Deactivate', and 'Edit', for a network site, and
     580             * 'Activate', 'Deactivate', 'Edit', and 'Delete' for a single site.
     581             *
     582             * @since 2.5.0 As `{$prefix}_plugin_action_links`
     583             * @since 4.4.0
     584             *
     585             * @param array  $actions     An array of plugin action links.
     586             * @param string $plugin_file Path to the plugin file relative to the plugins directory.
     587             * @param array  $plugin_data An array of plugin data.
     588             * @param string $context     The plugin context. Defaults are 'All', 'Active',
     589             *                            'Inactive', 'Recently Activated', 'Upgrade',
     590             *                            'Must-Use', 'Drop-ins', 'Search'.
     591             */
     592            $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context );
     593
     594            /**
     595             * Filter the list of action links displayed for a specific plugin in the Plugins list table.
     596             *
     597             * The dynamic portion of the hook name, $plugin_file, refers to the path
     598             * to the plugin file, relative to the plugins directory.
     599             *
     600             * @since 2.7.0 As `{$prefix}_plugin_action_links_{$plugin_file}`
     601             * @since 4.4.0
     602             *
     603             * @param array  $actions     An array of plugin action links.
     604             * @param string $plugin_file Path to the plugin file relative to the plugins directory.
     605             * @param array  $plugin_data An array of plugin data.
     606             * @param string $context     The plugin context. Defaults are 'All', 'Active',
     607             *                            'Inactive', 'Recently Activated', 'Upgrade',
     608             *                            'Must-Use', 'Drop-ins', 'Search'.
     609             */
     610            $actions = apply_filters( "plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context );
     611
     612        }
    582613
    583614        $class = $is_active ? 'active' : 'inactive';
Note: See TracChangeset for help on using the changeset viewer.