Jetpack::filter_default_modules PHP Method

filter_default_modules() public method

Checks activated plugins during auto-activation to determine if any of those plugins are in the list with a corresponding module that is not compatible with the plugin. The module will not be allowed to auto-activate.
Since: 2.6
public filter_default_modules ( array $modules ) : array
$modules array
return array
    function filter_default_modules($modules)
    {
        $active_plugins = self::get_active_plugins();
        if (!empty($active_plugins)) {
            // For each module we'd like to auto-activate...
            foreach ($modules as $key => $module) {
                // If there are potential conflicts for it...
                if (!empty($this->conflicting_plugins[$module])) {
                    // For each potential conflict...
                    foreach ($this->conflicting_plugins[$module] as $title => $plugin) {
                        // If that conflicting plugin is active...
                        if (in_array($plugin, $active_plugins)) {
                            // Remove that item from being auto-activated.
                            unset($modules[$key]);
                        }
                    }
                }
            }
        }
        return $modules;
    }
Jetpack