/** * Class constructor/cache handler. * * @since 150422 Rewrite. */ public function __construct() { parent::__construct(); if (!defined('WP_CACHE') || !WP_CACHE || !COMET_CACHE_ENABLE) { return; // Not enabled. } if (defined('WP_INSTALLING') || defined('RELOCATE')) { return; // N/A; installing|relocating. } $this->is_running = true; $this->timer = microtime(true); $this->loadAcPlugins(); $this->registerShutdownFlag(); $this->maybeIgnoreUserAbort(); $this->maybeStopBrowserCaching(); $this->maybeStartOutputBuffering(); }
/** * Plugin constructor. * * @since 150422 Rewrite. * * @param bool $enable_hooks Defaults to `TRUE`. */ public function __construct($enable_hooks = true) { parent::__construct(); /* -------------------------------------------------------------- */ if (!($this->enable_hooks = (bool) $enable_hooks)) { return; // Stop here; construct without hooks. } /* -------------------------------------------------------------- */ add_action('plugins_loaded', [$this, 'setup']); register_activation_hook(PLUGIN_FILE, [$this, 'activate']); register_deactivation_hook(PLUGIN_FILE, [$this, 'deactivate']); }