| @@ -102,8 +102,13 @@ | ||
| 102 | 102 | add_action('admin_init', [$this, 'jltma_add_redirect_hook']); |
| 103 | 103 | |
| 104 | 104 | // Run pending upgrade migrations (e.g. legacy option key migration) |
| 105 | 105 | add_action('admin_init', [$this, 'jltma_maybe_run_upgrades'], 5); |
| 106 | + | |
| 107 | + // One-time removal of the local template-library mirror under | |
| 108 | + // uploads/master_addons. Self-gates: never runs on the library | |
| 109 | + // server (see Local_Cache_Cleanup::allowed()). | |
| 110 | + \MasterAddons\Inc\Classes\Local_Cache_Cleanup::get_instance(); | |
| 106 | 111 | } |
| 107 | 112 | |
| 108 | 113 | /** |
| 109 | 114 | * Stops WordPress from turning a paged singular request into a 404. |
| @@ -201,8 +206,17 @@ | ||
| 201 | 206 | self::activated_extensions(); |
| 202 | 207 | self::activated_third_party_plugins(); |
| 203 | 208 | self::activated_icons_library(); |
| 204 | 209 | |
| 210 | + // The template library and kits are served from the remote API, so a | |
| 211 | + // client site has no reason to carry a copy of them on its own disk. | |
| 212 | + // Reactivating is the thing site owners do when they expect the | |
| 213 | + // plugin to tidy up, so the mirror goes now rather than a minute | |
| 214 | + // later on a cron that may never fire. | |
| 215 | + if (class_exists('\\MasterAddons\\Inc\\Classes\\Local_Cache_Cleanup')) { | |
| 216 | + \MasterAddons\Inc\Classes\Local_Cache_Cleanup::purge_now(); | |
| 217 | + } | |
| 218 | + | |
| 205 | 219 | // Current Master Addons Version |
| 206 | 220 | $current_version = get_option('_master_addons_version', null); |
| 207 | 221 | if (is_null($current_version)) { |
| 208 | 222 | update_option('_master_addons_version', JLTMA_VER); |
| @@ -399,17 +413,17 @@ | ||
| 399 | 413 | } |
| 400 | 414 | } |
| 401 | 415 | |
| 402 | 416 | // Handle Widgets subnamespace (Widgets Library) |
| 403 | - // if (0 === strpos($templates_class, 'Widgets\\')) { | |
| 404 | - // $widgets_class = str_replace('Widgets\\', '', $templates_class); | |
| 405 | - // $widgets_file_name = strtolower(preg_replace(['/([a-z])([A-Z])/', '/_/'], ['$1-$2', '-'], $widgets_class)); | |
| 406 | - // $file = JLTMA_PATH . 'inc/admin/templates/widgets/class-' . $widgets_file_name . '.php'; | |
| 407 | - // if (is_readable($file)) { | |
| 408 | - // include_once $file; | |
| 409 | - // return; | |
| 410 | - // } | |
| 411 | - // } | |
| 417 | + if (0 === strpos($templates_class, 'Widgets\\')) { | |
| 418 | + $widgets_class = str_replace('Widgets\\', '', $templates_class); | |
| 419 | + $widgets_file_name = strtolower(preg_replace(['/([a-z])([A-Z])/', '/_/'], ['$1-$2', '-'], $widgets_class)); | |
| 420 | + $file = JLTMA_PATH . 'inc/admin/templates/widgets/class-' . $widgets_file_name . '.php'; | |
| 421 | + if (is_readable($file)) { | |
| 422 | + include_once $file; | |
| 423 | + return; | |
| 424 | + } | |
| 425 | + } | |
| 412 | 426 | |
| 413 | 427 | // Handle Includes subnamespace (types, classes, sources, documents) |
| 414 | 428 | if (0 === strpos($templates_class, 'Includes\\')) { |
| 415 | 429 | $includes_class = str_replace('Includes\\', '', $templates_class); |