• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP w3_get_pgcache_rules_core_path函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中w3_get_pgcache_rules_core_path函数的典型用法代码示例。如果您正苦于以下问题:PHP w3_get_pgcache_rules_core_path函数的具体用法?PHP w3_get_pgcache_rules_core_path怎么用?PHP w3_get_pgcache_rules_core_path使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了w3_get_pgcache_rules_core_path函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: options


//.........这里部分代码省略.........
                        $error = sprintf(__('The <strong>%s</strong> field(s) cannot be empty.', 'w3-total-cache'), implode(__(' and ', 'w3-total-cache'), $fields));
                    }
                    if ($this->_config->get_string('cdn.maxcdn.authorization_key') != '' && sizeof(explode('+', $this->_config->get_string('cdn.maxcdn.authorization_key'))) != 3) {
                        $error .= __('The <strong>"Authorization key"</strong> is not correct.', 'w3-total-cache');
                    } elseif ($this->_config->get_integer('cdn.maxcdn.zone_id', 0) <= 0) {
                        $error .= __('You need to select / create a pull zone.', 'w3-total-cache');
                    }
                    break;
                case $cdn_engine == 'cotendo' && !count($this->_config->get_array('cdn.cotendo.domain')):
                    $error = __('The <strong>"Replace default hostname with"</strong> field cannot be empty.', 'w3-total-cache');
                    break;
                case $cdn_engine == 'edgecast' && !count($this->_config->get_array('cdn.edgecast.domain')):
                    $error = __('The <strong>"Replace default hostname with"</strong> field cannot be empty.', 'w3-total-cache');
                    break;
                case $cdn_engine == 'att' && !count($this->_config->get_array('cdn.att.domain')):
                    $error = __('The <strong>"Replace default hostname with"</strong> field cannot be empty.', 'w3-total-cache');
                    break;
                case $cdn_engine == 'akamai' && !count($this->_config->get_array('cdn.akamai.domain')):
                    $error = 'The <strong>"Replace default hostname with"</strong> field cannot be empty.';
                    break;
            }
            if ($error) {
                $this->_errors[] = __('A configuration issue prevents <acronym title="Content Delivery Network">CDN</acronym> from working: ', 'w3-total-cache') . $error . __(' <a href="?page=w3tc_cdn#configuration">Specify it here</a>.', 'w3-total-cache');
            }
        }
        /**
         * Preview mode
         */
        if ($this->_config->is_preview()) {
            $this->_notes[] = sprintf(__('Preview mode is active: Changed settings will not take effect until preview mode is %s or %s.', 'w3-total-cache'), w3_button_link(__('deploy', 'w3-total-cache'), wp_nonce_url(sprintf('admin.php?page=%s&w3tc_config_preview_deploy', $this->_page), 'w3tc')), w3_button_link(__('disable', 'w3-total-cache'), wp_nonce_url(sprintf('admin.php?page=%s&w3tc_config_preview_disable', $this->_page), 'w3tc'))) . '<br /><span class="description">' . sprintf(__('To preview any changed settings (without deploying): %s', 'w3-total-cache'), w3tc_get_preview_link()) . '</span>';
        }
        /**
         *
         */
        if ($this->_config->get_boolean('notes.root_rules') && count($this->_rule_errors_root) > 0) {
            $this->_rule_errors_root_hide = w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'root_rules');
        } else {
            $this->_rule_errors_root = array();
        }
        $this->_disable_file_operation_notification = $this->_disable_add_in_files_notification || $this->_disable_cache_write_notification;
        if (!$this->_disable_file_operation_notification && isset($file_operation_exception) && $file_operation_exception) {
            $tech_message = '<ul>';
            $core_rules_perms = '';
            if (w3_get_file_permissions(w3_get_wp_config_path()) != 0644) {
                $core_config_perms = sprintf(__('File permissions are <strong>%s</strong>, however they should be
					<strong>644</strong>.', 'w3-total-cache'), base_convert(w3_get_file_permissions(w3_get_wp_config_path()), 10, 8));
            } else {
                $core_config_perms = sprintf(__('File permissions are <strong>%s</strong>', 'w3-total-cache'), base_convert(w3_get_file_permissions(w3_get_wp_config_path()), 10, 8));
            }
            if (w3_get_file_permissions(w3_get_pgcache_rules_core_path()) != 0644) {
                $core_rules_perms = sprintf(__('File permissions are <strong>%s</strong>, however they should be
											<strong>644</strong>.', 'w3-total-cache'), base_convert(w3_get_file_permissions(w3_get_pgcache_rules_core_path()), 10, 8));
            } else {
                $core_rules_perms = sprintf(__('File permissions are <strong>%s</strong>', 'w3-total-cache'), base_convert(w3_get_file_permissions(w3_get_pgcache_rules_core_path()), 10, 8));
            }
            $wp_content_perms = '';
            if (w3_get_file_permissions(WP_CONTENT_DIR) != 0755) {
                $wp_content_perms = sprintf(__('Directory permissions are <strong>%s</strong>, however they should be
											<strong>755</strong>.', 'w3-total-cache'), base_convert(w3_get_file_permissions(WP_CONTENT_DIR), 10, 8));
            }
            $tech_message .= '<li>' . sprintf(__('File: <strong>%s</strong> %s File owner: %s', 'w3-total-cache'), w3_get_wp_config_path(), $core_config_perms, w3_get_file_owner(w3_get_wp_config_path())) . '</li>';
            $tech_message .= '<li>' . sprintf(__('File: <strong>%s</strong> %s File owner: %s', 'w3-total-cache'), w3_get_pgcache_rules_core_path(), $core_rules_perms, w3_get_file_owner(w3_get_pgcache_rules_core_path())) . '</li>';
            $tech_message .= '<li>' . sprintf(__('Directory: <strong>%s</strong> %s File owner: %s', 'w3-total-cache'), WP_CONTENT_DIR, $wp_content_perms, w3_get_file_owner(WP_CONTENT_DIR)) . '</li>';
            $tech_message .= '<li>' . sprintf(__('Owner of current file: %s', 'w3-total-cache'), w3_get_file_owner()) . '</li>';
            if (!(w3_get_file_owner() == w3_get_file_owner(w3_get_pgcache_rules_core_path()) && w3_get_file_owner() == w3_get_file_owner(WP_CONTENT_DIR))) {
                $tech_message .= __('<li>The files and directories have different ownership, they should have the same ownership.
								 </li>', 'w3-total-cache');
            }
            $tech_message .= '</ul>';
            $tech_message = '<div class="w3tc-technical-info" style="display:none">' . $tech_message . '</div>';
            $w3tc_error[] = sprintf(__('<strong>W3 Total Cache Error:</strong> The plugin tried to edit, %s, but failed.
								Files and directories cannot be modified. Please review your
								<a target="_blank" href="http://codex.wordpress.org/Changing_File_Permissions">
								file permissions</a>. A common cause is %s and %s having different ownership or permissions.
								%s %s', 'w3-total-cache'), $wp_config_edit ? w3_get_wp_config_path() : w3_get_pgcache_rules_core_path(), $wp_config_edit ? basename(w3_get_wp_config_path()) : basename(w3_get_pgcache_rules_core_path()), WP_CONTENT_DIR, w3_button(__('View technical information', 'w3-total-cache'), '', 'w3tc-show-technical-info'), $tech_message);
        }
        /**
         * Remove functions results
         */
        if ($remove_results) {
            foreach ($remove_results as $result) {
                $this->_errors = array_merge($this->_errors, $result['errors']);
                if (!isset($this->_ftp_form) && isset($result['ftp_form'])) {
                    $extra_ftp_message = __('Please enter FTP details <a href="#ftp_upload_form">below</a> to remove the disabled modules. ', 'w3-total-cache');
                    $this->_ftp_form = $result['ftp_form'];
                    $this->_use_ftp_form = true;
                }
            }
            if (isset($extra_ftp_message)) {
                $this->_errors[] = $extra_ftp_message;
            }
        }
        foreach ($w3tc_error as $error) {
            array_unshift($this->_errors, $error);
        }
        if (isset($this->_ftp_form)) {
            $this->_use_ftp_form = true;
        }
        $this->view();
    }
开发者ID:easinewe,项目名称:Avec2016,代码行数:101,代码来源:PluginView.php


示例2: rules_core_remove

 /**
  * Removes Page Cache core directives
  *
  * @param SelfTestExceptions $exs
  * @throws FilesystemOperationException with S/FTP form if it can't get the required filesystem credentials
  * @throws FileOperationException
  */
 private function rules_core_remove($exs)
 {
     w3_remove_rules($exs, w3_get_pgcache_rules_core_path(), W3TC_MARKER_BEGIN_PGCACHE_CORE, W3TC_MARKER_END_PGCACHE_CORE);
 }
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:11,代码来源:PgCacheAdminEnvironment.php


示例3: check_rules_wpsc

 /**
  * Check if WPSC rules exists
  *
  * @return boolean
  */
 function check_rules_wpsc()
 {
     $path = w3_get_pgcache_rules_core_path();
     return ($data = @file_get_contents($path)) && w3_has_rules(w3_clean_rules($data), W3TC_MARKER_BEGIN_PGCACHE_WPSC, W3TC_MARKER_END_PGCACHE_WPSC);
 }
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:10,代码来源:PgCacheAdmin.php


示例4: action_support_request

 /**
  * Send support request action
  *
  * @return void
  */
 function action_support_request()
 {
     w3_require_once(W3TC_LIB_W3_DIR . '/Request.php');
     $request_type = W3_Request::get_string('request_type');
     $payment = W3_Request::get_boolean('payment');
     $request_id = W3_Request::get_string('request_id');
     $url = W3_Request::get_string('url');
     $name = W3_Request::get_string('name');
     $email = W3_Request::get_string('email');
     $twitter = W3_Request::get_string('twitter');
     $phone = W3_Request::get_string('phone');
     $subject = W3_Request::get_string('subject');
     $description = W3_Request::get_string('description');
     $templates = W3_Request::get_array('templates');
     $forum_url = W3_Request::get_string('forum_url');
     $wp_login = W3_Request::get_string('wp_login');
     $wp_password = W3_Request::get_string('wp_password');
     $ftp_host = W3_Request::get_string('ftp_host');
     $ftp_login = W3_Request::get_string('ftp_login');
     $ftp_password = W3_Request::get_string('ftp_password');
     $subscribe_releases = W3_Request::get_string('subscribe_releases');
     $subscribe_customer = W3_Request::get_string('subscribe_customer');
     $params = array('request_type' => $request_type, 'payment' => $payment, 'url' => $url, 'name' => $name, 'email' => $email, 'twitter' => $twitter, 'phone' => $phone, 'subject' => $subject, 'description' => $description, 'forum_url' => $forum_url, 'wp_login' => $wp_login, 'wp_password' => $wp_password, 'ftp_host' => $ftp_host, 'ftp_login' => $ftp_login, 'ftp_password' => $ftp_password, 'subscribe_releases' => $subscribe_releases, 'subscribe_customer' => $subscribe_customer);
     $post = $params;
     foreach ($templates as $template_index => $template) {
         $template_key = sprintf('templates[%d]', $template_index);
         $params[$template_key] = $template;
     }
     if (!isset($this->_request_types[$request_type])) {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_type')), false);
     }
     $required = array('bug_report' => 'url,name,email,subject,description', 'new_feature' => 'url,name,email,subject,description', 'email_support' => 'url,name,email,subject,description', 'phone_support' => 'url,name,email,subject,description,phone', 'plugin_config' => 'url,name,email,subject,description,wp_login,wp_password', 'theme_config' => 'url,name,email,subject,description,wp_login,wp_password,ftp_host,ftp_login,ftp_password', 'linux_config' => 'url,name,email,subject,description,wp_login,wp_password,ftp_host,ftp_login,ftp_password');
     if (strstr($required[$request_type], 'url') !== false && $url == '') {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_url')), false);
     }
     if (strstr($required[$request_type], 'name') !== false && $name == '') {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_name')), false);
     }
     if (strstr($required[$request_type], 'email') !== false && !preg_match('~^[a-z0-9_\\-\\.]+@[a-z0-9-\\.]+\\.[a-z]{2,5}$~', $email)) {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_email')), false);
     }
     if (strstr($required[$request_type], 'phone') !== false && !preg_match('~^[0-9\\-\\.\\ \\(\\)\\+]+$~', $phone)) {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_phone')), false);
     }
     if (strstr($required[$request_type], 'subject') !== false && $subject == '') {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_subject')), false);
     }
     if (strstr($required[$request_type], 'description') !== false && $description == '') {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_description')), false);
     }
     if (strstr($required[$request_type], 'wp_login') !== false && $wp_login == '') {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_wp_login')), false);
     }
     if (strstr($required[$request_type], 'wp_password') !== false && $wp_password == '') {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_wp_password')), false);
     }
     if (strstr($required[$request_type], 'ftp_host') !== false && $ftp_host == '') {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_ftp_host')), false);
     }
     if (strstr($required[$request_type], 'ftp_login') !== false && $ftp_login == '') {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_ftp_login')), false);
     }
     if (strstr($required[$request_type], 'ftp_password') !== false && $ftp_password == '') {
         w3_admin_redirect(array_merge($params, array('w3tc_error' => 'support_request_ftp_password')), false);
     }
     /**
      * Add attachments
      */
     $attachments = array();
     $attach_files = array(w3_get_wp_config_path(), w3_cache_blog_dir('log') . '/minify.log', w3_get_pgcache_rules_core_path(), w3_get_pgcache_rules_cache_path(), w3_get_browsercache_rules_cache_path(), w3_get_browsercache_rules_no404wp_path(), w3_get_minify_rules_core_path(), w3_get_minify_rules_cache_path());
     /**
      * Attach config files
      */
     if ($handle = opendir(W3TC_CONFIG_DIR)) {
         while (($entry = @readdir($handle)) !== false) {
             if ($entry == '.' || $entry == '..' || $entry == 'index.html') {
                 continue;
             }
             $attachments[] = W3TC_CONFIG_DIR . '/' . $entry;
         }
         closedir($handle);
     }
     foreach ($attach_files as $attach_file) {
         if ($attach_file && file_exists($attach_file) && !in_array($attach_file, $attachments)) {
             $attachments[] = $attach_file;
         }
     }
     /**
      * Attach server info
      */
     $server_info = print_r($this->get_server_info(), true);
     $server_info = str_replace("\n", "\r\n", $server_info);
     $server_info_path = W3TC_CACHE_TMP_DIR . '/server_info.txt';
     if (@file_put_contents($server_info_path, $server_info)) {
         $attachments[] = $server_info_path;
//.........这里部分代码省略.........
开发者ID:easinewe,项目名称:Avec2016,代码行数:101,代码来源:SupportActionsAdmin.php


示例5: array_unique

                </li>
            <?php 
    }
    ?>

        <?php 
}
?>

    </ul>

    <h4>WordPress Resources</h4>

    <ul>
        <?php 
$paths = array_unique(array(w3_get_pgcache_rules_core_path(), w3_get_browsercache_rules_cache_path(), w3_get_browsercache_rules_no404wp_path()));
?>

        <?php 
foreach ($paths as $path) {
    if ($path) {
        ?>

        <li>
            <?php 
        echo htmlspecialchars($path);
        ?>
:
            <?php 
        if (file_exists($path)) {
            ?>
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:31,代码来源:self_test.php


示例6: w3_get_new_relic_rules_core_path

function w3_get_new_relic_rules_core_path()
{
    return w3_get_pgcache_rules_core_path();
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:4,代码来源:rule.php


示例7: support_request

 /**
  * Send support request
  *
  * @return void
  */
 function support_request()
 {
     require_once W3TC_LIB_W3_DIR . '/Request.php';
     $request_type = W3_Request::get_string('request_type');
     $payment = W3_Request::get_boolean('payment');
     $request_id = W3_Request::get_string('request_id');
     $url = W3_Request::get_string('url');
     $name = W3_Request::get_string('name');
     $email = W3_Request::get_string('email');
     $twitter = W3_Request::get_string('twitter');
     $phone = W3_Request::get_string('phone');
     $subject = W3_Request::get_string('subject');
     $description = W3_Request::get_string('description');
     $templates = W3_Request::get_array('templates');
     $forum_url = W3_Request::get_string('forum_url');
     $wp_login = W3_Request::get_string('wp_login');
     $wp_password = W3_Request::get_string('wp_password');
     $ftp_host = W3_Request::get_string('ftp_host');
     $ftp_login = W3_Request::get_string('ftp_login');
     $ftp_password = W3_Request::get_string('ftp_password');
     $params = array('request_type' => $request_type, 'payment' => $payment, 'url' => $url, 'name' => $name, 'email' => $email, 'twitter' => $twitter, 'phone' => $phone, 'subject' => $subject, 'description' => $description, 'forum_url' => $forum_url, 'wp_login' => $wp_login, 'wp_password' => $wp_password, 'ftp_host' => $ftp_host, 'ftp_login' => $ftp_login, 'ftp_password' => $ftp_password);
     foreach ($templates as $template_index => $template) {
         $template_key = sprintf('templates[%d]', $template_index);
         $params[$template_key] = $template;
     }
     if (!isset($this->_request_types[$request_type])) {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_type')));
     }
     $required = array('bug_report' => 'url,name,email,subject,description', 'new_feature' => 'url,name,email,subject,description', 'email_support' => 'url,name,email,subject,description', 'phone_support' => 'url,name,email,subject,description,phone', 'plugin_config' => 'url,name,email,subject,description,wp_login,wp_password', 'theme_config' => 'url,name,email,subject,description,wp_login,wp_password,ftp_host,ftp_login,ftp_password', 'linux_config' => 'url,name,email,subject,description,wp_login,wp_password,ftp_host,ftp_login,ftp_password');
     if (strstr($required[$request_type], 'url') !== false && $url == '') {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_url')));
     }
     if (strstr($required[$request_type], 'name') !== false && $name == '') {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_name')));
     }
     if (strstr($required[$request_type], 'email') !== false && !preg_match('~^[a-z0-9_\\-\\.]+@[a-z0-9-\\.]+\\.[a-z]{2,5}$~', $email)) {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_email')));
     }
     if (strstr($required[$request_type], 'phone') !== false && !preg_match('~^[0-9\\-\\.\\ \\(\\)\\+]+$~', $phone)) {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_phone')));
     }
     if (strstr($required[$request_type], 'subject') !== false && $subject == '') {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_subject')));
     }
     if (strstr($required[$request_type], 'description') !== false && $description == '') {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_description')));
     }
     if (strstr($required[$request_type], 'wp_login') !== false && $wp_login == '') {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_wp_login')));
     }
     if (strstr($required[$request_type], 'wp_password') !== false && $wp_password == '') {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_wp_password')));
     }
     if (strstr($required[$request_type], 'ftp_host') !== false && $ftp_host == '') {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_ftp_host')));
     }
     if (strstr($required[$request_type], 'ftp_login') !== false && $ftp_login == '') {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_ftp_login')));
     }
     if (strstr($required[$request_type], 'ftp_password') !== false && $ftp_password == '') {
         $this->redirect(array_merge($params, array('w3tc_error' => 'support_request_ftp_password')));
     }
     /**
      * Add attachments
      */
     $attachments = array();
     $attach_files = array(w3_get_wp_config_path(), W3TC_CONFIG_PATH, W3TC_CONFIG_PREVIEW_PATH, W3TC_CONFIG_MASTER_PATH, W3TC_MINIFY_LOG_FILE, w3_get_pgcache_rules_core_path(), w3_get_pgcache_rules_cache_path(), w3_get_browsercache_rules_cache_path(), w3_get_browsercache_rules_no404wp_path(), w3_get_minify_rules_core_path(), w3_get_minify_rules_cache_path());
     foreach ($attach_files as $attach_file) {
         if ($attach_file && file_exists($attach_file) && !in_array($attach_file, $attachments)) {
             $attachments[] = $attach_file;
         }
     }
     /**
      * Attach server info
      */
     $server_info = print_r($this->get_server_info(), true);
     $server_info = str_replace("\n", "\r\n", $server_info);
     $server_info_path = W3TC_TMP_DIR . '/server_info.txt';
     if (@file_put_contents($server_info_path, $server_info)) {
         $attachments[] = $server_info_path;
     }
     /**
      * Attach phpinfo
      */
     ob_start();
     phpinfo();
     $php_info = ob_get_contents();
     ob_end_clean();
     $php_info_path = W3TC_TMP_DIR . '/php_info.html';
     if (@file_put_contents($php_info_path, $php_info)) {
         $attachments[] = $php_info_path;
     }
     /**
      * Attach self-test
      */
//.........这里部分代码省略.........
开发者ID:niko-lgdcom,项目名称:archives,代码行数:101,代码来源:TotalCache.php


示例8: remove_rules_cache_multisite_nginx_with_message

 /**
  * @return array
  */
 function remove_rules_cache_multisite_nginx_with_message()
 {
     $ftp_form = null;
     $errors = array();
     $errors_short_form = array();
     if (w3_is_multisite() && w3_is_nginx() && $this->check_rules_cache()) {
         try {
             $this->remove_rules_cache();
         } catch (Exception $e) {
             $errors[] = sprintf('To fully disable Page Cache Disc: Enhanced for Network Sites rules need to be removed. To remove them manually, edit the configuration file (<strong>%s</strong>) and remove all lines between and including <strong>%s</strong> and <strong>%s</strong> markers inclusive.', w3_get_pgcache_rules_core_path(), W3TC_MARKER_BEGIN_PGCACHE_CACHE, W3TC_MARKER_END_PGCACHE_CACHE);
             $errors_short_form[] = sprintf('Edit file (<strong>%s</strong>) and remove all lines between and including <strong>%s</strong> and <strong>%s</strong> markers inclusive.', w3_get_pgcache_rules_core_path(), W3TC_MARKER_BEGIN_PGCACHE_CACHE, W3TC_MARKER_END_PGCACHE_CACHE);
             if (!isset($ftp_form) && $e instanceof FilesystemCredentialException) {
                 $ftp_form = $e->ftp_form();
             }
         }
     }
     return array('errors' => $errors, 'ftp_form' => $ftp_form, 'errors_short_form' => $errors_short_form);
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:21,代码来源:PgCacheAdmin.php


示例9: action_rules_autoinstall

 /**
  * Write rules
  *
  * @return void
  */
 function action_rules_autoinstall()
 {
     $commands = explode(',', W3_Request::get_string('autoinstall'));
     $errors = array();
     $notes = array();
     foreach ($commands as $command) {
         try {
             switch ($command) {
                 case 'browsercache_write_rules_cache':
                     $w3_plugin_browsercache = w3_instance('W3_Plugin_BrowserCacheAdmin');
                     $w3_plugin_browsercache->write_rules_cache();
                     if ($w3_plugin_browsercache->check_rules_cache()) {
                         $notes[] = 'Browser cache directives have been successfully written.';
                     } else {
                         $browsercache_rules_cache_path = w3_get_browsercache_rules_cache_path();
                         $errors[] = sprintf('The browser cache rules could not be modified. Please %srun <strong>chmod 777 %s</strong> to resolve this issue.', file_exists($browsercache_rules_cache_path) ? '' : sprintf('create an empty file in <strong>%s</strong> and ', $browsercache_rules_cache_path), $browsercache_rules_cache_path);
                     }
                     break;
                 case 'minify_remove_rules_legacy':
                     $w3_plugin_minify = w3_instance('W3_Plugin_MinifyAdmin');
                     if ($w3_plugin_minify->remove_rules_legacy()) {
                         $notes[] = 'Legacy minify configuration settings have been successfuly removed.';
                     } else {
                         $minify_rules_cache_path = w3_get_minify_rules_cache_path();
                         $errors[] = sprintf('The legacy minify rules could not be modified. Please run <strong>chmod 777 %s</strong> to resolve this issue.', file_exists($minify_rules_cache_path) ? $minify_rules_cache_path : dirname($minify_rules_cache_path));
                     }
                     break;
                 case 'minify_write_rules':
                     $w3_plugin_minify = w3_instance('W3_Plugin_MinifyAdmin');
                     $w3_plugin_minify->write_rules_cache();
                     // throw exceptions
                     if ($w3_plugin_minify->write_rules_core()) {
                         $notes[] = 'Minify rewrite rules have been successfully written.';
                     } else {
                         $minify_rules_core_path = w3_get_minify_rules_core_path();
                         $errors[] = sprintf('The minify rules could not be modified. Please run <strong>chmod 777 %s</strong> to resolve this issue.', file_exists($minify_rules_core_path) ? $minify_rules_core_path : dirname($minify_rules_core_path));
                     }
                     break;
                 case 'minify_write_test_rules':
                     $w3_plugin_minify = w3_instance('W3_Plugin_MinifyAdmin');
                     $w3_plugin_minify->write_multiste_subfolder_rewrite_test_rules_apache();
                     if ($w3_plugin_minify->check_multisite_subfolder_test_rules_cache_apache()) {
                         $notes[] = 'Minify test rewrite rules have been successfully written.';
                     } else {
                         $minify_test_rules_path = w3_get_document_root() . '/.htaccess';
                         $errors[] = sprintf('The minify test rules could not be modified. Please run <strong>chmod 777 %s</strong> to resolve this issue.', $minify_test_rules_path);
                     }
                     break;
                 case 'pgcache_remove_rules_legacy':
                     $w3_plugin_pgcache = w3_instance('W3_Plugin_PgCacheAdmin');
                     if ($w3_plugin_pgcache->remove_rules_legacy()) {
                         $notes[] = 'Legacy page cache configuration settings have been successfully removed.';
                     } else {
                         $pgcache_rules_cache_path = w3_get_pgcache_rules_cache_path();
                         $errors[] = sprintf('The legacy page cache rules could not be removed. Please run <strong>chmod 777 %s</strong> to resolve this issue.', file_exists($pgcache_rules_cache_path) ? $pgcache_rules_cache_path : dirname($pgcache_rules_cache_path));
                     }
                     break;
                 case 'pgcache_write_rules_cache':
                     $w3_plugin_pgcache = w3_instance('W3_Plugin_PgCacheAdmin');
                     $w3_plugin_pgcache->write_rules_cache();
                     // throw exceptions
                     $notes[] = 'Page cache rewrite rules have been successfully written.';
                     break;
                 case 'pgcache_write_rules_core':
                     $w3_plugin_pgcache = w3_instance('W3_Plugin_PgCacheAdmin');
                     $w3_plugin_pgcache->write_rules_core();
                     if ($w3_plugin_pgcache->check_rules_core()) {
                         $notes[] = 'Page cache rewrite rules have been successfully written.';
                     } else {
                         $pgcache_rules_core_path = w3_get_pgcache_rules_core_path();
                         $errors[] = sprintf('The page cache rules could not be modified. Please %srun <strong>chmod 777 %s</strong> to resolve this issue.', file_exists($pgcache_rules_core_path) ? '' : sprintf('create an empty file in <strong>%s</strong> and ', $pgcache_rules_core_path), $pgcache_rules_core_path);
                     }
                     break;
             }
         } catch (Exception $e) {
             $error = $e->getMessage();
             // avoid duplicate errors, like absense of permission for wp-content folder
             if (!in_array($error, $errors)) {
                 $errors[] = $error;
             }
         }
     }
     $this->redirect_with_custom_messages(array(), $errors, $notes);
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:89,代码来源:TotalCacheAdmin.php



注:本文中的w3_get_pgcache_rules_core_path函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP w3_get_site_path函数代码示例发布时间:2022-05-23
下一篇:
PHP w3_get_pgcache_rules_cache_path函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap