* @copyright Copyright (c) 2013, Nicolas GUILLAUME * @link http://themesandco.com/customizr * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html */ if ( ! class_exists( 'TC_sidebar' ) ) : class TC_sidebar { static $instance; function __construct () { self::$instance =& $this; //displays left sidebar add_action ( '__before_article_container' , array( $this , 'tc_sidebar_display' ) ); add_action ( '__before_left_sidebar' , array( $this , 'tc_social_in_sidebar' ) ); //displays right sidebar add_action ( '__after_article_container' , array( $this , 'tc_sidebar_display' ) ); add_action ( '__before_right_sidebar' , array( $this , 'tc_social_in_sidebar' ) ); } /** * Returns the sidebar or the front page featured pages area * @param Name of the widgetized area * @package Customizr * @since Customizr 1.0 */ function tc_sidebar_display() { //first check if home and no content option is choosen if ( tc__f( '__is_home_empty') ) return; //gets current screen layout $screen_layout = tc__f( '__screen_layout' , tc__f ( '__ID' ) , 'sidebar' ); //gets position from current hook and checks the context $position = apply_filters( 'tc_sidebar_position', strpos(current_filter(), 'before') ? 'left' : 'right' ); if ( 'left' == $position && $screen_layout != 'l' && $screen_layout != 'b' ) return; if ( 'right' == $position && $screen_layout != 'r' && $screen_layout != 'b' ) return; //gets the global layout settings $global_layout = apply_filters( 'tc_global_layout' , TC_init::$instance -> global_layout ); $sidebar_layout = $global_layout[$screen_layout]; //defines the sidebar wrapper class $class = sprintf('%1$s %2$s tc-sidebar', apply_filters( "tc_{$position}_sidebar_class", $sidebar_layout['sidebar'] ), $position ); ob_start(); ?>