| @@ -31,17 +31,14 @@ | ||
| 31 | 31 | wp_register_script('bbpc-frontend', FORUMAX_FRONT_ASS . 'js/frontend.js', ['jquery'], FORUMAX_VERSION, true); |
| 32 | 32 | |
| 33 | 33 | // Always localize 'forumax_localize_script' on 'jquery' (since it is loaded everywhere) if bbPress exists. |
| 34 | 34 | // This guarantees that any script requiring these variables won't fail with a ReferenceError. |
| 35 | - // Forum-specific values are only resolved on bbPress pages; elsewhere they are empty. | |
| 36 | - $is_bbpress_page = function_exists('is_bbpress') && is_bbpress(); | |
| 37 | - | |
| 38 | 35 | wp_localize_script('jquery', 'forumax_localize_script', [ |
| 39 | 36 | 'ajaxurl' => admin_url('admin-ajax.php'), |
| 40 | 37 | 'nonce' => wp_create_nonce('forumax-nonce'), |
| 41 | - 'bbpc_subscribed_link' => $is_bbpress_page ? wp_kses_post(bbp_get_forum_subscription_link()) : '', | |
| 42 | - 'bbpc_subscribed_forum_title' => $is_bbpress_page ? forumax_forum_title() : '', | |
| 43 | - 'bbpc_subscribed_forum_id' => $is_bbpress_page ? bbp_get_forum_id() : 0, | |
| 38 | + 'bbpc_subscribed_link' => wp_kses_post(bbp_get_forum_subscription_link()), | |
| 39 | + 'bbpc_subscribed_forum_title' => forumax_forum_title(), | |
| 40 | + 'bbpc_subscribed_forum_id' => bbp_get_forum_id(), | |
| 44 | 41 | 'bbp_topic_id' => get_the_ID() |
| 45 | 42 | ]); |
| 46 | 43 | |
| 47 | 44 | wp_register_style('bbpc-single', FORUMAX_STYLES . 'frontend/forum-single.css', [], FORUMAX_VERSION); |
| @@ -50,17 +47,17 @@ | ||
| 50 | 47 | if ( is_rtl() ) { |
| 51 | 48 | wp_enqueue_style( 'bbpc-main-rtl', FORUMAX_STYLES . 'frontend/main-rtl.css', [], FORUMAX_VERSION ); |
| 52 | 49 | } |
| 53 | 50 | |
| 54 | - if (!$is_bbpress_page) { | |
| 51 | + if (!function_exists('is_bbpress') || !is_bbpress()) { | |
| 55 | 52 | return; |
| 56 | 53 | } |
| 57 | 54 | |
| 58 | - wp_enqueue_style('elegant-icon', FORUMAX_VEND . 'elegant-icon/style.css', [], FORUMAX_VERSION); | |
| 55 | + wp_enqueue_style('elegant-icon', FORUMAX_VEND . 'elegant-icon/style.css'); | |
| 59 | 56 | wp_register_script('bbpc-wp-widget', FORUMAX_ASSETS . 'frontend/js/wp-widgets.js', ['jquery'], FORUMAX_VERSION, true); |
| 60 | 57 | |
| 61 | 58 | // Nice Select for frontend (prefixed to avoid conflicts) |
| 62 | - wp_register_style('frmx-nice-select', FORUMAX_VEND . 'frmx-nice-select/nice-select.css', [], FORUMAX_VERSION); | |
| 59 | + wp_register_style('frmx-nice-select', FORUMAX_VEND . 'frmx-nice-select/nice-select.css'); | |
| 63 | 60 | wp_register_script('frmx-nice-select', FORUMAX_VEND . 'frmx-nice-select/jquery.nice-select.min.js', ['jquery'], '1.0', true); |
| 64 | 61 | |
| 65 | 62 | $bbpc_brand_color = forumax_get_opt('bbpc_brand_color'); |
| 66 | 63 | if ( ! empty( $bbpc_brand_color ) ) { |
| @@ -71,17 +68,17 @@ | ||
| 71 | 68 | wp_add_inline_style( 'bbpc-single', $dynamic_css ); |
| 72 | 69 | } |
| 73 | 70 | |
| 74 | 71 | |
| 75 | - wp_register_script('bbpc-voting', FORUMAX_FRONT_ASS . 'voting/bbpc-voting.js', ['jquery'], FORUMAX_VERSION, true); | |
| 76 | - wp_register_script('forumax-custom', FORUMAX_FRONT_ASS . 'js/custom.js', ['jquery'], FORUMAX_VERSION, true); | |
| 77 | - wp_register_script('bbp-replies-sorting', FORUMAX_FRONT_ASS . 'js/bbp-replies-sorting.js', ['jquery'], FORUMAX_VERSION, true); | |
| 78 | - wp_register_script('docy-forum', FORUMAX_FRONT_ASS . 'js/forum.js', ['jquery'], FORUMAX_VERSION, true); | |
| 72 | + wp_register_script('bbpc-voting', FORUMAX_FRONT_ASS . 'voting/bbpc-voting.js', ['jquery'], FORUMAX_VERSION); | |
| 73 | + wp_register_script('forumax-custom', FORUMAX_FRONT_ASS . 'js/custom.js', ['jquery'], FORUMAX_VERSION); | |
| 74 | + wp_register_script('bbp-replies-sorting', FORUMAX_FRONT_ASS . 'js/bbp-replies-sorting.js', ['jquery'], FORUMAX_VERSION); | |
| 75 | + wp_register_script('docy-forum', FORUMAX_FRONT_ASS . 'js/forum.js', ['jquery'], FORUMAX_VERSION); | |
| 79 | 76 | wp_register_script('frmx-inline-edit', FORUMAX_FRONT_ASS . 'js/frmx-inline-edit.js', ['jquery'], FORUMAX_VERSION, true); |
| 80 | 77 | |
| 81 | 78 | wp_enqueue_style('bbpc-single'); |
| 82 | 79 | wp_enqueue_style('bbpc-forum'); |
| 83 | - wp_enqueue_style('bbpc-voting', FORUMAX_FRONT_ASS . 'voting/bbpc-voting.css', [], FORUMAX_VERSION); | |
| 80 | + wp_enqueue_style('bbpc-voting', FORUMAX_FRONT_ASS . 'voting/bbpc-voting.css'); | |
| 84 | 81 | wp_enqueue_style('frmx-nice-select'); |
| 85 | 82 | |
| 86 | 83 | wp_enqueue_script('frmx-nice-select'); |
| 87 | 84 | wp_enqueue_script('forumax-custom'); |
| @@ -128,9 +125,9 @@ | ||
| 128 | 125 | |
| 129 | 126 | // User page styles |
| 130 | 127 | if ( function_exists( 'bbp_is_single_user' ) ) { |
| 131 | 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() ) { |
| 132 | - wp_enqueue_style('bbpc-forum-user', FORUMAX_STYLES . 'frontend/forum-user.css', [], FORUMAX_VERSION); | |
| 129 | + wp_enqueue_style('bbpc-forum-user', FORUMAX_STYLES . 'frontend/forum-user.css'); | |
| 133 | 130 | } |
| 134 | 131 | } |
| 135 | 132 | |
| 136 | 133 | } |