PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.0.0
Forumax – AI Powered Advanced Community Forum Plugin v2.0.0
2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 2.0.0 2.1.0 All 29 releases
bbp-core / includes / Elementor / Forumax_Widgets.php

Forumax_Widgets.php in Forumax – AI Powered Advanced Community Forum Plugin 2.0.0, at includes/Elementor/Forumax_Widgets.php

78 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace admin\Elementor;
3
4 use admin\Pro_El_Widget_Map;
5
6 class Forumax_Widgets {
7
8 public function __construct() {
9
10 // Register Widgets
11 add_action( 'elementor/widgets/widgets_registered', [ $this, 'register_widgets' ] );
12
13 // Register Category
14 add_action( 'elementor/elements/categories_registered', [ $this, 'register_category' ] );
15 add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'register_elementor_editor_assets' ] );
16
17 // Register Elementor Preview Editor Scripts
18 $currentTheme = wp_get_theme()->get( 'Name' ) == 'Ama' ? true : false;
19 $returnType = forumax_is_premium() == true ? true : $currentTheme;
20 if ( $returnType != 1 ) {
21 add_action('elementor/editor/after_enqueue_scripts', [$this, 'enqueue_editor_scripts']);
22 }
23 }
24
25
26 /**
27 * @return void
28 *
29 */
30 public function enqueue_editor_scripts() {
31
32 wp_enqueue_script('bbpc-el-editor', FORUMAX_ASSETS . 'admin/js/bbpc-el-editor.js', [], '1.0.0', true);
33
34 $localize_data = [];
35 $pro_widget_map = new Pro_El_Widget_Map();
36 $localize_data['promotional_widgets'] = $pro_widget_map->get_pro_widget_map();
37 wp_localize_script('bbpc-el-editor', 'BbpcConfig', $localize_data);
38 }
39
40
41 // Register Widgets
42 public function register_widgets( $widgets_manager ) {
43
44 $theme = wp_get_theme();
45
46 // Include Widget files
47 if ( $theme == 'Ama' || forumax_is_premium() ) {
48 require_once( __DIR__ . '/Single_forum.php' );
49 require_once( __DIR__ . '/Forum_Ajax.php' );
50 require_once( __DIR__ . '/Forum_posts.php' );
51 // require_once( __DIR__ . '/Forumax_Forums.php' );
52 require_once( __DIR__ . '/Forum_Tab.php' );
53 require_once( __DIR__ . '/Search.php' );
54
55 $widgets_manager->register( new Single_forum() );
56 $widgets_manager->register( new Forum_Ajax() );
57 $widgets_manager->register( new Forum_posts() );
58 // $widgets_manager->register( new Forumax_Forums() );
59 $widgets_manager->register( new Forum_Tab() );
60 $widgets_manager->register( new Search() );
61 }
62 }
63
64 // Register category
65 public function register_category( $elements_manager ) {
66 $elements_manager->add_category(
67 'forumax', [
68 'title' => __( 'Forumax', 'forumax' ),
69 ]
70 );
71 }
72
73 function register_elementor_editor_assets() {
74 wp_enqueue_style( 'bbpc-el-editor', FORUMAX_ADMIN_ASS . 'css/elementor-editor.css' );
75 }
76 }
77
78