add-to-cart
8 months ago
additional-information
3 years ago
advanced-search
1 year ago
archive-description
3 years ago
archive-products
11 months ago
archive-result-count
2 years ago
archive-title
1 year ago
archive-view-mode
2 years ago
breadcrumbs
4 years ago
call-for-price
10 months ago
cart-table
1 year ago
cart-totals
2 years ago
checkout-coupon-form
3 years ago
checkout-form-additional
3 years ago
checkout-form-billing
2 years ago
checkout-form-login
3 years ago
checkout-form-shipping
2 years ago
checkout-payment
3 years ago
checkout-review-order
2 years ago
checkout-shipping-methods
2 years ago
cross-sells
1 year ago
deal-products
2 years ago
empty-cart-message
2 years ago
filter-orderby
2 years ago
filter-products-per-page
3 years ago
filterable-product-list
1 year ago
init
10 months ago
notice
2 years ago
product-categories
3 years ago
product-category-lists
1 year ago
product-description
2 years ago
product-excerpt
3 years ago
product-image
1 year ago
product-list
2 years ago
product-meta
2 years ago
product-price
3 years ago
product-rating
3 years ago
product-review
2 years ago
product-share
2 years ago
product-sku
3 years ago
product-stock
10 months ago
product-tabs
8 months ago
product-tags
3 years ago
product-title
2 years ago
qr-code
10 months ago
recently-viewed-products
11 months ago
related
11 months ago
return-to-shop
2 years ago
up-sells
11 months ago
view-single-product
3 years ago
lazy-cache.php
3 years ago
manifest.php
11 months ago
prod-short-code.php
2 years ago
products.php
3 years ago
shop.php
3 years ago
widget-helper.php
2 years ago
manifest.php
128 lines
| 1 | <?php |
| 2 | |
| 3 | namespace ShopEngine\Widgets; |
| 4 | |
| 5 | defined('ABSPATH') || exit; |
| 6 | |
| 7 | use ShopEngine\Core\Register\Widget_List; |
| 8 | use ShopEngine\Widgets\Init\Enqueue_Scripts; |
| 9 | use ShopEngine\Widgets\Init\Route; |
| 10 | |
| 11 | |
| 12 | class Manifest{ |
| 13 | |
| 14 | private $widget_list; |
| 15 | |
| 16 | public function init() { |
| 17 | |
| 18 | new Enqueue_Scripts(); |
| 19 | new Route(); |
| 20 | |
| 21 | $this->manifest_widgets(); |
| 22 | |
| 23 | add_action('elementor/elements/categories_registered', [$this, 'widget_categories']); |
| 24 | add_action('elementor/widgets/register', [$this, 'register_widgets']); |
| 25 | |
| 26 | add_filter('woocommerce_default_address_fields', function($fields) { |
| 27 | foreach ($fields as $key => $value) { |
| 28 | unset($fields[$key]['priority']); |
| 29 | } |
| 30 | return $fields; |
| 31 | }); |
| 32 | |
| 33 | |
| 34 | // Check if the MP3 Music Player by Sonaar plugin is active |
| 35 | |
| 36 | if(is_plugin_active('mp3-music-player-by-sonaar/sonaar-music.php')){ |
| 37 | |
| 38 | add_action('elementor/editor/init', [$this, 'category_initialize'], 0); |
| 39 | |
| 40 | } |
| 41 | |
| 42 | } |
| 43 | |
| 44 | public function category_initialize(){ |
| 45 | $elements_manager = \Elementor\Plugin::instance()->elements_manager; |
| 46 | $this->widget_categories($elements_manager); |
| 47 | } |
| 48 | public function manifest_widgets() { |
| 49 | |
| 50 | foreach(Widget_List::instance()->get_list(true, 'active') as $widget) { |
| 51 | |
| 52 | if(isset($widget['path'])){ |
| 53 | |
| 54 | if(file_exists($widget['path'] . '/' . $widget['slug'] . '-config.php')){ |
| 55 | require_once $widget['path'] . '/' . $widget['slug'] . '-config.php'; |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | if(class_exists($widget['config_class'])){ |
| 60 | $widget_config = new $widget['config_class'](); |
| 61 | |
| 62 | if($widget_config->custom_inline_css() !== false){ |
| 63 | wp_add_inline_style( 'shopengine-elementor-style', $widget_config->custom_inline_css()); |
| 64 | } |
| 65 | |
| 66 | if($widget_config->custom_inline_js() !== false){ |
| 67 | wp_add_inline_script( 'shopengine-elementor-script', $widget_config->custom_inline_css()); |
| 68 | } |
| 69 | |
| 70 | if($widget_config->custom_init() !== false){ |
| 71 | add_action('init', [$widget_config, 'custom_init']); |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | public function register_widgets() { |
| 78 | |
| 79 | foreach(Widget_List::instance()->get_list(true, 'active') as $widget) { |
| 80 | |
| 81 | if(isset($widget['path'])){ |
| 82 | |
| 83 | if(file_exists($widget['path'] . '/' . $widget['slug'] . '.php')){ |
| 84 | require_once $widget['path'] . '/' . $widget['slug'] . '.php'; |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | if(isset($widget['base_class']) && class_exists($widget['base_class'])){ |
| 89 | |
| 90 | \Elementor\Plugin::instance()->widgets_manager->register(new $widget['base_class']()); |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | public function widget_categories($elements_manager) { |
| 96 | |
| 97 | $elements_manager->add_category('shopengine-general', [ |
| 98 | 'title' => esc_html__('ShopEngine General', 'shopengine'), |
| 99 | 'icon' => 'fa fa-plug', |
| 100 | ]); |
| 101 | $elements_manager->add_category('shopengine-single', [ |
| 102 | 'title' => esc_html__('ShopEngine Single Product', 'shopengine'), |
| 103 | 'icon' => 'fa fa-plug', |
| 104 | ]); |
| 105 | $elements_manager->add_category('shopengine-cart', [ |
| 106 | 'title' => esc_html__('ShopEngine Cart', 'shopengine'), |
| 107 | 'icon' => 'fa fa-plug', |
| 108 | ]); |
| 109 | $elements_manager->add_category('shopengine-archive', [ |
| 110 | 'title' => esc_html__('ShopEngine Product Archive', 'shopengine'), |
| 111 | 'icon' => 'fa fa-plug', |
| 112 | ]); |
| 113 | $elements_manager->add_category('shopengine-checkout', [ |
| 114 | 'title' => esc_html__('ShopEngine Checkout', 'shopengine'), |
| 115 | 'icon' => 'fa fa-plug', |
| 116 | ]); |
| 117 | $elements_manager->add_category('shopengine-order', [ |
| 118 | 'title' => esc_html__('ShopEngine Order', 'shopengine'), |
| 119 | 'icon' => 'fa fa-plug', |
| 120 | ]); |
| 121 | $elements_manager->add_category('shopengine-my_account', [ |
| 122 | 'title' => esc_html__('ShopEngine My Account', 'shopengine'), |
| 123 | 'icon' => 'fa fa-plug', |
| 124 | ]); |
| 125 | } |
| 126 | } |
| 127 | |
| 128 |