Plugin Directory


Ignore:
Timestamp:
11/08/2026 11:10:57 AM (less than one hour ago)
Author:
mohammaadfarid
Message:

Update to version 4.1.0 from GitHub

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ultimate-store-kit/trunk/includes/API/Settings.php

    r3504294 r3790891  
    3838                'callback' => [$this, 'save_settings'],
    3939            ],
     40            [
     41                'path'     => '/optimization/regenerate',
     42                'methods'  => 'POST',
     43                'callback' => [$this, 'regenerate_combined_assets'],
     44            ],
    4045        ];
    4146    }
    … …  
    6065
    6166        $sanitized = $this->sanitize_settings($settings);
     67
     68        // ultimate_store_kit_other_settings is shared: every module page keeps its
     69        // switch there, and Pro switches modules through its own route. A page
     70        // posts only what it knows, so merge instead of replacing, or saving one
     71        // page would switch off modules turned on elsewhere since it loaded.
     72        if ('ultimate_store_kit_other_settings' === $section) {
     73            $stored    = get_option($section, []);
     74            $sanitized = array_merge(is_array($stored) ? $stored : [], $sanitized);
     75        }
     76
    6277        update_option($section, $sanitized);
    6378
    6479        return $this->success(['message' => __('Settings saved successfully.', 'ultimate-store-kit')]);
    6580    }
     81
     82    /**
     83     * Delete the combined asset files; pages rebuild them on their next view.
     84     */
     85    public function regenerate_combined_assets(\WP_REST_Request $request) {
     86        if (class_exists('\UltimateStoreKit\Includes\Asset_Combiner')) {
     87            \UltimateStoreKit\Includes\Asset_Combiner::flush();
     88        }
     89
     90        return $this->success([
     91            'message' => __('Combined files cleared. Pages rebuild them on their next visit.', 'ultimate-store-kit'),
     92            'stats'   => class_exists('\UltimateStoreKit\Includes\Asset_Combiner') ? \UltimateStoreKit\Includes\Asset_Combiner::stats() : null,
     93        ]);
     94    }
    6695}
Note: See TracChangeset for help on using the changeset viewer.