/** * Defines no-cache constants for various WordPress plugins. * * This is compatible with Quick Cache, W3 Total Cache, and also with WP Super Cache. * Quick Cache uses: ``QUICK_CACHE_ALLOWED``, and other plugins use: ``DONOTCACHEPAGE``. * W3 Total Cache is also known to be compatible with ``DONOTCACHEOBJECT`` and ``DONOTCACHEDB``. * * Disallow caching if the ``$no_cache`` parameter is passed in as ``true``, by other routines. * In addition, always disallow caching for logged in users, and GET requests with: `/?s2member` Systematics. * For clarity on s2Member Systematics, see: {@link s2Member\Systematics\c_ws_plugin__s2member_systematics::is_s2_systematic_use_page()}. * * However, this routine will ALWAYS obey the `?qcAC` query string parameter. * This Quick Cache parameter explicitly allows caching to occur. * * @package s2Member\No_Cache * @since 3.5 * * @also-called-by Other routines within s2Member. * * @param bool $no_cache Optional. Defaults to false. If true, force no-cache if at all possible. * @return bool This function will always return `true`. */ public static function no_cache_constants($no_cache = FALSE) { static $once; // We only need to set these constants once. foreach (array_keys(get_defined_vars()) as $__v) { $__refs[$__v] =& ${$__v}; } do_action("ws_plugin__s2member_before_no_cache_constants", get_defined_vars()); unset($__refs, $__v); if (!$once && empty($_GET["qcAC"]) && ($no_cache || is_user_logged_in() && (!defined("QUICK_CACHE_WHEN_LOGGED_IN") || !QUICK_CACHE_WHEN_LOGGED_IN) || c_ws_plugin__s2member_systematics::is_s2_systematic_use_page())) { /** * No-cache DB queries for plugins. * * @package s2Member\No_Cache * @since 111115 * * @var bool */ if (!defined("DONOTCACHEDB")) { define("DONOTCACHEDB", true); } /** * No-cache Page for plugins. * * @package s2Member\No_Cache * @since 3.5 * * @var bool */ if (!defined("DONOTCACHEPAGE")) { define("DONOTCACHEPAGE", true); } /** * No-cache Objects for plugins. * * @package s2Member\No_Cache * @since 111115 * * @var bool */ if (!defined("DONOTCACHEOBJECT")) { define("DONOTCACHEOBJECT", true); } /** * No-cache anything for Quick Cache plugin. * * @package s2Member\No_Cache * @since 3.5 * * @var bool */ if (!defined("QUICK_CACHE_ALLOWED")) { define("QUICK_CACHE_ALLOWED", false); } $once = true; // Only need to set these constants one time. c_ws_plugin__s2member_no_cache::$headers = true; do_action("ws_plugin__s2member_during_no_cache_constants", get_defined_vars()); } do_action("ws_plugin__s2member_after_no_cache_constants", get_defined_vars()); return true; // Always return true. }
/** * Defines no-cache constants for various WordPress plugins. * * This is compatible with Quick Cache, W3 Total Cache, and also with WP Super Cache. * Quick Cache uses: ``QUICK_CACHE_ALLOWED``, and other plugins use: ``DONOTCACHEPAGE``. * W3 Total Cache is also known to be compatible with ``DONOTCACHEOBJECT`` and ``DONOTCACHEDB``. * * Disallow caching if the ``$no_cache`` parameter is passed in as ``true``, by other routines. * In addition, always disallow caching for logged in users, and GET requests with: `/?s2member` Systematics. * For clarity on s2Member Systematics, see: {@link s2Member\Systematics\c_ws_plugin__s2member_systematics::is_s2_systematic_use_page()}. * * However, this routine will ALWAYS obey the `?qcAC` query string parameter. * This Quick Cache parameter explicitly allows caching to occur. * * @package s2Member\No_Cache * @since 3.5 * * @also-called-by Other routines within s2Member. * * @param bool $no_cache Optional. Defaults to false. If true, force no-cache if at all possible. * * @return bool This function will always return `true`. */ public static function no_cache_constants($no_cache = FALSE) { static $once; // We only need to set these constants once. foreach (array_keys(get_defined_vars()) as $__v) { $__refs[$__v] =& ${$__v}; } do_action('ws_plugin__s2member_before_no_cache_constants', get_defined_vars()); unset($__refs, $__v); // Housekeeping. if (!$once && (empty($_GET['qcAC']) || !filter_var($_GET['qcAC'], FILTER_VALIDATE_BOOLEAN)) && ($no_cache === TRUE || $no_cache === 'restricted' && (!defined('ZENCACHE_WHEN_LOGGED_IN') || !ZENCACHE_WHEN_LOGGED_IN) && (!defined('QUICK_CACHE_WHEN_LOGGED_IN') || !QUICK_CACHE_WHEN_LOGGED_IN) || is_user_logged_in() && (!defined('ZENCACHE_WHEN_LOGGED_IN') || !ZENCACHE_WHEN_LOGGED_IN) && (!defined('QUICK_CACHE_WHEN_LOGGED_IN') || !QUICK_CACHE_WHEN_LOGGED_IN) || c_ws_plugin__s2member_systematics::is_s2_systematic_use_page())) { /** * No-cache DB queries for plugins. * * @package s2Member\No_Cache * @since 111115 * * @var bool */ if (!defined('DONOTCACHEDB')) { define('DONOTCACHEDB', TRUE); } /** * No-cache Page for plugins. * * @package s2Member\No_Cache * @since 3.5 * * @var bool */ if (!defined('DONOTCACHEPAGE')) { define('DONOTCACHEPAGE', TRUE); } /** * No-cache Objects for plugins. * * @package s2Member\No_Cache * @since 111115 * * @var bool */ if (!defined('DONOTCACHEOBJECT')) { define('DONOTCACHEOBJECT', TRUE); } /** * No-cache anything for ZenCache plugin. * * @package s2Member\No_Cache * @since 3.5 * * @var bool */ if (!defined('ZENCACHE_ALLOWED')) { define('ZENCACHE_ALLOWED', FALSE); } /** * No-cache anything for Quick Cache plugin. * * @package s2Member\No_Cache * @since 3.5 * * @var bool */ if (!defined('QUICK_CACHE_ALLOWED')) { define('QUICK_CACHE_ALLOWED', FALSE); } $once = TRUE; // Set these one time only. c_ws_plugin__s2member_no_cache::$headers = TRUE; do_action('ws_plugin__s2member_during_no_cache_constants', get_defined_vars()); } do_action('ws_plugin__s2member_after_no_cache_constants', get_defined_vars()); return TRUE; // Always return true. }