本文整理汇总了PHP中td_global类的典型用法代码示例。如果您正苦于以下问题:PHP td_global类的具体用法?PHP td_global怎么用?PHP td_global使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了td_global类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
function render($atts)
{
$this->block_uid = td_global::td_generate_unique_id();
//update unique id on each render
extract(shortcode_atts(array('limit' => 3, 'sort' => '', 'category_id' => '', 'category_ids' => '', 'custom_title' => '', 'custom_url' => '', 'hide_title' => '', 'show_child_cat' => '', 'tag_slug' => '', 'header_color' => ''), $atts));
$buffy = '';
//output buffer
$td_unique_id = td_global::td_generate_unique_id();
$td_query =& td_data_source::get_wp_query($atts);
//by ref do the query
//get the js for this block
$buffy .= $this->get_block_js($atts, $td_query);
$buffy .= '<div class="td_block_wrap td_block7">';
//get the block title
$buffy .= $this->get_block_title($atts);
//get the sub category filter for this block
$buffy .= $this->get_block_sub_cats($atts, $td_unique_id);
$buffy .= '<div id=' . $this->block_uid . ' class="td_block_inner">';
//inner content of the block
$buffy .= $this->inner($td_query->posts);
$buffy .= '</div>';
//get the ajax pagination for this block
$buffy .= $this->get_block_pagination($atts, $td_unique_id);
$buffy .= '</div> <!-- ./block1 -->';
return $buffy;
}
示例2: get_pull_down_filter
/**
* renders the filter of the block
* @return string
*/
function get_pull_down_filter()
{
$buffy = '';
if (empty($this->template_data_array['td_pull_down_items'])) {
return '';
}
//generate unique id for this pull down filter control
$pull_down_wrapper_id = "td_pulldown_" . $this->template_data_array['block_uid'];
// wrapper
$buffy .= '<div class="td-subcat-filter" id="' . $pull_down_wrapper_id . '">';
// subcategory list
$buffy .= '<ul class="td-subcat-list" id="' . $pull_down_wrapper_id . '_list">';
foreach ($this->template_data_array['td_pull_down_items'] as $item) {
$buffy .= '<li class="td-subcat-item"><a class="td-subcat-link" id="' . td_global::td_generate_unique_id() . '" data-td_filter_value="' . $item['id'] . '" data-td_block_id="' . $this->template_data_array['block_uid'] . '" href="#">' . $item['name'] . '</a></li>';
}
$buffy .= '</ul>';
// subcategory dropdown list
$buffy .= '<div class="td-subcat-dropdown">';
$buffy .= '<div class="td-subcat-more" aria-haspopup="true"><span>' . __td('More', TD_THEME_NAME) . '</span><i class="td-icon-read-down"></i></div>';
// the dropdown list
$buffy .= '<ul class="td-pulldown-filter-list">';
$buffy .= '</ul>';
$buffy .= '</div>';
$buffy .= '</div>';
return $buffy;
}
示例3: td_theme_settings_read_for_demo
function td_theme_settings_read_for_demo()
{
$td_cookie_value = '';
if (isset($_COOKIE["td-cookie-demo-theme-options"])) {
$td_cookie_value = $_COOKIE["td-cookie-demo-theme-options"];
}
switch ($td_cookie_value) {
case 'style_1':
td_global::$td_options = unserialize(base64_decode(file_get_contents('files_cookies_settings/demo_style_1.txt', true)));
break;
case 'style_2':
td_global::$td_options = unserialize(base64_decode(file_get_contents('files_cookies_settings/demo_style_2.txt', true)));
break;
case 'style_3':
td_global::$td_options = unserialize(base64_decode(file_get_contents('files_cookies_settings/demo_style_3.txt', true)));
break;
case 'style_4':
td_global::$td_options = unserialize(base64_decode(file_get_contents('files_cookies_settings/demo_style_4.txt', true)));
break;
//read the database theme options if no cookie is found
//read the database theme options if no cookie is found
default:
td_global::$td_options = get_option(TD_THEME_OPTIONS_NAME);
}
}
示例4: 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 :)
}
示例5: 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)
// we have no related posts to display
if ($this->td_query->post_count == 0) {
return;
}
$buffy = '';
//output buffer
//get the js for this block
$buffy .= $this->get_block_js();
$buffy .= '<div class="' . $this->get_block_classes() . '">';
//get the filter for this block
$buffy .= '<h4 class="td-related-title">';
$buffy .= '<a id="' . td_global::td_generate_unique_id() . '" class="td-related-left td-cur-simple-item" data-td_filter_value="" data-td_block_id="' . $this->block_uid . '" href="#">' . __td('RELATED ARTICLES') . '</a>';
$buffy .= '<a id="' . td_global::td_generate_unique_id() . '" class="td-related-right" data-td_filter_value="td_related_more_from_author" data-td_block_id="' . $this->block_uid . '" href="#">' . __td('MORE FROM AUTHOR') . '</a>';
$buffy .= '</h4>';
$buffy .= '<div id=' . $this->block_uid . ' class="td_block_inner">';
$buffy .= $this->inner($this->td_query->posts);
//inner content of the block
$buffy .= '</div>';
//get the ajax pagination for this block
$buffy .= $this->get_block_pagination();
$buffy .= '</div> <!-- ./block -->';
return $buffy;
}
示例6: render
function render($atts, $content = null)
{
$atts['limit'] = 5;
parent::render($atts);
// sets the live atts, $this->atts, $this->block_uid, $this->td_query (it runs the query)
if (is_category()) {
// we have no related posts to display
if ($this->td_query->post_count == 0) {
return '<div class="td_line_above_cat_big_grid"> </div>';
}
/** if we have posts in the big grid and we are on a category, do not show the default page no posts message. @see td_global::$custom_no_posts_message */
td_global::$custom_no_posts_message = false;
}
$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">';
$buffy .= $this->inner($this->td_query->posts);
//inner content of the block
$buffy .= '</div>';
//get the ajax pagination for this block
$buffy .= $this->get_block_pagination();
$buffy .= '</div> <!-- ./block -->';
$buffy .= '<div class="clearfix"></div>';
return $buffy;
}
示例7: get_pull_down_filter
/**
* @todo mega menu subcats - folosim functia asta pentru ca e necesar sa avem alt output
* @return bool|string
*/
function get_pull_down_filter()
{
extract(shortcode_atts(array('limit' => 5, 'sort' => '', 'category_id' => '', 'category_ids' => '', 'custom_title' => '', 'custom_url' => '', 'show_child_cat' => '', 'sub_cat_ajax' => ''), $this->atts));
$buffy = '';
if (!empty($show_child_cat) and !empty($category_id)) {
$td_subcategories = get_categories(array('child_of' => $category_id));
if (!empty($td_subcategories)) {
if ($show_child_cat != 'all') {
$td_subcategories = array_slice($td_subcategories, 0, $show_child_cat);
}
$buffy .= '<div class="block-mega-child-cats">';
//show all categories only on ajax
if (empty($sub_cat_ajax)) {
$buffy .= '<a class="cur-sub-cat mega-menu-sub-cat-' . $this->block_uid . '" id="' . td_global::td_generate_unique_id() . '" data-td_block_id="' . $this->block_uid . '" data-td_filter_value="" href="' . get_category_link($category_id) . '">' . __td('All') . '</a>';
}
foreach ($td_subcategories as $td_category) {
$buffy .= '<a class="mega-menu-sub-cat-' . $this->block_uid . '" id="' . td_global::td_generate_unique_id() . '" data-td_block_id="' . $this->block_uid . '" data-td_filter_value="' . $td_category->cat_ID . '" href="' . get_category_link($td_category->cat_ID) . '">' . $td_category->name . '</a>';
}
$buffy .= '</div>';
} else {
//there are no subcategories, return false - this is used by the mega menu block to alter it's structure
return false;
}
}
return $buffy;
}
示例8: render
function render($atts)
{
$this->block_uid = td_global::td_generate_unique_id();
//update unique id on each render
extract(shortcode_atts(array('limit' => '6', 'custom_title' => '', 'custom_url' => '', 'hide_title' => '', 'header_color' => ''), $atts));
$cat_args = array('show_count' => true, 'orderby' => 'count', 'hide_empty' => false, 'order' => 'DESC', 'number' => $limit, 'exclude' => get_cat_ID(TD_FEATURED_CAT));
if (TD_DEPLOY_MODE == 'demo' or TD_DEPLOY_MODE == 'dev') {
$cat_args['exclude'] = '251, 252, 253, 254, 255, 256, 257, 258, 305, 306, ' . get_cat_ID(TD_FEATURED_CAT);
}
$categories = get_categories($cat_args);
$buffy = '';
$buffy .= '<div class="td_block_wrap td_popular_categories widget widget_categories">';
$buffy .= $this->get_block_title_raw($atts, 'Popular category');
if (!empty($categories)) {
$buffy .= '<ul>';
foreach ($categories as $category) {
if (strtolower($category->cat_name) != 'uncategorized') {
$buffy .= '<li><a href="' . get_category_link($category->cat_ID) . '">' . $category->name . '<span class="td-cat-no">' . $category->count . '</span></a></li>';
}
}
$buffy .= '</ul>';
}
$buffy .= '</div> <!-- ./block -->';
return $buffy;
}
示例9: 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)
// this block need td_column_number to add rows if more posts are displayed on a post.
/// the td_column_number is not standard here, it's 5 for full width / 3 for content + sidebar
extract(shortcode_atts(array('td_column_number' => ''), $atts));
// we have no related posts to display
if ($this->td_query->post_count == 0) {
return;
}
$buffy = '';
//output buffer
//get the js for this block
$buffy .= $this->get_block_js();
$buffy .= '<div class="' . $this->get_block_classes() . '">';
//get the filter for this block
$buffy .= '<h4 class="td-related-title">';
$buffy .= '<a id="' . td_global::td_generate_unique_id() . '" class="td-related-left td-cur-simple-item" data-td_filter_value="" data-td_block_id="' . $this->block_uid . '" href="#">' . __td('RELATED ARTICLES', TD_THEME_NAME) . '</a>';
$buffy .= '<a id="' . td_global::td_generate_unique_id() . '" class="td-related-right" data-td_filter_value="td_related_more_from_author" data-td_block_id="' . $this->block_uid . '" href="#">' . __td('MORE FROM AUTHOR', TD_THEME_NAME) . '</a>';
$buffy .= '</h4>';
$buffy .= '<div id=' . $this->block_uid . ' class="td_block_inner">';
$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;
}
示例10: get_single_breadcrumbs
/**
* get the single breadcrumbs
* @param $post_title
* @return string
*/
static function get_single_breadcrumbs($post_title)
{
/**
* check to see if we are on a custom post type page. If that's the case we will load the breadcrumbs
* via @see td_page_generator::get_custom_post_type_breadcrumbs() - in this file
*/
global $post;
if ($post->post_type != 'post') {
return self::get_custom_post_type_breadcrumbs();
}
// get the breadcrumb for single posts - ! if we are on a custom post type, we don't get here !
if (td_util::get_option('tds_breadcrumbs_show') == 'hide') {
return '';
}
$category_1_name = '';
$category_1_url = '';
$category_2_name = '';
$category_2_url = '';
$primary_category_id = td_global::get_primary_category_id();
$primary_category_obj = get_category($primary_category_id);
//print_r($primary_category_obj);
if (!empty($primary_category_obj)) {
if (!empty($primary_category_obj->name)) {
$category_1_name = $primary_category_obj->name;
} else {
$category_1_name = '';
}
if (!empty($primary_category_obj->cat_ID)) {
$category_1_url = get_category_link($primary_category_obj->cat_ID);
}
if (!empty($primary_category_obj->parent) and $primary_category_obj->parent != 0) {
$parent_category_obj = get_category($primary_category_obj->parent);
if (!empty($parent_category_obj)) {
$category_2_name = $parent_category_obj->name;
$category_2_url = get_category_link($parent_category_obj->cat_ID);
}
}
}
if (!empty($category_1_name)) {
//parent category (only if we have one and if the theme is set to show it)
if (!empty($category_2_name) and td_util::get_option('tds_breadcrumbs_show_parent') != 'hide') {
$breadcrumbs_array[] = array('title_attribute' => __td('查看所有文章:', TD_THEME_NAME) . ' ' . htmlspecialchars($category_2_name), 'url' => $category_2_url, 'display_name' => $category_2_name);
}
//child category
$breadcrumbs_array[] = array('title_attribute' => __td('查看所有文章:', TD_THEME_NAME) . ' ' . htmlspecialchars($category_1_name), 'url' => $category_1_url, 'display_name' => $category_1_name);
//article title (only if the theme is set to show it)
if (td_util::get_option('tds_breadcrumbs_show_article') != 'hide') {
//child category
$breadcrumbs_array[] = array('title_attribute' => $post_title, 'url' => '', 'display_name' => td_util::excerpt($post_title, 13));
}
}
if (isset($breadcrumbs_array) and is_array($breadcrumbs_array)) {
//the breadcrumbs may be empty due to settings
return self::get_breadcrumbs($breadcrumbs_array);
//generate the breadcrumbs
} else {
return '';
}
}
示例11: todo
function todo()
{
//do we enable the unique posts filter?
$td_unique_articles = get_post_meta($post->ID, 'td_unique_articles', true);
if (!empty($td_unique_articles['td_unique_articles'])) {
td_global::$td_unique_articles = true;
}
}
示例12: 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;
}
示例13: read_once_theme_settings
/**
* reading the theme settings
* if we are in demo mode looks for cookies
* else takes the settings from database
*/
static function read_once_theme_settings()
{
//this is for demo mode
if (TD_DEBUG_LIVE_THEME_STYLE) {
td_theme_settings_read_for_demo();
//this function is in demo folder td_theme_demo_cookies.php
//this is for deploy and dev
} else {
td_global::$td_options = get_option(TD_THEME_OPTIONS_NAME);
}
}
示例14: update_theme_settings
static function update_theme_settings($old_theme_settings)
{
$settings_buffer = array();
foreach (self::$td_options_to_be_imported as $option_id) {
if (isset($old_theme_settings[$option_id]) and !empty($old_theme_settings[$option_id])) {
$settings_buffer[$option_id] = $old_theme_settings[$option_id];
}
}
td_global::$td_options = $settings_buffer;
update_option(TD_THEME_OPTIONS_NAME, td_global::$td_options);
}
示例15: get_single_breadcrumbs
/**
* get the single breadcrumbs
* @param $post_title
* @return string
*/
static function get_single_breadcrumbs($post_title)
{
if (td_util::get_option('tds_breadcrumbs_show') == 'hide') {
return;
}
$category_1_name = '';
$category_1_url = '';
$category_2_name = '';
$category_2_url = '';
$primary_category_id = td_global::get_primary_category_id();
$primary_category_obj = get_category($primary_category_id);
//print_r($primary_category_obj);
if (!empty($primary_category_obj)) {
if (!empty($primary_category_obj->name)) {
$category_1_name = $primary_category_obj->name;
} else {
$category_1_name = '';
}
if (!empty($primary_category_obj->cat_ID)) {
$category_1_url = get_category_link($primary_category_obj->cat_ID);
}
if (!empty($primary_category_obj->parent) and $primary_category_obj->parent != 0) {
$parent_category_obj = get_category($primary_category_obj->parent);
if (!empty($parent_category_obj)) {
$category_2_name = $parent_category_obj->name;
$category_2_url = get_category_link($parent_category_obj->cat_ID);
}
}
}
if (!empty($category_1_name)) {
//parent category (only if we have one and if the theme is set to show it)
if (!empty($category_2_name) and td_util::get_option('tds_breadcrumbs_show_parent') != 'hide') {
$breadcrumbs_array[] = array('title_attribute' => __td('View all posts in', TD_THEME_NAME) . ' ' . htmlspecialchars($category_2_name), 'url' => $category_2_url, 'display_name' => $category_2_name);
}
//child category
$breadcrumbs_array[] = array('title_attribute' => __td('View all posts in', TD_THEME_NAME) . ' ' . htmlspecialchars($category_1_name), 'url' => $category_1_url, 'display_name' => $category_1_name);
//article title (only if the theme is set to show it)
if (td_util::get_option('tds_breadcrumbs_show_article') != 'hide') {
//child category
$breadcrumbs_array[] = array('title_attribute' => $post_title, 'url' => '', 'display_name' => td_util::excerpt($post_title, 13));
}
}
if (isset($breadcrumbs_array) and is_array($breadcrumbs_array)) {
//the breadcrumbs may be empty due to settings
return self::get_breadcrumbs($breadcrumbs_array);
//generate the breadcrumbs
} else {
return '';
}
}