PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.5.0
Forumax – AI Powered Advanced Community Forum Plugin v2.5.0
2.5.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 All 30 releases
← All changes | includes/Frontend/Frontend_Assets.php +19 -31 2.4.0 → 2.5.0 View file →
@@ -13,30 +13,11 @@
13 13 */
14 14 public function __construct()
15 15 {
16 16 add_action('wp_enqueue_scripts', [$this, 'frontend_scripts'], 999);
17 - add_action('elementor/widgets/widgets_registered', [$this, 'bbpc_elementor_script'], 999);
18 -
19 17 }
20 18
21 19 /**
22 - * Register scripts and styles [ ELEMENTOR ]
23 - */
24 - public function bbpc_elementor_script()
25 - {
26 - // Elementor widgets scripts
27 - wp_enqueue_style('bbpc-el-widgets', FORUMAX_STYLES . 'frontend/el-widgets.css', array(), FORUMAX_VERSION);
28 - wp_enqueue_style('elegant-icon', FORUMAX_VEND . 'elegant-icon/style.css');
29 - wp_register_script('bbpc_js', FORUMAX_FRONT_ASS . 'js/forumTab.js', ['jquery'], true, true);
30 - wp_register_script('bbpc-frontend-js', FORUMAX_FRONT_ASS . 'js/frontend.js', array('jquery'), FORUMAX_VERSION, true);
31 - wp_register_script('bbpc-ajax', FORUMAX_FRONT_ASS . 'js/ajax.js', array('jquery'), FORUMAX_VERSION, true);
32 -
33 - if (is_rtl()) {
34 - wp_enqueue_style('bbpc-rtl', FORUMAX_STYLES . 'frontend/bbpc-main-rtl.css');
35 - }
36 - }
37 -
38 - /**
39 20 * Register scripts and styles [ FRONTEND ]
40 21 */
41 22 public function frontend_scripts()
42 23 {
@@ -45,14 +26,14 @@
45 26 return;
46 27 }
47 28
48 29 // Register front-end scripts/styles first so they are available for Gutenberg/Elementor blocks.
49 - wp_register_script('bbpc-ajax', FORUMAX_FRONT_ASS . 'js/ajax.js', array('jquery'), FORUMAX_VERSION, true);
50 - wp_register_script('bbpc-frontend-js', FORUMAX_FRONT_ASS . 'js/frontend.js', array('jquery'), FORUMAX_VERSION, true);
30 + wp_register_script('bbpc-ajax', FORUMAX_FRONT_ASS . 'js/ajax.js', ['jquery'], FORUMAX_VERSION, true);
31 + wp_register_script('bbpc-frontend', FORUMAX_FRONT_ASS . 'js/frontend.js', ['jquery'], FORUMAX_VERSION, true);
51 32
52 33 // Always localize 'forumax_localize_script' on 'jquery' (since it is loaded everywhere) if bbPress exists.
53 34 // This guarantees that any script requiring these variables won't fail with a ReferenceError.
54 - wp_localize_script('jquery', 'forumax_localize_script', array(
35 + wp_localize_script('jquery', 'forumax_localize_script', [
55 36 'ajaxurl' => admin_url('admin-ajax.php'),
56 37 'nonce' => wp_create_nonce('forumax-nonce'),
57 38 'bbpc_subscribed_link' => wp_kses_post(bbp_get_forum_subscription_link()),
58 39 'bbpc_subscribed_forum_title' => forumax_forum_title(),
@@ -57,20 +38,27 @@
57 38 'bbpc_subscribed_link' => wp_kses_post(bbp_get_forum_subscription_link()),
58 39 'bbpc_subscribed_forum_title' => forumax_forum_title(),
59 40 'bbpc_subscribed_forum_id' => bbp_get_forum_id(),
60 41 'bbp_topic_id' => get_the_ID()
61 - ));
42 + ]);
62 43
44 + wp_register_style('bbpc-single', FORUMAX_STYLES . 'frontend/forum-single.css', [], FORUMAX_VERSION);
45 + wp_register_style('bbpc-forum', FORUMAX_STYLES . 'frontend/forum.css', [], FORUMAX_VERSION);
46 +
47 + if ( is_rtl() ) {
48 + wp_enqueue_style( 'bbpc-main-rtl', FORUMAX_STYLES . 'frontend/main-rtl.css', [], FORUMAX_VERSION );
49 + }
50 +
63 51 if (!function_exists('is_bbpress') || !is_bbpress()) {
64 52 return;
65 53 }
66 54
67 55 wp_enqueue_style('elegant-icon', FORUMAX_VEND . 'elegant-icon/style.css');
68 - wp_register_script('bbpc-wp-widget', FORUMAX_ASSETS . 'frontend/js/wp-widgets.js', array('jquery'), FORUMAX_VERSION, true);
56 + wp_register_script('bbpc-wp-widget', FORUMAX_ASSETS . 'frontend/js/wp-widgets.js', ['jquery'], FORUMAX_VERSION, true);
69 57
70 58 // Nice Select for frontend (prefixed to avoid conflicts)
71 59 wp_register_style('frmx-nice-select', FORUMAX_VEND . 'frmx-nice-select/nice-select.css');
72 - wp_register_script('frmx-nice-select', FORUMAX_VEND . 'frmx-nice-select/jquery.nice-select.min.js', array('jquery'), '1.0', true);
60 + wp_register_script('frmx-nice-select', FORUMAX_VEND . 'frmx-nice-select/jquery.nice-select.min.js', ['jquery'], '1.0', true);
73 61
74 62 $bbpc_brand_color = forumax_get_opt('bbpc_brand_color');
75 63 if ( ! empty( $bbpc_brand_color ) ) {
76 64 $dynamic_css = sprintf(
@@ -79,10 +67,8 @@
79 67 );
80 68 wp_add_inline_style( 'bbpc-single', $dynamic_css );
81 69 }
82 70
83 - wp_register_style('bbpc-single', FORUMAX_STYLES . 'frontend/forum-single.css');
84 - wp_register_style('bbpc-forum', FORUMAX_STYLES . 'frontend/forum.css');
85 71
86 72 wp_register_script('bbpc-voting', FORUMAX_FRONT_ASS . 'voting/bbpc-voting.js', ['jquery'], FORUMAX_VERSION);
87 73 wp_register_script('forumax-custom', FORUMAX_FRONT_ASS . 'js/custom.js', ['jquery'], FORUMAX_VERSION);
88 74 wp_register_script('bbp-replies-sorting', FORUMAX_FRONT_ASS . 'js/bbp-replies-sorting.js', ['jquery'], FORUMAX_VERSION);
@@ -98,8 +84,9 @@
98 84 wp_enqueue_script('forumax-custom');
99 85 wp_enqueue_script('bbp-replies-sorting');
100 86 wp_enqueue_script('docy-forum');
101 87 wp_enqueue_script('bbpc-voting');
88 + wp_enqueue_script('bbpc-frontend');
102 89
103 90 // Ensure TinyMCE scripts are queued early on all forumax editor pages
104 91 if ( bbp_is_single_topic() || bbp_is_single_forum() || bbp_is_reply_edit() || bbp_is_topic_edit() ) {
105 92 wp_enqueue_editor();
@@ -108,13 +95,13 @@
108 95 // Inline edit — only on single topic pages.
109 96 if ( bbp_is_single_topic() ) {
110 97
111 98 wp_enqueue_script( 'frmx-inline-edit' );
112 - wp_localize_script( 'frmx-inline-edit', 'frmxInlineEdit', array(
99 + wp_localize_script( 'frmx-inline-edit', 'frmxInlineEdit', [
113 100 'ajaxurl' => admin_url( 'admin-ajax.php' ),
114 101 'nonce' => wp_create_nonce( 'forumax-nonce' ),
115 102 'topic_id' => bbp_get_topic_id(),
116 - 'i18n' => array(
103 + 'i18n' => [
117 104 'edit' => esc_html__( 'Edit', 'forumax' ),
118 105 'save' => esc_html__( 'Save', 'forumax' ),
119 106 'cancel' => esc_html__( 'Cancel', 'forumax' ),
120 107 'saving' => esc_html__( 'Saving…', 'forumax' ),
@@ -130,10 +117,10 @@
130 117 'unsaved_changes' => esc_html__( 'Unsaved changes', 'forumax' ),
131 118 'discard_confirm' => esc_html__( 'Discard unsaved changes?', 'forumax' ),
132 119 'discard' => esc_html__( 'Discard', 'forumax' ),
133 120 'keep_editing' => esc_html__( 'Keep editing', 'forumax' ),
134 - ),
135 - ) );
121 + ],
122 + ] );
136 123 }
137 124
138 125
139 126 // User page styles
@@ -141,8 +128,9 @@
141 128 if ( bbp_is_single_user() || bbp_is_favorites() || bbp_is_subscriptions() || bbp_is_single_user_engagements() || bbp_is_single_user_topics() || bbp_is_single_user_replies() || bbp_is_single_user_edit() || bbp_is_single_user_profile() ) {
142 129 wp_enqueue_style('bbpc-forum-user', FORUMAX_STYLES . 'frontend/forum-user.css');
143 130 }
144 131 }
132 +
145 133 }
146 134 }
147 135
148 136