コード例 #1
0
 public static function options_page()
 {
     do_action("ws_plugin__qcache_before_options_page", get_defined_vars());
     /**/
     c_ws_plugin__qcache_menu_pages::update_all_options() . clearstatcache();
     /**/
     if (file_exists(ABSPATH . "wp-config.php") && !is_writable(ABSPATH . "wp-config.php")) {
         c_ws_plugin__qcache_admin_notices::display_admin_notice('<strong>Permissions:</strong> Please check permissions on <code>' . esc_html(preg_replace("/^" . preg_quote($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", ABSPATH . "wp-config.php")) . '</code>. Quick Cache needs write-access to this file. Permissions need to be <code>755</code> or higher.', true);
     } else {
         if (file_exists(dirname(ABSPATH) . "/wp-config.php") && !is_writable(dirname(ABSPATH) . "/wp-config.php")) {
             c_ws_plugin__qcache_admin_notices::display_admin_notice('<strong>Permissions:</strong> Please check permissions on <code>' . esc_html(preg_replace("/^" . preg_quote($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", dirname(ABSPATH) . "/wp-config.php")) . '</code>. Quick Cache needs write-access to this file. Permissions need to be <code>755</code> or higher.', true);
         }
     }
     if (is_dir(WP_CONTENT_DIR) && !is_writable(WP_CONTENT_DIR)) {
         c_ws_plugin__qcache_admin_notices::display_admin_notice('<strong>Permissions:</strong> Please check permissions on <code>' . esc_html(preg_replace("/^" . preg_quote($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", WP_CONTENT_DIR)) . '</code>. Quick Cache needs write-access to this directory. Permissions need to be <code>755</code> or higher.', true);
     }
     if (is_dir(WP_CONTENT_DIR . "/cache") && !is_writable(WP_CONTENT_DIR . "/cache")) {
         c_ws_plugin__qcache_admin_notices::display_admin_notice('<strong>Permissions:</strong> Please check permissions on <code>' . esc_html(preg_replace("/^" . preg_quote($_SERVER["DOCUMENT_ROOT"], "/") . "/", "", WP_CONTENT_DIR . "/cache")) . '</code>. Quick Cache needs write-access to this directory. Permissions need to be <code>755</code> or higher.', true);
     }
     /**/
     include_once dirname(dirname(__FILE__)) . "/menu-pages/options.inc.php";
     /**/
     do_action("ws_plugin__qcache_after_options_page", get_defined_vars());
     /**/
     return;
     /* Return for uniformity. */
 }
コード例 #2
0
 public static function admin_notices()
 {
     global $pagenow;
     /* This holds the current page filename. */
     /**/
     do_action("ws_plugin__qcache_before_admin_notices", get_defined_vars());
     /**/
     if (is_admin() && is_array($notices = get_option("ws_plugin__qcache_notices")) && !empty($notices)) {
         $a = is_blog_admin() ? "blog" : $a;
         $a = is_user_admin() ? "user" : $a;
         $a = is_network_admin() ? "network" : $a;
         $a = !$a ? "blog" : $a;
         /* Default Blog Admin. */
         /**/
         foreach ($notices as $i => $notice) {
             /* Check several things about each Notice. */
             foreach (!$notice["on_pages"] ? array("*") : (array) $notice["on_pages"] as $page) {
                 if (!preg_match("/^(.+?)\\:/", $page)) {
                     /* NO prefix? */
                     $page = "blog:" . ltrim($page, ":");
                 }
                 /* `blog:` */
                 /**/
                 $adms = preg_split("/\\|/", preg_replace("/\\:(.*)\$/i", "", $page));
                 $page = preg_replace("/^([^\\:]*)\\:/i", "", $page);
                 /**/
                 if (empty($adms) || in_array("*", $adms) || in_array($a, $adms)) {
                     if (!$page || "*" === $page || $pagenow === $page || $_GET["page"] === $page) {
                         if (strtotime("now") >= (int) $notice["time"]) {
                             eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
                             do_action("ws_plugin__qcache_during_admin_notices_before_display", get_defined_vars());
                             unset($__refs, $__v);
                             /* Unset defined __refs, __v. */
                             /**/
                             if (!$notice["dismiss"] || $_GET["ws-plugin--qcache-dismiss-admin-notice"] === md5($notice["notice"])) {
                                 unset($notices[$i]);
                             }
                             /* Clear this administrative notice now? */
                             /**/
                             if (!$notice["dismiss"] || $_GET["ws-plugin--qcache-dismiss-admin-notice"] !== md5($notice["notice"])) {
                                 c_ws_plugin__qcache_admin_notices::display_admin_notice($notice["notice"], $notice["error"], $notice["dismiss"]);
                             }
                             /**/
                             do_action("ws_plugin__qcache_during_admin_notices_after_display", get_defined_vars());
                         }
                         /**/
                         continue 2;
                         /* This Notice processed; continue to next. */
                     }
                 }
             }
         }
         /**/
         $notices = array_merge($notices);
         /* Re-index array. */
         /**/
         eval('foreach(array_keys(get_defined_vars())as$__v)$__refs[$__v]=&$$__v;');
         do_action("ws_plugin__qcache_during_admin_notices", get_defined_vars());
         unset($__refs, $__v);
         /* Unset defined __refs, __v. */
         /**/
         update_option("ws_plugin__qcache_notices", $notices);
     }
     /**/
     do_action("ws_plugin__qcache_after_admin_notices", get_defined_vars());
     /**/
     return;
     /* Return for uniformity. */
 }