Changeset 3366875
- Timestamp:
- 09/24/2025 04:55:12 AM (6 months ago)
- Location:
- ip2location-country-blocker/trunk
- Files:
-
- 3 edited
-
assets/js/settings.js (modified) (1 diff)
-
ip2location-country-blocker.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ip2location-country-blocker/trunk/assets/js/settings.js
r3316128 r3366875 279 279 }); 280 280 281 $('#btn_clear_cache').on('click', function (e) { 282 e.preventDefault(); 283 284 var $form = $('<form method="post">') 285 .html('<input type="hidden" name="cache_nonce" value="' + $('#cache_nonce').val() + '">'); 286 287 $('body').append($form); 288 $form.submit(); 289 }); 281 290 }); -
ip2location-country-blocker/trunk/ip2location-country-blocker.php
r3348463 r3366875 5 5 * Plugin URI: https://ip2location.com/resources/wordpress-ip2location-country-blocker 6 6 * Description: Block visitors from accessing your website or admin area by their country. 7 * Version: 2. 39.57 * Version: 2.40.0 8 8 * Requires PHP: 7.4 9 9 * Author: IP2Location … … 1203 1203 if (!in_array($real_ip_header, array_values($real_ip_headers))) { 1204 1204 $real_ip_header = ''; 1205 } 1206 1207 if ($this->post('cache_nonce')) { 1208 check_admin_referer('cache', 'cache_nonce'); 1209 1210 $this->cache_flush(); 1211 1212 $settings_status = ' 1213 <div class="updated"> 1214 <p>' . __('All cache has been flushed.', 'ip2location-country-blocker') . '</p> 1215 </div>'; 1205 1216 } 1206 1217 … … 1702 1713 </td> 1703 1714 </tr> 1715 <tr> 1716 <th scope="row"> 1717 <label>' . __('Cache', 'ip2location-country-blocker') . '</label> 1718 </th> 1719 <td> 1720 <button id="btn_clear_cache" type="button" class="button button-danger">' . __('Clear Cache', 'ip2location-country-blocker') . ' (' . $this->display_bytes($this->cache_size()) . ')</button> 1721 <p class="description"> 1722 ' . __('Clear all cached data.', 'ip2location-country-blocker') . ' 1723 </p> 1724 <input type="hidden" id="cache_nonce" value="' . wp_create_nonce('cache') . '"> 1725 </td> 1726 </tr> 1704 1727 </table> 1705 1728 <p class="submit"> … … 3770 3793 } 3771 3794 3795 private function cache_size() 3796 { 3797 $size = 0; 3798 3799 $files = scandir(IP2LOCATION_DIR . 'caches'); 3800 3801 foreach ($files as $file) { 3802 if (substr($file, -5) == '.json') { 3803 $size += filesize(IP2LOCATION_DIR . 'caches' . \DIRECTORY_SEPARATOR . $file); 3804 } 3805 } 3806 3807 return $size; 3808 } 3809 3772 3810 private function cache_flush() 3773 3811 { … … 3943 3981 return false; 3944 3982 } 3983 3984 private function display_bytes($bytes) 3985 { 3986 $ext = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; 3987 3988 $index = 0; 3989 for (; $bytes > 1024; ++$index) { 3990 $bytes /= 1024; 3991 } 3992 3993 return number_format((float) $bytes, 0, '.', ',') . ' ' . $ext[$index]; 3994 } 3945 3995 } -
ip2location-country-blocker/trunk/readme.txt
r3348463 r3366875 6 6 Requires at least: 4.6 7 7 Tested up to: 6.8 8 Stable tag: 2. 39.58 Stable tag: 2.40.0 9 9 10 10 Blocks unwanted visitors from accessing your frontend (blog pages) or backend (admin area) by countries or proxy servers. … … 92 92 93 93 == Changelog == 94 * 2.40.0 Added ability to flush cached data. 94 95 * 2.39.5 Fixed issue saving backend error page. 95 96 * 2.39.4 Removed internal table updates.
Note: See TracChangeset
for help on using the changeset viewer.