PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 2.2.0
Forumax – AI Powered Advanced Community Forum Plugin v2.2.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 / Frontend / Frontend_Assets.php

Frontend_Assets.php in Forumax – AI Powered Advanced Community Forum Plugin 2.2.0, at includes/Frontend/Frontend_Assets.php

92 lines 3.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Frontend;
3
4 /**
5 * Class Assets
6 * @package EazyDocs\Admin
7 */
8 class Frontend_Assets
9 {
10
11 /**
12 * Assets constructor.
13 */
14 public function __construct()
15 {
16 add_action('wp_enqueue_scripts', [$this, 'frontend_scripts'], 999);
17 add_action('elementor/widgets/widgets_registered', [$this, 'bbpc_elementor_script'], 999);
18 }
19
20 /**
21 * Register scripts and styles [ ELEMENTOR ]
22 */
23 public function bbpc_elementor_script()
24 {
25 // Elementor widgets scripts
26 wp_enqueue_style('bbpc-el-widgets', FORUMAX_FRONT_ASS . 'css/el-widgets.css');
27 wp_enqueue_style('elegant-icon', FORUMAX_VEND . 'elegant-icon/style.css');
28 wp_register_script('bbpc_js', FORUMAX_FRONT_ASS . 'js/forumTab.js', ['jquery'], true, true);
29 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', array('jquery'), FORUMAX_VERSION, true);
31
32 if (is_rtl()) {
33 wp_enqueue_style('bbpc-rtl', FORUMAX_FRONT_ASS . 'css/bbpc-main-rtl.css');
34 }
35 }
36
37 /**
38 * Register scripts and styles [ FRONTEND ]
39 */
40 public function frontend_scripts()
41 {
42
43 if (!class_exists('bbPress') || !class_exists('Forumax')) {
44 return;
45 }
46 wp_enqueue_style('elegant-icon', FORUMAX_VEND . 'elegant-icon/style.css');
47 wp_register_script('bbpc-wp-widget', FORUMAX_ASSETS . 'frontend/js/wp-widgets.js', array('jquery'), FORUMAX_VERSION, true);
48
49 // Nice Select for frontend (prefixed to avoid conflicts)
50 wp_register_style('frmx-nice-select', FORUMAX_VEND . 'frmx-nice-select/nice-select.css');
51 wp_register_script('frmx-nice-select', FORUMAX_VEND . 'frmx-nice-select/jquery.nice-select.min.js', array('jquery'), '1.0', true);
52
53 // localize script
54 wp_localize_script('jquery', 'forumax_localize_script', array(
55 'ajaxurl' => admin_url('admin-ajax.php'),
56 'nonce' => wp_create_nonce('forumax-nonce'),
57 'bbpc_subscribed_link' => wp_kses_post(bbp_get_forum_subscription_link()),
58 'bbpc_subscribed_forum_title' => forumax_forum_title(),
59 'bbpc_subscribed_forum_id' => bbp_get_forum_id(),
60 'bbp_topic_id' => get_the_ID()
61 ));
62
63 $dynamic_css = ":root { --bbpc_brand_color: " . forumax_get_opt('bbpc_brand_color') . "; }";
64 wp_add_inline_style('forumax_localize_script', $dynamic_css);
65
66 wp_register_style('bbpc', FORUMAX_FRONT_ASS . 'css/bbpc.css');
67 wp_register_style('bbpc-single', FORUMAX_FRONT_ASS . 'css/forum-single.css');
68 wp_register_style('bbpc-forum', FORUMAX_FRONT_ASS . 'css/forum.css');
69
70
71 wp_register_script('bbpc-voting', FORUMAX_FRONT_ASS . 'voting/bbpc-voting.js', ['jquery'], FORUMAX_VERSION);
72 wp_register_script('forumax-custom', FORUMAX_FRONT_ASS . 'js/custom.js', ['jquery'], FORUMAX_VERSION);
73 wp_register_script('bbp-replies-sorting', FORUMAX_FRONT_ASS . 'js/bbp-replies-sorting.js', ['jquery'], FORUMAX_VERSION);
74 wp_register_script('docy-forum', FORUMAX_FRONT_ASS . 'js/forum.js', ['jquery'], FORUMAX_VERSION);
75
76 if (class_exists('bbPress') || class_exists('Forumax')) {
77 wp_enqueue_style('bbpc');
78 wp_enqueue_style('bbpc-single');
79 wp_enqueue_style('bbpc-forum');
80 wp_enqueue_style('bbpc-voting', FORUMAX_FRONT_ASS . 'voting/bbpc-voting.css');
81 wp_enqueue_style('frmx-nice-select');
82
83 wp_enqueue_script('frmx-nice-select');
84 wp_enqueue_script('forumax-custom');
85 wp_enqueue_script('bbp-replies-sorting');
86 wp_enqueue_script('docy-forum');
87 wp_enqueue_script('bbpc-voting');
88 }
89 }
90 }
91
92