function inner($posts, $td_column_number = '') { $buffy = ''; $td_block_layout = new td_block_layout(); if (empty($td_column_number)) { $td_column_number = td_util::vc_get_column_number(); // get the column width of the block from the page builder API } if (!empty($posts)) { foreach ($posts as $post) { switch ($td_column_number) { case '1': $td_module_mx3 = new td_module_mx3($post); $buffy .= $td_module_mx3->render($post); break; case '2': $td_module_14 = new td_module_14($post); $buffy .= $td_module_14->render($post); break; case '3': //we use module 14 - maybe use a full screen one? $td_module_14 = new td_module_14($post); $buffy .= $td_module_14->render($post); break; } } } $buffy .= $td_block_layout->close_all_tags(); return $buffy; }
function render($atts, $content = null) { parent::render($atts); // sets the live atts, $this->atts, $this->block_uid, $this->td_query (it runs the query) if (empty($td_column_number)) { $td_column_number = td_util::vc_get_column_number(); // get the column width of the block from the page builder API } $buffy = ''; //output buffer //get the js for this block $buffy .= $this->get_block_js(); $buffy .= '<div class="' . $this->get_block_classes() . '">'; //get the block title $buffy .= $this->get_block_title(); //get the sub category filter for this block $buffy .= $this->get_pull_down_filter(); $buffy .= '<div id=' . $this->block_uid . ' class="td_block_inner td-column-' . $td_column_number . '">'; $buffy .= $this->inner($this->td_query->posts, $td_column_number); //inner content of the block $buffy .= '</div>'; //get the ajax pagination for this block $buffy .= $this->get_block_pagination(); $buffy .= '</div> <!-- ./block -->'; return $buffy; }
function inner($posts, $td_column_number = '', $atts) { $buffy = ''; $navigation = ''; if (!empty($atts['navigation'])) { $navigation = $atts['navigation']; } $td_block_layout = new td_block_layout(); if (empty($td_column_number)) { $td_column_number = td_util::vc_get_column_number(); // get the column width of the block from the page builder API } $td_post_count = 0; // the number of posts rendered $td_current_column = 1; //the current columng if (!empty($posts)) { $td_module_trending_now = new td_module_trending_now(); switch ($td_column_number) { case '1': //one column layout $buffy .= $td_block_layout->open_row(); $buffy .= $td_module_trending_now->render(array($posts, $navigation)); if ($td_current_column == 1) { $buffy .= $td_block_layout->close_row(); } break; case '2': //two column layout $buffy .= $td_block_layout->open_row(); //$buffy .= $td_block_layout->open6(); $buffy .= $td_module_trending_now->render(array($posts, $navigation)); //$buffy .= $td_block_layout->close6(); if ($td_current_column == 2) { $buffy .= $td_block_layout->close_row(); } break; case '3': //three column layout $buffy .= $td_block_layout->open_row(); //$buffy .= $td_block_layout->open4(); $buffy .= $td_module_trending_now->render(array($posts, $navigation)); //$buffy .= $td_block_layout->close4(); if ($td_current_column == 3) { $buffy .= $td_block_layout->close_row(); } break; } //current column if ($td_current_column == $td_column_number) { $td_current_column = 1; } else { $td_current_column++; } $td_post_count++; } $buffy .= $td_block_layout->close_all_tags(); return $buffy; }
function render($atts, $content = null) { $this->block_uid = td_global::td_generate_unique_id(); //update unique id on each render $buffy = ''; //output buffer extract(shortcode_atts(array('limit' => 4, 'sort' => '', 'category_id' => '', 'category_ids' => '', 'tag_slug' => '', 'force_columns' => '', 'autoplay' => '', 'offset' => 0), $atts)); if (empty($td_column_number)) { $td_column_number = td_util::vc_get_column_number(); // get the column width of the block } if ($td_column_number == 3) { $current_limit = intval($limit); $post_limit = constant(get_class($this->internal_block_instance) . '::POST_LIMIT'); $td_query = td_data_source::get_wp_query($atts); if (!empty($td_query->posts)) { if ($current_limit > $post_limit and count($td_query->posts) > $post_limit) { $buffy .= '<div class="td-big-grid-slide td_block_wrap" id="iosSlider_' . $this->block_uid . '">'; $buffy .= '<div class="td-theme-slider td_block_inner" id="' . $this->block_uid . '">'; $current_offset = 0; $atts['class'] = 'item'; while ($current_limit > 0) { $atts['offset'] = $offset + $current_offset; $buffy .= $this->internal_block_instance->render($atts); $current_offset += $post_limit; $current_limit -= $post_limit; } $buffy .= '</div>'; //end slider (if slider) $buffy .= '<i class = "td-icon-left"></i>'; $buffy .= '<i class = "td-icon-right"></i>'; $buffy .= '</div>'; //end iosSlider (if slider) $autoplay_settings = ''; $current_autoplay = filter_var($autoplay, FILTER_VALIDATE_INT); if ($current_autoplay !== false) { $autoplay_settings = 'autoSlide: true, autoSlideTimer: ' . $current_autoplay * 1000 . ','; } $slide_javascript = ';jQuery(document).ready(function() { jQuery("#iosSlider_' . $this->block_uid . '").iosSlider({ snapToChildren: true, desktopClickDrag: true, keyboardControls: true, responsiveSlides: true, infiniteSlider: true, ' . $autoplay_settings . ' navPrevSelector: jQuery("#iosSlider_' . $this->block_uid . ' .td-icon-left"), navNextSelector: jQuery("#iosSlider_' . $this->block_uid . ' .td-icon-right") }); });'; td_js_buffer::add_to_footer($slide_javascript); } else { $buffy .= $this->internal_block_instance->render($atts); } } } return $buffy; }
function inner($posts, $td_column_number = '') { $buffy = ''; $td_block_layout = new td_block_layout(); if (empty($td_column_number)) { $td_column_number = td_util::vc_get_column_number(); // get the column width of the block from the page builder API } $td_post_count = 0; // the number of posts rendered $td_current_column = 1; //the current column if (!empty($posts)) { foreach ($posts as $post) { $td_module_9 = new td_module_9($post); switch ($td_column_number) { case '1': //one column layout $buffy .= $td_block_layout->open12(); //added in 010 theme - span 12 doesn't use rows $buffy .= $td_module_9->render($post); $buffy .= $td_block_layout->close12(); break; case '2': //two column layout $buffy .= $td_block_layout->open_row(); $buffy .= $td_block_layout->open6(); //added in 010 theme - span 12 doesn't use rows $buffy .= $td_module_9->render($post); $buffy .= $td_block_layout->close6(); if ($td_current_column == 2) { $buffy .= $td_block_layout->close_row(); } break; case '3': //three column layout $buffy .= $td_block_layout->open_row(); $buffy .= $td_block_layout->open4(); $buffy .= $td_module_9->render($post); $buffy .= $td_block_layout->close4(); if ($td_current_column == 3) { $buffy .= $td_block_layout->close_row(); } break; } //current column if ($td_current_column == $td_column_number) { $td_current_column = 1; } else { $td_current_column++; } $td_post_count++; } } $buffy .= $td_block_layout->close_all_tags(); return $buffy; }
function inner($posts, $td_column_number = '') { $buffy = ''; $td_block_layout = new td_block_layout(); if (empty($td_column_number)) { $td_column_number = td_util::vc_get_column_number(); // get the column width of the block from the page builder API } if (!empty($posts)) { foreach ($posts as $post) { $td_module_9 = new td_module_9($post); $buffy .= $td_module_9->render($post); } } $buffy .= $td_block_layout->close_all_tags(); return $buffy; }
function inner($posts, $td_column_number = '') { $buffy = ''; if (empty($td_column_number)) { $td_column_number = td_util::vc_get_column_number(); // get the column width of the block from the page builder API } //if we are on 3 columns //if ($td_column_number == 3) {//@todo nu merge functia td_util::vc_get_column_number() $td_block_layout = new td_block_layout(); //if we have posts if (!empty($posts)) { $td_module_big_grid = new td_module_big_grid(); $buffy .= $td_module_big_grid->render($posts); } $buffy .= $td_block_layout->close_all_tags(); //} return $buffy; }
function inner($posts, $td_column_number = '') { $buffy = ''; $td_block_layout = new td_block_layout(); if (empty($td_column_number)) { $td_column_number = td_util::vc_get_column_number(); // get the column width of the block from the page builder API } if (!empty($posts)) { foreach ($posts as $post) { $td_module_11 = new td_module_11($post); $buffy .= $td_block_layout->open12(); //added in 010 theme - span 12 doesn't use rows $buffy .= $td_module_11->render($post); $buffy .= $td_block_layout->close12(); } } $buffy .= $td_block_layout->close_all_tags(); return $buffy; }
function render($atts, $content = null) { if (empty($atts['custom_title'])) { $atts['custom_title'] = 'Weather'; } parent::render($atts); // sets the live atts, $this->atts, $this->block_uid, $this->td_query (it runs the query) if (empty($td_column_number)) { $td_column_number = td_util::vc_get_column_number(); // get the column width of the block from the page builder API } $buffy = ''; //output buffer $buffy .= '<div class="' . $this->get_block_classes() . '">'; //get the block title $buffy .= $this->get_block_title(); $buffy .= '<div id=' . $this->block_uid . ' class="td-weather-wrap td_block_inner td-column-' . $td_column_number . '">'; $buffy .= td_weather::render_generic($atts, $this->block_uid); $buffy .= '</div>'; $buffy .= '</div> <!-- ./block -->'; return $buffy; }
function get_quotes_on_blocks() { // do not show the quote on WordPress loops if (td_global::$is_wordpress_loop === true or td_util::vc_get_column_number() != 1) { return ''; } //get quotes data from database $post_data_from_db = get_post_meta($this->post->ID, 'td_post_theme_settings', true); if (!empty($post_data_from_db['td_quote_on_blocks'])) { return '<div class="td_quote_on_blocks">' . $post_data_from_db['td_quote_on_blocks'] . '</div>'; } }
/** * @param $posts * @param string $td_column_number - get the column number * @param string $autoplay - not use via ajax * @param bool $is_ajax - if true the script will return the js inline, if not, it will use the td_js_buffer class * @return string */ function inner($posts, $td_column_number = '', $autoplay = '', $is_ajax = false) { $buffy = ''; $td_block_layout = new td_block_layout(); if (empty($td_column_number)) { $td_column_number = td_util::vc_get_column_number(); // get the column width of the block from the page builder API } $td_post_count = 0; // the number of posts rendered $td_unique_id_slide = td_global::td_generate_unique_id(); //@generic class for sliders : td-theme-slider $buffy .= '<div id="' . $td_unique_id_slide . '" class="td-theme-slider iosSlider-col-' . $td_column_number . ' td_mod_wrap">'; $buffy .= '<div class="td-slider ">'; if (!empty($posts)) { foreach ($posts as $post) { //$buffy .= td_modules::mod_slide_render($post, $td_column_number, $td_post_count); $td_module_slide = new td_module_slide($post); $buffy .= $td_module_slide->render($td_column_number, $td_post_count, $td_unique_id_slide); $td_post_count++; } } $buffy .= $td_block_layout->close_all_tags(); $buffy .= '</div>'; //close slider $buffy .= '<i class = "td-icon-left prevButton"></i>'; $buffy .= '<i class = "td-icon-right nextButton"></i>'; $buffy .= '</div>'; //close ios if (!empty($autoplay)) { $autoplay_string = ' autoSlide: true, autoSlideTimer: ' . $autoplay * 1000 . ', '; } else { $autoplay_string = ''; } //add resize events //$add_js_resize = ''; //if($td_column_number > 1) { $add_js_resize = ', //onSliderLoaded : td_resize_normal_slide, //onSliderResize : td_resize_normal_slide_and_update'; //} $slide_js = ' jQuery(document).ready(function() { jQuery("#' . $td_unique_id_slide . '").iosSlider({ snapToChildren: true, desktopClickDrag: true, keyboardControls: false, responsiveSlideContainer: true, responsiveSlides: true, ' . $autoplay_string . ' infiniteSlider: true, navPrevSelector: jQuery("#' . $td_unique_id_slide . ' .prevButton"), navNextSelector: jQuery("#' . $td_unique_id_slide . ' .nextButton") ' . $add_js_resize . ' }); }); '; if ($is_ajax) { $buffy .= '<script>' . $slide_js . '</script>'; } else { td_js_buffer::add_to_footer($slide_js); } return $buffy; }
function get_block_js() { //get the js for this block - do not load it in inline mode in visual composer if (td_util::vc_is_inline()) { return ''; } extract(shortcode_atts(array('limit' => 5, 'sort' => '', 'category_id' => '', 'category_ids' => '', 'custom_title' => '', 'custom_url' => '', 'show_child_cat' => '', 'sub_cat_ajax' => '', 'ajax_pagination' => '', 'header_color' => '', 'ajax_pagination_infinite_stop' => '', 'td_column_number' => ''), $this->atts)); if (!empty($this->atts['custom_title'])) { $this->atts['custom_title'] = htmlspecialchars($this->atts['custom_title'], ENT_QUOTES); } if (!empty($this->atts['custom_url'])) { $this->atts['custom_url'] = htmlspecialchars($this->atts['custom_url'], ENT_QUOTES); } if (empty($td_column_number)) { $td_column_number = td_util::vc_get_column_number(); // get the column width of the block so we can sent it to the server. If the shortcode already has a user defined column number, we use that } $block_item = 'block_' . $this->block_uid; $buffy = ''; $buffy .= '<script>'; $buffy .= 'var ' . $block_item . ' = new tdBlock();' . "\n"; $buffy .= $block_item . '.id = "' . $this->block_uid . '";' . "\n"; $buffy .= $block_item . ".atts = '" . json_encode($this->atts) . "';" . "\n"; $buffy .= $block_item . '.td_column_number = "' . $td_column_number . '";' . "\n"; $buffy .= $block_item . '.block_type = "' . $this->block_id . '";' . "\n"; //wordpress wp query parms $buffy .= $block_item . '.post_count = "' . $this->td_query->post_count . '";' . "\n"; $buffy .= $block_item . '.found_posts = "' . $this->td_query->found_posts . '";' . "\n"; $buffy .= $block_item . '.header_color = "' . $header_color . '";' . "\n"; $buffy .= $block_item . '.ajax_pagination_infinite_stop = "' . $ajax_pagination_infinite_stop . '";' . "\n"; // The max_num_pages is computed so it considers the offset and the limit atts settings // There were necessary these changes because on the user interface there are js scripts that use the max_num_pages js variable to show/hide some ui components if (!empty($this->atts['offset'])) { if ($this->atts['limit'] != 0) { $buffy .= $block_item . '.max_num_pages = "' . ceil(($this->td_query->found_posts - $this->atts['offset']) / $this->atts['limit']) . '";' . "\n"; } else { if (get_option('posts_per_page') != 0) { $buffy .= $block_item . '.max_num_pages = "' . ceil(($this->td_query->found_posts - $this->atts['offset']) / get_option('posts_per_page')) . '";' . "\n"; } } } else { $buffy .= $block_item . '.max_num_pages = "' . $this->td_query->max_num_pages . '";' . "\n"; } $buffy .= 'tdBlocksArray.push(' . $block_item . ');' . "\n"; $buffy .= '</script>'; //print_r($this->td_block_template_data); // ajax subcategories preloader // @todo preloading "all" filter content should happen regardless of the setting if (!empty($this->td_block_template_data['td_pull_down_items']) and !empty($this->atts['td_ajax_preloading'])) { /* ------------------------------------------------------------------------------------- add 'ALL' item to the cache */ // pagination - we need to compute the pagination for each cache entry $td_hide_next = false; if (!empty($this->atts['offset']) && !empty($this->atts['limit']) && $this->atts['limit'] != 0) { if (1 >= ceil(($this->td_query->found_posts - $this->atts['offset']) / $this->atts['limit'])) { $td_hide_next = true; //hide link on last page } } else { if (1 >= $this->td_query->max_num_pages) { $td_hide_next = true; //hide link on last page } } // this will be send to JS bellow $buffyArray = array('td_data' => $this->inner($this->td_query->posts, $td_column_number), 'td_block_id' => $this->block_uid, 'td_hide_prev' => true, 'td_hide_next' => $td_hide_next); /* ------------------------------------------------------------------------------------- add the rest of the items to the local cache */ ob_start(); // we need to clone the object to set is_ajax_running to true // first we set an object for the all filter ?> <script> var tmpObj = JSON.parse(JSON.stringify(<?php echo $block_item; ?> )); tmpObj.is_ajax_running = true; var currentBlockObjSignature = JSON.stringify(tmpObj); tdLocalCache.set(currentBlockObjSignature, JSON.stringify(<?php echo json_encode($buffyArray); ?> )); <?php foreach ($this->td_block_template_data['td_pull_down_items'] as $count => $item) { if (empty($item['id'])) { continue; } // preload only 6 or 20 items depending on the setting if ($this->atts['td_ajax_preloading'] == 'preload_all' and $count > 20) { break; } else { if ($this->atts['td_ajax_preloading'] == 'preload' and $count > 6) { break; } } $ajax_parameters = array('td_atts' => $this->atts, 'td_column_number' => $td_column_number, 'td_current_page' => 1, 'td_block_id' => $this->block_uid, 'block_type' => get_class($this), 'td_filter_value' => $item['id']); ?> tmpObj = JSON.parse(JSON.stringify(<?php echo $block_item; ?> )); tmpObj.is_ajax_running = true; tmpObj.td_current_page = 1; tmpObj.td_filter_value = <?php echo $item['id']; ?> ; var currentBlockObjSignature = JSON.stringify(tmpObj); tdLocalCache.set(currentBlockObjSignature, JSON.stringify(<?php echo td_ajax_block($ajax_parameters); ?> )); <?php } ?> </script> <?php //ob_clean(); $buffy .= ob_get_clean(); } // end preloader if return $buffy; }
function get_block_js() { //get the js for this block - do not load it in inline mode in visual composer if (td_util::vc_is_inline()) { return ''; } extract(shortcode_atts(array('limit' => 5, 'sort' => '', 'category_id' => '', 'category_ids' => '', 'custom_title' => '', 'custom_url' => '', 'show_child_cat' => '', 'sub_cat_ajax' => '', 'ajax_pagination' => '', 'header_color' => '', 'ajax_pagination_infinite_stop' => ''), $this->atts)); if (!empty($this->atts['custom_title'])) { $this->atts['custom_title'] = htmlspecialchars($this->atts['custom_title'], ENT_QUOTES); } if (!empty($this->atts['custom_url'])) { $this->atts['custom_url'] = htmlspecialchars($this->atts['custom_url'], ENT_QUOTES); } $td_column_number = td_util::vc_get_column_number(); // get the column width of the block so we can sent it to the server $block_item = 'block_' . $this->block_uid; $buffy = ''; $buffy .= '<script>'; $buffy .= 'var ' . $block_item . ' = new td_block();' . "\n"; $buffy .= $block_item . '.id = "' . $this->block_uid . '";' . "\n"; $buffy .= $block_item . ".atts = '" . json_encode($this->atts) . "';" . "\n"; $buffy .= $block_item . '.td_column_number = "' . $td_column_number . '";' . "\n"; $buffy .= $block_item . '.block_type = "' . $this->block_id . '";' . "\n"; //wordpress wp query parms $buffy .= $block_item . '.post_count = "' . $this->td_query->post_count . '";' . "\n"; $buffy .= $block_item . '.found_posts = "' . $this->td_query->found_posts . '";' . "\n"; $buffy .= $block_item . '.max_num_pages = "' . $this->td_query->max_num_pages . '";' . "\n"; $buffy .= $block_item . '.header_color = "' . $header_color . '";' . "\n"; $buffy .= $block_item . '.ajax_pagination_infinite_stop = "' . $ajax_pagination_infinite_stop . '";' . "\n"; $buffy .= 'td_blocks.push(' . $block_item . ');' . "\n"; $buffy .= '</script>'; return $buffy; }
function get_block_js() { //get the js for this block - do not load it in inline mode in visual composer if (td_util::vc_is_inline()) { return ''; } extract(shortcode_atts(array('limit' => 5, 'sort' => '', 'category_id' => '', 'category_ids' => '', 'custom_title' => '', 'custom_url' => '', 'show_child_cat' => '', 'sub_cat_ajax' => '', 'ajax_pagination' => '', 'header_color' => '', 'ajax_pagination_infinite_stop' => '', 'td_column_number' => ''), $this->atts)); if (!empty($this->atts['custom_title'])) { $this->atts['custom_title'] = htmlspecialchars($this->atts['custom_title'], ENT_QUOTES); } if (!empty($this->atts['custom_url'])) { $this->atts['custom_url'] = htmlspecialchars($this->atts['custom_url'], ENT_QUOTES); } if (empty($td_column_number)) { $td_column_number = td_util::vc_get_column_number(); // get the column width of the block so we can sent it to the server. If the shortcode already has a user defined column number, we use that } $block_item = 'block_' . $this->block_uid; $buffy = ''; $buffy .= '<script>'; $buffy .= 'var ' . $block_item . ' = new td_block();' . "\n"; $buffy .= $block_item . '.id = "' . $this->block_uid . '";' . "\n"; $buffy .= $block_item . ".atts = '" . json_encode($this->atts) . "';" . "\n"; $buffy .= $block_item . '.td_column_number = "' . $td_column_number . '";' . "\n"; $buffy .= $block_item . '.block_type = "' . $this->block_id . '";' . "\n"; //wordpress wp query parms $buffy .= $block_item . '.post_count = "' . $this->td_query->post_count . '";' . "\n"; $buffy .= $block_item . '.found_posts = "' . $this->td_query->found_posts . '";' . "\n"; $buffy .= $block_item . '.header_color = "' . $header_color . '";' . "\n"; $buffy .= $block_item . '.ajax_pagination_infinite_stop = "' . $ajax_pagination_infinite_stop . '";' . "\n"; // The max_num_pages is computed so it considers the offset and the limit atts settings // There were necessary these changes because on the user interface there are js scripts that use the max_num_pages js variable to show/hide some ui components if (!empty($this->atts['offset'])) { if ($this->atts['limit'] != 0) { $buffy .= $block_item . '.max_num_pages = "' . ceil(($this->td_query->found_posts - $this->atts['offset']) / $this->atts['limit']) . '";' . "\n"; } else { if (get_option('posts_per_page') != 0) { $buffy .= $block_item . '.max_num_pages = "' . ceil(($this->td_query->found_posts - $this->atts['offset']) / get_option('posts_per_page')) . '";' . "\n"; } } } else { $buffy .= $block_item . '.max_num_pages = "' . $this->td_query->max_num_pages . '";' . "\n"; } $buffy .= 'td_blocks.push(' . $block_item . ');' . "\n"; $buffy .= '</script>'; return $buffy; }
static function inner($list_type) { global $post; //get the playlists in post meta if any $playlist_video_db = ''; $playlist_video_db = get_post_meta($post->ID, td_video_playlist_support::$td_playlist_video_key, true); $buffy = ''; $td_block_layout = new td_block_layout(); if (is_single()) { //get the column number on single post page if (td_global::$cur_single_template_sidebar_pos == 'no_sidebar') { $td_column_number = 3; } else { $td_column_number = 2; } } else { //page $td_column_number = td_util::vc_get_column_number(); // get the column width of the block } $td_current_column = 1; //the current column $vimeo_js_player_placeholder = ''; //use only for vimeo to hold the js for the player if ($list_type == 'youtube') { //array key for youtube in the pos meta db array $list_name = 'youtube_ids'; } else { //array key for vimeo in the pos meta db array $list_name = 'vimeo_ids'; } if (!empty($playlist_video_db) and !empty($playlist_video_db[$list_name])) { $first_video_id = ''; $contor_first_video = 0; $js_object = ''; $click_video_container = ''; foreach ($playlist_video_db[$list_name] as $video_id => $video_data) { //take the id of first video if ($contor_first_video == 0) { $first_video_id = $video_id; } $contor_first_video++; //add comma (,) for next value if (!empty($js_object)) { $js_object .= ','; } $js_object .= "\n'td_" . $video_id . "':{"; $video_data_propeties = ''; //get thumb $playlist_structure_thumb = ''; if (!empty($video_data['thumb'])) { $playlist_structure_thumb = '<div class="td_video_thumb"><img src="' . $video_data['thumb'] . '" alt="" /></div>'; //$video_data_propeties .= 'thumb:"' . $video_data['thumb'] . '",'; } //get title $playlist_structure_title = '<div class="td_video_title_and_time">'; if (!empty($video_data['title'])) { $playlist_structure_title .= '<div class="td_video_title">' . $video_data['title'] . '</div>'; $video_data_propeties .= 'title:"' . $video_data['title'] . '",'; } //get time $playlist_structure_time = ''; if (!empty($video_data['time'])) { $get_video_time = ''; if (substr($video_data['time'], 0, 3) == '00:') { $get_video_time = substr($video_data['time'], 3); } else { $get_video_time = $video_data['time']; } $playlist_structure_title .= '<div class="td_video_time">' . $get_video_time . '</div>'; $video_data_propeties .= 'time:"' . $get_video_time . '"'; } $playlist_structure_title .= '</div>'; //creating click-able playlist video $click_video_container .= '<a id="td_' . $video_id . '" class="td_click_video td_click_video_' . $list_type . '"> ' . $playlist_structure_thumb . $playlist_structure_title . '</a>'; $js_object .= $video_data_propeties . "}"; } if (!empty($js_object)) { $js_object = 'var td_' . $list_type . '_list_ids = {' . $js_object . '}'; } //creating column number classes $column_number_class = 'td_video_playlist_column_2'; if ($td_column_number == 1) { $column_number_class = 'td_video_playlist_column_1'; } if ($td_column_number == 3) { $column_number_class = 'td_video_playlist_column_3'; } //creating title wrapper if any $td_video_title = ''; if (!empty($playlist_video_db[$list_type . '_title'])) { $td_video_title = '<div class="td_video_playlist_title"><div class="td_video_title_text">' . $playlist_video_db[$list_type . '_title'] . '</div></div>'; } //autoplay $td_playlist_autoplay = 0; $td_class_autoplay_control = 'td-sp-video-play'; if (!empty($playlist_video_db[$list_type . '_auto_play']) and intval($playlist_video_db[$list_type . '_auto_play']) > 0) { $td_playlist_autoplay = 1; //$td_class_autoplay_control = 'td-sp-video-pause'; } //check how many video ids we have; if there are more then 5 then add a class that is used on chrome to add the playlist scroll bar $td_class_number_video_ids = ''; $td_playlist_video_count = count($playlist_video_db[$list_name]); if (intval($td_playlist_video_count) > 4) { $td_class_number_video_ids = 'td_add_scrollbar_to_playlist_for_mobile'; } if (intval($td_playlist_video_count) > 5) { $td_class_number_video_ids = 'td_add_scrollbar_to_playlist'; } //$js_object is there so we can take the string and parsit as json to create an object in jQuery return '<div class="' . $column_number_class . '">' . $td_video_title . '<div class="td_wrapper_video_playlist"><div class="td_wrapper_player td_wrapper_playlist_player_' . $list_type . '" data-first-video="' . esc_attr($first_video_id) . '" data-autoplay="' . $td_playlist_autoplay . '"> <div id="player_' . $list_type . '"></div> </div><div class="td_container_video_playlist " > <div class="td_video_controls_playlist_wrapper"><div class="td_video_stop_play_control"><a class="' . $td_class_autoplay_control . ' td-sp td_' . $list_type . '_control"></a></div><div id="td_current_video_play_title_' . $list_type . '" class="td_video_title_playing"></div><div id="td_current_video_play_time_' . $list_type . '" class="td_video_time_playing"></div></div> <div id="td_' . $list_type . '_playlist_video" class="td_playlist_clickable ' . $td_class_number_video_ids . '">' . $click_video_container . '</div> </div> </div> </div> <script>' . $js_object . '</script>'; } //current column if ($td_current_column == $td_column_number) { $td_current_column = 1; } else { $td_current_column++; } $buffy .= $td_block_layout->close_all_tags(); return $buffy; }
function inner($posts, $td_column_number = '') { $buffy = ''; $td_block_layout = new td_block_layout(); if (empty($td_column_number)) { $td_column_number = td_util::vc_get_column_number(); // get the column width of the block from the page builder API } $td_post_count = 0; // the number of posts rendered if (!empty($posts)) { foreach ($posts as $post) { $td_module_4 = new td_module_4($post); $td_module_6 = new td_module_6($post); switch ($td_column_number) { case '1': //one column layout $buffy .= $td_block_layout->open12(); //added in 010 theme - span 12 doesn't use rows if ($td_post_count == 0) { //first post $buffy .= $td_module_4->render(); } else { $buffy .= $td_module_6->render(); } $buffy .= $td_block_layout->close12(); break; case '2': //two column layout $buffy .= $td_block_layout->open_row(); if ($td_post_count == 0) { //first post $buffy .= $td_block_layout->open6(); $buffy .= $td_module_4->render(); $buffy .= $td_block_layout->close6(); } else { //the rest $buffy .= $td_block_layout->open6(); $buffy .= $td_module_6->render(); } break; case '3': //three column layout $buffy .= $td_block_layout->open_row(); if ($td_post_count == 0) { //first post $buffy .= $td_block_layout->open4(); $buffy .= $td_module_4->render(); $buffy .= $td_block_layout->close4(); } else { //2-3 cols $buffy .= $td_block_layout->open4(); $buffy .= $td_module_6->render(); if ($td_post_count == 4) { //make new column $buffy .= $td_block_layout->close4(); } } break; } $td_post_count++; } } $buffy .= $td_block_layout->close_all_tags(); return $buffy; }