Changeset 1906488
- Timestamp:
- 07/09/2018 02:08:01 PM (8 years ago)
- Location:
- purge-varnish
- Files:
-
- 26 added
- 5 edited
-
tags/1.0.8 (added)
-
tags/1.0.8/class_purge_varnish.php (added)
-
tags/1.0.8/css (added)
-
tags/1.0.8/css/purge_varnish.css (added)
-
tags/1.0.8/images (added)
-
tags/1.0.8/images/error.png (added)
-
tags/1.0.8/images/ok.png (added)
-
tags/1.0.8/images/purge16x16.png (added)
-
tags/1.0.8/includes (added)
-
tags/1.0.8/includes/expire.php (added)
-
tags/1.0.8/includes/purge_all.php (added)
-
tags/1.0.8/includes/purge_urls.php (added)
-
tags/1.0.8/includes/terminal.php (added)
-
tags/1.0.8/js (added)
-
tags/1.0.8/js/purge_varnish.js (added)
-
tags/1.0.8/readme.txt (added)
-
tags/1.0.8/vcl (added)
-
tags/1.0.8/vcl/3.x (added)
-
tags/1.0.8/vcl/3.x/default.vcl (added)
-
tags/1.0.8/vcl/3.x/varnish (added)
-
tags/1.0.8/vcl/4.x (added)
-
tags/1.0.8/vcl/4.x/default.vcl (added)
-
tags/1.0.8/vcl/4.x/varnish (added)
-
tags/1.0.8/vcl/5.x (added)
-
tags/1.0.8/vcl/5.x/default.vcl (added)
-
tags/1.0.8/vcl/5.x/varnish (added)
-
trunk/class_purge_varnish.php (modified) (15 diffs)
-
trunk/css/purge_varnish.css (modified) (3 diffs)
-
trunk/includes/expire.php (modified) (5 diffs)
-
trunk/js/purge_varnish.js (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
purge-varnish/trunk/class_purge_varnish.php
r1724944 r1906488 44 44 if (current_user_can('manage_options')) { 45 45 add_submenu_page('purge-varnish-settings', 'Terminal', 'Terminal', 'manage_options', 'purge-varnish-settings', array( 46 $this, 'purge_varnish_page_file_path'));46 $this, 'purge_varnish_page_file_path')); 47 47 add_submenu_page('purge-varnish-settings', 'Purge all', 'Purge all', 'manage_options', 'purge-varnish-all', array( 48 $this, 'purge_varnish_page_file_path'));48 $this, 'purge_varnish_page_file_path')); 49 49 50 50 add_submenu_page('purge-varnish-settings', 'Expire', 'Expire', 'manage_options', 'purge-varnish-expire', array( 51 $this, 'purge_varnish_page_file_path'));51 $this, 'purge_varnish_page_file_path')); 52 52 } 53 53 54 54 if (current_user_can('edit_posts')) { 55 55 add_submenu_page('purge-varnish-settings', 'Purge URLs', 'Purge URLs', 'edit_posts', 'purge-varnish-urls', array( 56 $this, 'purge_varnish_page_file_path'));56 $this, 'purge_varnish_page_file_path')); 57 57 } 58 58 } … … 165 165 $result = socket_write($client, "$command\n"); 166 166 if ($status = $this->purge_varnish_execute_command($client, $command)) { 167 $logdata .= $status;168 167 $ret[$terminal][$command] = $status; 169 168 } … … 216 215 error_log('Socket error: ' . socket_strerror($error), 0); 217 216 return array( 218 'code' => $error,219 'msg' => socket_strerror($error),217 'code' => $error, 218 'msg' => socket_strerror($error), 220 219 ); 221 220 } … … 224 223 225 224 $status = array( 226 'code' => substr($header, 0, 3),227 'msg' => socket_read($client, $msg_len, PHP_BINARY_READ),225 'code' => substr($header, 0, 3), 226 'msg' => socket_read($client, $msg_len, PHP_BINARY_READ), 228 227 ); 229 228 … … 273 272 $message['error']['varnish_socket_timeout'] = esc_html('Varnish connection timeout must be a positive number.'); 274 273 } 275 274 276 275 $msg = ''; 277 276 if (isset($message['error']) && count($message['error'])) { … … 483 482 if (count($custom_urls)) { 484 483 foreach ($custom_urls as $url) { 485 $command = $this->purge_varnish_get_command($url); 486 $this->purge_varnish_terminal_run(array($command)); 484 $url = trim($url); 485 if (!empty($url)) { 486 $command = $this->purge_varnish_get_command($url); 487 $this->purge_varnish_terminal_run(array($command)); 488 } 487 489 } 488 490 } … … 556 558 $expire = unserialize($purge_varnish_expire); 557 559 if (is_array($expire)) { 560 $uploads_path = wp_upload_dir(); 558 561 foreach ($expire as $page) { 559 562 switch ($page) { … … 609 612 } 610 613 611 if (($new_status <> $old_status) && ($new_status == 'approved' || $old_status == 'approved')) {614 if (($new_status <> $old_status) && ($new_status == 'approved')) { 612 615 $comment_post_id = $comment->comment_post_ID; 613 616 $post = get_post($comment_post_id); … … 697 700 698 701 /* 699 * Callback to purge various type of varnish objects on comment edited. 700 */ 701 702 function purge_varnish_comment_post_trigger($ID) { 703 $comment = get_comment($ID); 704 705 if (!is_object($comment)) { 702 * Callback to purge publish post object whenever comment is posted 703 */ 704 705 function purge_varnish_comment_insert_trigger($comment_id, $comment_object) { 706 // Cause with wp_update_nav_menu 707 if (is_object($comment_object)) { 708 $post_id = $comment_object->comment_post_ID; 709 $post = get_post($post_id); 710 711 // Halt exection if not have post object 712 $this->purge_varnish_is_post_object($post); 713 if ($post->post_status == 'publish') { 714 $this->purge_varnish_trigger_post_expire($post); 715 } 716 } else { 706 717 return; 707 718 } 708 709 $post_id = $comment->comment_post_ID; 710 $post = get_post($ID); 711 712 if (is_object($comment) && ($comment->comment_approved <> 1 || $post->post_status <> 'publish')) { 719 } 720 721 /* 722 * Callback to purge publish post object whenever comment is posted 723 */ 724 725 function purge_varnish_comment_edit_trigger($comment_id, $comment_object) { 726 // Cause with wp_update_nav_menu 727 if (is_object($comment_object)) { 728 $post_id = $comment_object->comment_post_ID; 729 $post = get_post($post_id); 730 731 // Halt exection if not have post object 732 $this->purge_varnish_is_post_object($post); 733 if ($post->post_status == 'publish') { 734 $this->purge_varnish_trigger_post_expire($post); 735 } 736 } else { 713 737 return; 714 738 } 715 // Call to purge716 $this->purge_varnish_trigger_comment_expire($post);717 739 } 718 740 … … 800 822 function purge_varnish_default_actions() { 801 823 return array( 802 'post_insert_update' => 'post_updated', 803 'post_status' => 'transition_post_status', 804 'post_trash' => 'wp_trash_post', 805 'comment_insert_update' => 'comment_post', 806 'navmenu_insert_update' => 'wp_update_nav_menu', 807 'theme_switch' => 'after_switch_theme', 824 'post_insert_update' => 'post_updated', 825 'post_status' => 'transition_post_status', 826 'post_trash' => 'wp_trash_post', 827 'comment_insert' => 'wp_insert_comment', 828 'comment_update' => 'edit_comment', 829 'navmenu_insert_update' => 'wp_update_nav_menu', 830 'theme_switch' => 'after_switch_theme', 808 831 ); 809 832 } … … 816 839 $default_actions = $this->purge_varnish_default_actions(); 817 840 $additional_actions = array( 818 'comment_status_changed' => 'transition_comment_status',841 'comment_status_changed' => 'transition_comment_status', 819 842 ); 820 843 $actions = $default_actions + $additional_actions; … … 834 857 function purge_varnish_default_tiggers() { 835 858 return array( 836 'post_front_page' => 'front_page',837 'post_custom_url' => 'custom_url',838 'post_post_item' => 'post_item',839 'post_category_page' => 'category_page',840 'comment_front_page' => 'front_page',841 'comment_custom_url' => 'custom_url',842 'navmenu_front_page' => 'front_page',843 'navmenu_custom_url' => 'custom_url',844 'wp_theme_front_page' => 'front_page',845 'wp_theme_custom_url' => 'custom_url',859 'post_front_page' => 'front_page', 860 'post_custom_url' => 'custom_url', 861 'post_post_item' => 'post_item', 862 'post_category_page' => 'category_page', 863 'comment_front_page' => 'front_page', 864 'comment_custom_url' => 'custom_url', 865 'navmenu_front_page' => 'front_page', 866 'navmenu_custom_url' => 'custom_url', 867 'wp_theme_front_page' => 'front_page', 868 'wp_theme_custom_url' => 'custom_url', 846 869 ); 847 870 } … … 854 877 $default_tiggers = $this->purge_varnish_default_tiggers(); 855 878 $additional_tiggers = array( 856 'comment_post_item' => 'post_item',857 'navmenu_menu_link' => 'post_item',858 'wp_theme_purge_all' => 'purge_all',859 'post_custom_urls' => '?',860 'comment_custom_urls' => '?',861 'navmenu_custom_urls' => '?',862 'wp_theme_custom_urls' => '?',879 'comment_post_item' => 'post_item', 880 'navmenu_menu_link' => 'menu_item', 881 'wp_theme_purge_all' => 'purge_all', 882 'post_custom_urls' => '?', 883 'comment_custom_urls' => '?', 884 'navmenu_custom_urls' => '?', 885 'wp_theme_custom_urls' => '?', 863 886 ); 864 887 $tiggers = $default_tiggers + $additional_tiggers; … … 939 962 if (!empty($purge_varnish_action)) { 940 963 $actions = unserialize($purge_varnish_action); 941 if (is_array($actions)) { 964 if (is_array($actions)) { 942 965 foreach ($actions as $action) { 943 966 switch ($action) { … … 957 980 break; 958 981 959 case 'comment_post': 960 add_action($action, array($purge_varnish, 'purge_varnish_comment_post_trigger')); 982 case 'wp_insert_comment': 983 add_action($action, array($purge_varnish, 'purge_varnish_comment_insert_trigger'), 10, 3); 984 break; 985 986 case 'edit_comment': 987 add_action($action, array($purge_varnish, 'purge_varnish_comment_edit_trigger'), 10, 3); 961 988 break; 962 989 -
purge-varnish/trunk/css/purge_varnish.css
r1624809 r1906488 1 1 .purge_varnish 2 2 { 3 width: 90%;4 padding-left: 2px;3 width: 98%; 4 padding-left: 2px; 5 5 } 6 6 .purge_varnish table 7 7 { 8 width: 80%;8 width: 98%; 9 9 } 10 10 .purge_varnish .screen 11 11 { 12 background-color: #fff;13 padding-bottom: 30px;12 background-color: #fff; 13 padding-bottom: 30px; 14 14 } 15 15 .purge_varnish h2 16 16 { 17 background-image: url("../images/purge16x16.png");18 background-position: left 8px center;19 background-repeat: no-repeat;20 margin: 15px 0 0;21 padding: 9px 0 9px 30px;17 background-image: url("../images/purge16x16.png"); 18 background-position: left 8px center; 19 background-repeat: no-repeat; 20 margin: 15px 0 0; 21 padding: 9px 0 9px 30px; 22 22 } 23 23 .purge_varnish .screen .desc 24 24 { 25 padding-left: 23px;26 color: #777;25 padding-left: 23px; 26 color: #777; 27 27 } 28 28 29 29 .terminal_desc 30 30 { 31 padding-top: 3px;32 color: #777;31 padding-top: 3px; 32 color: #777; 33 33 } 34 34 35 35 .purge_varnish table th{ 36 text-align: right;37 padding-right: 20px;36 text-align: right; 37 vertical-align: text-top; 38 38 } 39 39 .purge_varnish table td{ 40 text-align: left;41 padding-right: 20px;40 text-align: left; 41 vertical-align: text-top; 42 42 } 43 43 44 44 .purge_varnish input[type=text], .purge_varnish select { 45 width: 350px;46 border: 1px solid #0073AA;47 border-left: 4px solid #1d8ccc;45 width: 350px; 46 border: 1px solid #0073AA; 47 border-left: 4px solid #1d8ccc; 48 48 } 49 49 50 50 .purge_varnish input[type=checkbox]{ 51 border: 1px solid #0073AA;52 border-left: 4px solid #1d8ccc; 51 border: 2px solid #0073AA; 52 /* border-left: 4px solid #1d8ccc;*/ 53 53 } 54 54 55 55 .purge_varnish code 56 56 { 57 border-left: 4px solid #1d8ccc;58 padding: 4px;59 font-size: 14px;57 border-left: 4px solid #1d8ccc; 58 padding: 4px; 59 font-size: 14px; 60 60 } 61 61 .purge_varnish input[type=submit] { … … 73 73 transition-timing-function: ease-in; 74 74 } 75 ul.tab { 76 border-left: 5px solid #fff; 77 border-right: 5px solid #fff; 78 list-style-type: none; 79 margin: 0; 80 padding: 0; 81 overflow: hidden; 82 border-top: none; 83 background-color: #f1f1f1; 75 ul.tab { 76 list-style-type: none; 77 margin: 0; 78 padding: 0; 79 overflow: hidden; 80 border-top: none; 81 background-color: #f1f1f1; 84 82 } 85 83 86 84 /* Float the list items side by side */ 87 85 ul.tab li { 88 float: left;89 border-right: #eee;86 float: left; 87 border-right: #eee; 90 88 } 91 89 92 90 /* Style the links inside the list items */ 93 91 ul.tab li a { 94 display: inline-block;95 color: black;96 text-align: center;97 padding: 14px 16px;98 text-decoration: none;99 transition: 0.3s;100 font-size: 17px;92 display: inline-block; 93 color: black; 94 text-align: center; 95 padding: 10px 30px; 96 text-decoration: none; 97 transition: 0.3s; 98 font-size: 17px; 101 99 } 102 100 103 101 /* Change background color of links on hover */ 104 102 ul.tab li a:hover { 105 background-color: #ddd;103 background-color: #ddd; 106 104 } 107 105 108 106 /* Create an active/current tablink class */ 109 107 ul.tab li a:focus, .active { 110 background-color: #ccc;108 background-color: #ccc; 111 109 } 112 110 113 111 /* Style the tab content */ 114 112 .tabcontent { 115 border-style:none!important;;116 display: none;117 padding: 6px 12px;118 border: 1px solid #ccc;119 border-top: none;113 border-style:none!important;; 114 display: none; 115 padding: 6px 12px; 116 border: 1px solid #ccc; 117 border-top: none; 120 118 } 121 119 122 120 .tablinks{ 123 font-weight: bold;124 font-size: 20px;121 font-weight: bold; 122 font-size: 20px; 125 123 } 126 124 #wpbody-content dd, li { … … 129 127 .hide_custom_url {display: none;} 130 128 .show_custom_url {display: block;} 129 130 /*input[type="checkbox"][readonly] { 131 pointer-events: none; 132 }*/ 133 134 135 table.expiration tr td{ 136 border-bottom: 1px solid #ccc; 137 padding-bottom: 20px; 138 } 139 table.expiration tr td:first-child{ 140 background-color: #fbfbfb; 141 } 142 tr.expiration td{ 143 padding-top: 20px; 144 background-color: #fbfbfb; 145 } -
purge-varnish/trunk/includes/expire.php
r1705528 r1906488 13 13 if ($purge_varnish->purge_varnish_nonce('pvEsetting') == true) { 14 14 $post_actions = (array) $_POST['purge_varnish_action']; 15 15 16 $sanitize_actions = $purge_varnish->purge_varnish_sanitize_actions($post_actions); 16 17 update_option('purge_varnish_action', serialize($sanitize_actions)); … … 27 28 $post_status = ''; 28 29 $post_trash = ''; 29 $comment_insert_update = ''; 30 $comment_insert = ''; 31 $comment_update = ''; 30 32 $comment_status_changed = ''; 31 33 $navmenu_insert_update = ''; … … 36 38 $post_status = isset($action['post_status']) ? $action['post_status'] : ''; 37 39 $post_trash = isset($action['post_trash']) ? $action['post_trash'] : ''; 38 $comment_insert_update = isset($action['comment_insert_update']) ? $action['comment_insert_update'] : ''; 40 $comment_insert = isset($action['comment_insert']) ? $action['comment_insert'] : ''; 41 $comment_update = isset($action['comment_update']) ? $action['comment_update'] : ''; 39 42 $comment_status_changed = isset($action['comment_status_changed']) ? $action['comment_status_changed'] : ''; 40 43 $navmenu_insert_update = isset($action['navmenu_insert_update']) ? $action['navmenu_insert_update'] : ''; … … 149 152 <input type="checkbox" name="purge_varnish_expire[post_custom_url]" value="custom_url" <?php print $expire_post_checked; ?> class="ck_custom_url" /> <label><?php esc_html_e('Custom URLs'); ?></label> <br /> 150 153 <span class="desc"><?php esc_html_e('Expire user-defined custom urls.'); ?></span> 151 <div class="custom_url <?php print $expire_post_custom_url_class; ?>"> <b>Enter custom URLs </b>154 <div class="custom_url <?php print $expire_post_custom_url_class; ?>"> 152 155 <textarea rows="3" cols="70" name="purge_varnish_expire[post_custom_urls]" class="input_custom_urls"><?php print $expire_post_custom_urls; ?></textarea> 153 156 <div> … … 157 160 </tbody> 158 161 </table> 159 </div> 160 161 <div id="comment_expiration" class="tabcontent"> 162 <h3><?php esc_html_e('Comment expiration'); ?></h3> 163 <table cellpadding="5"> 164 <tbody> 165 <tr> 166 <th width="20%"></th> 167 <td width="80%"> 168 <b><?php esc_html_e('Comment actions') ?></b> 169 <p> 170 <input type="checkbox" name="purge_varnish_action[comment_insert_update]" value="comment_post" <?php 171 if ($comment_insert_update == 'comment_post') { 172 print 'checked="checked"'; 173 } 174 ?> /> <label><?php esc_html_e('Comment insert/update'); ?></label> <br /> <span class="desc"><?php esc_html_e('Trigger when approved comment is posted on approved post.'); ?></span><br /> 175 176 <input type="checkbox" name="purge_varnish_action[comment_status_changed]" value="transition_comment_status" <?php 177 if ($comment_status_changed == 'transition_comment_status') { 178 print 'checked="checked"'; 179 } 180 ?> /> <label><?php esc_html_e('Comment status changed'); ?></label> <br /><span class="desc"><?php esc_html_e('Trigger when comment is approved/unapproved.'); ?></span><br /> 181 182 </p> 183 </td> 184 </tr> 185 <tr> 186 <th> </th> 187 <td> 188 <b><?php esc_html_e('What URLs should be expired when comment action is triggered?'); ?></b> 189 <p> 190 <input type="checkbox" name="purge_varnish_expire[comment_front_page]" value="front_page" <?php 191 if ($expire_comment_front_page == 'front_page') { 192 print 'checked="checked"'; 193 } 194 ?> /> <label><?php esc_html_e('Front page'); ?></label> <br /><span class="desc"><?php esc_html_e('Expire url of the site front page'); ?></span><br /> 195 <input type="checkbox" name="purge_varnish_expire[comment_post_item]" value="post_item" <?php 196 if ($expire_comment_post_item == 'post_item') { 197 print 'checked="checked"'; 198 } 199 ?> /> <label><?php esc_html_e('Post page'); ?></label> <br /> <span class="desc"><?php esc_html_e('Expire url of the expiring post/page'); ?></span><br /> 200 201 <?php 202 $expire_comment_custom_url_class = 'hide_custom_url'; 203 $expire_comment_checked = ''; 204 if ($expire_comment_custom_url == 'custom_url') { 205 $expire_comment_checked = 'checked="checked"'; 206 $expire_comment_custom_url_class = 'show_custom_url'; 207 } 208 ?> 209 <input type="checkbox" name="purge_varnish_expire[comment_custom_url]" value="custom_url" <?php print $expire_comment_checked; ?> class="ck_custom_url" /> <label><?php esc_html_e('Custom URLs'); ?></label> <br /> 210 <span class="desc"><?php esc_html_e('Expire user-defined custom urls.'); ?></span><br /> 211 <div class="custom_url <?php print $expire_comment_custom_url_class; ?>"><b>Enter custom URLs </b> 212 <textarea rows="3" cols="70" name="purge_varnish_expire[comment_custom_urls]" class="input_custom_urls"><?php print $expire_comment_custom_urls; ?></textarea> 213 </div> 214 </p> 215 </td> 216 </tr> 217 </tbody> 218 </table> 219 </div> 220 221 <div id="menu_expiration" class="tabcontent"> 222 <h3><?php esc_html_e('Menu links expiration'); ?></h3> 223 <table cellpadding="5"> 224 <tbody> 225 <tr> 226 <th width="20%"></th> 227 <td width="80%"> 228 <b><?php esc_html_e('Menu link actions') ?></b> 229 <p> 230 <input type="checkbox" name="purge_varnish_action[navmenu_insert_update]" value="wp_update_nav_menu" <?php 231 if ($navmenu_insert_update == 'wp_update_nav_menu') { 232 print 'checked="checked"'; 233 } 234 ?> /> <label><?php esc_html_e('Menu link insert/update/delete'); ?></label> <br /> <span class="desc"><?php esc_html_e('Trigger on menu save action.'); ?></span><br /> 235 </p> 236 </td> 237 </tr> 238 <tr> 239 <th> </th> 240 <td> 241 <b><?php esc_html_e('What URLs should be expired when menu save action is triggered?') ?></b> 242 <p> 243 <input type="checkbox" name="purge_varnish_expire[navmenu_front_page]" value="front_page" <?php 244 if ($expire_navmenu_front_page == 'front_page') { 245 print 'checked="checked"'; 246 } 247 ?> /> <label><?php esc_html_e('Front page'); ?></label> <br /><span class="desc"><?php esc_html_e('Expire url of the site front page'); ?></span><br /> 248 <input type="checkbox" name="purge_varnish_expire[navmenu_menu_link]" value="post_item" <?php 249 if ($expire_navmenu_link == 'post_item') { 250 print 'checked="checked"'; 251 } 252 ?> /> <label><?php esc_html_e('Menu links'); ?></label> <br /> <span class="desc"><?php esc_html_e('Expire url of menu links'); ?></span><br /> 253 254 <?php 255 $expire_navmenu_custom_url_class = 'hide_custom_url'; 256 $expire_navmenu_checked = ''; 257 if ($expire_navmenu_custom_url == 'custom_url') { 258 $expire_navmenu_checked = 'checked="checked"'; 259 $expire_navmenu_custom_url_class = 'show_custom_url'; 260 } 261 ?> 262 <input type="checkbox" name="purge_varnish_expire[navmenu_custom_url]" value="custom_url" <?php print $expire_navmenu_checked; ?> class="ck_custom_url" /> <label><?php esc_html_e('Custom URLs'); ?></label> <br /> 263 <span class="desc"><?php esc_html_e('Expire user-defined custom urls.'); ?></span><br /> 264 <div class="custom_url <?php print $expire_navmenu_custom_url_class; ?>"><b>Enter custom URLs </b> 265 <textarea rows="3" cols="70" name="purge_varnish_expire[navmenu_custom_urls]" class="input_custom_urls"><?php print $expire_navmenu_custom_urls; ?></textarea> 266 </div> 267 </p> 268 </td> 269 </tr> 270 </tbody> 271 </table> 272 </div> 273 274 <div id="switch_theme" class="tabcontent"> 275 <h3><?php esc_html_e('Switch theme expiration'); ?></h3> 276 <table cellpadding="5"> 277 <tbody> 278 <tr> 279 <th width="20%"></th> 280 <td width="80%"> 281 <b><?php esc_html_e('Theme actions') ?></b> 282 <p> 283 <input type="checkbox" name="purge_varnish_action[theme_switch]" value="after_switch_theme" <?php 284 if ($switch_theme == 'after_switch_theme') { 285 print 'checked="checked"'; 286 } 287 ?> /> <label><?php esc_html_e('switch theme'); ?></label> <br /><span class="desc"><?php esc_html_e('Trigger when theme is switched.'); ?></span><br /> 288 </p> 289 </td> 290 </tr> 291 <tr> 292 <th> </th> 293 <td> 294 <b><?php esc_html_e('What URLs should be expired when theme switch action is triggered?') ?></b> 295 <p> 296 <input type="checkbox" name="purge_varnish_expire[wp_theme_front_page]" value="front_page" <?php 297 if ($expire_wp_theme_front_page == 'front_page') { 298 print 'checked="checked"'; 299 } 300 ?> /> <label><?php esc_html_e('Front page') ?></label> <br /><span class="desc"><?php esc_html_e('Expire url of the site front page'); ?></span><br /> 301 <input type="checkbox" name="purge_varnish_expire[wp_theme_purge_all]" value="purge_all" <?php 302 if ($expire_wp_theme_purge_all == 'purge_all') { 303 print 'checked="checked"'; 304 } 305 ?> class="ck_custom_url" /> <label>All varnish cache</label> <br /> <span class="desc"><?php esc_html_e('Expire/Purge all varnish cache'); ?></span><br /> 306 307 <?php 308 $expire_wp_theme_custom_url_class = 'hide_custom_url'; 309 $expire_wp_theme_checked = ''; 310 if ($expire_wp_theme_custom_url == 'custom_url') { 311 $expire_wp_theme_checked = 'checked="checked"'; 312 $expire_wp_theme_custom_url_class = 'show_custom_url'; 313 } 314 ?> 315 <input type="checkbox" name="purge_varnish_expire[wp_theme_custom_url]" value="custom_url" <?php print $expire_wp_theme_checked; ?> class="ck_custom_url" /> <label><?php esc_html_e('Custom URLs'); ?></label> <br /> 316 <span class="desc"><?php esc_html_e('Expire user-defined custom urls.'); ?></span><br /> 317 <div class="custom_url <?php print $expire_wp_theme_custom_url_class; ?>"><b>Enter custom URLs </b> 318 <textarea rows="3" cols="70" name="purge_varnish_expire[wp_theme_custom_urls]" class="input_custom_urls"><?php print $expire_wp_theme_custom_urls; ?></textarea> 319 </div> 320 </p> 321 </td> 322 </tr> 323 </tbody> 324 </table> 325 </div> 326 <table cellpadding="5"> 327 <tr> 328 <th width="20%"></th> 329 <td> 330 <?php wp_nonce_field('pvEsetting'); ?> 331 <input type="submit" value="Save Configurations" name="save_configurations" /> 332 </td> 333 </tr> 334 </table> 335 </form> 336 </div> 337 </div> 162 </div> 163 164 <div id="comment_expiration" class="tabcontent"> 165 <h3><?php esc_html_e('Comment expiration'); ?></h3> 166 <table cellpadding="5"> 167 <tbody> 168 <tr> 169 <th width="20%"></th> 170 <td width="80%"> 171 <b><?php esc_html_e('Comment actions') ?></b> 172 <p> 173 <input type="checkbox" name="purge_varnish_action[comment_insert]" value="wp_insert_comment" <?php 174 if ($comment_insert == 'wp_insert_comment') { 175 print 'checked="checked"'; 176 } 177 ?> /> <label><?php esc_html_e('Comment inserted'); ?></label> <br /> <span class="desc"><?php esc_html_e('Trigger when comment is posted on approved post.'); ?></span><br /> 178 179 180 <input type="checkbox" name="purge_varnish_action[comment_update]" value="edit_comment" <?php 181 if ($comment_update == 'edit_comment') { 182 print 'checked="checked"'; 183 } 184 ?> /> <label><?php esc_html_e('Comment updated'); ?></label> <br /> <span class="desc"><?php esc_html_e('Trigger on approved post whenever comment is updated.'); ?></span><br /> 185 186 187 188 189 <input type="checkbox" name="purge_varnish_action[comment_status_changed]" value="transition_comment_status" <?php 190 if ($comment_status_changed == 'transition_comment_status') { 191 print 'checked="checked"'; 192 } 193 ?> /> <label><?php esc_html_e('Comment status changed'); ?></label> <br /><span class="desc"><?php esc_html_e('Trigger when comment is approved/unapproved.'); ?></span><br /> 194 195 </p> 196 </td> 197 </tr> 198 <tr> 199 <th> </th> 200 <td> 201 <b><?php esc_html_e('What URLs should be expired when comment action is triggered?'); ?></b> 202 <p> 203 <input type="checkbox" name="purge_varnish_expire[comment_front_page]" value="front_page" <?php 204 if ($expire_comment_front_page == 'front_page') { 205 print 'checked="checked"'; 206 } 207 ?> /> <label><?php esc_html_e('Front page'); ?></label> <br /><span class="desc"><?php esc_html_e('Expire url of the site front page'); ?></span><br /> 208 <input type="checkbox" name="purge_varnish_expire[comment_post_item]" value="post_item" <?php 209 if ($expire_comment_post_item == 'post_item') { 210 print 'checked="checked"'; 211 } 212 ?> /> <label><?php esc_html_e('Post page'); ?></label> <br /> <span class="desc"><?php esc_html_e('Expire url of the expiring post/page'); ?></span><br /> 213 214 <?php 215 $expire_comment_custom_url_class = 'hide_custom_url'; 216 $expire_comment_checked = ''; 217 if ($expire_comment_custom_url == 'custom_url') { 218 $expire_comment_checked = 'checked="checked"'; 219 $expire_comment_custom_url_class = 'show_custom_url'; 220 } 221 ?> 222 <input type="checkbox" name="purge_varnish_expire[comment_custom_url]" value="custom_url" <?php print $expire_comment_checked; ?> class="ck_custom_url" /> <label><?php esc_html_e('Custom URLs'); ?></label> <br /> 223 <span class="desc"><?php esc_html_e('Expire user-defined custom urls.'); ?></span><br /> 224 <div class="custom_url <?php print $expire_comment_custom_url_class; ?>"> 225 <textarea rows="3" cols="70" name="purge_varnish_expire[comment_custom_urls]" class="input_custom_urls"><?php print $expire_comment_custom_urls; ?></textarea> 226 </div> 227 </p> 228 </td> 229 </tr> 230 </tbody> 231 </table> 232 </div> 233 234 <div id="menu_expiration" class="tabcontent"> 235 <h3><?php esc_html_e('Menu links expiration'); ?></h3> 236 <table cellpadding="5"> 237 <tbody> 238 <tr> 239 <th width="20%"></th> 240 <td width="80%"> 241 <b><?php esc_html_e('Menu link actions') ?></b> 242 <p> 243 <input type="checkbox" name="purge_varnish_action[navmenu_insert_update]" value="wp_update_nav_menu" <?php 244 if ($navmenu_insert_update == 'wp_update_nav_menu') { 245 print 'checked="checked"'; 246 } 247 ?> /> <label><?php esc_html_e('Menu link insert/update/delete'); ?></label> <br /> <span class="desc"><?php esc_html_e('Trigger on menu save action.'); ?></span><br /> 248 </p> 249 </td> 250 </tr> 251 <tr> 252 <th> </th> 253 <td> 254 <b><?php esc_html_e('What URLs should be expired when menu save action is triggered?') ?></b> 255 <p> 256 <input type="checkbox" name="purge_varnish_expire[navmenu_front_page]" value="front_page" <?php 257 if ($expire_navmenu_front_page == 'front_page') { 258 print 'checked="checked"'; 259 } 260 ?> /> <label><?php esc_html_e('Front page'); ?></label> <br /><span class="desc"><?php esc_html_e('Expire url of the site front page'); ?></span><br /> 261 <input type="checkbox" name="purge_varnish_expire[navmenu_menu_link]" value="menu_item" <?php 262 if ($expire_navmenu_link == 'menu_item') { 263 print 'checked="checked"'; 264 } 265 ?> /> <label><?php esc_html_e('Menu links'); ?></label> <br /> <span class="desc"><?php esc_html_e('Expire url of menu links'); ?></span><br /> 266 267 <?php 268 $expire_navmenu_custom_url_class = 'hide_custom_url'; 269 $expire_navmenu_checked = ''; 270 if ($expire_navmenu_custom_url == 'custom_url') { 271 $expire_navmenu_checked = 'checked="checked"'; 272 $expire_navmenu_custom_url_class = 'show_custom_url'; 273 } 274 ?> 275 <input type="checkbox" name="purge_varnish_expire[navmenu_custom_url]" value="custom_url" <?php print $expire_navmenu_checked; ?> class="ck_custom_url" /> <label><?php esc_html_e('Custom URLs'); ?></label> <br /> 276 <span class="desc"><?php esc_html_e('Expire user-defined custom urls.'); ?></span><br /> 277 <div class="custom_url <?php print $expire_navmenu_custom_url_class; ?>"> 278 <textarea rows="3" cols="70" name="purge_varnish_expire[navmenu_custom_urls]" class="input_custom_urls"><?php print $expire_navmenu_custom_urls; ?></textarea> 279 </div> 280 </p> 281 </td> 282 </tr> 283 </tbody> 284 </table> 285 </div> 286 287 <div id="switch_theme" class="tabcontent"> 288 <h3><?php esc_html_e('Switch theme expiration'); ?></h3> 289 <table cellpadding="5"> 290 <tbody> 291 <tr> 292 <th width="20%"></th> 293 <td width="80%"> 294 <b><?php esc_html_e('Theme actions') ?></b> 295 <p> 296 <input type="checkbox" name="purge_varnish_action[theme_switch]" value="after_switch_theme" <?php 297 if ($switch_theme == 'after_switch_theme') { 298 print 'checked="checked"'; 299 } 300 ?> /> <label><?php esc_html_e('switch theme'); ?></label> <br /><span class="desc"><?php esc_html_e('Trigger when theme is switched.'); ?></span><br /> 301 </p> 302 </td> 303 </tr> 304 <tr> 305 <th> </th> 306 <td> 307 <b><?php esc_html_e('What URLs should be expired when theme switch action is triggered?') ?></b> 308 <p> 309 <input type="checkbox" name="purge_varnish_expire[wp_theme_front_page]" value="front_page" <?php 310 if ($expire_wp_theme_front_page == 'front_page') { 311 print 'checked="checked"'; 312 } 313 ?> /> <label><?php esc_html_e('Front page') ?></label> <br /><span class="desc"><?php esc_html_e('Expire url of the site front page'); ?></span><br /> 314 <input type="checkbox" name="purge_varnish_expire[wp_theme_purge_all]" value="purge_all" <?php 315 if ($expire_wp_theme_purge_all == 'purge_all') { 316 print 'checked="checked"'; 317 } 318 ?> class="ck_custom_url" /> <label>All varnish cache</label> <br /> <span class="desc"><?php esc_html_e('Expire/Purge all varnish cache'); ?></span><br /> 319 320 <?php 321 $expire_wp_theme_custom_url_class = 'hide_custom_url'; 322 $expire_wp_theme_checked = ''; 323 if ($expire_wp_theme_custom_url == 'custom_url') { 324 $expire_wp_theme_checked = 'checked="checked"'; 325 $expire_wp_theme_custom_url_class = 'show_custom_url'; 326 } 327 ?> 328 <input type="checkbox" name="purge_varnish_expire[wp_theme_custom_url]" value="custom_url" <?php print $expire_wp_theme_checked; ?> class="ck_custom_url" /> <label><?php esc_html_e('Custom URLs'); ?></label> <br /> 329 <span class="desc"><?php esc_html_e('Expire user-defined custom urls.'); ?></span><br /> 330 <div class="custom_url <?php print $expire_wp_theme_custom_url_class; ?>"> 331 <textarea rows="3" cols="70" name="purge_varnish_expire[wp_theme_custom_urls]" class="input_custom_urls"><?php print $expire_wp_theme_custom_urls; ?></textarea> 332 </div> 333 </p> 334 </td> 335 </tr> 336 </tbody> 337 </table> 338 </div> 339 <table cellpadding="5"> 340 <tr> 341 <th width="20%"></th> 342 <td> 343 <?php wp_nonce_field('pvEsetting'); ?> 344 <input type="submit" value="Save Configurations" name="save_configurations" /> 345 </td> 346 </tr> 347 </table> 348 </form> 349 </div> 350 </div> -
purge-varnish/trunk/js/purge_varnish.js
r1624809 r1906488 14 14 } 15 15 }); 16 17 16 18 17 }); -
purge-varnish/trunk/readme.txt
r1758930 r1906488 5 5 Requires at least: 4.0 6 6 Tested up to: 4.8.1 7 Stable tag: 1.0. 77 Stable tag: 1.0.8 8 8 License: GPLv2 or later 9 9 … … 108 108 == ChangeLog == 109 109 110 = 1.0.8 = 111 112 Fix: 113 1. Wrong number of arguments’ errors filling up logs. 114 2. Purge Varnish cache on comment post/update on published post. 110 115 111 116 = 1.0.7 =
Note: See TracChangeset
for help on using the changeset viewer.