Changeset 810453
- Timestamp:
- 11/25/2013 09:39:10 PM (12 years ago)
- Location:
- cloudflare-cache-purge/trunk
- Files:
-
- 3 edited
-
cloudflare_cachepurge.php (modified) (2 diffs)
-
lib/ccpurge.class.php (modified) (6 diffs)
-
readme.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
cloudflare-cache-purge/trunk/cloudflare_cachepurge.php
r810444 r810453 4 4 Plugin Name: Cloudflare Cache Purge 5 5 Description: API Integration with Cloudflare to purge your cache 6 Version: 1.0. 26 Version: 1.0.3 7 7 Author: Bryan Shanaver @ fiftyandfifty.org 8 8 Author URI: https://www.fiftyandfifty.org/ … … 17 17 */ 18 18 19 define('CCPURGE_VERSION', '1.0. 2');19 define('CCPURGE_VERSION', '1.0.3'); 20 20 21 21 define('CCPURGE_PLUGIN_URL', plugin_dir_url( __FILE__ )); -
cloudflare-cache-purge/trunk/lib/ccpurge.class.php
r690167 r810453 17 17 18 18 class CCPURGE_API { 19 19 20 20 var $ccpurge_endpoint = "https://www.cloudflare.com/api_json.html"; 21 21 var $ccpurge_methods = array(); 22 var $ccpurge_options = array(); 22 var $ccpurge_options = array(); 23 23 var $ccpurge_url = ''; 24 24 var $ccpurge_suppress_debug = false; 25 25 26 26 function __construct() { 27 27 $this->ccpurge_options = get_option('ccpurge_options'); 28 28 isset($this->ccpurge_options['auto_purge']) || $this->ccpurge_options['auto_purge'] = false; 29 if( $this->ccpurge_options['account'] == ''){29 if( empty($this->ccpurge_options['account']) ){ 30 30 $this->ccpurge_options['account'] = $this->get_wordpress_domain(); 31 31 update_option('ccpurge_options', $this->ccpurge_options); … … 34 34 $this->wordpress_upload_dir = wp_upload_dir(); 35 35 } 36 36 37 37 function build_api_calls(){ 38 38 $tkn = isset($this->ccpurge_options['token']) ? $this->ccpurge_options['token'] : null; … … 55 55 ); 56 56 } 57 57 58 58 function return_json_success($data='') { 59 59 print json_encode( array("success" => 'true', "data" => $data) ); 60 } 61 60 } 61 62 62 function return_json_error($error='') { 63 63 print json_encode( array("success" => 'false', 'error' => array("message" => $error)) ); 64 } 65 64 } 65 66 66 function make_api_request($api_method, $extra_post_variables = null){ 67 67 $headers = ''; … … 71 71 return; 72 72 } 73 73 74 74 if( is_array($extra_post_variables) ){ 75 75 $post_variables = array_merge( $this->api_methods[$api_method], $extra_post_variables ); … … 78 78 $post_variables = $this->api_methods[$api_method]; 79 79 } 80 80 81 81 if( isset($this->ccpurge_options['console_calls']) && !$this->ccpurge_suppress_debug ){ 82 82 ccpurge_transaction_logging("\n" . "api url: " . $this->ccpurge_endpoint . "\n" . "api post args: " . print_r($post_variables, true) . "\n", 'print_debug'); … … 84 84 85 85 $results = wp_remote_post($this->ccpurge_endpoint, array( 'headers' => $headers, 'body' => $post_variables) ); 86 86 87 87 if( isset($this->ccpurge_options['console_details']) && !$this->ccpurge_suppress_debug ){ 88 88 print_r($results); 89 89 } 90 90 91 91 if( is_object($results) ){ 92 92 if( get_class($results) == 'WP_Error' ){ 93 93 $this->return_json_error('Wordpress Error - ' . json_encode($results)); 94 94 die(); 95 } 95 } 96 96 } 97 97 98 98 if($results['response']['code'] != '200'){ 99 99 $this->return_json_error($results['response']['message']); 100 100 die(); 101 101 } 102 102 103 103 return json_decode($results['body']); 104 104 } -
cloudflare-cache-purge/trunk/readme.txt
r810444 r810453 47 47 * Multisite domain mapping support - thanks Ed Cooper 48 48 49 = 1.0.3 50 * Small php notice fix 51 49 52 == Upgrade Notice == 50 53
Note: See TracChangeset
for help on using the changeset viewer.