| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
/** |
| 5 |
* Ultimate Store Kit widget filters |
| 6 |
* @since 3.0.0 |
| 7 |
*/ |
| 8 |
|
| 9 |
use UltimateStoreKit\Admin\ModuleService; |
| 10 |
|
| 11 |
|
| 12 |
if (!defined('ABSPATH')) exit; // Exit if accessed directly |
| 13 |
|
| 14 |
// Settings Filters |
| 15 |
if (!function_exists('ultimate_store_kit_is_dashboard_enabled')) { |
| 16 |
function ultimate_store_kit_is_dashboard_enabled() { |
| 17 |
return apply_filters('ultimatestorekit/settings/dashboard', true); |
| 18 |
} |
| 19 |
} |
| 20 |
|
| 21 |
if (!function_exists('ultimate_store_kit_is_widget_enabled')) { |
| 22 |
function ultimate_store_kit_is_widget_enabled($widget_id, $options = []) { |
| 23 |
|
| 24 |
if (!$options) { |
| 25 |
$options = get_option('ultimate_store_kit_active_modules', []); |
| 26 |
} |
| 27 |
|
| 28 |
if (ModuleService::is_module_active($widget_id, $options)) { |
| 29 |
$widget_id = str_replace('-', '_', $widget_id); |
| 30 |
return apply_filters("ultimatestorekit/wc_widget/{$widget_id}", true); |
| 31 |
} |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
if (!function_exists('ultimate_store_kit_is_general_widget_enabled')) { |
| 36 |
function ultimate_store_kit_is_general_widget_enabled($widget_id, $options = []) { |
| 37 |
|
| 38 |
if (!$options) { |
| 39 |
$options = get_option('ultimate_store_kit_general_modules', []); |
| 40 |
} |
| 41 |
|
| 42 |
if (ModuleService::is_module_active($widget_id, $options)) { |
| 43 |
$widget_id = str_replace('-', '_', $widget_id); |
| 44 |
return apply_filters("ultimatestorekit/general_widget/{$widget_id}", true); |
| 45 |
} |
| 46 |
} |
| 47 |
} |
| 48 |
|
| 49 |
if (!function_exists('ultimate_store_kit_is_edd_enabled')) { |
| 50 |
function ultimate_store_kit_is_edd_enabled($widget_id, $options = []) { |
| 51 |
|
| 52 |
if (!$options) { |
| 53 |
$options = get_option('ultimate_store_kit_edd_modules', []); |
| 54 |
} |
| 55 |
|
| 56 |
if (ModuleService::is_module_active($widget_id, $options)) { |
| 57 |
$widget_id = str_replace('-', '_', $widget_id); |
| 58 |
return apply_filters("ultimatestorekit/edd_widget/{$widget_id}", true); |
| 59 |
} |
| 60 |
} |
| 61 |
} |
| 62 |
|
| 63 |
if (!function_exists('ultimate_store_kit_is_asset_optimization_enabled')) { |
| 64 |
function ultimate_store_kit_is_asset_optimization_enabled() { |
| 65 |
$asset_manager = ultimate_store_kit_option('asset-manager', 'ultimate_store_kit_other_settings', 'off'); |
| 66 |
if ($asset_manager == 'on') { |
| 67 |
return apply_filters("ultimatestorekit/optimization/asset_manager", true); |
| 68 |
} |
| 69 |
} |
| 70 |
} |
| 71 |
|