PHP Класс WPCOM_VIP_Plugins_UI, vip-mu-plugins-public

Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$activation_disabled Whether or not to disable the plugin activation links.
$capability Required capability to access this plugin's features. Use the "wpcom_vip_plugins_ui_capability" filter to change this.
$fpp_plugins List of Featured Partner Program plugins.
$hidden_plugins List of plugins that should be hidden.
$hook_suffix The $hook_suffix value for the menu page.
$parent_menu_slug Parent menu's slug. Use the "wpcom_vip_plugins_ui_parent_menu_slug" filter to change this.
$plugin_folder Path to the extra plugins folder.

Открытые методы

Метод Описание
__clone ( ) A dummy magic method to prevent WPCOM_VIP_Plugins_UI from being cloned
__wakeup ( ) A dummy magic method to prevent WPCOM_VIP_Plugins_UI from being unserialized
action_admin_menu_add_menu_item ( ) Adds the new menu item and registers a few more hook callbacks relating to the menu page.
action_admin_post_plugin_activate ( ) Handles the plugin activation links and activates the requested plugin.
action_admin_post_plugin_deactivate ( ) Handles the plugin deactivation links and deactivates the requested plugin.
action_enqueue_scripts ( string $hook ) : void Load the assets for this plugin on the correct screen only
action_init ( ) Now that we've given the theme time to register its own filters, set up the rest of the plugin's hooks and run some filters.
activate_plugin ( string $plugin ) : boolean | WP_Error Activates a plugin.
add_activate_or_deactive_action_link ( array $actions, string $plugin ) : array Filters an array of action links to add an activation or deactivation link.
cleanup_active_plugins_option ( ) Removes any invalid plugins from the option, i.e. when they're deleted.
community_plugins_menu_columns ( array $columns ) : array Filters the columns of the Community Plugins table.
deactivate_plugin ( string $plugin, $force = false ) : void Deactivates a plugin.
display_menu_page ( ) Outputs the contents of the menu page.
get_active_plugins_option ( ) : array Gets the list of VIP plugins that have been activated via the UI.
get_menu_url ( array $extra_query_args = [] ) : string Generates a link to the plugin's menu page.
get_plugin_activation_link ( string $plugin ) : string Generates the URL to activate a VIP plugin.
get_plugin_deactivation_link ( string $plugin ) : string Generates the URL to deactivate a VIP plugin.
get_plugins ( ) : array Grab list of regular WP plugins
get_shared_plugins ( ) : array Grab list of VIP Shared Plugins
include_active_plugins ( ) Includes any active plugin files that are enabled via the UI/option.
instance ( ) : WPCOM_VIP_Plugins_UI Main WPCOM_VIP_Plugins_UI Instance
is_plugin_active ( string $plugin ) : string | boolean Determines if a given plugin slug is already activated or not.
validate_plugin ( string $plugin ) : boolean Validates a plugin slug.

Приватные методы

Метод Описание
__construct ( ) A dummy constructor to prevent WPCOM_VIP_Plugins_UI from being loaded more than once.
setup_actions ( ) Set up early action hooks for this plugin
setup_globals ( ) Set up the class variables.

Описание методов

__clone() публичный Метод

A dummy magic method to prevent WPCOM_VIP_Plugins_UI from being cloned
public __clone ( )

__wakeup() публичный Метод

A dummy magic method to prevent WPCOM_VIP_Plugins_UI from being unserialized
public __wakeup ( )

action_admin_menu_add_menu_item() публичный Метод

Adds the new menu item and registers a few more hook callbacks relating to the menu page.

action_admin_post_plugin_activate() публичный Метод

Handles the plugin activation links and activates the requested plugin.

action_admin_post_plugin_deactivate() публичный Метод

Handles the plugin deactivation links and deactivates the requested plugin.

action_enqueue_scripts() публичный Метод

Load the assets for this plugin on the correct screen only
public action_enqueue_scripts ( string $hook ) : void
$hook string
Результат void

action_init() публичный Метод

Now that we've given the theme time to register its own filters, set up the rest of the plugin's hooks and run some filters.
public action_init ( )

activate_plugin() публичный Метод

Activates a plugin.
public activate_plugin ( string $plugin ) : boolean | WP_Error
$plugin string The slug of the plugin to activate.
Результат boolean | WP_Error True if the plugin was activated, a WP_Error if an error was encountered.

cleanup_active_plugins_option() публичный Метод

Removes any invalid plugins from the option, i.e. when they're deleted.

community_plugins_menu_columns() публичный статический Метод

Filters the columns of the Community Plugins table.
public static community_plugins_menu_columns ( array $columns ) : array
$columns array An array of existing columns.
Результат array Modified list of columns.

deactivate_plugin() публичный Метод

Deactivates a plugin.
public deactivate_plugin ( string $plugin, $force = false ) : void
$plugin string The slug of the plugin to deactivate.
Результат void deactivate_plugins() returns nothing...so we can't actually know if it succeeded :)

display_menu_page() публичный Метод

Outputs the contents of the menu page.
public display_menu_page ( )

get_active_plugins_option() публичный Метод

Gets the list of VIP plugins that have been activated via the UI.
public get_active_plugins_option ( ) : array
Результат array List of active plugin slugs.

get_menu_url() публичный Метод

Generates a link to the plugin's menu page.
public get_menu_url ( array $extra_query_args = [] ) : string
$extra_query_args array Optional. Extra arguments to pass to add_query_arg().
Результат string URL to the plugin's menu page.

get_plugins() публичный Метод

Grab list of regular WP plugins
См. также: get_plugins()
public get_plugins ( ) : array
Результат array Array of plugins

get_shared_plugins() публичный Метод

Grab list of VIP Shared Plugins
См. также: get_plugins()
public get_shared_plugins ( ) : array
Результат array Array of shared plugins

include_active_plugins() публичный Метод

Includes any active plugin files that are enabled via the UI/option.

instance() публичный статический Метод

Insures that only one instance of WPCOM_VIP_Plugins_UI exists in memory at any one time. Also prevents needing to define globals all over the place.
См. также: WPCOM_VIP_Plugins_UI()
public static instance ( ) : WPCOM_VIP_Plugins_UI
Результат WPCOM_VIP_Plugins_UI The one true WPCOM_VIP_Plugins_UI

is_plugin_active() публичный Метод

Determines if a given plugin slug is already activated or not.
public is_plugin_active ( string $plugin ) : string | boolean
$plugin string The slug of the VIP plugin to check.
Результат string | boolean "option" if the plugin was activated via UI, "manual" if activated via code, and false if not activated.

validate_plugin() публичный Метод

Validates a plugin slug.
public validate_plugin ( string $plugin ) : boolean
$plugin string The slug of the VIP plugin to validate.
Результат boolean True if valid, false if not.

Описание свойств

$activation_disabled публичное свойство

Whether or not to disable the plugin activation links.
public $activation_disabled

$capability публичное свойство

Required capability to access this plugin's features. Use the "wpcom_vip_plugins_ui_capability" filter to change this.
public $capability

$fpp_plugins публичное свойство

List of Featured Partner Program plugins.
public $fpp_plugins

$hidden_plugins публичное свойство

List of plugins that should be hidden.
public $hidden_plugins

$hook_suffix публичное свойство

The $hook_suffix value for the menu page.
public $hook_suffix

$parent_menu_slug публичное свойство

Parent menu's slug. Use the "wpcom_vip_plugins_ui_parent_menu_slug" filter to change this.
public $parent_menu_slug

$plugin_folder публичное свойство

Path to the extra plugins folder.
public $plugin_folder