'1.2.2', 'FASTLESS_CACHE_MIN_PHP' => '7.0', 'FASTLESS_CACHE_MIN_WP' => '6.0', 'FASTLESS_CACHE_DIR' => __DIR__, // plugin_dir_url() lives in wp-includes/plugin.php but depends on // trailingslashit()/plugins_url(), which WordPress has not loaded yet when // the advanced-cache.php drop-in requires this file. Guard on those // dependencies so the early include cannot fatal; the URL is only used in // wp-admin, where the constants file is required again with them present. 'FASTLESS_CACHE_URL' => ( function_exists( 'trailingslashit' ) && function_exists( 'plugins_url' ) ) ? plugin_dir_url( __FILE__ ) : null, 'FASTLESS_CACHE_FILE' => __DIR__ . '/fastless-cache.php', 'FASTLESS_CACHE_BASE' => ( function_exists( 'wp_normalize_path' ) ) ? plugin_basename( __DIR__ . '/fastless-cache.php' ) : null, 'FASTLESS_CACHE_CACHE_DIR' => WP_CONTENT_DIR . '/cache/fastless-cache', // Without a trailing slash. /** * @since 1.2.1 Folder path for settings is updated to be inside the cache folder */ 'FASTLESS_CACHE_SETTINGS_DIR' => WP_CONTENT_DIR . '/cache/fastless-cache-settings', // Without a trailing slash. 'FASTLESS_CACHE_CONSTANTS_FILE' => __FILE__, 'FASTLESS_CACHE_INDEX_FILE' => ABSPATH . 'index.php', ); foreach ( $fastless_cache_constants as $fastless_cache_const_name => $fastless_cache_const_value ) { if ( ! defined( $fastless_cache_const_name ) && null !== $fastless_cache_const_value ) { define( $fastless_cache_const_name, $fastless_cache_const_value ); } } } } // The call stays outside the function_exists() guard on purpose: the // advanced-cache.php drop-in includes this file before wp_normalize_path() // exists (so FASTLESS_CACHE_URL/FASTLESS_CACHE_BASE stay undefined there), and // the main plugin file includes it again later to define them. Running the // call on every include (with the !defined() guard inside) preserves that // late-binding behavior while keeping the declaration safe to include twice. fastless_cache_define_constants();