| Server IP : 104.26.4.103 / Your IP : 216.73.216.4 Web Server : nginx/1.27.1 System : Linux in-5 5.15.0-143-generic #153-Ubuntu SMP Fri Jun 13 19:10:45 UTC 2025 x86_64 User : arabianexpress ( 1872) PHP Version : 8.0.30 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,parse_ini_file,show_source MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /storage/v9321/cleanlinefmsv3/public_html/wp-content/themes/clanyeco/vamtam/classes/ |
Upload File : |
<?php
/**
* Sidebar helpers
*
* @package vamtam/clanyeco
*/
/**
* class VamtamSidebars
*
* register right/left, header and footer sidebars
* also provides a function which outputs the correct right/left sidebar
*/
class VamtamSidebars {
/**
* List of widget areas
* @var array
*/
private $sidebars = array();
/**
* List of sidebar placements
* @var array
*/
private $places = array();
/**
* Singleton instance
* @var VamtamSidebars
*/
private static $instance;
/**
* Set the available widgets area
*/
public function __construct() {
$this->sidebars = array(
'page' => esc_html__( 'Main Widget Area', 'clanyeco' ),
);
if ( vamtam_has_woocommerce() )
$this->sidebars['vamtam-woocommerce'] = esc_html__( 'WooCommerce Widget Area', 'clanyeco' );
$this->places = array( 'left' );
}
/**
* Get singleton instance
* @return VamtamSidebars singleton instance
*/
public static function get_instance() {
if ( ! isset( self::$instance ) )
self::$instance = new self();
return self::$instance;
}
/**
* Register sidebars
*/
public function register_sidebars() {
unregister_sidebar( 'sidebar-event' );
foreach ( $this->sidebars as $id => $name ) {
foreach ( $this->places as $place ) {
register_sidebar( array(
'id' => $id . '-' . $place,
'name' => $name . " ( $place )",
'description' => $name . " ( $place )",
'before_widget' => '<section id="%1$s" class="widget %2$s">',
'after_widget' => '</section>',
'before_title' => '<h4 class="widgettitle">',
'after_title' => '</h4>',
) );
}
}
}
private function get_sidebar_name( $place = 'left' ) {
global $post;
if ( vamtam_has_woocommerce() && is_woocommerce() ) {
$sidebar = 'vamtam-woocommerce';
}
if ( isset( $sidebar ) ) {
return $sidebar . '-' . $place;
}
return 'page-' . $place;
}
/**
* Output the correct sidebar
*
* @uses dynamic_sidebar()
*
* @param string $place one of $this->placements
* @return bool result of dynamic_sidebar()
*/
public function get_sidebar( $place = 'left' ) {
$name = $this->get_sidebar_name( $place );
dynamic_sidebar( $name );
}
/**
* Check if we should show a sidebar
*
* @uses is_active_sidebar()
*
* @param string $place one of $this->placements
* @return bool result of dynamic_sidebar()
*/
public function has_sidebar( $place = 'left' ) {
if ( vamtam_has_woocommerce() && ( is_cart() || is_checkout() || is_account_page() ) ) {
return false;
}
$name = $this->get_sidebar_name( $place );
return is_active_sidebar( $name );
}
};