%PDF- %PDF-
Direktori : /var/www/html/higroup/wp-content/themes/evenex/components/editor/elementor/ |
Current File : /var/www/html/higroup/wp-content/themes/evenex/components/editor/elementor/elementor.php |
<?php if ( ! defined( 'ABSPATH' ) ) exit; class Evenex_Shortcode{ /** * Holds the class object. * * @since 1.0 * */ public static $_instance; /** * Localize data array * * @var array */ public $localize_data = array(); /** * Load Construct * * @since 1.0 */ public function __construct(){ add_action('elementskit/loaded', [$this, 'init']); } public function init(){ add_action('elementor/init', array($this, 'evenex_elementor_init')); add_action('elementor/controls/controls_registered', array( $this, 'evenex_elementor_init' ), 11 ); add_action('elementor/widgets/widgets_registered', array($this, 'evenex_shortcode_elements')); add_action( 'elementor/frontend/before_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); add_action( 'elementor/preview/enqueue_styles', array( $this, 'preview_enqueue_scripts' ) ); } /** * Enqueue Scripts * * @return void */ public function enqueue_scripts() { wp_enqueue_script( 'evenex-main-elementor', EVENEX_JS . '/elementor.js',array( 'jquery', 'elementor-frontend' ), EVENEX_VERSION, true ); } /** * Enqueue editor styles * * @return void */ /** * Preview Enqueue Scripts * * @return void */ public function preview_enqueue_scripts() {} /** * Elementor Initialization * * @since 1.0 * */ public function evenex_elementor_init(){ \Elementor\Plugin::$instance->elements_manager->add_category( 'evenex-elements', [ 'title' =>esc_html__( 'Evenex', 'evenex' ), 'icon' => 'fas fa-plug', ], 1 ); } /** * Extend Icon pack core controls. * * @param object $controls_manager Controls manager instance. * @return void */ public function evenex_icon_pack( $controls_manager ) { require_once EVENEX_EDITOR_ELEMENTOR. '/controls/icon.php'; $controls = array( $controls_manager::ICON => 'Evenex_Icon_Controler', ); foreach ( $controls as $control_id => $class_name ) { $controls_manager->unregister_control( $control_id ); $controls_manager->register_control( $control_id, new $class_name() ); } } public function evenex_custom_icon_pack( ) { $this->__generate_font(); add_filter( 'elementor/icons_manager/additional_tabs', [ $this, '__add_font']); } public function __add_font( $font){ $font_new['icon-evenex'] = [ 'name' => 'icon-evenex', 'label' => esc_html__( 'Evenex Icon', 'evenex' ), 'url' => EVENEX_CSS . '/xs-icon-font.css', 'enqueue' => [ EVENEX_CSS . '/xs-icon-font.css' ], 'prefix' => 'xsicon-', 'displayPrefix' => 'xsicon', 'labelIcon' => 'xsicon xsicon-icon031', 'ver' => '5.9.0', 'fetchJson' => EVENEX_JS . '/xs-icon-font.js', 'native' => true, ]; return array_merge($font, $font_new); } public function __generate_font(){ global $wp_filesystem; require_once ( ABSPATH . '/wp-admin/includes/file.php' ); WP_Filesystem(); $css_file = EVENEX_CSS_DIR . '/xs-icon-font.css'; if ( $wp_filesystem->exists( $css_file ) ) { $css_source = $wp_filesystem->get_contents( $css_file ); } // End If Statement preg_match_all( "/\.(xsicon-.*?):\w*?\s*?{/", $css_source, $matches, PREG_SET_ORDER, 0 ); $iconList = []; foreach ( $matches as $match ) { $new_icons[$match[1] ] = str_replace('xsicon-', '', $match[1]); $iconList[] = str_replace('xsicon-', '', $match[1]); } $icons = new \stdClass(); $icons->icons = $iconList; $icon_data = json_encode($icons); $file = EVENEX_THEME_DIR . '/assets/js/xs-icon-font.js'; global $wp_filesystem; require_once ( ABSPATH . '/wp-admin/includes/file.php' ); WP_Filesystem(); if ( $wp_filesystem->exists( $file ) ) { $content = $wp_filesystem->put_contents( $file, $icon_data) ; } } public function evenex_shortcode_elements($widgets_manager){ if (class_exists('ACF')) { require_once EVENEX_EDITOR_ELEMENTOR.'/widgets/schedule/schedule.php'; $widgets_manager->register_widget_type(new Elementor\Evenex_Schedule_Widget()); require_once EVENEX_EDITOR_ELEMENTOR.'/widgets/speaker/speaker.php'; $widgets_manager->register_widget_type(new Elementor\Evenex_Speaker_Widget()); } require_once EVENEX_EDITOR_ELEMENTOR.'/widgets/back-to-top/back-to-top.php'; $widgets_manager->register_widget_type(new Elementor\Evenex_BackTo()); if (class_exists('\Etn\Bootstrap')) { require_once EVENEX_EDITOR_ELEMENTOR.'/widgets/eventin/eventin-events.php'; $widgets_manager->register_widget_type(new Elementor\Multi_Event_Widget()); require_once EVENEX_EDITOR_ELEMENTOR.'/widgets/eventin/banner-search.php'; $widgets_manager->register_widget_type(new Elementor\Multi_Event_Search_Widget()); require_once EVENEX_EDITOR_ELEMENTOR.'/widgets/event-slider/event-slider.php'; $widgets_manager->register_widget_type(new Elementor\Evenex_Event_Slider()); } require_once EVENEX_EDITOR_ELEMENTOR.'/widgets/search/search.php'; $widgets_manager->register_widget_type(new Elementor\Evenex_Search()); require_once EVENEX_EDITOR_ELEMENTOR.'/widgets/advanced-tab/advanced-tab.php'; $widgets_manager->register_widget_type(new Elementor\Evenex_Advanced_Tab_Widget()); require_once EVENEX_EDITOR_ELEMENTOR.'/widgets/pricing/pricing.php'; $widgets_manager->register_widget_type(new Elementor\Event_Widget_Pricing()); if(class_exists('\Elementor\Elementskit_Widget_Gallery')){ $widgets_manager->register_widget_type(new Elementor\Elementskit_Widget_Gallery()); } } public static function evenex_get_instance() { if (!isset(self::$_instance)) { self::$_instance = new Evenex_Shortcode(); } return self::$_instance; } } Evenex_Shortcode::evenex_get_instance(); if(!defined('ELEMENTOR_PRO_VERSION')){ add_action( 'elementor/editor/after_enqueue_styles', function() { wp_enqueue_style( 'xs-elementor-editor-panel', EVENEX_CSS . '/elementor-editor-panel.css', null, EVENEX_VERSION ); }); }