settings
3 months ago
globals.php
2 years ago
import-export.php
2 years ago
notices.php
1 year ago
welcome.php
2 years ago
globals.php
47 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Add values to global variables |
| 5 | * |
| 6 | * |
| 7 | * @copyright Copyright (c) 2017, Jeffrey Carandang |
| 8 | * @since 3.3.1 |
| 9 | */ |
| 10 | |
| 11 | if (!function_exists('widgetopts_register_globals')) { |
| 12 | add_action('init', 'widgetopts_register_globals', 90); |
| 13 | function widgetopts_register_globals() |
| 14 | { |
| 15 | global $widgetopts_taxonomies, $widgetopts_types, $widgetopts_categories; |
| 16 | |
| 17 | $widgetopts_taxonomies = widgetopts_global_taxonomies(); |
| 18 | $widgetopts_types = widgetopts_global_types(); |
| 19 | $widgetopts_categories = widgetopts_global_categories(); |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | if (!function_exists('widgetopts_removed_widget_cached')) { |
| 24 | add_action('admin_init', 'widgetopts_removed_widget_cached', 90); |
| 25 | function widgetopts_removed_widget_cached() |
| 26 | { |
| 27 | $cached = get_option('widgetopts_editor_cached'); |
| 28 | if ($cached) { |
| 29 | $_cached = json_decode($cached, true); |
| 30 | if (isset($_cached) && !empty($_cached)) { |
| 31 | $_cached = (array) $_cached; |
| 32 | if (is_iterable($_cached)) { |
| 33 | foreach ($_cached as $key => $c) { |
| 34 | if (!empty($c['widgetopts_expiry'])) { |
| 35 | if (time() > strtotime($c['widgetopts_expiry'])) { |
| 36 | unset($_cached[$key]); |
| 37 | } |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | update_option('widgetopts_editor_cached', json_encode($_cached)); |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | } |
| 47 |