/** * Class constructor/cache handler. * * @since 150422 Rewrite. */ public function __construct() { parent::__construct(); $closures_dir = dirname(dirname(__FILE__)) . '/closures/Ac'; $self = $this; // Reference for closures. foreach (scandir($closures_dir) as $_closure) { if (substr($_closure, -4) === '.php') { require $closures_dir . '/' . $_closure; } } unset($_closure); // Housekeeping. if (!defined('WP_CACHE') || !WP_CACHE || !ZENCACHE_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(); $closures_dir = dirname(dirname(__FILE__)) . '/closures/Plugin'; $self = $this; // Reference for closures. foreach (scandir($closures_dir) as $_closure) { if (substr($_closure, -4) === '.php') { require $closures_dir . '/' . $_closure; } } unset($_closure); // Housekeeping. /* -------------------------------------------------------------- */ if (!($this->enable_hooks = (bool) $enable_hooks)) { return; // Stop here; construct without hooks. } /* -------------------------------------------------------------- */ add_action('after_setup_theme', array($this, 'setup')); register_activation_hook(PLUGIN_FILE, array($this, 'activate')); register_deactivation_hook(PLUGIN_FILE, array($this, 'deactivate')); }