le slug.
*
* @return bool
*/
public function deactivate( $module ) {
/**
* Fires when a module is deactivated.
*
* @since 1.9.0
*
* @param string $module Module slug.
*/
do_action( 'jetpack_pre_deactivate_module', $module );
$active = $this->get_active();
$new = array_filter( array_diff( $active, (array) $module ) );
return $this->update_active( $new );
}
/**
* Generate a module's path from its slug.
*
* @param string $slug Module slug.
*/
public function get_path( $slug ) {
if ( ! Constants::is_defined( 'JETPACK__PLUGIN_DIR' ) ) {
return '';
}
/**
* Filters the path of a modules.
*
* @since 7.4.0
*
* @param array $return The absolute path to a module's root php file
* @param string $slug The module slug
*/
return apply_filters( 'jetpack_get_module_path', JETPACK__PLUGIN_DIR . "modules/$slug.php", $slug );
}
/**
* Saves all the currently active modules to options.
* Also fires Action hooks for each newly activated and deactivated module.
*
* @param array $modules Array of active modules to be saved in options.
*
* @return bool $success true for success, false for failure.
*/
public function update_active( $modules ) {
$current_modules = \Jetpack_Options::get_option( 'active_modules', array() );
$active_modules = $this->get_active();
$new_active_modules = array_diff( $modules, $current_modules );
$new_inactive_modules = array_diff( $active_modules, $modules );
$new_current_modules = array_diff( array_merge( $current_modules, $new_active_modules ), $new_inactive_modules );
$reindexed_modules = array_values( $new_current_modules );
$success = \Jetpack_Options::update_option( 'active_modules', array_unique( $reindexed_modules ) );
// Let's take `pre_update_option_jetpack_active_modules` filter into account
// and actually decide for which modules we need to fire hooks by comparing
// the 'active_modules' option before and after the update.
$current_modules_post_update = \Jetpack_Options::get_option( 'active_modules', array() );
$new_inactive_modules = array_diff( $current_modules, $current_modules_post_update );
$new_inactive_modules = array_unique( $new_inactive_modules );
$new_inactive_modules = array_values( $new_inactive_modules );
$new_active_modules = array_diff( $current_modules_post_update, $current_modules );
$new_active_modules = array_unique( $new_active_modules );
$new_active_modules = array_values( $new_active_modules );
foreach ( $new_active_modules as $module ) {
/**
* Fires when a specific module is activated.
*
* @since 1.9.0
*
* @param string $module Module slug.
* @param boolean $success whether the module was activated. @since 4.2
*/
do_action( 'jetpack_activate_module', $module, $success );
/**
* Fires when a module is activated.
* The dynamic part of the filter, $module, is the module slug.
*
* @since 1.9.0
*
* @param string $module Module slug.
*/
do_action( "jetpack_activate_module_$module", $module );
}
foreach ( $new_inactive_modules as $module ) {
/**
* Fired after a module has been deactivated.
*
* @since 4.2.0
*
* @param string $module Module slug.
* @param boolean $success whether the module was deactivated.
*/
do_action( 'jetpack_deactivate_module', $module, $success );
/**
* Fires when a module is deactivated.
* The dynamic part of the filter, $module, is the module slug.
*
* @since 1.9.0
*
* @param string $module Module slug.
*/
do_action( "jetpack_deactivate_module_$module", $module );
}
return $success;
}
}
Fatal error: Uncaught Error: Class 'Automattic\Jetpack\Modules' not found in /var/www/html/dportilho.com.br/web/wp-content/plugins/jetpack/class.jetpack.php:795
Stack trace:
#0 /var/www/html/dportilho.com.br/web/wp-includes/class-wp-hook.php(324): Jetpack->configure('')
#1 /var/www/html/dportilho.com.br/web/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#2 /var/www/html/dportilho.com.br/web/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#3 /var/www/html/dportilho.com.br/web/wp-settings.php(559): do_action('plugins_loaded')
#4 /var/www/html/dportilho.com.br/web/wp-config.php(126): require_once('/var/www/html/d...')
#5 /var/www/html/dportilho.com.br/web/wp-load.php(50): require_once('/var/www/html/d...')
#6 /var/www/html/dportilho.com.br/web/wp-blog-header.php(13): require_once('/var/www/html/d...')
#7 /var/www/html/dportilho.com.br/web/index.php(17): require('/var/www/html/d...')
#8 {main}
thrown in /var/www/html/dportilho.com.br/web/wp-content/plugins/jetpack/class.jetpack.php on line 795