add-to-cart
2 years ago
additional-information
3 years ago
advanced-search
3 years ago
archive-description
3 years ago
archive-products
1 year ago
archive-result-count
2 years ago
archive-title
3 years ago
archive-view-mode
2 years ago
breadcrumbs
4 years ago
cart-table
2 years 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
1 year 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
1 year 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
1 year 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
2 years ago
product-tabs
2 years ago
product-tags
3 years ago
product-title
1 year ago
recently-viewed-products
1 year ago
related
2 years ago
return-to-shop
2 years ago
up-sells
2 years ago
view-single-product
3 years ago
lazy-cache.php
3 years ago
manifest.php
3 years 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
114 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 | public function manifest_widgets() { |
| 35 | |
| 36 | foreach(Widget_List::instance()->get_list(true, 'active') as $widget) { |
| 37 | |
| 38 | if(isset($widget['path'])){ |
| 39 | |
| 40 | if(file_exists($widget['path'] . '/' . $widget['slug'] . '-config.php')){ |
| 41 | require_once $widget['path'] . '/' . $widget['slug'] . '-config.php'; |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | if(class_exists($widget['config_class'])){ |
| 46 | $widget_config = new $widget['config_class'](); |
| 47 | |
| 48 | if($widget_config->custom_inline_css() !== false){ |
| 49 | wp_add_inline_style( 'shopengine-elementor-style', $widget_config->custom_inline_css()); |
| 50 | } |
| 51 | |
| 52 | if($widget_config->custom_inline_js() !== false){ |
| 53 | wp_add_inline_script( 'shopengine-elementor-script', $widget_config->custom_inline_css()); |
| 54 | } |
| 55 | |
| 56 | if($widget_config->custom_init() !== false){ |
| 57 | add_action('init', [$widget_config, 'custom_init']); |
| 58 | } |
| 59 | } |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | public function register_widgets() { |
| 64 | |
| 65 | foreach(Widget_List::instance()->get_list(true, 'active') as $widget) { |
| 66 | |
| 67 | if(isset($widget['path'])){ |
| 68 | |
| 69 | if(file_exists($widget['path'] . '/' . $widget['slug'] . '.php')){ |
| 70 | require_once $widget['path'] . '/' . $widget['slug'] . '.php'; |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | if(isset($widget['base_class']) && class_exists($widget['base_class'])){ |
| 75 | |
| 76 | \Elementor\Plugin::instance()->widgets_manager->register(new $widget['base_class']()); |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | public function widget_categories($elements_manager) { |
| 82 | |
| 83 | $elements_manager->add_category('shopengine-general', [ |
| 84 | 'title' => esc_html__('ShopEngine General', 'shopengine'), |
| 85 | 'icon' => 'fa fa-plug', |
| 86 | ]); |
| 87 | $elements_manager->add_category('shopengine-single', [ |
| 88 | 'title' => esc_html__('ShopEngine Single Product', 'shopengine'), |
| 89 | 'icon' => 'fa fa-plug', |
| 90 | ]); |
| 91 | $elements_manager->add_category('shopengine-cart', [ |
| 92 | 'title' => esc_html__('ShopEngine Cart', 'shopengine'), |
| 93 | 'icon' => 'fa fa-plug', |
| 94 | ]); |
| 95 | $elements_manager->add_category('shopengine-archive', [ |
| 96 | 'title' => esc_html__('ShopEngine Product Archive', 'shopengine'), |
| 97 | 'icon' => 'fa fa-plug', |
| 98 | ]); |
| 99 | $elements_manager->add_category('shopengine-checkout', [ |
| 100 | 'title' => esc_html__('ShopEngine Checkout', 'shopengine'), |
| 101 | 'icon' => 'fa fa-plug', |
| 102 | ]); |
| 103 | $elements_manager->add_category('shopengine-order', [ |
| 104 | 'title' => esc_html__('ShopEngine Order', 'shopengine'), |
| 105 | 'icon' => 'fa fa-plug', |
| 106 | ]); |
| 107 | $elements_manager->add_category('shopengine-my_account', [ |
| 108 | 'title' => esc_html__('ShopEngine My Account', 'shopengine'), |
| 109 | 'icon' => 'fa fa-plug', |
| 110 | ]); |
| 111 | } |
| 112 | } |
| 113 | |
| 114 |