constants(); $self->includes(); } /** * Define plugin constants. * * @return void */ private function constants() { define('AJAXPRESS_URL', plugin_dir_url( AJAXPRESS )); define('AJAXPRESS_PATH', plugin_dir_path( AJAXPRESS )); define('AJAXPRESS_INCLUDES', AJAXPRESS_PATH . '/includes/'); define('AJAXPRESS_PREFIX', 'ajaxpress_'); } /** * Include plugin files. * * @return void */ private function includes() { $this->include_common_files(); $this->include_admin_files(); } /** * Include common files. * * @return void. */ private function include_common_files() { // For everyone. require_once AJAXPRESS_INCLUDES . 'common/abstract-class-base.php'; require_once AJAXPRESS_INCLUDES . 'common/class-options.php'; require_once AJAXPRESS_INCLUDES . 'common/class-settings-sanitizer.php'; // Pro features for sites without AjaxPress Pro. Removed in 2.4.4. require_once AJAXPRESS_INCLUDES . 'legacy-pro/class-legacy-pro.php'; // Update detection. Loaded for everyone, not just admin, because // the version check runs on admin_init and the hooks that listen // to it are registered on the front end too. require_once AJAXPRESS_INCLUDES . 'classes/class-upgrade.php'; // Cloudflare cache (always load for auto-purge hooks). require_once AJAXPRESS_INCLUDES . 'cloudflare/class-cloudflare-api.php'; require_once AJAXPRESS_INCLUDES . 'cloudflare/class-cloudflare-oauth.php'; require_once AJAXPRESS_INCLUDES . 'cloudflare/class-cloudflare-cache.php'; require_once AJAXPRESS_INCLUDES . 'cloudflare/class-cloudflare-hooks.php'; require_once AJAXPRESS_INCLUDES . 'cloudflare/class-cloudflare-rest.php'; // Started once every plugin has loaded: AjaxPress Pro carries the // same integration, and when it is active it runs its copy instead. add_action( 'plugins_loaded', array( __CLASS__, 'start_cloudflare' ), 20 ); // For only frontend. if ( ! is_admin() ) { require_once AJAXPRESS_INCLUDES . 'classes/class-enqueues.php'; require_once AJAXPRESS_INCLUDES . 'classes/class-templates.php'; } } /** * Start the Cloudflare integration, unless AjaxPress Pro runs it. * * Both copies work on the same ajaxpress_cf_* options, cron events and * REST routes, so whichever runs, the site's connection, cache and * edge Worker carry on unchanged. * * @return void */ public static function start_cloudflare() { if ( apply_filters( 'ajaxpress_pro_active', false ) ) { return; } Cloudflare\Hooks::start(); Cloudflare\REST::start(); } /** * Include admin files. * * @return void. */ private function include_admin_files() { if ( is_admin() ) { require_once AJAXPRESS_INCLUDES . 'admin/class-admin-enqueues.php'; require_once AJAXPRESS_INCLUDES . 'admin/class-admin-hooks.php'; require_once AJAXPRESS_INCLUDES . 'admin/class-rating-prompt.php'; // Deactivation feedback now uses the PackEdge SDK modal // (assets/js/packedge.js, wired in ajaxpress.php), not this // plugin's old custom modal. } require_once AJAXPRESS_INCLUDES . 'admin/class-admin-rest.php'; // Outside is_admin(): it also serves a REST route for the settings app. require_once AJAXPRESS_INCLUDES . 'admin/class-pro-notice.php'; } } // Let's start dude. Boot::start(); }