Пример #1
0
 /**
  * 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 optimizeMember Systematics, see: {@link optimizeMember\Systematics\c_ws_plugin__optimizemember_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 optimizeMember\No_Cache
  * @since 3.5
  *
  * @also-called-by Other routines within optimizeMember.
  *
  * @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. */
     /**/
     eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
     do_action("ws_plugin__optimizemember_before_no_cache_constants", get_defined_vars());
     unset($__refs, $__v);
     /* Unset defined __refs, __v. */
     /**/
     if (!$once && empty($_GET["qcAC"]) && ($no_cache || is_user_logged_in() || c_ws_plugin__optimizemember_systematics::is_s2_systematic_use_page())) {
         /**
          * No-cache DB queries for plugins.
          *
          * @package optimizeMember\No_Cache
          * @since 111115
          *
          * @var bool
          */
         if (!defined("DONOTCACHEDB")) {
             define("DONOTCACHEDB", true);
         }
         /**
          * No-cache Page for plugins.
          *
          * @package optimizeMember\No_Cache
          * @since 3.5
          *
          * @var bool
          */
         if (!defined("DONOTCACHEPAGE")) {
             define("DONOTCACHEPAGE", true);
         }
         /**
          * No-cache Objects for plugins.
          *
          * @package optimizeMember\No_Cache
          * @since 111115
          *
          * @var bool
          */
         if (!defined("DONOTCACHEOBJECT")) {
             define("DONOTCACHEOBJECT", true);
         }
         /**
          * No-cache anything for Quick Cache plugin.
          *
          * @package optimizeMember\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__optimizemember_no_cache::$headers = true;
         /**/
         do_action("ws_plugin__optimizemember_during_no_cache_constants", get_defined_vars());
     }
     /**/
     do_action("ws_plugin__optimizemember_after_no_cache_constants", get_defined_vars());
     /**/
     return true;
     /* Always return true. */
 }
Пример #2
0
 /**
  * Determines if the current page is Systematic in any way.
  *
  * @package optimizeMember\Systematics
  * @since 3.5
  *
  * @return bool True if Systematic, else false.
  *
  * @note The results of this function are cached staticially.
  * 	Do NOT call upon this until the `wp` Hook is fired.
  */
 public static function is_systematic_use_page()
 {
     static $is_systematic;
     /* For optimization. */
     /**/
     if (isset($is_systematic)) {
         return $is_systematic;
         /* Filters will have already been applied here. */
     } else {
         if (c_ws_plugin__optimizemember_systematics::is_s2_systematic_use_page()) {
             return $is_systematic = apply_filters("ws_plugin__optimizemember_is_systematic_use_page", true, get_defined_vars());
         } else {
             if (c_ws_plugin__optimizemember_systematics::is_wp_systematic_use_page()) {
                 return $is_systematic = apply_filters("ws_plugin__optimizemember_is_systematic_use_page", true, get_defined_vars());
             } else {
                 if (c_ws_plugin__optimizemember_utils_conds::bp_is_installed() && (bp_is_register_page() || bp_is_activation_page())) {
                     return $is_systematic = apply_filters("ws_plugin__optimizemember_is_systematic_use_page", true, get_defined_vars());
                 } else {
                     if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["login_welcome_page"] && is_page($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["login_welcome_page"])) {
                         return $is_systematic = apply_filters("ws_plugin__optimizemember_is_systematic_use_page", true, get_defined_vars());
                     } else {
                         if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["membership_options_page"] && is_page($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["membership_options_page"])) {
                             return $is_systematic = apply_filters("ws_plugin__optimizemember_is_systematic_use_page", true, get_defined_vars());
                         } else {
                             if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["file_download_limit_exceeded_page"] && is_page($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["file_download_limit_exceeded_page"])) {
                                 return $is_systematic = apply_filters("ws_plugin__optimizemember_is_systematic_use_page", true, get_defined_vars());
                             } else {
                                 if ($GLOBALS["WS_PLUGIN__"]["optimizemember"]["o"]["login_redirection_override"] && ($_lro = c_ws_plugin__optimizemember_login_redirects::login_redirection_uri(false, "root-returns-false")) && preg_match("/^" . preg_quote($_lro, "/") . "\$/", $_SERVER["REQUEST_URI"])) {
                                     return $is_systematic = apply_filters("ws_plugin__optimizemember_is_systematic_use_page", true, get_defined_vars());
                                 } else {
                                     /* Otherwise, we return false ( it's NOT a Systematic Use Page in any way ). */
                                     return $is_systematic = apply_filters("ws_plugin__optimizemember_is_systematic_use_page", false, get_defined_vars());
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }