/** * 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 }
/** * 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 }
/** * 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 }
/** * 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 }
/** * 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 }
/** * 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 }
/** * 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; }
/** * 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); }