* @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_header_main' ) ) : class TC_header_main { static $instance; function __construct () { self::$instance =& $this; //html > head actions add_action ( '__before_body' , array( $this , 'tc_head_display' )); add_action ( 'wp_head' , array( $this , 'tc_favicon_display' )); //html > header actions add_action ( '__before_main_wrapper' , 'get_header'); add_action ( '__header' , array( $this , 'tc_logo_title_display' ) , 10 ); add_action ( '__header' , array( $this , 'tc_tagline_display' ) , 20, 1 ); add_action ( '__header' , array( $this , 'tc_navbar_display' ) , 30 ); //body > header > navbar actions ordered by priority add_action ( '__navbar' , array( $this , 'tc_social_in_header' ) , 10, 2 ); add_action ( '__navbar' , array( $this , 'tc_tagline_display' ) , 20, 1 ); } /** * Displays what is inside the head html tag. Includes the wp_head() hook. * * * @package Customizr * @since Customizr 3.0 */ function tc_head_display() { ?> <?php wp_title( '|' , true, 'right' ); ?> ' ); } /** * The template for displaying the logo (text or img) * * * @package Customizr * @since Customizr 3.0 */ function tc_logo_title_display() { //rebuild the logo path : check if the full path is already saved in DB. If not, then rebuild it. $upload_dir = wp_upload_dir(); $saved_path = esc_url ( tc__f( '__get_option' , 'tc_logo_upload') ); $logo_src = ( false !== strpos( $saved_path , '/wp-content/' ) ) ? $saved_path : $upload_dir['baseurl'] . $saved_path; //makes ssl compliant $logo_src = is_ssl() ? str_replace('http://', 'https://', $logo_src) : $logo_src; $logo_src = apply_filters( 'tc_logo_src' , $logo_src ) ; $logo_resize = esc_attr( tc__f( '__get_option' , 'tc_logo_resize') ); $accepted_formats = apply_filters( 'tc_logo_img_formats' , array('jpg', 'jpeg', 'png' ,'gif', 'svg', 'svgz' ) ); $filetype = wp_check_filetype ($logo_src); $logo_class = apply_filters( 'tc_logo_class', 'brand span3' ); ?> $logo_src, 'logo_resize' => $logo_resize, 'logo_class' => $logo_class ); ob_start(); $width = ''; $height = ''; //gets height and width from image, we check if getimagesize can be used first with the error control operator if ( @getimagesize($logo_src) ) { list( $width, $height ) = getimagesize($logo_src); } ?>
%5$s', apply_filters( 'tc_logo_link_url', esc_url( home_url( '/' ) ) ) , apply_filters( 'tc_site_name_text', __( esc_attr( get_bloginfo( 'name' ) ) ) ), apply_filters( 'tc_tagline_text', __( esc_attr( get_bloginfo( 'description' ) ) ) ), $logo_src, __( 'Back Home' , 'customizr' ), $width, $height, ( 1 == $logo_resize) ? sprintf( 'style="max-width:%1$spx;max-height:%2$spx"', apply_filters( '__max_logo_width', 250 ), apply_filters( '__max_logo_height', 100 ) ) : '' ); do_action( '__after_logo' ); ?>
%3$s', apply_filters( 'tc_site_title_tag', 'h1' ) , apply_filters( 'tc_logo_link_url', esc_url( home_url( '/' ) ) ) , apply_filters( 'tc_site_name_text ', __( esc_attr( get_bloginfo( 'name' ) ) ) ), apply_filters( 'tc_tagline_text ', __( esc_attr( get_bloginfo( 'description' ) ) ) ) ); do_action( '__after_logo' ) ?>
%2$s', $social_header_block_class, ( 0 != tc__f( '__get_option', 'tc_social_in_header') ) ? tc__f( '__get_socials' ) : '' ); echo apply_filters( 'tc_social_in_header', $html, $resp ); } /** * Displays the tagline. This function has two hooks : __header and __navbar * * * @package Customizr * @since Customizr 3.0 */ function tc_tagline_display() { if ( '__header' == current_filter() ) { //when hooked on __header $html = sprintf('
<%1$s class="site-description">%2$s
', apply_filters( 'tc_tagline_tag', 'h2' ), apply_filters( 'tc_tagline_text ', __( esc_attr( get_bloginfo( 'description' ) ) ) ) ); } else { //when hooked on __navbar $html = sprintf('<%1$s class="%2$s inside site-description">%3$s', apply_filters( 'tc_tagline_tag', 'h2' ), apply_filters( 'tc_tagline_class', 'span7' ), apply_filters( 'tc_tagline_text ', __( esc_attr( get_bloginfo( 'description' ) ) ) ) ); } echo apply_filters( 'tc_tagline_display', $html ); } }//end of class endif;