readme changelog updated, stable tag updated 1.4.3
readme changelog updated, stable tag updated

 Binary files a/assets/banner-772x250.png and b/assets/banner-772x250.png differ
file:a/readme.txt -> file:b/readme.txt
--- a/readme.txt
+++ b/readme.txt
@@ -1,10 +1,10 @@
-=== VCaching ===
+=== Varnish Caching ===
 Donate link: www.paypal.com/use/email/razvan_stanga@yahoo.com
 Contributors: razvanstanga
 Tags: varnish, purge, cache, caching, optimization, performance, traffic
 Requires at least: 4.0
-Tested up to: 4.4
-Stable tag: 1.4
+Tested up to: 4.5
+Stable tag: 1.4.3
 License: GPLv2 or later
 
 Wordpress Varnish Cache 3.x/4.x integration
@@ -60,9 +60,13 @@
 
 == Installation ==
 
-Use the Varnish Cache configuration generator. Fill in the backends/ACLs then download your configuration files.
+* You must install Varnish Cache on your server(s)
+* Go to the configuration generator. Fill in the backends/ACLs then download the configuration files
+* Use these configuration files to configure Varnish Cache server(s). Usualy the configuration files are in /etc/varnish. In most cases you must put the downloaded configuration files in /etc/varnish and restart Varnish Cache
+
 Or use the provided Varnish Cache configuration files located in /wp-content/plugins/vcaching/varnish-conf folder.
-You can also use the purge key method. You must fill in lib/purge.vcl the purge key.
+
+You can also use the purge key method if you can't setup ACLs. You must fill in lib/purge.vcl the purge key.
 
 == Frequently Asked Questions ==
 
@@ -101,17 +105,28 @@
 
 = What is logged in cookie? =
 
-Logged in cookie is a special cookie this plugin sets upon user loggin. Varnish Cache uses this cookie to bypass caching for logged in users.
+Logged in cookie is a special cookie this plugin sets upon user login. Varnish Cache uses this cookie to bypass caching for logged in users.
+
 This is a small step towards securing your site for denial of service attacks. Denial of service attacks can happen if the attacker bypasses Varnish Cache and hits the backend directly.
 With the current configuration and the way Wordpress works, this can still happen with POST/AJAX requests.
 
 == Changelog ==
 
+= 1.4.3 =
+* Truncate option added for too many 'trying to purge' messages. Added check for ZipArchive class to download VCLs.
+
+= 1.4.2 =
+* Bugfix release. Replaced home_url with plugins_url to show VCaching image
+
+= 1.4.1 =
+* Do not cache static files on admin domain
+
 = 1.4 =
-* Varnish Cache configuration files generator
+* Varnish Cache configuration generator
 * added `logged in cookie`. This replaces the logged in admin/user based on Wordpress standard cookies to bypass caching
 * moved backends to conf/backend.vcl
 * moved ACLs to conf/acl.vcl
+* updated VCLs. If you are using 1.3 VCLs should upgrade to 1.4
 
 = 1.3.3 =
 * support for Varnish 4
@@ -143,7 +158,8 @@
 
 == Upgrade Notice ==
 
-* none
+= 1.4 =
+Users using 1.3 Varnish Cache VCLs should upgrade to 1.4
 
 == Screenshots ==
 

--- a/varnish-conf/v3/lib/static.vcl
+++ b/varnish-conf/v3/lib/static.vcl
@@ -2,6 +2,11 @@
 
 sub vcl_recv {
     if (req.request ~ "^(GET|HEAD)$" && req.url ~ "\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)(\?.*)?$") {
+        # if you use a subdomain for admin section, do not cache it
+        #if (req.http.host ~ "admin.yourdomain.com") {
+        #    set req.http.X-VC-Cacheable = "NO:Admin domain";
+        #    return(pass);
+        #}
         # enable this if you want
         #if (req.url ~ "debug") {
         #    set req.http.X-VC-Debug = "true";

--- a/varnish-conf/v4/lib/static.vcl
+++ b/varnish-conf/v4/lib/static.vcl
@@ -2,6 +2,11 @@
 
 sub vcl_recv {
     if (req.method ~ "^(GET|HEAD)$" && req.url ~ "\.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|pdf|txt|tar|wav|bmp|rtf|js|flv|swf|html|htm)(\?.*)?$") {
+        # if you use a subdomain for admin section, do not cache it
+        #if (req.http.host ~ "admin.yourdomain.com") {
+        #    set req.http.X-VC-Cacheable = "NO:Admin domain";
+        #    return(pass);
+        #}
         # enable this if you want
         #if (req.url ~ "debug") {
         #    set req.http.X-VC-Debug = "true";

--- a/vcaching.php
+++ b/vcaching.php
@@ -1,9 +1,9 @@
 <?php
 /*
-Plugin Name: VCaching
+Plugin Name: Varnish Caching
 Plugin URI: http://wordpress.org/extend/plugins/vcaching/
 Description: WordPress Varnish Cache integration.
-Version: 1.4
+Version: 1.4.3
 Author: Razvan Stanga
 Author URI: http://git.razvi.ro/
 License: http://www.apache.org/licenses/LICENSE-2.0
@@ -29,6 +29,7 @@
     protected $override = 0;
     protected $customFields = array();
     protected $noticeMessage = '';
+    protected $truncateNotice = false;
     protected $debug = 0;
 
     public function __construct()
@@ -63,6 +64,7 @@
         add_action('wp', array($this, 'buffer_start'), 1000000);
         add_action('shutdown', array($this, 'buffer_end'), 1000000);
 
+        $this->truncateNotice = get_option($this->prefix . 'truncate_notice');
         $this->debug = get_option($this->prefix . 'debug');
 
         // send headers to varnish
@@ -218,7 +220,7 @@
                                 echo '<p><strong>' . $customField['title'] . '</strong></p>';
                                 echo '<label class="screen-reader-text" for="' . $this->prefix . $customField['name'] . '">' . $customField['title'] . '</label>';
                                 echo '<p><input type="checkbox" name="' . $this->prefix . $customField['name'] . '" id="' . $this->prefix . $customField['name'] . '" value="yes"';
-                                if (get_post_meta( $post->ID, $this->prefix . $customField['name'], true ) == "yes")
+                                if (get_post_meta($post->ID, $this->prefix . $customField['name'], true ) == "yes")
                                     echo ' checked="checked"';
                                 echo '" style="width: auto;" /></p>';
                                 break;
@@ -356,14 +358,19 @@
                     }
                 }
             } else {
-                $this->noticeMessage .= '<br />' . __('Trying to purge URL :', $this->plugin) . $purgeme;
-                $message = preg_match("/<title>(.*)<\/title>/i", $response['body'], $matches);
-                $this->noticeMessage .= ' => <br /> ' . isset($matches[1]) ? " => " . $matches[1] : $response['body'];
-                $this->noticeMessage .= '<br />';
-                if ($this->debug) {
-                    $this->noticeMessage .= $response['body'] . "<br />";
+                if ($this->truncateNotice && $key <= 2 || $this->truncateNotice == false) {
+                    $this->noticeMessage .= '' . __('Trying to purge URL :', $this->plugin) . $purgeme;
+                    preg_match("/<title>(.*)<\/title>/i", $response['body'], $matches);
+                    $this->noticeMessage .= ' => <br /> ' . isset($matches[1]) ? " => " . $matches[1] : $response['body'];
+                    $this->noticeMessage .= '<br />';
+                    if ($this->debug) {
+                        $this->noticeMessage .= $response['body'] . "<br />";
+                    }
                 }
             }
+        }
+        if ($this->truncateNotice) {
+            $this->noticeMessage .= '<br />' . __('Truncate message activated. Showing only first 3 messages.', $this->plugin);
         }
 
         do_action('after_purge_url', $url, $purgeme);
@@ -388,21 +395,21 @@
             $categories = get_the_category($postId);
             if ($categories) {
                 foreach ($categories as $cat) {
-                    array_push($listofurls, get_category_link( $cat->term_id));
+                    array_push($listofurls, get_category_link($cat->term_id));
                 }
             }
             // Tag purge based on Donnacha's work in WP Super Cache
             $tags = get_the_tags($postId);
             if ($tags) {
                 foreach ($tags as $tag) {
-                    array_push($listofurls, get_tag_link( $tag->term_id));
+                    array_push($listofurls, get_tag_link($tag->term_id));
                 }
             }
 
             // Author URL
             array_push($listofurls,
-                get_author_posts_url(get_post_field( 'post_author', $postId)),
-                get_author_feed_link(get_post_field( 'post_author', $postId))
+                get_author_posts_url(get_post_field('post_author', $postId)),
+                get_author_feed_link(get_post_field('post_author', $postId))
             );
 
             // Archives and their feeds
@@ -488,7 +495,7 @@
     public function add_menu_item()
     {
         if ($this->check_if_purgeable()) {
-            add_menu_page(__('Varnish Caching', $this->plugin), __('Varnish Caching', $this->plugin), 'manage_options', $this->plugin . '-plugin', array($this, 'settings_page'), home_url() . '/wp-content/plugins/' . $this->plugin . '/icon.png', 99);
+            add_menu_page(__('Varnish Caching', $this->plugin), __('Varnish Caching', $this->plugin), 'manage_options', $this->plugin . '-plugin', array($this, 'settings_page'), plugins_url() . '/' . $this->plugin . '/icon.png', 99);
         }
     }
 
@@ -615,13 +622,22 @@
                     submit_button();
                 ?>
             </form>
-            <form method="post" action="index.php?page=<?=$this->plugin?>-plugin&amp;tab=conf">
+            <?php if (class_exists('ZipArchive')): ?>
+                <form method="post" action="index.php?page=<?=$this->plugin?>-plugin&amp;tab=conf">
+                    <?php
+                        settings_fields($this->prefix . 'download');
+                        do_settings_sections($this->prefix . 'download');
+                        submit_button(__('Download'));
+                    ?>
+                </form>
+            <?php else: ?>
                 <?php
-                    settings_fields($this->prefix . 'download');
-                    do_settings_sections($this->prefix . 'download');
-                    submit_button(__('Download'));
+                    do_settings_sections($this->prefix . 'download_error');
+                    echo sprintf(__('You server\'s PHP configuration is missing the ZIP extension (ZipArchive class is used by VCaching). Please enable the ZIP extension. For more information click <a href="%1$s" target="_blank">here</a>.', $this->plugin), 'http://www.php.net/manual/en/book.zip.php');
+                    echo "<br />";
+                    echo __('If you cannot enable the ZIP extension, please use the provided Varnish Cache configuration files located in /wp-content/plugins/vcaching/varnish-conf folder', $this->plugin);
                 ?>
-            </form>
+            <?php endif; ?>
         <?php endif; ?>
         </div>
     <?php
@@ -643,6 +659,7 @@
         add_settings_field($this->prefix . "purge_key", __("Purge key", $this->plugin), array($this, $this->prefix . "purge_key"), $this->prefix . 'options', $this->prefix . 'options');
         add_settings_field($this->prefix . "cookie", __("Logged in cookie", $this->plugin), array($this, $this->prefix . "cookie"), $this->prefix . 'options', $this->prefix . 'options');
         add_settings_field($this->prefix . "stats_json_file", __("Statistics JSONs", $this->plugin), array($this, $this->prefix . "stats_json_file"), $this->prefix . 'options', $this->prefix . 'options');
+        add_settings_field($this->prefix . "truncate_notice", __("Truncate notice message", $this->plugin), array($this, $this->prefix . "truncate_notice"), $this->prefix . 'options', $this->prefix . 'options');
         add_settings_field($this->prefix . "debug", __("Enable debug", $this->plugin), array($this, $this->prefix . "debug"), $this->prefix . 'options', $this->prefix . 'options');
 
         if($_POST['option_page'] == $this->prefix . 'options') {
@@ -656,6 +673,7 @@
             register_setting($this->prefix . 'options', $this->prefix . "purge_key");
             register_setting($this->prefix . 'options', $this->prefix . "cookie");
             register_setting($this->prefix . 'options', $this->prefix . "stats_json_file");
+            register_setting($this->prefix . 'options', $this->prefix . "truncate_notice");
             register_setting($this->prefix . 'options', $this->prefix . "debug");
         }
     }
@@ -752,6 +770,16 @@
         <?php
     }
 
+    public function varnish_caching_truncate_notice()
+    {
+        ?>
+            <input type="checkbox" name="varnish_caching_truncate_notice" value="1" <?php checked(1, get_option($this->prefix . 'truncate_notice'), true); ?> />
+            <p class="description">
+                <?=__('When using multiple Varnish Cache servers, VCaching shows too many `Trying to purge URL` messages. Check this option to truncate that message.', $this->plugin)?>
+            </p>
+        <?php
+    }
+
     public function varnish_caching_debug()
     {
         ?>
@@ -790,6 +818,9 @@
         }
 
         add_settings_section('download', __("Get configuration files", $this->plugin), null, $this->prefix . 'download');
+        if (!class_exists('ZipArchive')) {
+            add_settings_section('download_error', __("You cannot download the configuration files", $this->plugin), null, $this->prefix . 'download_error');
+        }
 
         add_settings_field($this->prefix . "varnish_version", __("Version", $this->plugin), array($this, $this->prefix . "varnish_version"), $this->prefix . 'download', "download");
 

comments