Server : Apache System : Linux server.lienzindia.com 4.18.0-348.7.1.el8_5.x86_64 #1 SMP Wed Dec 22 13:25:12 UTC 2021 x86_64 User : plutus ( 1007) PHP Version : 7.4.33 Disable Function : NONE Directory : /home/plutus/public_html/wp-content/themes/vrm/inc/integration/ |
Upload File : |
<?php namespace TotalTheme\Integration; \defined( 'ABSPATH' ) || exit; /** * bbPress Integration. */ final class BuddyPress { /** * Instance. * * @access private * @var object Class object. */ private static $instance; /** * Create or retrieve the instance of BuddyPress. */ public static function instance() { if ( \is_null( static::$instance ) ) { static::$instance = new self(); } return static::$instance; } /** * Hook into actions and filters. */ public function __construct() { \define( 'WPEX_BUDDYPRESS_DIR', \WPEX_INC_DIR . 'integration/buddypress/' ); \add_action( 'wp_enqueue_scripts', [ $this, 'scripts'], 20 ); \add_filter( 'totaltheme/page/header/is_enabled', [ $this, 'maybe_disable_page_header'] ); \add_filter( 'wpex_post_layout_class', [ $this, 'layouts'], 11 ); // on 11 due to buddyPress issues \add_filter( 'wpex_customizer_panels', [ $this, 'add_customizer_panel'] ); } /** * Load custom CSS. */ public function scripts(): void { if ( ! get_theme_mod( 'bp_enqueue_theme_styles', true ) ) { return; } $deps = []; if ( \wp_style_is( 'bp-nouveau' ) ) { $deps[] = 'bp-nouveau'; } \wp_enqueue_style( 'wpex-buddypress', \wpex_asset_url( 'css/wpex-buddypress.css' ), $deps, WPEX_THEME_VERSION ); } /** * Potentially disable the page hader. */ public function maybe_disable_page_header( $check ): bool { if ( $check ) { if ( ! \is_buddypress() ) { return $check; } if ( \bp_is_directory() ) { if ( ! \get_theme_mod( 'bp_directory_page_title', true ) ) { $check = false; } } elseif ( bp_is_user() ) { if ( ! \get_theme_mod( 'bp_user_singular_page_title', true ) ) { $check = false; } } } return $check; } /** * Set layouts. */ public function layouts( $layout ): string { if ( \is_buddypress() ) { $layout = \get_theme_mod( 'bp_layout' ) ?: \wpex_get_default_content_area_layout(); if ( \bp_is_directory() ) { $layout = \get_theme_mod( 'bp_directory_layout' ) ?: $layout; } elseif ( \bp_is_user() ) { $layout = \get_theme_mod( 'bp_user_layout' ) ?: $layout; } } return $layout; } /** * Adds new Customizer Panel for bbPress. */ public function add_customizer_panel( array $panels ): array { $panels['buddypress'] = array( 'title' => \esc_html__( 'BuddyPress (Total)', 'total' ), 'settings' => WPEX_BUDDYPRESS_DIR . 'customizer-settings.php' ); return $panels; } }