Automattic\Jetpack\Autoloader\jpcd4dc500be73992154ab94f06c9d1b27
Plugins_Handler::get_plugins_activating_via_request() private WC 1.0
Returns an array containing the names of plugins that are activating via a request.
{} It's a method of the class: Plugins_Handler{}
No Hooks.
Return
Array. An array of names of the activating plugins or an empty array.
Usage
// private - for code of main (parent) class only $result = $this->get_plugins_activating_via_request();
Code of Plugins_Handler::get_plugins_activating_via_request() Plugins Handler::get plugins activating via request WC 5.0.0
private function get_plugins_activating_via_request() {
// phpcs:disable WordPress.Security.NonceVerification.Recommended
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.MissingUnslash
// phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : false;
$plugin = isset( $_REQUEST['plugin'] ) ? $_REQUEST['plugin'] : false;
$nonce = isset( $_REQUEST['_wpnonce'] ) ? $_REQUEST['_wpnonce'] : false;
/**
* Note: we're not actually checking the nonce here becase it's too early
* in the execution. The pluggable functions are not yet loaded to give
* plugins a chance to plug their versions. Therefore we're doing the bare
* minimum: checking whether the nonce exists and it's in the right place.
* The request will fail later if the nonce doesn't pass the check.
*/
// In case of a single plugin activation there will be a plugin slug.
if ( 'activate' === $action && ! empty( $nonce ) ) {
return array( $this->create_plugin_path( wp_unslash( $plugin ) ) );
}
$plugins = isset( $_REQUEST['checked'] ) ? $_REQUEST['checked'] : array();
// In case of bulk activation there will be an array of plugins.
if ( 'activate-selected' === $action && ! empty( $nonce ) ) {
$plugin_slugs = array_map( 'wp_unslash', $plugins );
return array_map( array( $this, 'create_plugin_path' ), $plugin_slugs );
}
// phpcs:enable WordPress.Security.NonceVerification.Recommended
// phpcs:enable WordPress.Security.ValidatedSanitizedInput.MissingUnslash
// phpcs:enable WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
return array();
}