Changeset 2512427
- Timestamp:
- 04/09/2021 09:29:46 PM (5 years ago)
- File:
-
- 1 edited
-
cynderhost/trunk/cynderhost.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cynderhost/trunk/cynderhost.php
r2512425 r2512427 9 9 * Plugin URI: https://cynderhost.com 10 10 * Description: Provides an easy interface to clear the CynderHost CDN cache, both automatically and programmatically. 11 * Version: 1.4. 811 * Version: 1.4.9 12 12 * Author: CynderHost 13 13 * Author URI: https://profiles.wordpress.org/cynderhost/ … … 24 24 25 25 //Define version 26 define('CYNDERHOST_VERSION', '1.4. 8');26 define('CYNDERHOST_VERSION', '1.4.9'); 27 27 28 28 /** … … 116 116 $api_key = $cynderhost_cdn_settings_options['api_key_0']; 117 117 $hostname = $cynderhost_cdn_settings_options['hostname_1']; 118 //cdn cache multiple urls119 $response = wp_remote_post("https://api.cynderhost.com/high-performance/cache/cdn/purge-multiple/", array(120 'method' => 'POST',121 'timeout' => 0.12,122 'redirection' => 5,123 'blocking' => false,124 'body' => array(125 'API' => "$api_key",126 'URLS' => json_encode($stripped_urls)127 )128 ));129 118 //server cache multiple url 130 119 $response = wp_remote_post("https://api.cynderhost.com/high-performance/cache/local/purge-multiple/", array( … … 139 128 ) 140 129 )); 141 //we don't know the response anyways 142 143 return true; 144 } 145 146 /** 147 * Purge CynderHost Server + CDN Cache (Single URL) 148 * @params (string) url - url of page to purge 149 * @return bool - returns true 150 */ 151 function purge_cynderhost_single($url) 152 { 153 //strip http added automatically 154 $url = preg_replace('#^https?://#', '', $url); 155 $cynderhost_cdn_settings_options = get_option('cynderhost_cdn_settings_option_name'); // Array of All Options 156 $api_key = $cynderhost_cdn_settings_options['api_key_0']; 157 $hostname = $cynderhost_cdn_settings_options['hostname_1']; 158 $stripped_urls = array($url); 159 //server cache single url 130 131 //cdn cache multiple urls 160 132 $response = wp_remote_post("https://api.cynderhost.com/high-performance/cache/cdn/purge-multiple/", array( 161 133 'method' => 'POST', … … 168 140 ) 169 141 )); 170 //server cache multiple url 142 //we don't know the response anyways 143 144 return true; 145 } 146 147 /** 148 * Purge CynderHost Server + CDN Cache (Single URL) 149 * @params (string) url - url of page to purge 150 * @return bool - returns true 151 */ 152 function purge_cynderhost_single($url) 153 { 154 //strip http added automatically 155 $url = preg_replace('#^https?://#', '', $url); 156 $cynderhost_cdn_settings_options = get_option('cynderhost_cdn_settings_option_name'); // Array of All Options 157 $api_key = $cynderhost_cdn_settings_options['api_key_0']; 158 $hostname = $cynderhost_cdn_settings_options['hostname_1']; 159 $stripped_urls = array($url); 160 //server cache single url 171 161 $response = wp_remote_post("https://api.cynderhost.com/high-performance/cache/local/purge-multiple/", array( 172 162 'method' => 'POST', … … 177 167 'API' => "$api_key", 178 168 "HOST" => $hostname, 169 'URLS' => json_encode($stripped_urls) 170 ) 171 )); 172 //cdn cache single url 173 $response = wp_remote_post("https://api.cynderhost.com/high-performance/cache/cdn/purge-multiple/", array( 174 'method' => 'POST', 175 'timeout' => 0.12, 176 'redirection' => 5, 177 'blocking' => false, 178 'body' => array( 179 'API' => "$api_key", 179 180 'URLS' => json_encode($stripped_urls) 180 181 )
Note: See TracChangeset
for help on using the changeset viewer.