Changeset 3047640
- Timestamp:
- 03/08/2024 07:25:52 AM (2 years ago)
- Location:
- wgpwpp/trunk
- Files:
-
- 10 edited
-
README.txt (modified) (2 diffs)
-
admin/class-wgpwpp-cache-setting.php (modified) (1 diff)
-
admin/class-wgpwpp-verification.php (modified) (2 diffs)
-
includes/class-wgpwpp-notify.php (modified) (2 diffs)
-
includes/class-wgpwpp-rest-api.php (modified) (8 diffs)
-
includes/class-wgpwpp-wp-cache.php (modified) (1 diff)
-
includes/class-wgpwpp-wpinfo.php (modified) (2 diffs)
-
includes/wpcache/advanced-cache.php (modified) (1 diff)
-
loader.php (modified) (1 diff)
-
wgpwpp.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wgpwpp/trunk/README.txt
r3046829 r3047640 5 5 Requires at least: 5.6 6 6 Tested up to: 6.4 7 Stable tag: 1.1. 27 Stable tag: 1.1.3 8 8 Requires PHP: 7.4 9 9 License: GPLv2 or later … … 112 112 113 113 == Changelog == 114 = v1.1.3 = 115 * Page caching improvements 116 * REST API improvements 117 114 118 = v1.1.2 = 115 119 * Page caching improvements -
wgpwpp/trunk/admin/class-wgpwpp-cache-setting.php
r3046829 r3047640 104 104 $this->plugin->admin_section->notices->warning($text)->render(); 105 105 } 106 elseif ($cache_plugins_detection['advanced-cach e'])106 elseif ($cache_plugins_detection['advanced-caching']) 107 107 { 108 108 $text = __('It seems there is activated another page caching plugin. We strongly recommend to deactivate all other page caching plugins before activating our page caching to avoid incompatibilities.', 'wgpwpp'); -
wgpwpp/trunk/admin/class-wgpwpp-verification.php
r3045994 r3047640 23 23 24 24 /** 25 * Plugin instance26 *27 * @since 1.0.028 * @var Wgpwpp29 */30 private Wgpwpp $plugin;31 32 /**33 25 * Authorization controller instance 34 26 * … … 48 40 public function __construct(Wgpwpp $plugin, Wgpwpp_Authorization $authorization) 49 41 { 50 $this->plugin = $plugin;42 parent::__construct($plugin); 51 43 $this->authorization = $authorization; 52 44 -
wgpwpp/trunk/includes/class-wgpwpp-notify.php
r3045994 r3047640 20 20 const SCOPE = 'wgp_wp_notify'; 21 21 22 /**23 * Main plugin class24 *25 * @since 1.1.026 * @var Wgpwpp27 */28 private Wgpwpp $plugin;29 30 22 31 23 /** … … 38 30 public function __construct(Wgpwpp $plugin) 39 31 { 40 $this->plugin = $plugin;32 parent::__construct($plugin); 41 33 $this->define_hooks(); 42 34 } -
wgpwpp/trunk/includes/class-wgpwpp-rest-api.php
r3045994 r3047640 38 38 const AUTHORIZATION_SERVER_TIMEOUT = 5; 39 39 40 /** 41 * Main plugin class 42 * 43 * @since 1.1.3 44 * @var Wgpwpp 45 */ 46 protected Wgpwpp $plugin; 47 48 49 /** 50 * Constructor 51 * 52 * @since 1.1.3 53 * @param Wgpwpp $plugin 54 */ 55 public function __construct(Wgpwpp $plugin) 56 { 57 $this->plugin = $plugin; 58 } 59 40 60 41 61 /** … … 53 73 54 74 if (is_wp_error($response) || wp_remote_retrieve_response_code($response) != 200) 75 { 76 $this->log('Failed to get allowed IP address list', $response, Wgpwpp_Log::TYPE_ERROR); 55 77 return NULL; 78 } 56 79 57 80 $ips = json_decode($response['body']); 58 81 if (!$ips) 82 { 83 $this->log('Failed to get allowed IP address list', $response, Wgpwpp_Log::TYPE_ERROR); 59 84 return NULL; 85 } 60 86 61 87 return $ips; … … 78 104 $server_ip = isset($_SERVER['REMOTE_ADDR']) ? sanitize_text_field($_SERVER['REMOTE_ADDR']) : NULL; 79 105 if (!$server_ip) 106 { 107 $this->log('Failed to get origin server IP address', $_SERVER, Wgpwpp_Log::TYPE_ERROR); 80 108 throw new Exception("Failed to get origin server IP address", 2); 109 } 81 110 82 111 $is_ip_allowed = false; … … 98 127 99 128 if (!$is_ip_allowed) 129 { 130 $this->log('Not allowed origin IP address. Unauthorized request.', $server_ip, Wgpwpp_Log::TYPE_ERROR); 100 131 throw new Exception("Not allowed origin IP address: ".$server_ip, 3); 132 } 101 133 } 102 134 … … 113 145 $headers = $request->get_headers(); 114 146 if (!isset($headers['authorization']) || !is_array($headers['authorization']) || !count($headers['authorization'])) 147 { 148 $this->log('Missing authorization header. Unauthorized request.', $request, Wgpwpp_Log::TYPE_ERROR); 115 149 return NULL; 150 } 116 151 117 152 $authorization = current($headers['authorization']); … … 151 186 // chyba API volání 152 187 if (is_wp_error($response) || wp_remote_retrieve_response_code($response) != 200) 188 { 189 $this->log('Failed to verify authorization token. Unable to contact authorization server.', $response, Wgpwpp_Log::TYPE_ERROR); 153 190 throw new Exception("Authorization server connection failure", 1); 191 } 154 192 155 193 $response_data = json_decode($response['body'], true); … … 158 196 $msg = $response_data['msg'] ?? ''; 159 197 $msg = $response_data['data']['error_description'] ?? $msg; 198 $this->log('Invalid authorization token.', $response_data, Wgpwpp_Log::TYPE_ERROR); 160 199 throw new Exception('Invalid token. '.$msg, 2); 161 200 } … … 207 246 return true; 208 247 } 248 249 250 /** 251 * Log for WP REST API 252 * 253 * @since 1.1.3 254 * @param string $msg 255 * @param WP_Error|mixed $data 256 * @param string $type 257 * @return void 258 */ 259 private function log(string $msg, $data = NULL, string $type = Wgpwpp_Log::TYPE_INFO) 260 { 261 $msg = "\tWP REST API :: ".$msg; 262 $this->plugin->log->write($msg, $data, $type); 263 } 209 264 } -
wgpwpp/trunk/includes/class-wgpwpp-wp-cache.php
r3046829 r3047640 804 804 } 805 805 806 return ['advanced-caching' => $advanced_caching, 'wp_cache_constant' => $wp_cache_constant, 'known-cache-plugins' => $known_cache_plugins,]; 806 return [ 807 'advanced-caching' => $advanced_caching, 808 'wp_cache_constant' => $wp_cache_constant, 809 'known-cache-plugins' => $known_cache_plugins, 810 ]; 807 811 } 808 812 -
wgpwpp/trunk/includes/class-wgpwpp-wpinfo.php
r3045994 r3047640 20 20 const SCOPE = 'wgp-wp-info'; 21 21 22 /**23 * Plugin main class24 * @var Wgpwpp25 */26 private $plugin;27 28 22 29 23 /** … … 35 29 public function __construct(Wgpwpp $plugin) 36 30 { 37 $this->plugin = $plugin; 38 31 parent::__construct($plugin); 39 32 $this->define_hooks(); 40 33 } -
wgpwpp/trunk/includes/wpcache/advanced-cache.php
r3045994 r3047640 13 13 } 14 14 15 if (!file_exists($filename)) 16 return; 17 15 18 include_once( $filename ); -
wgpwpp/trunk/loader.php
r3046829 r3047640 11 11 * Rename this for your plugin and update it as you release new versions. 12 12 */ 13 const WGPWPP_VERSION = '1.1. 2';13 const WGPWPP_VERSION = '1.1.3'; 14 14 const WGPWPP_PLUGIN_NAME = 'wgpwpp'; 15 15 const WGPWPP_PLUGIN_FILE = __FILE__; -
wgpwpp/trunk/wgpwpp.php
r3046829 r3047640 17 17 * Plugin URI: https://www.wedos.com/protection/#wgp-plugin 18 18 * Description: Activate and use the WEDOS Global service. WEDOS Global brings global security for your WordPress website, ensures low latency and minimal loading time. 19 * Version: 1.1. 219 * Version: 1.1.3 20 20 * Requires at least: 5.6 21 21 * Requires PHP: 7.4
Note: See TracChangeset
for help on using the changeset viewer.