Changeset 3366878
- Timestamp:
- 09/24/2025 04:55:58 AM (5 months ago)
- Location:
- ip2location-redirection/trunk
- Files:
-
- 3 edited
-
assets/js/settings.js (modified) (1 diff)
-
ip2location-redirection.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ip2location-redirection/trunk/assets/js/settings.js
r3316642 r3366878 76 76 }, 77 77 }); 78 79 $('#btn_clear_cache').on('click', function (e) { 80 e.preventDefault(); 81 82 var $form = $('<form method="post">') 83 .html('<input type="hidden" name="cache_nonce" value="' + $('#cache_nonce').val() + '">'); 84 85 $('body').append($form); 86 $form.submit(); 87 }); 78 88 }); -
ip2location-redirection/trunk/ip2location-redirection.php
r3335592 r3366878 4 4 * Plugin URI: https://ip2location.com/resources/wordpress-ip2location-redirection 5 5 * Description: Redirect visitors by their country. 6 * Version: 1.3 4.36 * Version: 1.35.0 7 7 * Requires PHP: 7.4 8 8 * Author: IP2Location … … 1355 1355 } 1356 1356 1357 if ($this->post('cache_nonce')) { 1358 check_admin_referer('cache', 'cache_nonce'); 1359 1360 $this->cache_flush(); 1361 1362 $settings_status = ' 1363 <div class="updated"> 1364 <p>' . __('All cache has been flushed.', 'ip2location-redirection') . '</p> 1365 </div>'; 1366 } 1367 1357 1368 if ($this->post('submit')) { 1358 1369 check_admin_referer('save_settings'); … … 1670 1681 </p> 1671 1682 <input type="hidden" id="restore_nonce" value="' . wp_create_nonce('restore') . '"> 1683 </td> 1684 </tr> 1685 <tr> 1686 <th scope="row"> 1687 <label>' . __('Cache', 'ip2location-redirection') . '</label> 1688 </th> 1689 <td> 1690 <button id="btn_clear_cache" type="button" class="button button-danger">' . __('Clear Cache', 'ip2location-redirection') . ' (' . $this->display_bytes($this->cache_size()) . ')</button> 1691 <p class="description"> 1692 ' . __('Clear all cached data.', 'ip2location-redirection') . ' 1693 </p> 1694 <input type="hidden" id="cache_nonce" value="' . wp_create_nonce('cache') . '"> 1672 1695 </td> 1673 1696 </tr> … … 2930 2953 } 2931 2954 2955 private function cache_size() 2956 { 2957 $size = 0; 2958 2959 $files = scandir(IP2LOCATION_DIR . 'caches'); 2960 2961 foreach ($files as $file) { 2962 if (substr($file, -5) == '.json') { 2963 $size += filesize(IP2LOCATION_DIR . 'caches' . \DIRECTORY_SEPARATOR . $file); 2964 } 2965 } 2966 2967 return $size; 2968 } 2969 2932 2970 private function cache_flush() 2933 2971 { … … 3043 3081 return $_SERVER['HTTP_HOST'] ?? ''; 3044 3082 } 3083 3084 private function display_bytes($bytes) 3085 { 3086 $ext = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; 3087 3088 $index = 0; 3089 for (; $bytes > 1024; ++$index) { 3090 $bytes /= 1024; 3091 } 3092 3093 return number_format((float) $bytes, 0, '.', ',') . ' ' . $ext[$index]; 3094 } 3045 3095 } -
ip2location-redirection/trunk/readme.txt
r3335592 r3366878 5 5 Requires at least: 4.6 6 6 Tested up to: 6.8 7 Stable tag: 1.3 4.37 Stable tag: 1.35.0 8 8 9 9 Redirects visitors to a blog page or a predefined URL based on their country and region geolocated using IP address. … … 63 63 64 64 == Changelog == 65 * 1.35.0 Added ability to flush cached data. 65 66 * 1.34.3 Restored option to skip bots & crawlers. 66 67 * 1.34.2 Fixed PHP warning when cronjobs are running.
Note: See TracChangeset
for help on using the changeset viewer.