/**
         * Displays the sidebar or the front page featured pages area
         * If no widgets are set, displays a placeholder
         *
         * @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_utils::tc_get_layout(TC_utils::tc_id(), 'sidebar');
            // GY: add relative right and left for LTR/RTL sites
            $rel_left = is_rtl() ? 'right' : 'left';
            $rel_right = is_rtl() ? 'left' : 'right';
            //gets position from current hook and checks the context
            $position = apply_filters('tc_sidebar_position', strpos(current_filter(), 'before') ? $rel_left : $rel_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 = implode(" ", apply_filters("tc_{$position}_sidebar_class", array($sidebar_layout['sidebar'], $position, 'tc-sidebar')));
            ob_start();
            ?>

        <div class="<?php 
            echo $class;
            ?>
">
           <div id="<?php 
            echo $position;
            ?>
" class="widget-area" role="complementary">
              <?php 
            do_action("__before_{$position}_sidebar");
            ##hook of social icons
            if (is_active_sidebar($position)) {
                get_sidebar($position);
            } else {
                $this->tc_display_sidebar_placeholder($position);
            }
            do_action("__after_{$position}_sidebar");
            ?>
            </div><!-- #left or #right-->
        </div><!--.tc-sidebar -->

        <?php 
            $html = ob_get_contents();
            if ($html) {
                ob_end_clean();
            }
            echo apply_filters('tc_sidebar_display', $html, $sidebar_layout, $position);
        }
   /**
    * hook : __after_fp
    * @since v3.4+
    */
   function tc_maybe_display_dismiss_notice()
   {
       if (!TC_placeholders::tc_is_fp_notice_on()) {
           return;
       }
       $_customizer_lnk = TC_utils::tc_get_customizer_url(array('section' => 'frontpage_sec'));
       ?>
 <div class="tc-placeholder-wrap tc-fp-notice">
   <?php 
       printf('<p><strong>%1$s</strong></p>', sprintf(__("Edit those featured pages %s, or %s (you'll be able to add yours later).", "customizr"), sprintf('<a href="%3$s" title="%1$s">%2$s</a>', __("Edit those featured pages", "customizr"), __("now", "customizr"), $_customizer_lnk), sprintf('<a href="#" class="tc-inline-remove" title="%1$s">%2$s</a>', __("Remove the featured pages", "customizr"), __("remove them", "customizr"))));
       printf('<a class="tc-dismiss-notice" href="#" title="%1$s">%1$s x</a>', __('dismiss notice', 'customizr'));
       ?>
 </div>
 <?php 
   }
 private function tc_get_grid_cols() {
   return apply_filters( 'tc_get_grid_cols',
     esc_attr( TC_utils::$inst->tc_opt( 'tc_grid_columns') ),
     TC_utils::tc_get_layout( $this -> post_id , 'class' )
   );
 }
   /**
    * When do we display this placeholder ?
    * -User logged in
    * -Admin
    * -User did not dismiss the notice
    * @param : string position left or right
    * @since Customizr 3.3
    */
   private function tc_display_footer_placeholder()
   {
       if (!TC_placeholders::tc_is_widget_placeholder_enabled('footer')) {
           return;
       }
       ?>
 <aside class="tc-placeholder-wrap tc-widget-placeholder">
   <?php 
       printf('<span class="tc-admin-notice">%1$s</span>', __('This block is visible for admin users only.', 'customizr'));
       printf('<h4>%1$s</h4>', __('The footer has no widgets', 'customizr'));
       printf('<p><strong>%1$s</strong></p>', sprintf(__("Add widgets to the footer %s or %s.", "customizr"), sprintf('<a href="%1$s" title="%2$s">%3$s</a>', TC_utils::tc_get_customizer_url(array('panel' => 'widgets')), __("Add widgets", "customizr"), __("now", "customizr")), sprintf('<a class="tc-inline-dismiss-notice" data-position="footer" href="#" title="%1$s">%1$s</a>', __('dismiss this notice', 'customizr'))));
       printf('<a class="tc-dismiss-notice" data-position="footer" href="#" title="%1$s">%1$s x</a>', __('dismiss notice', 'customizr'));
       ?>
 </aside>
 <?php 
   }
 /**
  * Loads Customizr front scripts
  * Dependencies are defined in the script map property
  *
  * @return  void()
  * @uses wp_enqueue_script() to manage script dependencies
  * @package Customizr
  * @since Customizr 1.0
  */
 function tc_enqueue_front_scripts()
 {
     //wp scripts
     if (is_singular() && get_option('thread_comments')) {
         wp_enqueue_script('comment-reply');
     }
     wp_enqueue_script('jquery');
     wp_enqueue_script('jquery-ui-core');
     wp_enqueue_script('modernizr', TC_BASE_URL . 'inc/assets/js/modernizr.min.js', array(), CUSTOMIZR_VER, isset($_SERVER['HTTP_USER_AGENT']) && false !== strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') ? false : true);
     //customizr scripts and libs
     if ($this->tc_load_concatenated_front_scripts()) {
         if ($this->tc_is_fancyboxjs_required()) {
             $this->tc_enqueue_script('tc-fancybox');
         }
         //!!tc-scripts includes underscore, tc-js-arraymap-proto
         $this->tc_enqueue_script('tc-scripts');
     } else {
         wp_enqueue_script('underscore');
         //!!mind the dependencies
         $this->tc_enqueue_script(array('tc-js-params', 'tc-js-arraymap-proto', 'tc-img-original-sizes', 'tc-bootstrap', 'tc-smoothscroll'));
         if ($this->tc_is_fancyboxjs_required()) {
             $this->tc_enqueue_script('tc-fancybox');
         }
         $this->tc_enqueue_script(array('tc-dropcap', 'tc-img-smartload', 'tc-ext-links', 'tc-center-images', 'tc-main-front'));
     }
     //end of load concatenate script if
     //carousel options
     //gets slider options if any for home/front page or for others posts/pages
     $js_slidername = tc__f('__is_home') ? TC_utils::$inst->tc_opt('tc_front_slider') : get_post_meta(TC_utils::tc_id(), $key = 'post_slider_key', $single = true);
     $js_sliderdelay = tc__f('__is_home') ? TC_utils::$inst->tc_opt('tc_slider_delay') : get_post_meta(TC_utils::tc_id(), $key = 'slider_delay_key', $single = true);
     //has the post comments ? adds a boolean parameter in js
     global $wp_query;
     $has_post_comments = 0 != $wp_query->post_count && comments_open() && get_comments_number() != 0 ? true : false;
     //adds the jquery effect library if smooth scroll is enabled => easeOutExpo effect
     $anchor_smooth_scroll = false != esc_attr(TC_utils::$inst->tc_opt('tc_link_scroll')) ? 'easeOutExpo' : 'linear';
     if (false != esc_attr(TC_utils::$inst->tc_opt('tc_link_scroll'))) {
         wp_enqueue_script('jquery-effects-core');
     }
     $anchor_smooth_scroll_exclude = apply_filters('tc_anchor_smoothscroll_excl', array('simple' => array('[class*=edd]', '.tc-carousel-control', '.carousel-control', '[data-toggle="modal"]', '[data-toggle="dropdown"]', '[data-toggle="tooltip"]', '[data-toggle="popover"]', '[data-toggle="collapse"]', '[data-toggle="tab"]', '[class*=upme]', '[class*=um-]'), 'deep' => array('classes' => array(), 'ids' => array())));
     $smooth_scroll_enabled = apply_filters('tc_enable_smoothscroll', !wp_is_mobile() && 1 == esc_attr(TC_utils::$inst->tc_opt('tc_smoothscroll')));
     $smooth_scroll_options = apply_filters('tc_smoothscroll_options', array());
     //smart load
     $smart_load_enabled = esc_attr(TC_utils::$inst->tc_opt('tc_img_smart_load'));
     $smart_load_opts = apply_filters('tc_img_smart_load_options', array('parentSelectors' => array('.article-container', '.__before_main_wrapper', '.widget-front'), 'opts' => array('excludeImg' => array('.tc-holder-img'))));
     //gets current screen layout
     $screen_layout = TC_utils::tc_get_layout(TC_utils::tc_id(), 'sidebar');
     //gets the global layout settings
     $global_layout = apply_filters('tc_global_layout', TC_init::$instance->global_layout);
     $sidebar_layout = isset($global_layout[$screen_layout]['sidebar']) ? $global_layout[$screen_layout]['sidebar'] : false;
     //Gets the left and right sidebars class for js actions
     $left_sb_class = sprintf('.%1$s.left.tc-sidebar', false != $sidebar_layout ? $sidebar_layout : 'span3');
     $right_sb_class = sprintf('.%1$s.right.tc-sidebar', false != $sidebar_layout ? $sidebar_layout : 'span3');
     wp_localize_script($this->tc_load_concatenated_front_scripts() ? 'tc-scripts' : 'tc-js-params', 'TCParams', apply_filters('tc_customizr_script_params', array('_disabled' => apply_filters('tc_disabled_front_js_parts', array()), 'FancyBoxState' => $this->tc_is_fancyboxjs_required(), 'FancyBoxAutoscale' => 1 == TC_utils::$inst->tc_opt('tc_fancybox_autoscale') ? true : false, 'SliderName' => $js_slidername, 'SliderDelay' => $js_sliderdelay, 'SliderHover' => apply_filters('tc_stop_slider_hover', true), 'centerSliderImg' => esc_attr(TC_utils::$inst->tc_opt('tc_center_slider_img')), 'SmoothScroll' => array('Enabled' => $smooth_scroll_enabled, 'Options' => $smooth_scroll_options), 'anchorSmoothScroll' => $anchor_smooth_scroll, 'anchorSmoothScrollExclude' => $anchor_smooth_scroll_exclude, 'ReorderBlocks' => esc_attr(TC_utils::$inst->tc_opt('tc_block_reorder')), 'centerAllImg' => esc_attr(TC_utils::$inst->tc_opt('tc_center_img')), 'HasComments' => $has_post_comments, 'LeftSidebarClass' => $left_sb_class, 'RightSidebarClass' => $right_sb_class, 'LoadModernizr' => apply_filters('tc_load_modernizr', true), 'stickyCustomOffset' => apply_filters('tc_sticky_custom_offset', array("_initial" => 0, "_scrolling" => 0, "options" => array("_static" => true, "_element" => ""))), 'stickyHeader' => esc_attr(TC_utils::$inst->tc_opt('tc_sticky_header')), 'dropdowntoViewport' => esc_attr(TC_utils::$inst->tc_opt('tc_menu_resp_dropdown_limit_to_viewport')), 'timerOnScrollAllBrowsers' => apply_filters('tc_timer_on_scroll_for_all_browser', true), 'extLinksStyle' => esc_attr(TC_utils::$inst->tc_opt('tc_ext_link_style')), 'extLinksTargetExt' => esc_attr(TC_utils::$inst->tc_opt('tc_ext_link_target')), 'extLinksSkipSelectors' => apply_filters('tc_ext_links_skip_selectors', array('classes' => array('btn', 'button'), 'ids' => array())), 'dropcapEnabled' => esc_attr(TC_utils::$inst->tc_opt('tc_enable_dropcap')), 'dropcapWhere' => array('post' => esc_attr(TC_utils::$inst->tc_opt('tc_post_dropcap')), 'page' => esc_attr(TC_utils::$inst->tc_opt('tc_page_dropcap'))), 'dropcapMinWords' => esc_attr(TC_utils::$inst->tc_opt('tc_dropcap_minwords')), 'dropcapSkipSelectors' => apply_filters('tc_dropcap_skip_selectors', array('tags' => array('IMG', 'IFRAME', 'H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'BLOCKQUOTE', 'UL', 'OL'), 'classes' => array('btn'), 'id' => array())), 'imgSmartLoadEnabled' => $smart_load_enabled, 'imgSmartLoadOpts' => $smart_load_opts, 'goldenRatio' => apply_filters('tc_grid_golden_ratio', 1.618), 'gridGoldenRatioLimit' => esc_attr(TC_utils::$inst->tc_opt('tc_grid_thumb_height')), 'isSecondMenuEnabled' => TC_utils::$inst->tc_is_secondary_menu_enabled(), 'secondMenuRespSet' => esc_attr(TC_utils::$inst->tc_opt('tc_second_menu_resp_setting'))), TC_utils::tc_id()));
     //fancybox style
     if ($this->tc_is_fancyboxjs_required()) {
         wp_enqueue_style('fancyboxcss', TC_BASE_URL . 'inc/assets/js/fancybox/jquery.fancybox-1.3.4.min.css');
     }
     //holder.js is loaded when featured pages are enabled AND FP are set to show images and at least one holder should be displayed.
     $tc_show_featured_pages = class_exists('TC_featured_pages') && TC_featured_pages::$instance->tc_show_featured_pages();
     if (0 != $tc_show_featured_pages && $this->tc_maybe_is_holder_js_required()) {
         wp_enqueue_script('holder', sprintf('%1$sinc/assets/js/holder.min.js', TC_BASE_URL), array(), CUSTOMIZR_VER, $in_footer = true);
     }
     //load retina.js in footer if enabled
     if (apply_filters('tc_load_retinajs', 1 == TC_utils::$inst->tc_opt('tc_retina_support'))) {
         wp_enqueue_script('retinajs', TC_BASE_URL . 'inc/assets/js/retina.min.js', array(), CUSTOMIZR_VER, $in_footer = true);
     }
     //Load hammer.js for mobile
     if (apply_filters('tc_load_hammerjs', wp_is_mobile())) {
         wp_enqueue_script('hammer', TC_BASE_URL . 'inc/assets/js/hammer.min.js', array('jquery'), CUSTOMIZR_VER);
     }
 }
Exemple #6
0
##hook of the featured page (priority 10) and breadcrumb (priority 20)...and whatever you need!
?>

    <div class="container" role="main">
        <div class="<?php 
echo implode(' ', apply_filters('tc_column_content_wrapper_classes', array('row', 'column-content-wrapper')));
?>
">

            <?php 
do_action('__before_article_container');
##hook of left sidebar
?>

                <div id="content" class="<?php 
echo implode(' ', apply_filters('tc_article_container_class', array(TC_utils::tc_get_layout(TC_utils::tc_id(), 'class'), 'article-container')));
?>
">

                    <?php 
do_action('__before_loop');
##hooks the heading of the list of post : archive, search...
?>

                        <?php 
if (tc__f('__is_no_results') || is_404()) {
    ##no search results or 404 cases
    ?>

                            <article <?php 
    tc__f('__article_selectors');
   /**
    * Displays the placeholder view if conditions are met in TC_placeholders::tc_is_second_menu_placeholder_on()
    * fired in tc_menu_display(), hook : __navbar
    * @since Customizr 3.4
    */
   function tc_maybe_display_second_menu_placeholder()
   {
       if (!TC_placeholders::tc_is_second_menu_placeholder_on()) {
           return;
       }
       ?>
 <div class="nav-collapse collapse tc-placeholder-wrap tc-menu-placeholder">
   <?php 
       printf('<p><strong>%1$s %2$s</strong></p>', __("You can display another menu here.", "customizr"), sprintf(__("Setup this menu %s or read the %s.", "customizr"), sprintf('<a href="%1$s" title="%2$s">%3$s</a>', TC_utils::tc_get_customizer_url(array("section" => "nav")), __("Add a menu", "customizr"), __("now", "customizr")), sprintf('<a href="%1$s" title="%2$s" target="blank">%2$s</a><span class="tc-external"></span>', esc_url('doc.presscustomizr.com/customizr/header-options/#navigation'), __("documentation", "customizr"))));
       printf('<a class="tc-dismiss-notice" href="#" title="%1$s">%1$s x</a>', __('dismiss notice', 'customizr'));
       ?>
 </div>
 <?php 
   }
        /**
         * The template displaying one single featured page
         * fired in : tc_fp_block_display()
         *
         * @package Customizr
         * @since Customizr 3.0
         * @param area are defined in featured-pages templates,show_img is a customizer option
         * @todo better area definition : dynamic
         */
        function tc_fp_single_display($fp_single_id, $show_img)
        {
            $_skin_color = TC_utils::$inst->tc_get_skin_color();
            $fp_holder_img = apply_filters('tc_fp_holder_img', sprintf('<img class="tc-holder-img" data-src="holder.js/270x250/%1$s:%2$s" data-no-retina alt="Holder Thumbnail" style="width:270px;height:250px;"/>', '#E4E4E4' != $_skin_color ? '#EEE' : '#5A5A5A', $_skin_color));
            $featured_page_id = 0;
            //if fps are not set
            if (null == TC_utils::$inst->tc_opt('tc_featured_page_' . $fp_single_id) || !TC_utils::$inst->tc_opt('tc_featured_page_' . $fp_single_id)) {
                //admin link if user logged in
                $featured_page_link = '';
                $customizr_link = '';
                if (is_user_logged_in() && current_user_can('edit_theme_options')) {
                    $customizr_link = sprintf('<a href="%1$s" title="%2$s">%3$s</a>', TC_utils::tc_get_customizer_url(array('control' => 'tc_featured_text_' . $fp_single_id, 'section' => 'frontpage_sec')), __('Customizer screen', 'customizr'), __('Edit now.', 'customizr'));
                    $featured_page_link = apply_filters('tc_fp_link_url', TC_utils::tc_get_customizer_url(array('control' => 'tc_featured_page_' . $fp_single_id, 'section' => 'frontpage_sec')));
                }
                //rendering
                $featured_page_id = null;
                $featured_page_title = apply_filters('tc_fp_title', __('Featured page', 'customizr'), $fp_single_id, $featured_page_id);
                $text = apply_filters('tc_fp_text', sprintf('%1$s %2$s', __('Featured page description text : use the page excerpt or set your own custom text in the Customizr screen.', 'customizr'), $customizr_link), $fp_single_id, $featured_page_id);
                $fp_img = apply_filters('fp_img_src', $fp_holder_img, $fp_single_id, $featured_page_id);
            } else {
                $featured_page_id = apply_filters('tc_fp_id', esc_attr(TC_utils::$inst->tc_opt('tc_featured_page_' . $fp_single_id)), $fp_single_id);
                $featured_page_link = apply_filters('tc_fp_link_url', get_permalink($featured_page_id), $fp_single_id);
                $featured_page_title = apply_filters('tc_fp_title', get_the_title($featured_page_id), $fp_single_id, $featured_page_id);
                //when are we displaying the edit link?
                $edit_enabled = is_user_logged_in() && current_user_can('edit_pages') && is_page($featured_page_id) ? true : false;
                $edit_enabled = is_user_logged_in() && current_user_can('edit_post', $featured_page_id) && !is_page($featured_page_id) ? true : $edit_enabled;
                $edit_enabled = apply_filters('tc_edit_in_fp_title', $edit_enabled);
                $featured_text = apply_filters('tc_fp_text', TC_utils::$inst->tc_opt('tc_featured_text_' . $fp_single_id), $fp_single_id, $featured_page_id);
                $featured_text = apply_filters('tc_fp_text_sanitize', strip_tags(html_entity_decode($featured_text)), $fp_single_id, $featured_page_id);
                //get the page/post object
                $page = get_post($featured_page_id);
                //set page excerpt as default text if no $featured_text
                $text = empty($featured_text) && !post_password_required($featured_page_id) ? strip_tags(apply_filters('the_content', $page->post_excerpt)) : $featured_text;
                $text = empty($text) && !post_password_required($featured_page_id) ? strip_tags(apply_filters('the_content', $page->post_content)) : $text;
                //limit text to 200 car
                $default_fp_text_length = apply_filters('tc_fp_text_length', 200, $fp_single_id, $featured_page_id);
                $text = strlen($text) > $default_fp_text_length ? substr($text, 0, strpos($text, ' ', $default_fp_text_length)) . ' ...' : $text;
                //set the image : uses thumbnail if any then >> the first attached image then >> a holder script
                $fp_img_size = apply_filters('tc_fp_img_size', 'tc-thumb', $fp_single_id, $featured_page_id);
                //allow user to specify a custom image id
                $fp_custom_img_id = apply_filters('fp_img_id', null, $fp_single_id, $featured_page_id);
                $fp_img = $this->tc_get_fp_img($fp_img_size, $featured_page_id, $fp_custom_img_id);
                $fp_img = $fp_img ? $fp_img : $fp_holder_img;
                $fp_img = apply_filters('fp_img_src', $fp_img, $fp_single_id, $featured_page_id);
            }
            //end if
            //Let's render this
            ob_start();
            ?>

          <div class="widget-front">
            <?php 
            if (isset($show_img) && $show_img == 1) {
                //check if image option is checked
                printf('<div class="thumb-wrapper %1$s">%2$s%3$s</div>', $fp_img == $fp_holder_img ? 'tc-holder' : '', apply_filters('tc_fp_round_div', sprintf('<a class="round-div" href="%1$s" title="%2$s"></a>', $featured_page_link, $featured_page_title), $fp_single_id, $featured_page_id), $fp_img);
            }
            //end if image enabled check
            //title block
            $tc_fp_title_block = sprintf('<%1$s>%2$s %3$s</%1$s>', apply_filters('tc_fp_title_tag', 'h2', $fp_single_id, $featured_page_id), $featured_page_title, isset($edit_enabled) && $edit_enabled ? sprintf('<span class="edit-link btn btn-inverse btn-mini"><a class="post-edit-link" href="%1$s" title="%2$s" target="_blank">%2$s</a></span>', get_edit_post_link($featured_page_id), __('Edit', 'customizr')) : '');
            echo apply_filters('tc_fp_title_block', $tc_fp_title_block, $featured_page_title, $fp_single_id, $featured_page_id);
            //text block
            $tc_fp_text_block = sprintf('<p class="fp-text-%1$s">%2$s</p>', $fp_single_id, $text);
            echo apply_filters('tc_fp_text_block', $tc_fp_text_block, $fp_single_id, $text, $featured_page_id);
            //button block
            $tc_fp_button_text = apply_filters('tc_fp_button_text', esc_attr(TC_utils::$inst->tc_opt('tc_featured_page_button_text')), $fp_single_id);
            if ($tc_fp_button_text || TC___::$instance->tc_is_customizing()) {
                $tc_fp_button_class = apply_filters('tc_fp_button_class', 'btn btn-primary fp-button', $fp_single_id);
                $tc_fp_button_class = $tc_fp_button_text ? $tc_fp_button_class : $tc_fp_button_class . ' hidden';
                $tc_fp_button_block = sprintf('<a class="%1$s" href="%2$s" title="%3$s">%4$s</a>', $tc_fp_button_class, $featured_page_link, $featured_page_title, $tc_fp_button_text);
                echo apply_filters('tc_fp_button_block', $tc_fp_button_block, $featured_page_link, $featured_page_title, $fp_single_id, $featured_page_id);
            }
            ?>

          </div><!-- /.widget-front -->

          <?php 
            $html = ob_get_contents();
            if ($html) {
                ob_end_clean();
            }
            return apply_filters('tc_fp_single_display', $html, $fp_single_id, $show_img, $fp_img, $featured_page_link, $featured_page_title, $text, $featured_page_id);
        }
 /**
  * Adds various classes on the body element.
  * hook body_class
  *
  * @package Customizr
  * @since Customizr 3.2.0
  */
 function tc_set_body_classes($_classes)
 {
     if (0 != esc_attr(TC_utils::$inst->tc_opt('tc_link_hover_effect'))) {
         array_push($_classes, 'tc-fade-hover-links');
     }
     if (TC___::$instance->tc_is_customizing()) {
         array_push($_classes, 'is-customizing');
     }
     if (wp_is_mobile()) {
         array_push($_classes, 'tc-is-mobile');
     }
     if (0 != esc_attr(TC_utils::$inst->tc_opt('tc_enable_dropcap'))) {
         array_push($_classes, esc_attr(TC_utils::$inst->tc_opt('tc_dropcap_design')));
     }
     //adds the layout
     $_layout = TC_utils::tc_get_layout(get_the_ID(), 'sidebar');
     if (in_array($_layout, array('b', 'l', 'r', 'f'))) {
         array_push($_classes, sprintf('tc-%s-sidebar', 'f' == $_layout ? 'no' : $_layout));
     }
     return $_classes;
 }
 /**
  * Helper : check if a given tax is allowed in the post metas or not
  * A tax is authorized if :
  * 1) not in the exclude list
  * 2) AND not private
  *
  * @return boolean (false)
  * @param  $post_type, $_tax_object
  * @package Customizr
  * @since Customizr 3.3+
  *
  */
 public function tc_is_tax_authorized($_tax_object, $post_type)
 {
     $_in_exclude_list = in_array($_tax_object['name'], apply_filters_ref_array('tc_exclude_taxonomies_from_metas', array(array('post_format'), $post_type, TC_utils::tc_id())));
     $_is_private = false === (bool) $_tax_object['public'] && apply_filters_ref_array('tc_exclude_private_taxonomies', array(true, $_tax_object['public'], TC_utils::tc_id()));
     return !$_in_exclude_list && !$_is_private;
 }
 /**
  * When do we display this placeholder ?
  * User logged in
  * + Admin
  * + User did not dismissed the notice
  * @param : string position left or right
  * @since Customizr 3.3
  */
 private function tc_display_sidebar_placeholder($position)
 {
     if (!TC_placeholders::tc_is_widget_placeholder_enabled('sidebar')) {
         return;
     }
     ?>
 <aside class="tc-placeholder-wrap tc-widget-placeholder">
   <?php 
     printf('<span class="tc-admin-notice">%1$s</span>', __('This block is visible for admin users only.', 'customizr'));
     printf('<h4>%1$s</h4>', sprintf(__('The %s sidebar has no widgets.', 'customizr'), $position));
     printf('<p><strong>%1$s</strong></p>', sprintf(__("Add widgets to this sidebar %s or %s.", "customizr"), sprintf('<a href="%1$s" title="%2$s">%3$s</a>', TC_utils::tc_get_customizer_url(array('panel' => 'widgets')), __("Add widgets", "customizr"), __("now", "customizr")), sprintf('<a class="tc-inline-dismiss-notice" data-position="sidebar" href="#" title="%1$s">%1$s</a>', __('dismiss this notice', 'customizr'))));
     printf('<p><i>%1s <a href="http:%2$s" title="%3$s" target="blank">%4$s</a></i></p>', __('You can also remove this sidebar by changing the current page layout.', 'customizr'), '//docs.presscustomizr.com/customizr/content-options/#pages-and-posts-layout', __('Changing the layout in the Customizr theme', 'customizr'), __('See the theme documentation.', 'customizr'));
     printf('<a class="tc-dismiss-notice" data-position="sidebar" href="#" title="%1$s">%1$s x</a>', __('dismiss notice', 'customizr'));
     ?>
 </aside>
 <?php 
 }
Exemple #12
0
   /**
    * Displays a help block about featured images for single posts
    * hook : __before_content
    * @since Customizr 3.4
    */
   function tc_maybe_display_featured_image_help()
   {
       if (!TC_placeholders::tc_is_thumbnail_help_on()) {
           return;
       }
       ?>
 <div class="tc-placeholder-wrap tc-thumbnail-help">
   <?php 
       printf('<p><strong>%1$s</strong></p><p>%2$s</p><p>%3$s</p>', __("You can display your post's featured image here if you have set one.", "customizr"), sprintf(__("%s to display a featured image here.", "customizr"), sprintf('<strong><a href="%1$s" title="%2$s">%2$s</a></strong>', TC_utils::tc_get_customizer_url(array("section" => "single_posts_sec")), __("Jump to the customizer now", "customizr"))), sprintf(__("Don't know how to set a featured image to a post? Learn how in the %s.", "customizr"), sprintf('<a href="%1$s" title="%2$s" target="_blank">%2$s</a><span class="tc-external"></span>', esc_url('codex.wordpress.org/Post_Thumbnails#Setting_a_Post_Thumbnail'), __("WordPress documentation", "customizr"))));
       printf('<a class="tc-dismiss-notice" href="#" title="%1$s">%1$s x</a>', __('dismiss notice', 'customizr'));
       ?>
 </div>
 <?php 
   }
   /**
    * Print Smartload help block notice
    *
    * @package Customizr
    * @since Customizr 3.4+
    */
   static function tc_print_smartload_help_block()
   {
       //prepare js printing in the footer
       add_filter('tc_write_img_smartload_help_js', '__return_true');
       ob_start();
       ?>
 <div class="tc-placeholder-wrap tc-img-smartload-help">
   <?php 
       printf('<p><strong>%1$s</strong></p><p>%2$s</p>', __("Did you know you can easily speed up your page load by deferring the loading of the non visible images?", "customizr"), sprintf(__("%s and check the option 'Load images on scroll' under 'Website Performances' section.", "customizr"), sprintf('<strong><a href="%1$s" title="%2$s">%2$s</a></strong>', TC_utils::tc_get_customizer_url(array("control" => "tc_img_smart_load", "section" => "performances_sec")), __("Jump to the customizer now", "customizr"))));
       printf('<a class="tc-dismiss-notice" href="#" title="%1$s">%1$s x</a>', __('dismiss notice', 'customizr'));
       ?>
 </div>
 <?php 
       $help_block = ob_get_contents();
       ob_end_clean();
       return $help_block;
   }
Exemple #14
0
<?php
/*
Page Name: Imdex
*/

get_header(); ?>

<div id="main-wrapper" class="container">

    <div class="container" role="main">
        <div class="<?php echo implode(' ', apply_filters( 'tc_column_content_wrapper_classes' , array('row' ,'column-content-wrapper') ) ) ?>">

            <div id="content" class="<?php echo implode(' ', apply_filters( 'tc_article_container_class' , array( TC_utils::tc_get_layout( TC_utils::tc_id() , 'class' ) , 'article-container' ) ) ) ?>">

                <?php do_action ('__before_loop');##hooks the heading of the list of post : archive, search... ?>

                <?php if ( tc__f('__is_no_results') || is_404() ) : ##no search results or 404 cases ?>

                <article <?php tc__f('__article_selectors') ?>>
                    <?php do_action( '__loop' ); ?>
                </article>

            <?php endif; ?>

            <?php if ( have_posts() && ! is_404() ) : ?>
            <?php while ( have_posts() ) : ##all other cases for single and lists: post, custom post type, page, archives, search, 404 ?>
            <?php the_post(); ?>

            <?php do_action ('__before_article') ?>
            <article <?php tc__f('__article_selectors') ?>>
                <?php do_action( '__loop' ); ?>
   /**
    * Displays the placeholder view if conditions are met in TC_placeholders::tc_is_second_menu_placeholder_on()
    * fired in tc_menu_display(), hook : __navbar
    * @since Customizr 3.4
    */
   function tc_maybe_display_second_menu_placeholder()
   {
       if (!TC_placeholders::tc_is_second_menu_placeholder_on()) {
           return;
       }
       ?>
 <div class="nav-collapse collapse tc-placeholder-wrap tc-menu-placeholder">
   <?php 
       printf('<p><strong>%1$s<br/>%2$s</strong></p>', __("You can display your main menu or a second menu here horizontally.", "customizr"), sprintf(__("%s or read the %s.", "customizr"), sprintf('<a href="%1$s" title="%2$s">%3$s</a>', TC_utils::tc_get_customizer_url(array("section" => "nav")), __("Manage menus in the header", "customizr"), __("Manage your menus in the header now", "customizr")), sprintf('<a href="%1$s" title="%2$s" target="blank">%2$s</a><span class="tc-external"></span>', esc_url('http://docs.presscustomizr.com/article/101-customizr-theme-options-header-settings/#navigation'), __("documentation", "customizr"))));
       printf('<a class="tc-dismiss-notice" href="#" title="%1$s">%1$s x</a>', __('dismiss notice', 'customizr'));
       ?>
 </div>
 <?php 
   }
        /**
         * The template part for displaying nav links
         *
         * @package Customizr
         * @since Customizr 3.0
         */
        function tc_post_nav()
        {
            // When do we display navigation ?
            //1) we don"t show post navigation for pages by default
            //2) + filter conditions
            $post_navigation_bool = is_page(TC_utils::tc_id()) ? false : true;
            $prev_arrow = is_rtl() ? '&rarr;' : '&larr;';
            $next_arrow = is_rtl() ? '&larr;' : '&rarr;';
            if (!apply_filters('tc_show_post_navigation', $post_navigation_bool)) {
                return;
            }
            global $wp_query;
            $html_id = 'nav-below';
            ob_start();
            ?>

        <?php 
            if (is_singular()) {
                ?>

          <?php 
                echo apply_filters('tc_singular_nav_separator', '<hr class="featurette-divider ' . current_filter() . '">');
                ?>

          <nav id="<?php 
                echo $html_id;
                ?>
" class="navigation" role="navigation">

              <h3 class="assistive-text">
                <?php 
                echo apply_filters('tc_singular_nav_title', __('Post navigation', 'customizr'));
                ?>
              </h3>

              <ul class="pager">
                <?php 
                if (get_previous_post() != null) {
                    ?>
                  <li class="previous">
                    <span class="nav-previous">
                      <?php 
                    $singular_nav_previous_text = apply_filters('tc_singular_nav_previous_text', _x($prev_arrow, 'Previous post link', 'customizr'));
                    $previous_post_link_args = apply_filters('tc_previous_single_post_link_args', array('format' => '%link', 'link' => '<span class="meta-nav">' . $singular_nav_previous_text . '</span> %title', 'in_same_term' => false, 'excluded_terms' => '', 'taxonomy' => 'category'));
                    extract($previous_post_link_args, EXTR_OVERWRITE);
                    previous_post_link($format, $link, $in_same_term, $excluded_terms, $taxonomy);
                    ?>
                    </span>
                  </li>
                <?php 
                }
                ?>
                <?php 
                if (get_next_post() != null) {
                    ?>
                  <li class="next">
                    <span class="nav-next">
                        <?php 
                    $singular_nav_next_text = apply_filters('tc_singular_nav_next_text', _x($next_arrow, 'Next post link', 'customizr'));
                    $next_post_link_args = apply_filters('tc_next_single_post_link_args', array('format' => '%link', 'link' => '%title <span class="meta-nav">' . $singular_nav_next_text . '</span>', 'in_same_term' => false, 'excluded_terms' => '', 'taxonomy' => 'category'));
                    extract($next_post_link_args, EXTR_OVERWRITE);
                    next_post_link($format, $link, $in_same_term, $excluded_terms, $taxonomy);
                    ?>
                    </span>
                  </li>
                <?php 
                }
                ?>
              </ul>

          </nav><!-- #<?php 
                echo $html_id;
                ?>
 .navigation -->

        <?php 
            } elseif ($wp_query->max_num_pages > 1 && !is_404() && !tc__f('__is_home_empty')) {
                ?>

          <nav id="<?php 
                echo $html_id;
                ?>
" class="navigation" role="navigation">

            <h3 class="assistive-text">
              <?php 
                echo apply_filters('tc_list_nav_title', __('Post navigation', 'customizr'));
                ?>
            </h3>

              <ul class="pager">

                <?php 
                if (get_next_posts_link() != null) {
                    ?>

                  <li class="previous">
                    <span class="nav-previous">
                      <?php 
                    $next_posts_link_args = apply_filters('tc_next_posts_link_args', array('label' => apply_filters('tc_list_nav_next_text', __('<span class="meta-nav">&larr;</span> Older posts', 'customizr')), 'max_pages' => 0));
                    extract($next_posts_link_args, EXTR_OVERWRITE);
                    next_posts_link($label, $max_pages);
                    ?>
                    </span>
                  </li>

                <?php 
                }
                ?>

                <?php 
                if (get_previous_posts_link() != null) {
                    ?>

                  <li class="next">
                    <span class="nav-next">
                      <?php 
                    $previous_posts_link_args = apply_filters('tc_previous_posts_link_args', array('label' => apply_filters('tc_list_nav_previous_text', __('Newer posts <span class="meta-nav">&rarr;</span>', 'customizr')), 'max_pages' => 0));
                    extract($previous_posts_link_args, EXTR_OVERWRITE);
                    previous_posts_link($label, $max_pages);
                    ?>
                    </span>
                  </li>

                <?php 
                }
                ?>

              </ul>

          </nav><!-- #<?php 
                echo $html_id;
                ?>
 .navigation -->

        <?php 
            }
            ?>

        <?php 
            $html = ob_get_contents();
            if ($html) {
                ob_end_clean();
            }
            echo apply_filters('tc_post_nav', $html);
        }
    /**
    * CUSTOMIZR WRAPPERS
    * print the customizr wrappers
    *
    * @since 3.3+
    *
    * originally used for woocommerce compatibility
    */
    function tc_mainwrapper_start() {
      ?>
      <div id="main-wrapper" class="<?php echo implode(' ', apply_filters( 'tc_main_wrapper_classes' , array('container') ) ) ?>">

        <?php do_action( '__before_main_container' ); ##hook of the featured page (priority 10) and breadcrumb (priority 20)...and whatever you need! ?>

        <div class="container" role="main">
          <div class="<?php echo implode(' ', apply_filters( 'tc_column_content_wrapper_classes' , array('row' ,'column-content-wrapper') ) ) ?>">

            <?php do_action( '__before_article_container'); ##hook of left sidebar?>

              <div id="content" class="<?php echo implode(' ', apply_filters( 'tc_article_container_class' , array( TC_utils::tc_get_layout( TC_utils::tc_id() , 'class' ) , 'article-container' ) ) ) ?>">

                <?php do_action ('__before_loop');##hooks the header of the list of post : archive, search... ?>
      <?php
    }
     /**
      * hook : __after_carousel_inner
      * @since v3.4+
      */
     function tc_maybe_display_dismiss_notice()
     {
         if (!TC_placeholders::tc_is_slider_notice_on()) {
             return;
         }
         $_customizer_lnk = TC_utils::tc_get_customizer_url(array('control' => 'tc_front_slider', 'section' => 'frontpage_sec'));
         ?>
 <div class="tc-placeholder-wrap tc-slider-notice">
   <?php 
         printf('<p><strong>%1$s</strong></p>', sprintf(__("Select your own slider %s, or %s (you'll be able to add one back later).", "customizr"), sprintf('<a href="%3$s" title="%1$s">%2$s</a>', __("Select your own slider", "customizr"), __("now", "customizr"), $_customizer_lnk), sprintf('<a href="#" class="tc-inline-remove" title="%1$s">%2$s</a>', __("Remove the home page slider", "customizr"), __("remove this demo slider", "customizr"))));
         printf('<a class="tc-dismiss-notice" href="#" title="%1$s">%1$s x</a>', __('dismiss notice', 'customizr'));
         ?>
 </div>
 <?php 
     }
    /**
    * Display or return the thumbnail view
    * @param : thumbnail model (img, width, height), layout value, echo bool
    * @package Customizr
    * @since Customizr 3.0.10
    */
    function tc_render_thumb_view( $_thumb_model , $layout = 'span3', $_echo = true ) {
      if ( empty( $_thumb_model ) )
        return;
      //extract "tc_thumb" , "tc_thumb_height" , "tc_thumb_width"
      extract( $_thumb_model );
      $thumb_img        = ! isset( $_thumb_model) ? false : $tc_thumb;
      $thumb_img        = apply_filters( 'tc_post_thumb_img', $thumb_img, TC_utils::tc_id() );
      if ( ! $thumb_img )
        return;

      //handles the case when the image dimensions are too small
      $thumb_size       = apply_filters( 'tc_thumb_size' , TC_init::$instance -> tc_thumb_size, TC_utils::tc_id()  );
      $no_effect_class  = ( isset($tc_thumb) && isset($tc_thumb_height) && ( $tc_thumb_height < $thumb_size['height']) ) ? 'no-effect' : '';
      $no_effect_class  = ( esc_attr( TC_utils::$inst->tc_opt( 'tc_center_img') ) || ! isset($tc_thumb) || empty($tc_thumb_height) || empty($tc_thumb_width) ) ? '' : $no_effect_class;

      //default hover effect
      $thumb_wrapper    = sprintf('<div class="%5$s %1$s"><div class="round-div"></div><a class="round-div %1$s" href="%2$s" title="%3$s"></a>%4$s</div>',
                                    implode( " ", apply_filters( 'tc_thumbnail_link_class', array( $no_effect_class ) ) ),
                                    get_permalink( get_the_ID() ),
                                    esc_attr( strip_tags( get_the_title( get_the_ID() ) ) ),
                                    $thumb_img,
                                    implode( " ", apply_filters( 'tc_thumb_wrapper_class', array('thumb-wrapper') ) )
      );

      $thumb_wrapper    = apply_filters_ref_array( 'tc_post_thumb_wrapper', array( $thumb_wrapper, $thumb_img, TC_utils::tc_id() ) );

      //cache the thumbnail view
      $html             = sprintf('<section class="tc-thumbnail %1$s">%2$s</section>',
        apply_filters( 'tc_post_thumb_class', $layout ),
        $thumb_wrapper
      );
      $html = apply_filters_ref_array( 'tc_render_thumb_view', array( $html, $_thumb_model, $layout ) );
      if ( ! $_echo )
        return $html;
      echo $html;
    }//end of function
 /**
  * Helper to return the current post terms of specified taxonomy type : hierarchical or not
  *
  * @return boolean (false) or array
  * @param  boolean : hierarchical or not
  * @package Customizr
  * @since Customizr 3.1.20
  *
  */
 public function tc_get_term_of_tax_type($hierarchical = true)
 {
     //var declaration
     $post_type = get_post_type(TC_utils::tc_id());
     $tax_list = get_object_taxonomies($post_type, 'object');
     $_tax_type_list = array();
     $_tax_type_terms_list = array();
     if (empty($tax_list)) {
         return false;
     }
     //filter the post taxonomies
     while ($el = current($tax_list)) {
         //skip the post format taxinomy
         if (in_array(key($tax_list), apply_filters_ref_array('tc_exclude_taxonomies_from_metas', array(array('post_format'), $post_type, TC_utils::tc_id())))) {
             next($tax_list);
             continue;
         }
         if ((bool) $hierarchical === (bool) $el->hierarchical) {
             $_tax_type_list[key($tax_list)] = $el;
         }
         next($tax_list);
     }
     if (empty($_tax_type_list)) {
         return false;
     }
     //fill the post terms array
     foreach ($_tax_type_list as $tax_name => $data) {
         $_current_tax_terms = get_the_terms(TC_utils::tc_id(), $tax_name);
         //If current post support this tax but no terms has been assigned yet = continue
         if (!$_current_tax_terms) {
             continue;
         }
         while ($term = current($_current_tax_terms)) {
             $_tax_type_terms_list[$term->term_id] = $term;
             next($_current_tax_terms);
         }
     }
     return empty($_tax_type_terms_list) ? false : apply_filters("tc_tax_meta_list", $_tax_type_terms_list, $hierarchical);
 }