PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 1.2.1
Forumax – AI Powered Advanced Community Forum Plugin v1.2.1
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 / Assets.php

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

59 lines 2.1 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 Assets {
9
10 /**
11 * Assets constructor.
12 */
13 public function __construct() {
14 add_action('wp_enqueue_scripts', [$this, 'frontend_scripts'], 999 );
15 add_action('elementor/widgets/widgets_registered', [$this, 'bbpc_elementor_script'], 999 );
16 }
17
18 /**
19 * Register scripts and styles [ ELEMENTOR ]
20 */
21 public function bbpc_elementor_script(){
22 // Elementor widgets scripts
23 wp_enqueue_style( 'bbpc-el-widgets', BBPC_ASSETS . 'css/el-widgets.css' );
24 wp_enqueue_style( 'elegant-icon', BBPC_ASSETS . 'vendors/elegant-icon/style.css' );
25 wp_register_script( 'bbpc_js', BBPC_ASSETS . 'js/forumTab.js', ['jquery'], true, true );
26 wp_register_script( 'bbpc-frontend-js', BBPC_ASSETS . 'frontend/js/frontend.js', array('jquery'), BBPC_VERSION, true );
27 wp_register_script( 'bbpc-ajax', BBPC_ASSETS . 'js/ajax.js', array('jquery'), BBPC_VERSION, true );
28 }
29
30 /**
31 * Register scripts and styles [ FRONTEND ]
32 */
33 public function frontend_scripts() {
34
35 if ( ! class_exists( 'bbPress' ) ) {
36 return;
37 }
38 wp_register_style( 'bbpc-frontend-global', BBPC_ASSETS . 'frontend/css/frontend.css', array(), BBPC_VERSION );
39 wp_register_script( 'bbpc-wp-widget', BBPC_ASSETS . 'frontend/js/wp-widgets.js', array('jquery'), BBPC_VERSION, true );
40
41 // localize script
42 wp_localize_script( 'jquery', 'bbpc_localize_script', array(
43 'ajaxurl' => admin_url( 'admin-ajax.php' ),
44 'nonce' => wp_create_nonce( 'bbpc-nonce' ),
45 'bbpc_subscribed_link' => wp_kses_post(bbp_get_forum_subscription_link()),
46 'bbpc_subscribed_forum_title' => bbpc_forum_title(),
47 'bbpc_subscribed_forum_id' => bbp_get_forum_id()
48 ) );
49
50 $dynamic_css = ":root { --bbpc_brand_color: " . bbpc_get_opt('bbpc_brand_color') . "; }";
51 wp_add_inline_style( 'bbpc-frontend-global', $dynamic_css );
52
53 if ( class_exists( 'bbPress' ) && bbpc_forum_assets() == true ) {
54 wp_enqueue_style( 'bbpc', BBPC_ASSETS . 'css/bbpc.css' );
55 wp_enqueue_style( 'bbpc-voting', BBPC_ASSETS . 'css/bbpc-voting.css' );
56 wp_enqueue_script( 'bbpc-voting', BBPC_ASSETS . 'js/bbpc-voting.js', [ 'jquery' ], BBPC_VERSION );
57 }
58 }
59 }