Jetpack::throw_error_on_activate_plugin PHP Method

throw_error_on_activate_plugin() public method

This function artificially throws errors for such cases (whitelisted).
public throw_error_on_activate_plugin ( string $plugin )
$plugin string The activated plugin.
    function throw_error_on_activate_plugin($plugin)
    {
        $active_modules = Jetpack::get_active_modules();
        // The Shortlinks module and the Stats plugin conflict, but won't cause errors on activation because of some function_exists() checks.
        if (function_exists('stats_get_api_key') && in_array('shortlinks', $active_modules)) {
            $throw = false;
            // Try and make sure it really was the stats plugin
            if (!class_exists('ReflectionFunction')) {
                if ('stats.php' == basename($plugin)) {
                    $throw = true;
                }
            } else {
                $reflection = new ReflectionFunction('stats_get_api_key');
                if (basename($plugin) == basename($reflection->getFileName())) {
                    $throw = true;
                }
            }
            if ($throw) {
                trigger_error(sprintf(__('Jetpack contains the most recent version of the old “%1$s” plugin.', 'jetpack'), 'WordPress.com Stats'), E_USER_ERROR);
            }
        }
    }
Jetpack