function get_content() { /* ---------------------------------------------------------------------------- Prepare the content */ $content = get_the_content(__td('Continue', TD_THEME_NAME)); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); /** ---------------------------------------------------------------------------- * Smart list support. class_exists and new object WORK VIA AUTOLOAD * @see td_autoload_classes::loading_classes */ //$td_smart_list = get_post_meta($this->post->ID, 'td_smart_list', true); $td_smart_list = get_post_meta($this->post->ID, 'td_post_theme_settings', true); if (!empty($td_smart_list['smart_list_template'])) { $td_smart_list_class = $td_smart_list['smart_list_template']; if (class_exists($td_smart_list_class)) { $td_smart_list_obj = new $td_smart_list_class(); // make the class from string * magic :) return $td_smart_list_obj->render_from_post_content($content); } else { // there was an error? td_util::error(__FILE__, 'Missing smart list: ' . $td_smart_list_class . '. Did you disabled a tagDiv plugin?'); } } /* ---------------------------------------------------------------------------- end smart list - if we have a list, the function returns above */ /* ---------------------------------------------------------------------------- ad support on content */ //read the current ad settings $tds_inline_ad_paragraph = td_util::get_option('tds_inline_ad_paragraph'); $tds_inline_ad_align = td_util::get_option('tds_inline_ad_align'); //add the inline ad if (td_util::is_ad_spot_enabled('content_inline') and is_single()) { if (empty($tds_inline_ad_paragraph)) { $tds_inline_ad_paragraph = 0; } $cnt = 0; $content_buffer = ''; // we replace the content with this buffer at the end $content_parts = preg_split('/(<p.*>)/U', $content, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); foreach ($content_parts as $content_part_index => $content_part_value) { if (!empty($content_part_value)) { if ($tds_inline_ad_paragraph == $content_part_index / 2) { //it's time to show the ad switch ($tds_inline_ad_align) { case 'left': $content_buffer .= td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'content_inline', 'align' => 'left')); break; case 'right': $content_buffer .= td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'content_inline', 'align' => 'right')); break; default: $content_buffer .= td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'content_inline')); break; } } $content_buffer .= $content_part_value; $cnt++; } } $content = $content_buffer; } //add the top ad if (td_util::is_ad_spot_enabled('content_top') and is_single()) { $content = td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'content_top')) . $content; } //add bottom ad if (td_util::is_ad_spot_enabled('content_bottom') and is_single()) { $content = $content . td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'content_bottom')); } return $content; }
function get_content() { /* ---------------------------------------------------------------------------- Prepare the content */ $content = get_the_content(__td('Continue', TD_THEME_NAME)); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); /* ---------------------------------------------------------------------------- Smart list support @todo reorganizare partea asta */ $td_smart_list = get_post_meta($this->post->ID, 'td_smart_list', true); if (!empty($td_smart_list['smart_list_template'])) { switch ($td_smart_list['smart_list_template']) { case 'td_smart_list_1': $td_smart_list_obj = new td_smart_list_1(); break; case 'td_smart_list_2': $td_smart_list_obj = new td_smart_list_2(); break; case 'td_smart_list_3': $td_smart_list_obj = new td_smart_list_3(); break; case 'td_smart_list_4': $td_smart_list_obj = new td_smart_list_4(); break; } if (isset($td_smart_list_obj)) { return $td_smart_list_obj->render_from_post_content($content); } else { //there was an error? } } /* ---------------------------------------------------------------------------- end smart list - if we have a list, the function returns above */ /* ---------------------------------------------------------------------------- ad support on content */ $tds_inline_ad_paragraph = td_util::get_option('tds_inline_ad_paragraph'); $tds_inline_ad_align = td_util::get_option('tds_inline_ad_align'); if (td_util::is_ad_spot_enabled('content_inline') and is_single()) { if (empty($tds_inline_ad_paragraph)) { $tds_inline_ad_paragraph = 0; } $content_buffer = ''; // we replace the content with this buffer at the end $content_parts = preg_split('/(<p.*>)/U', $content, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); //print_r($content_parts); //die; //$content_parts = explode('<p>', $content); foreach ($content_parts as $content_part_index => $content_part) { if (!empty($content_part)) { if ($tds_inline_ad_paragraph == $content_part_index / 2) { //we have 0 = > <p> 1 => content - that's why we have to divide by 2 //it's time to show the ad switch ($tds_inline_ad_align) { case 'left': $content_buffer .= td_global_blocks::get_instance('td_ad_box')->render(array('spot_id' => 'content_inline', 'align' => 'left')); break; case 'right': $content_buffer .= td_global_blocks::get_instance('td_ad_box')->render(array('spot_id' => 'content_inline', 'align' => 'right')); break; default: $content_buffer .= td_global_blocks::get_instance('td_ad_box')->render(array('spot_id' => 'content_inline')); break; } } $content_buffer .= $content_part; } } //end foreach $content = $content_buffer; } //add bottom ad if (td_util::is_ad_spot_enabled('content_bottom') and is_single()) { $content = $content . td_global_blocks::get_instance('td_ad_box')->render(array('spot_id' => 'content_bottom')); } return $content; }
/** * the content of a single post or single post type * @return mixed|string|void */ function get_content() { /* ---------------------------------------------------------------------------- Prepare the content */ $content = get_the_content(__td('Continue', TD_THEME_NAME)); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); /** ---------------------------------------------------------------------------- * Smart list support. class_exists and new object WORK VIA AUTOLOAD * @see td_autoload_classes::loading_classes */ //$td_smart_list = get_post_meta($this->post->ID, 'td_smart_list', true); $td_smart_list = get_post_meta($this->post->ID, 'td_post_theme_settings', true); if (!empty($td_smart_list['smart_list_template'])) { $td_smart_list_class = $td_smart_list['smart_list_template']; if (class_exists($td_smart_list_class)) { /** * @var $td_smart_list_obj td_smart_list */ $td_smart_list_obj = new $td_smart_list_class(); // make the class from string * magic :) // prepare the settings for the smart list $smart_list_settings = array('post_content' => $content, 'counting_order_asc' => false, 'td_smart_list_h' => 'h3', 'extract_first_image' => td_api_smart_list::get_key($td_smart_list_class, 'extract_first_image')); if (!empty($td_smart_list['td_smart_list_order'])) { $smart_list_settings['counting_order_asc'] = true; } if (!empty($td_smart_list['td_smart_list_h'])) { $smart_list_settings['td_smart_list_h'] = $td_smart_list['td_smart_list_h']; } return $td_smart_list_obj->render_from_post_content($smart_list_settings); } else { // there was an error? td_util::error(__FILE__, 'Missing smart list: ' . $td_smart_list_class . '. Did you disabled a tagDiv plugin?'); } } /* ---------------------------------------------------------------------------- end smart list - if we have a list, the function returns above */ /* ---------------------------------------------------------------------------- ad support on content */ //read the current ad settings $tds_inline_ad_paragraph = td_util::get_option('tds_inline_ad_paragraph'); $tds_inline_ad_align = td_util::get_option('tds_inline_ad_align'); //add the inline ad if (td_util::is_ad_spot_enabled('content_inline') and is_single()) { if (empty($tds_inline_ad_paragraph)) { $tds_inline_ad_paragraph = 0; } $cnt = 0; $content_buffer = ''; // we replace the content with this buffer at the end $content_parts = preg_split('/(<p.*>)/U', $content, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $p_open_tag_count = 0; // count how many <p> tags we have added to the buffer foreach ($content_parts as $content_part_index => $content_part_value) { if (!empty($content_part_value)) { // Show the ad ONLY IF THE CURRENT PART IS A <p> opening tag and before the <p> -> so we will have <p>content</p> ~ad~ <p>content</p> // and prevent cases like <p> ~ad~ content</p> if (preg_match('/(<p.*>)/U', $content_part_value) === 1) { if ($tds_inline_ad_paragraph == $p_open_tag_count) { switch ($tds_inline_ad_align) { case 'left': $content_buffer .= td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'content_inline', 'align' => 'left')); break; case 'right': $content_buffer .= td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'content_inline', 'align' => 'right')); break; default: $content_buffer .= td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'content_inline')); break; } } $p_open_tag_count++; } $content_buffer .= $content_part_value; $cnt++; } } $content = $content_buffer; } //add the top ad if (td_util::is_ad_spot_enabled('content_top') and is_single()) { $content = td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'content_top')) . $content; } //add bottom ad if (td_util::is_ad_spot_enabled('content_bottom') and is_single()) { $content = $content . td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'content_bottom')); } return $content; }
?> </div> <div class="lb2"> <?php //add the left 2 add if (td_util::is_ad_spot_enabled('custom_ad_2') and is_single()) { echo td_global_blocks::get_instance('td_ad_box')->render(array('spot_id' => 'custom_ad_2')); } ?> </div> </div> <?php } ?> <div class="span8 column_container td-post-content" role="main" itemprop="mainContentOfPage" <?php if (!td_util::is_ad_spot_enabled('custom_ad_1') and is_single()) { ?> style="margin-left:85px;"<?php } ?> > <?php locate_template('loop-single.php', true); // comments_template('', true); ?> </div> <div style="width: 26%;margin-left:25px;" class="span4 column_container td-post-sidebar" role="complementary" itemscope="itemscope" itemtype="<?php echo td_global::$http_or_https; ?> ://schema.org/WPSideBar"> <?php