public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { $control_buffy = ''; //read the menu setting from post meta (menu id, key, single) $td_mega_menu_cat = get_post_meta($item->ID, 'td_mega_menu_cat', true); $td_mega_menu_page_id = get_post_meta($item->ID, 'td_mega_menu_page_id', true); //make the tree $td_category_tree = array_merge(array(' - 不是大菜单 - ' => ''), td_util::get_category2id_array(false)); //make a new ui control ( dropdown ) $control_buffy .= '<p class="description description-wide"><br><br>'; $control_buffy .= '<label>'; $control_buffy .= '使这个分类为大菜单'; $control_buffy .= '</label>'; $control_buffy .= '<select name="td_mega_menu_cat[' . $item->ID . ']" id="" class="widefat code edit-menu-item-url">'; foreach ($td_category_tree as $category => $category_id) { $control_buffy .= '<option value="' . $category_id . '"' . selected($td_mega_menu_cat, $category_id, false) . '>' . $category . '</option>'; } $control_buffy .= ' </select>'; $control_buffy .= '</p>'; $control_buffy .= '<br>或<br>'; //make a new ui control ( dropdown ) $control_buffy .= '<p class="description description-wide">'; $control_buffy .= '<label>'; $control_buffy .= '在菜单加载页面(输入页面ID)'; $control_buffy .= '</label><br>'; $control_buffy .= '<input name="td_mega_menu_page_id[' . $item->ID . ']" type="text" value="' . $td_mega_menu_page_id . '" />'; $control_buffy .= '<span class="td-wpa-info"><strong>提示:</strong>如果你选择加载一个大菜单或页面,请不要给此项目添加子菜单。大菜单和大页面菜单是顶级菜单项目。<a href="http://forum.tagdiv.com/menus-newsmag/" target="_blank">阅读更多</a></span>'; $control_buffy .= '</p>'; //run the parent and add in $buffy (byref) our code via regex $buffy = ''; parent::start_el($buffy, $item, $depth, $args, $id); $buffy = preg_replace('/(?=<div.*submitbox)/', $control_buffy, $buffy); $output .= $buffy; }
function render() { ob_start(); ?> <div class="<?php echo $this->get_module_classes(); ?> "> <div class="td-module-image"> <?php echo $this->get_image('td_218x150'); ?> <?php if (td_util::get_option('tds_category_module_mx4') == 'yes') { echo $this->get_category(); } ?> </div> <?php echo $this->get_title(); ?> </div> <?php return ob_get_clean(); }
/** * The callback function used by spl_autoload_register * @param $class_name string - The class name */ private function loading_classes($class_name) { $path_regex = 'td'; // foreach regex path, the class name is verified for a start matching if (strpos($class_name, $path_regex) !== false and strpos($class_name, $path_regex) === 0) { $class_settings = td_api_base::get_by_id($class_name); if (!empty($class_settings)) { if (array_key_exists('file', $class_settings)) { $class_file_path = $class_settings['file']; if (isset($class_file_path) and !empty($class_file_path)) { // set the autoloaded key for that component td_api_base::_debug_set_class_is_autoloaded($class_name); // if ($class_name == 'td_page_views') { // print_r(debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 4)); //return only 4 call stack frames // die; // } // require_once($class_file_path); - we need to use load_template to make our single_templates work like wordpress // with load_template we prepare the globals ($post etc for the files) // we should not use the global $post or any other globals in our classes without explicit declaration load_template($class_file_path, true); } } else { td_util::error(__FILE__, "Missing parameter: 'file'"); } } } }
function render($atts, $content = null) { extract(shortcode_atts(array('spot_id' => '', 'align' => '', 'spot_title' => ''), $atts)); if (empty($spot_id)) { return; } $ad_array = td_util::get_td_ads($spot_id); // return if the ad for a specific spot id is empty if (empty($ad_array[$spot_id]['ad_code'])) { return; } $buffy = ''; if (!empty($spot_title)) { $buffy .= '<div class="td-adspot-title">' . $spot_title . '</div>'; } if (!empty($ad_array[$spot_id]['current_ad_type'])) { switch ($ad_array[$spot_id]['current_ad_type']) { case 'other': //render the normal ads $buffy .= $this->render_ads($ad_array[$spot_id], $atts); break; case 'google': //render the magic google ads :) $buffy .= $this->render_google_ads($ad_array[$spot_id], $atts); break; } } //print_r($ad_array); return $buffy; }
/** * we have to render the block first in the buffer, to avoid two queries. * - IF there are posts, we already have the buffer with the block's content and we don't have to make another query * - IF there are no posts, we ignore the buffer and we can also remove the wraps in the child classes of this class */ protected function render_posts_to_buffer() { // get the global category top posts grid style setting $td_grid_style = td_util::get_option('tds_category_td_grid_style'); $limit = td_api_category_top_posts_style::_helper_get_posts_shown_in_the_loop(); $block_name = td_api_category_top_posts_style::get_key(get_class($this), 'td_block_name'); // overwrite the $td_grid_style if the setting for this category was changed $td_grid_style_per_category_setting = td_util::get_category_option(td_global::$current_category_obj->cat_ID, 'tdc_category_td_grid_style'); if ($td_grid_style_per_category_setting != '') { $td_grid_style = $td_grid_style_per_category_setting; } // we have to have a default grid, there seems to be a problem with the grid styles if (empty($td_grid_style)) { $td_grid_style = 'td-grid-style-1'; } //parameters to filter to for big grid $atts_for_big_grid = array('limit' => $limit, 'category_id' => td_global::$current_category_obj->cat_ID, 'sort' => get_query_var('filter_by'), 'td_grid_style' => $td_grid_style); //show the big grid $block_instance = td_global_blocks::get_instance($block_name); $this->rendered_block_buffer = $block_instance->render($atts_for_big_grid); $this->rendered_posts_count = $block_instance->td_query->post_count; if ($this->rendered_posts_count > 0) { td_global::$custom_no_posts_message = false; } // use class_name($this) to get the id :) }
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 render() { ob_start(); ?> <div class="td_mod_related_posts"> <div class="td-module-image"> <?php echo $this->get_image('td_238x178'); ?> <?php if (td_util::get_option('tds_category_module_1') == 'yes') { echo $this->get_category(); } ?> </div> <div class="item-details"> <?php echo $this->get_title(25); ?> </div> </div> <?php return ob_get_clean(); }
public function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { $control_buffy = ''; //read the menu setting from post meta (menu id, key, single) $td_mega_menu_cat = get_post_meta($item->ID, 'td_mega_menu_cat', true); $td_mega_menu_page_id = get_post_meta($item->ID, 'td_mega_menu_page_id', true); //make the tree $td_category_tree = array_merge(array(' - Not mega menu - ' => ''), td_util::get_category2id_array(false)); //make a new ui control ( dropdown ) $control_buffy .= '<p class="description description-wide"><br><br>'; $control_buffy .= '<label>'; $control_buffy .= 'Make this a category mega menu'; $control_buffy .= '</label>'; $control_buffy .= '<select name="td_mega_menu_cat[' . $item->ID . ']" id="" class="widefat code edit-menu-item-url">'; foreach ($td_category_tree as $category => $category_id) { $control_buffy .= '<option value="' . $category_id . '"' . selected($td_mega_menu_cat, $category_id, false) . '>' . $category . '</option>'; } $control_buffy .= ' </select>'; $control_buffy .= '</p>'; $control_buffy .= '<br>OR<br>'; //make a new ui control ( dropdown ) $control_buffy .= '<p class="description description-wide">'; $control_buffy .= '<label>'; $control_buffy .= 'Load a page in the menu (enter the page ID)'; $control_buffy .= '</label><br>'; $control_buffy .= '<input name="td_mega_menu_page_id[' . $item->ID . ']" type="text" value="' . $td_mega_menu_page_id . '" />'; $control_buffy .= '<span class="td-wpa-info"><strong>Just a tip:</strong> If you choose to load a mega menu or a page, please do not add submenus to this item. The mega menu and mega page menu have to be the top most menu item. <a href="http://forum.tagdiv.com/menus-newsmag/" target="_blank">Read more</a></span>'; $control_buffy .= '</p>'; //run the parent and add in $buffy (byref) our code via regex $buffy = ''; parent::start_el($buffy, $item, $depth, $args, $id); $buffy = preg_replace('/(?=<div.*submitbox)/', $control_buffy, $buffy); $output .= $buffy; }
protected function render_list_item($item_array, $current_item_id, $current_item_number, $total_items_number) { //print_r($item_array); $buffy = ''; //checking the width of the tile and converting tags, quotes $smart_list_4_title = ''; if (!empty($item_array['title'])) { $smart_list_4_title = $item_array['title']; } //creating each slide $buffy .= '<div class="td-item">'; //get image info $first_img_all_info = td_util::attachment_get_full_info($item_array['first_img_id']); //image caption $first_img_caption = ''; if (!empty($first_img_all_info['caption'])) { $first_img_caption = $first_img_all_info['caption']; } $first_img_info = wp_get_attachment_image_src($item_array['first_img_id'], 'thumbnail'); if (!empty($first_img_info[0])) { $buffy .= '<figure class="td-slide-smart-list-figure"> <a class="td-sml-link-to-image" href="' . $first_img_all_info['src'] . '" data-caption="' . esc_attr($first_img_all_info['caption'], ENT_QUOTES) . '"> <img src="' . $first_img_info[0] . '"/> </a> <figcaption class="td-sml-caption"><div>' . $first_img_caption . '</div></figcaption> </figure>'; } //adding description if (!empty($item_array['description'])) { $buffy .= '<div class="td-number-and-title"><h2><span class="td-sml-current-item-nr">' . $current_item_number . '</span><span class="td-sml-current-item-title">' . $smart_list_4_title . '</span></h2></div> <span class="td-sml-description">' . $item_array['description'] . '</span>'; } $buffy .= '</div>'; return $buffy; }
function render() { ob_start(); ?> <div class="<?php echo $this->get_module_classes(array("td_mod_mega_menu")); ?> "> <div class="td-module-image"> <?php echo $this->get_image('td_218x150'); ?> <?php if (td_util::get_option('tds_category_module_mega_menu') == 'yes') { echo $this->get_category(); } ?> </div> <div class="item-details"> <?php echo $this->get_title(12); ?> </div> </div> <?php return ob_get_clean(); }
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($order_no) { ob_start(); ?> <div class="<?php echo $this->get_module_classes(array("td-big-grid-post-{$order_no}", "td-big-grid-post", "td-small-thumb")); ?> "> <?php echo $this->get_image('td_265x198'); ?> <div class="td-meta-info-container"> <div class="td-meta-align"> <div class="td-big-grid-meta"> <?php if (td_util::get_option('tds_category_module_mx6') == 'yes') { echo $this->get_category(); } ?> <?php echo $this->get_title(); ?> </div> </div> </div> </div> <?php return ob_get_clean(); }
function td_add_js_typekit() { $td_fonts_js_buffer = stripcslashes(td_util::get_option('td_fonts_js_buffer')); if (!empty($td_fonts_js_buffer)) { echo $td_fonts_js_buffer; } }
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() { ob_start(); ?> <div class="td_mod_wrap td_mod8 <?php echo $this->get_no_thumb_class(); ?> " <?php echo $this->get_item_scope(); ?> > <?php echo $this->get_image('art-big-1col'); ?> <div class="item-details"> <?php echo $this->get_title(td_util::get_option('tds_mod8_title_excerpt')); ?> <div class="meta-info"> <?php //echo $this->get_author(); ?> <?php echo $this->get_date(); ?> <?php echo $this->get_commentsAndViews(); ?> </div> <p><div class="td-post-text-excerpt"><?php echo $this->get_excerpt(td_util::get_option('tds_mod8_content_excerpt')); ?> </div></p> <div class="more-link-wrap wpb_button td_read_more clearfix"> <a href="<?php echo $this->href; ?> "><?php echo __td('Continue', TD_THEME_NAME); ?> </a> </div> </div> <?php echo $this->get_item_scope_meta(); ?> </div> <?php return ob_get_clean(); }
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 render() { ob_start(); ?> <div class="<?php echo $this->get_module_classes(); ?> " <?php echo $this->get_item_scope(); ?> > <div class="td-module-image"> <?php echo $this->get_image('td_324x160'); ?> <?php if (td_util::get_option('tds_category_module_2') == 'yes') { echo $this->get_category(); } ?> </div> <?php echo $this->get_title(); ?> <div class="td-module-meta-info"> <?php echo $this->get_author(); ?> <?php echo $this->get_date(); ?> <?php echo $this->get_comments(); ?> </div> <div class="td-excerpt"> <?php echo $this->get_excerpt(); ?> </div> <?php echo $this->get_quotes_on_blocks(); ?> <?php echo $this->get_item_scope_meta(); ?> </div> <?php return ob_get_clean(); }
function render() { ob_start(); ?> <div class="<?php echo $this->get_module_classes(); ?> "> <div class="meta-info-container"> <?php echo $this->get_image('td_696x385'); ?> <div class="td-module-meta-info"> <div class="td-module-meta-holder"> <?php echo $this->get_title(); ?> <?php if (td_util::get_option('tds_category_module_14') == 'yes') { echo $this->get_category(); } ?> <?php echo $this->get_author(); ?> <?php echo $this->get_date(); ?> <?php echo $this->get_comments(); ?> </div> </div> </div> <div class="td-excerpt"> <?php echo $this->get_excerpt(); ?> <div class="td-read-more"> <a href="<?php echo $this->href; ?> "><?php echo __td('Read more', TD_THEME_NAME); ?> </a> </div> </div> </div> <?php return ob_get_clean(); }
/** * add td_fonts_css_buffer from database into the source of the page * * td_fonts_css_buffer : used to store the css generated for custom font files in the database * * used in : @see td_css_generator.php */ public static function td_add_fonts_css_buffer() { $td_fonts_css_buffer = td_util::get_option('td_fonts_css_buffer'); if (!empty($td_fonts_css_buffer)) { return $td_fonts_css_buffer . "\n"; } else { return ''; } }
function render() { ob_start(); ?> <div class="<?php echo $this->get_module_classes(); ?> " <?php echo $this->get_item_scope(); ?> > <div class="item-details"> <?php echo $this->get_title(); ?> <div class="td-module-meta-info"> <?php if (td_util::get_option('tds_category_module_13') == 'yes') { echo $this->get_category(); } ?> <?php echo $this->get_author(); ?> <?php echo $this->get_date(); ?> <?php echo $this->get_comments(); ?> </div> <?php echo $this->get_image('td_696x0'); ?> <div class="td-read-more"> <a href="<?php echo $this->href; ?> "><?php echo __td('Read more', TD_THEME_NAME); ?> </a> </div> </div> <?php echo $this->get_item_scope_meta(); ?> </div> <?php return ob_get_clean(); }
function render_list_item($item_array, $current_item_id, $current_item_number, $total_items_number) { //print_r($item_array); $buffy = ''; //checking the width of the tile $smart_list_3_title = ''; if (!empty($item_array['title'])) { //if we need to cut the title to a certain length, for top and bottom titles if (mb_strlen($item_array['title'], 'UTF-8') > 59) { $this->smart_list_3_title_between_controls = mb_substr($item_array['title'], 0, 59, 'UTF-8') . '...'; } else { $this->smart_list_3_title_between_controls = $item_array['title']; } //if there are more then 28 chars, add `td-vertical-align-top` class for the main title in the slide $class_verticle_align_top = ''; if (mb_strlen($item_array['title'], 'UTF-8') > 28) { $class_verticle_align_top = 'td-vertical-align-top'; } //converting single and double quotes //we do this twice because if we check the converted (with htmlentities) string the title will be longer because the tags and quotes will become `<`, `"`, etc $smart_list_3_title = $item_array['title']; } //creating each slide $buffy .= '<div class="td-item" id="' . $this->smart_list_tip_3_unique_id . '_item_' . $current_item_id . '">'; $buffy .= '<div class="td-number-and-title"><h2><span class="td-sml-current-item-nr">' . $current_item_number . '</span><span class="td-sml-current-item-title">' . $smart_list_3_title . '</span></h2></div>'; //get image info $first_img_all_info = td_util::attachment_get_full_info($item_array['first_img_id']); //image caption $first_img_caption = ''; if (!empty($first_img_all_info['caption'])) { $first_img_caption = $first_img_all_info['caption']; } $first_img_info = wp_get_attachment_image_src($item_array['first_img_id'], 'medium'); //image and caption $buffy_image = ''; if (!empty($first_img_info[0])) { $buffy_image = ' <figure class="td-sml3-display-image td-slide-smart-list-figure"> <a class="td-sml-link-to-image" href="' . $first_img_all_info['src'] . '" id="td-sml3-slide_' . $this->nr_slide_on_smart_list . '" data-caption="' . esc_attr($first_img_all_info['caption'], ENT_QUOTES) . '" > <img src="' . $first_img_info[0] . '"/> </a> <figcaption class="td-sml-caption"><div>' . $first_img_caption . '</div></figcaption> </figure>'; } //adding description $temp_description = ''; if (!empty($item_array['description'])) { //adding the title to the description; description comes between <p> and </p>, so we need to insert the title after first <p> $temp_description = substr($item_array['description'], 3); $buffy .= '<div class="td-sml-description">' . $buffy_image . $temp_description . '</div>'; //bottom title //$buffy .= '<div class="td-sml3-bottom-title">' . $current_item_number . '. ' . $this->smart_list_3_title_between_controls . '</div>'; } $buffy .= '</div>'; $this->nr_slide_on_smart_list++; return $buffy; }
function load_setting($name, $append_to_value = '') { //echo 'rara1'; $current_customizer_value = td_util::get_option('tds_' . $name); if (!empty($current_customizer_value)) { $current_customizer_value .= $append_to_value; } $this->load_setting_raw($name, $current_customizer_value); }
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 get_title_main() { $cut_parms = array('char_per_line' => 26, 'excerpt' => 13, 'line_wrap_start' => '<span class="td-sbig-title">', 'line_wrap_end' => '</span><span class="td-sbig-sep"></span>'); $buffy = ''; $buffy .= '<div class="td-sbig-title-wrap">'; $buffy .= '<a class="noSwipe" itemprop="url" href="' . $this->href . '" rel="bookmark" title="' . $this->title_attribute . '">'; $buffy .= td_util::cut_title($cut_parms, $this->title); $buffy .= '</a>'; $buffy .= '</div>'; return $buffy; }
function get_comments() { $buffy = ''; if (td_util::get_option('tds_p_show_comments') != 'hide') { $buffy .= '<div class="td-post-comments"><i class="td-icon-comments"></i>'; $buffy .= '<a href="' . get_comments_link($this->post->ID) . '">'; $buffy .= get_comments_number($this->post->ID); $buffy .= '</a>'; $buffy .= '</div>'; } return $buffy; }
function render() { ob_start(); ?> <div class="<?php echo $this->get_module_classes(array_merge(get_post_class())); ?> " <?php echo $this->get_item_scope(); ?> > <div class="item-details"> <?php echo $this->get_title(); ?> <div class="td-module-meta-info"> <?php if (td_util::get_option('tds_category_module_15') == 'yes') { echo $this->get_category(); } ?> <?php echo $this->get_author(); ?> <?php echo $this->get_date(); ?> <?php echo $this->get_comments(); ?> </div> <?php echo $this->get_image('td_696x0'); ?> <div class="td-post-text-content td-post-content"> <?php echo $this->get_content(); ?> </div> </div> <?php echo $this->get_item_scope_meta(); ?> </div> <?php return ob_get_clean(); }
function render() { ob_start(); ?> <div class="<?php echo $this->get_module_classes(); ?> " <?php echo $this->get_item_scope(); ?> > <?php echo $this->get_image('td_218x150'); ?> <div class="item-details"> <?php echo $this->get_title(); ?> <div class="td-module-meta-info"> <?php if (td_util::get_option('tds_category_module_10') == 'yes') { echo $this->get_category(); } ?> <?php // echo $this->get_author(); ?> <?php // echo $this->get_date(); ?> <?php // echo $this->get_comments(); ?> </div> <div class="td-excerpt"> <?php echo $this->get_excerpt(); ?> </div> </div> <?php echo $this->get_item_scope_meta(); ?> </div> <?php return ob_get_clean(); }
/** * Used by all the shortcodes + widget to render the weather. The top bar has a separate function bellow * @param $atts * @param $block_uid * @param $template string -> block_template | top_bar_template * @return string */ static function render_generic($atts, $block_uid, $template = 'block_template') { if (empty($atts['w_location'])) { return self::error('<strong>location</strong> is empty. Configure this block/widget and enter a location and we will show the weather from that location :) '); } $current_unit = 0; // 0 - metric $current_temp_label = 'C'; $current_speed_label = 'kmh'; if (!empty($atts['w_units'])) { $current_unit = 1; // imperial $current_temp_label = 'F'; $current_speed_label = 'mph'; } // prepare the data and do an api call $weather_data = array('block_uid' => '', 'api_location' => $atts['w_location'], 'api_language' => '', 'api_key' => self::get_a_owm_key(), 'today_icon' => '', 'today_icon_text' => '', 'today_temp' => array(0, 0), 'today_humidity' => '', 'today_wind_speed' => array(0, 0), 'today_min' => array(0, 0), 'today_max' => array(0, 0), 'today_clouds' => 0, 'current_unit' => $current_unit, 'forecast' => array()); // disable the cache for debugging // td_remote_cache::_disable_cache(); $weather_data_status = self::get_weather_data($atts, $weather_data); // check if we have an error and return that if ($weather_data_status != 'api_fail_cache' and $weather_data_status != 'api' and $weather_data_status != 'cache') { return $weather_data_status; } // we have to patch the cached data - to make sure we have the REAL block_uid that is now on the page $weather_data['block_uid'] = $block_uid; // render the HTML $buffy = '<!-- td weather source: ' . $weather_data_status . ' -->'; if ($template == 'block_template') { // renders the block template $buffy .= self::render_block_template($atts, $weather_data, $current_temp_label, $current_speed_label); } else { // render the top menu template $buffy .= self::render_top_bar_template($atts, $weather_data, $current_temp_label); } // render the JS ob_start(); ?> <script> jQuery().ready(function() { tdWeather.items.push(<?php echo json_encode($weather_data); ?> ); }); </script> <?php $script_buffer = ob_get_clean(); $js_script = "\n" . td_util::remove_script_tag($script_buffer); td_js_buffer::add_to_footer($js_script); return $buffy; }
function render() { ob_start(); ?> <!-- <div class="<?php echo $this->get_module_classes(array("td_mod_related_posts")); ?> "> <div class="td-module-image"> <?php echo $this->get_image('td_218x150'); ?> <?php if (td_util::get_option('tds_category_module_related_posts') == 'yes') { echo $this->get_category(); } ?> </div> <div class="item-details"> <?php echo $this->get_title(); ?> </div> </div> --> <!-- ZA Custom --> <div class="<?php echo $this->get_module_classes(array("td_mod_related_posts")); ?> "> <div class="td-module-image"> <?php echo $this->get_image('td_218x150'); ?> </div> <div class="item-details"> <?php if (td_util::get_option('tds_category_module_related_posts') == 'yes') { echo $this->get_category(); } ?> <?php echo $this->get_title(); ?> </div> </div> <?php return ob_get_clean(); }
function get_title($excerpt_lenght = '') { $buffy = ''; $buffy .= '<h4 itemprop="name" class="entry-title">'; $buffy .= '<a itemprop="url" href="' . $this->href . '" rel="bookmark" title="' . $this->title_attribute . '">'; if (!empty($excerpt_lenght)) { $buffy .= td_util::excerpt($this->title, $excerpt_lenght, 'show_shortcodes'); } else { $buffy .= $this->title; } $buffy .= '</a>'; $buffy .= '</h4>'; return $buffy; }