本文整理汇总了PHP中td_util类的典型用法代码示例。如果您正苦于以下问题:PHP td_util类的具体用法?PHP td_util怎么用?PHP td_util使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了td_util类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start_el
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;
}
示例2: render
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();
}
示例3: loading_classes
/**
* 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'");
}
}
}
}
示例4: render
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;
}
示例5: render_posts_to_buffer
/**
* 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 :)
}
示例6: render
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;
}
示例7: render
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();
}
示例8: render_list_item
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;
}
示例9: render
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();
}
示例10: inner
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;
}
示例11: render
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();
}
示例12: td_add_js_typekit
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;
}
}
示例13: inner
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;
}
示例14: render
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();
}
示例15: render
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;
}