account-address
5 years ago
account-dashboard
5 years ago
account-details
5 years ago
account-downloads
5 years ago
account-form-login
5 years ago
account-form-register
5 years ago
account-logout
5 years ago
account-navigation
5 years ago
account-order-details
5 years ago
account-orders
5 years ago
add-to-cart
5 years ago
additional-information
5 years ago
advanced-search
5 years ago
archive-description
5 years ago
archive-products
5 years ago
archive-result-count
5 years ago
archive-title
5 years ago
archive-view-mode
5 years ago
breadcrumbs
5 years ago
cart-table
5 years ago
cart-totals
5 years ago
categories
5 years ago
checkout-coupon-form
5 years ago
checkout-form-additional
5 years ago
checkout-form-billing
5 years ago
checkout-form-login
5 years ago
checkout-form-shipping
5 years ago
checkout-payment
5 years ago
checkout-review-order
5 years ago
checkout-shipping-methods
5 years ago
cross-sells
5 years ago
deal-products
5 years ago
empty-cart-message
5 years ago
filter-orderby
5 years ago
filter-products-per-page
5 years ago
filterable-product-list
5 years ago
init
5 years ago
product-categories
5 years ago
product-category-lists
5 years ago
product-description
5 years ago
product-excerpt
5 years ago
product-filters
5 years ago
product-image
5 years ago
product-list
5 years ago
product-meta
5 years ago
product-price
5 years ago
product-rating
5 years ago
product-review
5 years ago
product-share
5 years ago
product-sku
5 years ago
product-stock
5 years ago
product-tabs
5 years ago
product-tags
5 years ago
product-title
5 years ago
recently-viewed-products
5 years ago
related
5 years ago
return-to-shop
5 years ago
thankyou-address-details
5 years ago
thankyou-order-confirm
5 years ago
thankyou-order-details
5 years ago
thankyou-thankyou
5 years ago
up-sells
5 years ago
lazy-cache.php
5 years ago
manifest.php
5 years ago
prod-short-code.php
5 years ago
products.php
5 years ago
shop.php
5 years ago
widget-helper.php
5 years ago
manifest.php
109 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/widgets_registered', [$this, 'register_widgets']); |
| 25 | } |
| 26 | |
| 27 | public function manifest_widgets() { |
| 28 | |
| 29 | foreach(Widget_List::instance()->get_list(true, 'active') as $widget) { |
| 30 | |
| 31 | if(isset($widget['path'])){ |
| 32 | |
| 33 | if(file_exists($widget['path'] . '/' . $widget['slug'] . '-config.php')){ |
| 34 | require_once $widget['path'] . '/' . $widget['slug'] . '-config.php'; |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | if(class_exists($widget['config_class'])){ |
| 39 | $widget_config = new $widget['config_class'](); |
| 40 | |
| 41 | if($widget_config->custom_inline_css() !== false){ |
| 42 | wp_add_inline_style( 'shopengine-elementor-style', $widget_config->custom_inline_css()); |
| 43 | } |
| 44 | |
| 45 | if($widget_config->custom_inline_js() !== false){ |
| 46 | wp_add_inline_script( 'shopengine-elementor-script', $widget_config->custom_inline_css()); |
| 47 | } |
| 48 | |
| 49 | if($widget_config->custom_init() !== false){ |
| 50 | add_action('init', [$widget_config, 'custom_init']); |
| 51 | } |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | public function register_widgets() { |
| 57 | |
| 58 | foreach(Widget_List::instance()->get_list(true, 'active') as $widget) { |
| 59 | |
| 60 | if(isset($widget['path'])){ |
| 61 | |
| 62 | if(file_exists($widget['path'] . '/' . $widget['slug'] . '.php')){ |
| 63 | require_once $widget['path'] . '/' . $widget['slug'] . '.php'; |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | if(isset($widget['base_class']) && class_exists($widget['base_class'])){ |
| 68 | |
| 69 | \Elementor\Plugin::instance()->widgets_manager->register_widget_type(new $widget['base_class']()); |
| 70 | } |
| 71 | |
| 72 | } |
| 73 | |
| 74 | } |
| 75 | |
| 76 | public function widget_categories($elements_manager) { |
| 77 | |
| 78 | $elements_manager->add_category('shopengine-general', [ |
| 79 | 'title' => esc_html__('ShopEngine General', 'shopengine'), |
| 80 | 'icon' => 'fa fa-plug', |
| 81 | ]); |
| 82 | $elements_manager->add_category('shopengine-single', [ |
| 83 | 'title' => esc_html__('ShopEngine Single Product', 'shopengine'), |
| 84 | 'icon' => 'fa fa-plug', |
| 85 | ]); |
| 86 | $elements_manager->add_category('shopengine-cart', [ |
| 87 | 'title' => esc_html__('ShopEngine Cart', 'shopengine'), |
| 88 | 'icon' => 'fa fa-plug', |
| 89 | ]); |
| 90 | $elements_manager->add_category('shopengine-archive', [ |
| 91 | 'title' => esc_html__('ShopEngine Product Archive', 'shopengine'), |
| 92 | 'icon' => 'fa fa-plug', |
| 93 | ]); |
| 94 | $elements_manager->add_category('shopengine-checkout', [ |
| 95 | 'title' => esc_html__('ShopEngine Checkout', 'shopengine'), |
| 96 | 'icon' => 'fa fa-plug', |
| 97 | ]); |
| 98 | $elements_manager->add_category('shopengine-order', [ |
| 99 | 'title' => esc_html__('ShopEngine Order', 'shopengine'), |
| 100 | 'icon' => 'fa fa-plug', |
| 101 | ]); |
| 102 | $elements_manager->add_category('shopengine-my_account', [ |
| 103 | 'title' => esc_html__('ShopEngine My Account', 'shopengine'), |
| 104 | 'icon' => 'fa fa-plug', |
| 105 | ]); |
| 106 | } |
| 107 | } |
| 108 | |
| 109 |