| @@ -6,19 +6,21 @@ | ||
| 6 | 6 | class Forumax_Widgets { |
| 7 | 7 | public function __construct() { |
| 8 | 8 | |
| 9 | 9 | // Register Widgets |
| 10 | - add_action( 'elementor/widgets/register', array( $this, 'register_widgets' ) ); | |
| 10 | + add_action( 'elementor/widgets/register', [ $this, 'register_widgets' ] ); | |
| 11 | 11 | |
| 12 | 12 | // Register Category |
| 13 | - add_action( 'elementor/elements/categories_registered', array( $this, 'register_category' ) ); | |
| 14 | - add_action( 'elementor/editor/before_enqueue_scripts', array( $this, 'register_elementor_editor_assets' ) ); | |
| 13 | + add_action( 'elementor/elements/categories_registered', [ $this, 'register_category' ] ); | |
| 14 | + add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'register_elementor_editor_assets' ] ); | |
| 15 | + add_action( 'wp_enqueue_scripts', [ $this, 'register_widget_assets' ], 5 ); | |
| 16 | + add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'register_widget_assets' ] ); | |
| 15 | 17 | |
| 16 | 18 | // Register Elementor Preview Editor Scripts |
| 17 | 19 | $current_theme = wp_get_theme()->get( 'Name' ) == 'Ama' ? true : false; |
| 18 | 20 | $return_type = forumax_is_premium() == true ? true : $current_theme; |
| 19 | 21 | if ($return_type != 1) { |
| 20 | - add_action( 'elementor/editor/after_enqueue_scripts', array( $this, 'enqueue_editor_scripts' ) ); | |
| 22 | + add_action( 'elementor/editor/after_enqueue_scripts', [ $this, 'enqueue_editor_scripts' ] ); | |
| 21 | 23 | } |
| 22 | 24 | } |
| 23 | 25 | |
| 24 | 26 | |
| @@ -27,11 +29,11 @@ | ||
| 27 | 29 | * |
| 28 | 30 | */ |
| 29 | 31 | public function enqueue_editor_scripts() { |
| 30 | 32 | |
| 31 | - wp_enqueue_script( 'bbpc-el-editor', FORUMAX_ASSETS . 'admin/js/bbpc-el-editor.js', array(), '1.0.0', true ); | |
| 33 | + wp_enqueue_script( 'bbpc-el-editor', FORUMAX_ASSETS . 'admin/js/bbpc-el-editor.js', [], FORUMAX_VERSION, true ); | |
| 32 | 34 | |
| 33 | - $localize_data = array(); | |
| 35 | + $localize_data = []; | |
| 34 | 36 | $pro_widget_map = new Pro_El_Widget_Map(); |
| 35 | 37 | $localize_data['promotional_widgets'] = $pro_widget_map->get_pro_widget_map(); |
| 36 | 38 | wp_localize_script( 'bbpc-el-editor', 'BbpcConfig', $localize_data ); |
| 37 | 39 | } |
| @@ -71,14 +73,22 @@ | ||
| 71 | 73 | // Register category |
| 72 | 74 | public function register_category( $elements_manager ) { |
| 73 | 75 | $elements_manager->add_category( |
| 74 | 76 | 'forumax', |
| 75 | - array( | |
| 77 | + [ | |
| 76 | 78 | 'title' => __( 'Forumax', 'forumax' ), |
| 77 | - ) | |
| 79 | + ] | |
| 78 | 80 | ); |
| 79 | 81 | } |
| 80 | 82 | |
| 81 | 83 | public function register_elementor_editor_assets() { |
| 82 | - wp_enqueue_style( 'bbpc-el-editor', FORUMAX_ADMIN_ASS . 'css/elementor-editor.css' ); | |
| 84 | + wp_enqueue_style( 'bbpc-el-editor', FORUMAX_ADMIN_ASS . 'css/elementor-editor.css', [], FORUMAX_VERSION ); | |
| 85 | + } | |
| 86 | + | |
| 87 | + public function register_widget_assets() { | |
| 88 | + wp_register_style( 'bbpc-el-widgets', FORUMAX_STYLES . 'frontend/el-widgets.css', [], FORUMAX_VERSION ); | |
| 89 | + wp_register_style( 'elegant-icon', FORUMAX_VEND . 'elegant-icon/style.css', [], FORUMAX_VERSION ); | |
| 90 | + wp_register_script( 'bbpc-forumTab', FORUMAX_FRONT_ASS . 'js/forumTab.js', [ 'jquery' ], FORUMAX_VERSION, true ); | |
| 91 | + wp_register_script( 'bbpc-frontend', FORUMAX_FRONT_ASS . 'js/frontend.js', [ 'jquery' ], FORUMAX_VERSION, true ); | |
| 92 | + wp_register_script( 'bbpc-ajax', FORUMAX_FRONT_ASS . 'js/ajax.js', [ 'jquery' ], FORUMAX_VERSION, true ); | |
| 83 | 93 | } |
| 84 | 94 | } |