Esempio n. 1
0
        echo '<li>', $check, '</li>';
    }
    ?>
    </ul>
    <?php 
}
?>

    <h4><?php 
_e('WordPress Resources', 'w3-total-cache');
?>
</h4>

    <ul>
        <?php 
$paths = array_unique(array(Util_Rule::get_pgcache_rules_core_path(), Util_Rule::get_browsercache_rules_cache_path(), Util_Rule::get_browsercache_rules_no404wp_path()));
?>
        <?php 
foreach ($paths as $path) {
    if ($path) {
        ?>
        <li>
            <?php 
        echo htmlspecialchars($path);
        ?>
:
            <?php 
        if (file_exists($path)) {
            ?>
                <?php 
            if (Util_File::is_writable($path)) {
 /**
  * Removes cache directives
  *
  * @throws Util_WpFile_FilesystemOperationException with S/FTP form if it can't get the required filesystem credentials
  */
 private function rules_cache_remove($exs)
 {
     Util_Rule::remove_rules($exs, Util_Rule::get_browsercache_rules_cache_path(), W3TC_MARKER_BEGIN_BROWSERCACHE_CACHE, W3TC_MARKER_END_BROWSERCACHE_CACHE);
 }
 /**
  * Send support request action
  *
  * @return void
  */
 function w3tc_support_send_details()
 {
     $c = Dispatcher::config();
     $post = array();
     foreach ($_GET as $p => $v) {
         $post[$p] = $v;
     }
     $post['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
     $post['version'] = W3TC_VERSION;
     $license_level = 'community';
     if (Util_Environment::is_w3tc_pro($c)) {
         $license_level = 'pro';
     } elseif (Util_Environment::is_w3tc_enterprise($c)) {
         $license_level = 'enterprise';
     }
     $post['license_level'] = $license_level . ' ' . $c->get_string('plugin.license_key');
     /**
      * Add attachments
      */
     $attachments = array();
     $attach_files = array(Util_Environment::wp_config_path(), Util_Rule::get_pgcache_rules_core_path(), Util_Rule::get_pgcache_rules_cache_path(), Util_Rule::get_browsercache_rules_cache_path(), Util_Rule::get_browsercache_rules_no404wp_path(), Util_Rule::get_minify_rules_core_path(), Util_Rule::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;
             }
             $attach_file[] = 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[] = array('filename' => basename($attach_file), 'content' => file_get_contents($attach_file));
         }
     }
     /**
      * Attach server info
      */
     $server_info = print_r($this->get_server_info(), true);
     $server_info = str_replace("\n", "\r\n", $server_info);
     $attachments[] = array('filename' => 'server_info.txt', 'content' => $server_info);
     /**
      * Attach phpinfo
      */
     ob_start();
     phpinfo();
     $php_info = ob_get_contents();
     ob_end_clean();
     $attachments[] = array('filename' => 'php_info.html', 'content' => $php_info);
     /**
      * Attach self-test
      */
     ob_start();
     $this->self_test();
     $self_test = ob_get_contents();
     ob_end_clean();
     $attachments[] = array('filename' => 'self_test.html', 'content' => $self_test);
     $post['attachments'] = $attachments;
     $response = wp_remote_post(W3TC_SUPPORT_REQUEST_URL, array('body' => $post, 'timeout' => $c->get_integer('timelimit.email_send')));
     if (!is_wp_error($response)) {
         $result = $response['response']['code'] == 200 && $response['body'] == 'ok';
     } else {
         $result = false;
     }
     echo $result ? 'ok' : 'error';
 }
 /**
  * Plugin action links filter
  *
  * @param array   $links
  * @return array
  */
 function plugin_action_links($links)
 {
     array_unshift($links, '<a class="edit" href="admin.php?page=w3tc_general">Settings</a>');
     array_unshift($links, '<a class="delete" href="admin.php?page=w3tc_support">Premium Support</a>');
     if (!is_writable(WP_CONTENT_DIR) || !is_writable(Util_Rule::get_browsercache_rules_cache_path())) {
         $delete_link = '<a href="' . wp_nonce_url(admin_url('plugins.php?action=w3tc_deactivate_plugin'), 'w3tc') . '">Uninstall</a>';
         array_unshift($links, $delete_link);
     }
     return $links;
 }
Esempio n. 5
0
 /**
  * Removes Page Cache core directives
  *
  * @param Util_Environment_Exceptions $exs
  * @throws Util_WpFile_FilesystemOperationException with S/FTP form if it can't get the required filesystem credentials
  */
 private function rules_remove($exs)
 {
     Util_Rule::remove_rules($exs, Util_Rule::get_browsercache_rules_cache_path(), W3TC_MARKER_BEGIN_CDN, W3TC_MARKER_END_CDN);
 }