builders
1 year ago
documents
1 year ago
builder-content.php
1 year ago
class-helper.php
1 year ago
class-loader.php
1 year ago
class-panel-options.php
1 year ago
conditions-file.php
1 year ago
conditions-rules.php
1 year ago
elementor-document.php
1 year ago
theme-builder.php
1 year ago
widgets-passing-lists.php
1 year ago
class-loader.php
222 lines
| 1 | <?php |
| 2 | namespace EcafeAddons; |
| 3 | use Elementor\Utils; |
| 4 | use Elementor\Core\Settings\Manager as SettingsManager; |
| 5 | |
| 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | exit; // Exit if accessed directly. |
| 8 | } |
| 9 | |
| 10 | final class EcafeElementLoad { |
| 11 | |
| 12 | private static $_instance; |
| 13 | |
| 14 | |
| 15 | private $_modules_manager; |
| 16 | |
| 17 | public static function instance() { |
| 18 | if ( is_null( self::$_instance ) ) { |
| 19 | self::$_instance = new self(); |
| 20 | self::$_instance->init(); |
| 21 | } |
| 22 | return self::$_instance; |
| 23 | } |
| 24 | |
| 25 | public function init() { |
| 26 | include_once( ECAFE_CLASSES_URL . 'builder-content.php' ); |
| 27 | include_once( ECAFE_CLASSES_URL . 'builders/theme-template.php' ); |
| 28 | include_once( ECAFE_CLASSES_URL . 'conditions-file.php' ); |
| 29 | include_once( ECAFE_CLASSES_URL . 'theme-builder.php' ); |
| 30 | include_once( ECAFE_CLASSES_URL . 'elementor-document.php' ); |
| 31 | include_once( ECAFE_CLASSES_URL . 'conditions-rules.php' ); |
| 32 | |
| 33 | register_activation_hook( ECAFE_BASE_NAME, [ __CLASS__, 'activation_hook' ] ); |
| 34 | } |
| 35 | |
| 36 | private function includes() { |
| 37 | |
| 38 | require_once ECAFE_CLASSES_URL .'class-helper.php'; |
| 39 | |
| 40 | $defaultOnLoad='ecafedefaultoptions'; |
| 41 | $value='1'; |
| 42 | if ( is_admin() && get_option( $defaultOnLoad ) !== false ) { |
| 43 | } else if( is_admin() ){ |
| 44 | $defaultLoad=get_option( 'ecafe_widgets' ); |
| 45 | if ( $defaultLoad !== false && $defaultLoad!='') { |
| 46 | $defaultNull = null; |
| 47 | $onLoadAuto = 'no'; |
| 48 | add_option( $defaultOnLoad,$value,$defaultNull,$onLoadAuto ); |
| 49 | }else{ |
| 50 | $widgetsPage=get_option( 'ecafe_widgets' ); |
| 51 | $widgetsPage['widgetsload']= array('ecafe-accordion','ecafe-adv-text-block','ecafe-business-hours','ecafe-button','ecafe-changelog','ecafe-chart','ecafe-image-hover-effect','ecafe-infobox','ecafe-social-icons','ecafe-title','ecafe-grid-post-listing','ecafe-lottie','ecafe-marketing-link','ecafe-tabs'); |
| 52 | |
| 53 | $defaultNull = null; |
| 54 | $onLoadAuto = 'no'; |
| 55 | add_option( 'ecafe_widgets',$widgetsPage, $defaultNull, $onLoadAuto ); |
| 56 | add_option( $defaultOnLoad,$value,$defaultNull,$onLoadAuto ); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | require ECAFE_CLASSES_URL.'class-panel-options.php'; |
| 61 | |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Carry widgets |
| 66 | */ |
| 67 | public function carryWidgets() { |
| 68 | require_once ECAFE_CLASSES_URL.'widgets-passing-lists.php'; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Editor load style |
| 73 | */ |
| 74 | public function afterEnqueueStylesEditor(){ |
| 75 | wp_enqueue_style( 'ecafe-elementor', ECAFE_ASSETS_PATH .'css/admin/ecafe-elementor.css', array(),ECAFE_VERSION,false ); |
| 76 | |
| 77 | $ui_theme = SettingsManager::get_settings_managers( 'editorPreferences' )->get_model()->get_settings( 'ui_theme' ); |
| 78 | if(!empty($ui_theme) && $ui_theme=='dark'){ |
| 79 | wp_enqueue_style( 'ecafe-dark-elementor',ECAFE_ASSETS_PATH .'css/admin/ecafe-dark-elementor.css', array(),ECAFE_VERSION,false); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Admin load style |
| 85 | */ |
| 86 | public function ecafeElementorAdminCss($hook){ |
| 87 | wp_enqueue_style('ecafe-elementor',ECAFE_ASSETS_PATH .'css/admin/ecafe-elementor.css', array(),ECAFE_VERSION,false); |
| 88 | wp_enqueue_script('ecafe-backuser',ECAFE_ASSETS_PATH .'js/admin/ecafe-admin.js', array('jquery'),ECAFE_VERSION,false); |
| 89 | |
| 90 | if ( ('post-new.php' === $hook || 'post.php' === $hook ) && get_post_type()===ECAFE_POST) { |
| 91 | wp_enqueue_style('select2-css', ECAFE_ASSETS_PATH .'css/admin/select2.min.css', array(), ECAFE_VERSION); |
| 92 | |
| 93 | wp_enqueue_script('select2-js', ECAFE_ASSETS_PATH .'js/admin/select2.min.js', array('jquery'), ECAFE_VERSION, true); |
| 94 | |
| 95 | wp_localize_script('ecafe-backuser', 'ecafe_data', array( |
| 96 | 'nonce' => wp_create_nonce('ecafe-temp-nonce'), |
| 97 | )); |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * Category for elementor |
| 103 | */ |
| 104 | public function categoryForElementor() { |
| 105 | $EI = \Elementor\Plugin::$instance; |
| 106 | $EI->elements_manager->add_category('essential',['title' => esc_html__( 'EC Essential', 'essential-classy-addons-for-elementor' ),'icon' => 'ecaddons',],1); |
| 107 | $EI->elements_manager->add_category('ecwoocommerce',['title' => esc_html__( 'EC WooCommerce', 'essential-classy-addons-for-elementor' ),'icon' => 'ecaddons',],1); |
| 108 | $EI->elements_manager->add_category('ecforms',['title' => esc_html__( 'EC Forms', 'essential-classy-addons-for-elementor' ),'icon' => 'ecaddons',],1); |
| 109 | $EI->elements_manager->add_category('ecembed',['title' => esc_html__( 'EC Embed', 'essential-classy-addons-for-elementor' ),'icon' => 'ecaddons',],1); |
| 110 | $EI->elements_manager->add_category('ecpro',['title' => esc_html__( 'EC Pro', 'essential-classy-addons-for-elementor' ),'icon' => 'ecaddons',],1); |
| 111 | $EI->elements_manager->add_category('ecacf',['title' => esc_html__( 'EC ACF', 'essential-classy-addons-for-elementor' ),'icon' => 'ecaddons',],1); |
| 112 | $EI->elements_manager->add_category('eccfs',['title' => esc_html__( 'EC CFS', 'essential-classy-addons-for-elementor' ),'icon' => 'ecaddons',],1); |
| 113 | $EI->elements_manager->add_category('ecjetengine',['title' => esc_html__( 'EC JetEngine', 'essential-classy-addons-for-elementor' ),'icon' => 'ecaddons',],1); |
| 114 | $EI->elements_manager->add_category('ecmetabox',['title' => esc_html__( 'EC Metabox', 'essential-classy-addons-for-elementor' ),'icon' => 'ecaddons',],1); |
| 115 | $EI->elements_manager->add_category('ecpods',['title' => esc_html__( 'EC Pods', 'essential-classy-addons-for-elementor' ),'icon' => 'ecaddons',],1); |
| 116 | $EI->elements_manager->add_category('ectoolset',['title' => esc_html__( 'EC Toolset', 'essential-classy-addons-for-elementor' ),'icon' => 'ecaddons',],1); |
| 117 | $EI->elements_manager->add_category('ecwck',['title' => esc_html__( 'EC WCK', 'essential-classy-addons-for-elementor' ),'icon' => 'ecaddons',],1); |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * Settings links |
| 122 | */ |
| 123 | function ecafeSettingsLinks($settingsLinks) { |
| 124 | $settingsLinksArray = array( |
| 125 | '<a href="'.admin_url('admin.php?page=ecafe_widgets').'">'.esc_html__("Settings","essential-classy-addons-for-elementor").'</a>', |
| 126 | ); |
| 127 | return array_merge( $settingsLinks, $settingsLinksArray ); |
| 128 | } |
| 129 | |
| 130 | function ecafeSettingsLinksRest($settingsLinks) { |
| 131 | if(defined('ECAFEP_VERSION')){ |
| 132 | $get_values = unserialize(get_option('ecafewhitelabel')); |
| 133 | if(!empty($get_values['plugin_name_free'])){ |
| 134 | $settingsLinksArray = array(); |
| 135 | }else{ |
| 136 | $settingsLinksArray = array( |
| 137 | ' | <a href="https://www.facebook.com/groups/340597333894907" target="_blank" style="color:#000; font-weight: bold;">' . __('Join/Contact US', 'essential-classy-addons-for-elementor') . '</a> | <a href="https://ecaddons.com/docs/" target="_blank" style="color:#000; font-weight: bold;">' . __('Document', 'essential-classy-addons-for-elementor') . '</a> | <a href="http://store.kapasias.com/helpdesk/" target="_blank" style="color:#000; font-weight: bold;">' . __('Support', 'essential-classy-addons-for-elementor') . '</a>', |
| 138 | ); |
| 139 | } |
| 140 | }else{ |
| 141 | $settingsLinksArray = array( |
| 142 | ' | <a href="https://www.facebook.com/groups/340597333894907" target="_blank" style="color:#000; font-weight: bold;">' . __('Join/Contact US', 'essential-classy-addons-for-elementor') . '</a> | <a href="https://ecaddons.com/docs/" target="_blank" style="color:#000; font-weight: bold;">' . __('Document', 'essential-classy-addons-for-elementor') . '</a> | <a href="http://store.kapasias.com/helpdesk/" target="_blank" style="color:#000; font-weight: bold;">' . __('Support', 'essential-classy-addons-for-elementor') . '</a>', |
| 143 | ); |
| 144 | } |
| 145 | |
| 146 | return array_merge( $settingsLinks, $settingsLinksArray ); |
| 147 | } |
| 148 | |
| 149 | public function ecafeEnqueueStyles() { |
| 150 | wp_enqueue_style('ecafe-frontend-css',ECAFE_ASSETS_PATH . 'css/custom/ecafe-front.min.css',[],ECAFE_VERSION); |
| 151 | wp_enqueue_style('ecafe-fancybox',ECAFE_ASSETS_PATH . 'css/baharni/jquery.fancybox.min.css',[],ECAFE_VERSION); |
| 152 | wp_enqueue_style('font-awesome-5-all',ELEMENTOR_ASSETS_URL . 'lib/font-awesome/css/all.min.css',[],ECAFE_VERSION); |
| 153 | |
| 154 | |
| 155 | wp_register_script('ecafe-accordion', ECAFE_ASSETS_PATH . 'js/custom/ecafe-accordion.min.js', array('jquery'),ECAFE_VERSION,false ); |
| 156 | wp_register_script('ecafe-back-to-top', ECAFE_ASSETS_PATH . 'js/custom/ecafe-back-to-top.min.js', array('jquery'),ECAFE_VERSION,false ); |
| 157 | wp_register_script('ecafe-chart-3rd',ECAFE_ASSETS_PATH .'js/baharni/chart.js', array('jquery'),ECAFE_VERSION,false); |
| 158 | wp_register_script('ecafe-chart', ECAFE_ASSETS_PATH . 'js/custom/ecafe-chart.min.js', array('ecafe-chart-3rd'),ECAFE_VERSION,false ); |
| 159 | wp_register_script('ecafe-calendly-3rd', ECAFE_ASSETS_PATH . 'js/baharni/calendlywidget.js', array('jquery'),ECAFE_VERSION,false ); |
| 160 | wp_register_script('ecafe-changelog', ECAFE_ASSETS_PATH . 'js/custom/ecafe-changelog.min.js', array('jquery'),ECAFE_VERSION,false ); |
| 161 | wp_register_script('ecafe-fancybox', ECAFE_ASSETS_PATH . 'js/baharni/jquery.fancybox.min.js', array('jquery'),ECAFE_VERSION,false ); |
| 162 | wp_register_script('ecafe-infounfold',ECAFE_ASSETS_PATH .'js/custom/ecafe-infounfold.min.js', array('jquery'),ECAFE_VERSION,false); |
| 163 | wp_register_script('ecafe-lax',ECAFE_ASSETS_PATH .'js/baharni/lax.min.js', array('jquery'),ECAFE_VERSION,false); |
| 164 | wp_register_script('ecafe-min-js', ECAFE_ASSETS_PATH . 'js/custom/ecafe.min.js', array('jquery'),ECAFE_VERSION,false ); |
| 165 | wp_register_script('ecafe-isotope',ECAFE_ASSETS_PATH .'js/baharni/isotope.pkgd.min.js', array('jquery'),ECAFE_VERSION,false); |
| 166 | wp_register_script('ecafe-imagesloaded',ECAFE_ASSETS_PATH .'js/baharni/imagesloaded.pkgd.min.js', array('jquery'),ECAFE_VERSION,false); |
| 167 | wp_register_script('ecafe-post-listing', ECAFE_ASSETS_PATH . 'js/custom/ecafe-post-listing.min.js', array('ecafe-isotope','ecafe-imagesloaded'),ECAFE_VERSION,false ); |
| 168 | wp_register_script('ecafe-tabs', ECAFE_ASSETS_PATH . 'js/custom/ecafe-tabs.min.js', array('jquery'),ECAFE_VERSION,false ); |
| 169 | wp_register_script('ecafe-whatsapp', ECAFE_ASSETS_PATH . 'js/custom/ecafe-whatsapp.min.js', array('jquery'),ECAFE_VERSION,false ); |
| 170 | wp_register_script('ecafe-countdown', ECAFE_ASSETS_PATH . 'js/custom/ecafe-countdown.min.js', array('jquery'),ECAFE_VERSION,false ); |
| 171 | wp_register_script('ecafe-lottie-3rd',ECAFE_ASSETS_PATH .'js/baharni/lottie.min.js', array('jquery'),ECAFE_VERSION,false); |
| 172 | wp_register_script('ecafe-lottie', ECAFE_ASSETS_PATH . 'js/custom/ecafe-lottie.min.js', array('ecafe-lottie-3rd'),ECAFE_VERSION,false ); |
| 173 | wp_register_script('ecafe-marketing-link',ECAFE_ASSETS_PATH .'js/custom/ecafe-marketing-link.min.js', array('jquery'),ECAFE_VERSION,false); |
| 174 | wp_register_script('ecafe-scroll-progress', ECAFE_ASSETS_PATH . 'js/custom/ecafe-scroll-progress.min.js', array('jquery'),ECAFE_VERSION,false ); |
| 175 | wp_register_script('ecafe-image-scroll', ECAFE_ASSETS_PATH . 'js/custom/ecafe-image-scroll.min.js', array('jquery'),ECAFE_VERSION,false ); |
| 176 | wp_register_script('ecafe-image-accordion', ECAFE_ASSETS_PATH . 'js/custom/ecafe-image-accordion.min.js', array('jquery'),ECAFE_VERSION,false ); |
| 177 | wp_register_script('ecafe-hover-background', ECAFE_ASSETS_PATH . 'js/custom/ecafe-hover-background.min.js', array('jquery'),ECAFE_VERSION,false ); |
| 178 | wp_register_script('ecafe-post-image', ECAFE_ASSETS_PATH . 'js/custom/ecafe-post-image.min.js', array('jquery'),ECAFE_VERSION,false ); |
| 179 | wp_register_script('ecafe-page-piling-3rd',ECAFE_ASSETS_PATH .'js/baharni/pagepiling.min.js', array('jquery'),ECAFE_VERSION,false); |
| 180 | wp_register_script('ecafe-page-piling', ECAFE_ASSETS_PATH . 'js/custom/ecafe-page-piling.min.js', array('ecafe-page-piling-3rd'),ECAFE_VERSION,false ); |
| 181 | |
| 182 | wp_localize_script( |
| 183 | 'jquery', 'ecafe_data', array( |
| 184 | 'eca_ajax_url' => admin_url('admin-ajax.php'), |
| 185 | ) |
| 186 | ); |
| 187 | } |
| 188 | |
| 189 | /** |
| 190 | * Hooks |
| 191 | */ |
| 192 | private function hooks() { |
| 193 | add_action('elementor/init',[$this,'categoryForElementor']); |
| 194 | |
| 195 | // Register Widget Styles & Script |
| 196 | add_action( 'wp_enqueue_scripts', [ $this, 'ecafeEnqueueStyles' ] ); |
| 197 | |
| 198 | add_action('elementor/editor/after_enqueue_styles',[$this,'afterEnqueueStylesEditor']); |
| 199 | add_action('admin_enqueue_scripts', [ $this,'ecafeElementorAdminCss']); |
| 200 | add_filter('plugin_action_links_'.ECAFE_BASE_NAME,[$this, 'ecafeSettingsLinks']); |
| 201 | add_filter('plugin_action_links_'.ECAFE_BASE_NAME,[$this, 'ecafeSettingsLinksRest']); |
| 202 | } |
| 203 | |
| 204 | /** |
| 205 | * Activation Hook |
| 206 | */ |
| 207 | public static function activation_hook( $network_wide ) { |
| 208 | flush_rewrite_rules(); |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * Constructor |
| 213 | */ |
| 214 | private function __construct() { |
| 215 | $this->includes(); |
| 216 | $this->hooks(); |
| 217 | $this->carryWidgets(); |
| 218 | ecafeWidgetsPassed(); |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | EcafeElementLoad::instance(); |