本文整理汇总了PHP中__ti函数的典型用法代码示例。如果您正苦于以下问题:PHP __ti函数的具体用法?PHP __ti怎么用?PHP __ti使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了__ti函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_templates
function get_templates($template, $type = '')
{
$template_post = "";
switch ($type) {
case 'more':
$template_post = '<a href="{search_url_escaped}">' . __ti('View All Results', 'tie') . '</a>';
break;
case 'taxonomy':
$template_post = '<a href="{category_link}">{name}</a>';
break;
case 'author':
case 'role':
$template_post = '<a href="{author_link}">{user_nicename}</a>';
break;
case 'post_type':
if (in_array($template, self::$woocommerce_post_types)) {
$template_post = '<a href="{post_link}">{post_image_html}<span class="live-search_text">{post_title} - {price}</span><span class="live-search_small">Posted by {post_author} on {post_date_formatted}</span></a>';
} else {
$template_post = '<a href="{post_link}">{post_image_html}<span class="live-search_text">{post_title} </span><p class="post-meta"><span class="post-meta-author"><i class="fa fa-user"></i> {post_author}</span><span class="tie-date"><i class="fa fa-clock-o"></i> {post_date_formatted}</span></p></a>';
}
break;
default:
$template_post = '<a href="{post_link}">{post_image_html}<span class="live-search_text">{post_title} </span><p class="post-meta"><span class="post-meta-author"><i class="fa fa-user"></i> {post_author}</span><span class="tie-date"><i class="fa fa-clock-o"></i> {post_date_formatted}</span></p></a>';
break;
}
return $template_post;
}
示例2: tie_register
function tie_register()
{
## Register Main style.css file
wp_register_style('tie-style', get_stylesheet_uri(), array(), '', 'all');
wp_enqueue_style('tie-style');
## Register All Scripts
wp_register_script('tie-scripts', get_template_directory_uri() . '/js/tie-scripts.js', array('jquery'), false, true);
wp_register_script('tie-tabs', get_template_directory_uri() . '/js/tabs.min.js', array('jquery'), false, true);
wp_register_script('tie-cycle', get_template_directory_uri() . '/js/jquery.cycle.all.js', array('jquery'), false, true);
wp_register_script('tie-validation', get_template_directory_uri() . '/js/validation.js', array('jquery'), false, true);
wp_register_script('tie-masonry', get_template_directory_uri() . '/js/isotope.js', array('jquery'), false, true);
wp_register_script('tie-ilightbox', get_template_directory_uri() . '/js/ilightbox.packed.js', array('jquery'), false, true);
## Get Global Scripts
wp_enqueue_script('tie-scripts');
wp_enqueue_script('tie-ilightbox');
## Register WooCommerce css file
wp_register_style('tie-woocommerce', get_template_directory_uri() . '/css/woocommerce.css', array(), '', 'all');
if (class_exists('Woocommerce')) {
wp_enqueue_style('tie-woocommerce');
}
## Register bbPress css file
wp_register_style('tie-bbpress', get_template_directory_uri() . '/css/bbpress.css', array(), '', 'all');
if (class_exists('bbpress')) {
wp_enqueue_style('tie-bbpress');
}
## Register buddyPress css file
wp_register_style('tie-buddypress', get_template_directory_uri() . '/css/buddypress.css', array(), '', 'all');
if (class_exists('buddypress')) {
wp_enqueue_style('tie-buddypress');
}
## Get Validation Script
if (tie_get_option('comment_validation') && is_singular() && comments_open()) {
wp_enqueue_script('tie-validation');
}
$lightbox_skin = 'dark';
if (tie_get_option('lightbox_skin')) {
$lightbox_skin = tie_get_option('lightbox_skin');
}
wp_enqueue_style('tie-ilightbox-skin', get_template_directory_uri() . '/css/ilightbox/' . $lightbox_skin . '-skin/skin.css');
## For facebook & Google + share
if (is_singular() && tie_get_option('post_og_cards') && (!function_exists('bp_current_component') || function_exists('bp_current_component') && !bp_current_component())) {
tie_og_data();
}
## Sticky Sidebars
$sticky_sidebar = false;
if (tie_get_option('sticky_sidebar')) {
$sticky_sidebar = true;
if ((is_home() || is_front_page()) && tie_get_option('sticky_sidebar_disable_homepage') || is_page() && tie_get_option('sticky_sidebar_disable_pages') || is_single() && tie_get_option('sticky_sidebar_disable_posts') || is_tag() && tie_get_option('sticky_sidebar_disable_tag') || is_category() && tie_get_option('sticky_sidebar_disable_cat')) {
$sticky_sidebar = false;
}
}
## Inline Vars
$tie_js_vars = array("mobile_menu_active" => tie_get_option('mobile_menu_active'), "mobile_menu_top" => tie_get_option('mobile_menu_top'), "lightbox_all" => tie_get_option('lightbox_all'), "lightbox_gallery" => tie_get_option('lightbox_gallery'), "woocommerce_lightbox" => get_option('woocommerce_enable_lightbox'), "lightbox_skin" => $lightbox_skin, "lightbox_thumb" => tie_get_option('lightbox_thumbs'), "lightbox_arrows" => tie_get_option('lightbox_arrows'), "sticky_sidebar" => $sticky_sidebar, "is_singular" => is_singular(), "reading_indicator" => tie_get_option('reading_indicator'), "lang_no_results" => __ti('No Results'), "lang_results_found" => __ti('Results Found'));
wp_localize_script('tie-scripts', 'tie', $tie_js_vars);
}
示例3: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
$no_of_tweets = $instance['no_of_tweets'];
$twitter_username = $instance['username'];
$consumer_key = $instance['consumer_key'];
$consumer_secret = $instance['consumer_secret'];
$widget_id = $args['widget_id'];
$cacheTime = 30;
if (!empty($twitter_username) && !empty($consumer_key) && !empty($consumer_secret)) {
$token = get_option('tie_TwitterToken' . $widget_id);
$twitter_data = get_transient('list_tweets' . $widget_id);
if (empty($twitter_data)) {
if (!$token) {
// preparing credentials
$credentials = $consumer_key . ':' . $consumer_secret;
$toSend = base64_encode($credentials);
// http post arguments
$args = array('method' => 'POST', 'httpversion' => '1.1', 'blocking' => true, 'headers' => array('Authorization' => 'Basic ' . $toSend, 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'), 'body' => array('grant_type' => 'client_credentials'));
add_filter('https_ssl_verify', '__return_false');
$response = wp_remote_post('https://api.twitter.com/oauth2/token', $args);
$keys = json_decode(wp_remote_retrieve_body($response));
if ($keys) {
// saving token to wp_options table
update_option('tie_TwitterToken' . $widget_id, $keys->access_token);
$token = $keys->access_token;
}
}
// we have bearer token wether we obtained it from API or from options
$args = array('httpversion' => '1.1', 'blocking' => true, 'headers' => array('Authorization' => "Bearer {$token}"));
add_filter('https_ssl_verify', '__return_false');
$api_url = "https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name={$twitter_username}&count={$no_of_tweets}";
$response = wp_remote_get($api_url, $args);
if (!is_wp_error($response)) {
$twitter_data = json_decode(wp_remote_retrieve_body($response));
set_transient('list_tweets' . $widget_id, $twitter_data, 60 * $cacheTime);
}
}
echo $before_widget;
echo $before_title;
?>
<a href="http://twitter.com/<?php
echo $twitter_username;
?>
"><?php
echo $title;
?>
</a>
<?php
echo $after_title;
if (is_array($twitter_data)) {
$i = 0;
$hyperlinks = true;
$twitter_users = true;
$update = true;
echo '
<div class="twitter-widget-content" >
<ul class="twitter_update_list">';
foreach ($twitter_data as $item) {
$msg = $item->text;
$permalink = 'http://twitter.com/#!/' . $twitter_username . '/status/' . $item->id_str;
$link = $permalink;
echo '
<li class="twitter-item">
<i class="fa fa-twitter"></i>';
if ($hyperlinks) {
$msg = $this->hyperlinks($msg);
}
if ($twitter_users) {
$msg = $this->twitter_users($msg);
}
echo $msg;
if ($update) {
$time = strtotime($item->created_at);
if (abs(time() - $time) < 86400) {
$h_time = sprintf(__ti('%s ago'), human_time_diff($time));
} else {
$h_time = date('Y/m/d', $time);
}
echo '<small class="twitter-timestamp"><abbr title="' . date('Y/m/d H:i:s', $time) . '">' . $h_time . '</abbr></small>';
}
echo '</li>
';
$i++;
if ($i >= $no_of_tweets) {
break;
}
}
echo '</ul> </div>
';
} else {
?>
<a href="http://twitter.com/<?php
echo $twitter_username;
?>
"><?php
echo $title;
?>
</a>
//.........这里部分代码省略.........
示例4: printf
if (is_day()) {
?>
<?php
printf(__ti('Daily Archives: <span>%s</span>'), get_the_date());
?>
<?php
} elseif (is_month()) {
?>
<?php
printf(__ti('Monthly Archives: <span>%s</span>'), get_the_date('F Y'));
?>
<?php
} elseif (is_year()) {
?>
<?php
printf(__ti('Yearly Archives: <span>%s</span>'), get_the_date('Y'));
?>
<?php
} else {
?>
<?php
_eti('Blog Archives');
?>
<?php
}
?>
</h2>
<div class="stripe-line"></div>
</div>
示例5: tie_custom_pings
function tie_custom_pings($comment, $args, $depth)
{
$GLOBALS['comment'] = $comment;
?>
<li class="comment pingback">
<p><?php
_eti('Pingback:');
?>
<?php
comment_author_link();
edit_comment_link(__ti('Edit'), ' ');
?>
</p>
<?php
}
示例6: get_header
<?php
get_header();
?>
<div class="content">
<?php
tie_breadcrumbs();
?>
<div class="page-head">
<h1 class="page-title">
<?php
printf(__ti('Tag Archives: %s'), '<span>' . single_tag_title('', false) . '</span>');
?>
</h1>
<?php
if (tie_get_option('tag_rss')) {
$tag_id = get_query_var('tag_id');
?>
<a class="rss-cat-icon tooltip" title="<?php
_eti('Feed Subscription');
?>
" href="<?php
echo get_term_feed_link($tag_id, 'post_tag', "rss2");
?>
"><i class="fa fa-rss"></i></a>
<?php
}
?>
示例7: tie_shortcode_post_slideshow
function tie_shortcode_post_slideshow($atts, $content = null)
{
wp_enqueue_script('tie-cycle');
$tie_random_id = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 5);
$out = '
<script type="text/javascript">
jQuery(window).load(function() {
jQuery( "#post-slideshow-' . $tie_random_id . '" ).cycle({
fx: "scrollHorz",
timeout: 0,
pager: ".slideshow-nav-' . $tie_random_id . '",
after: onBefore,
containerResize : false,
slideResize: false,
fit: 1,
slideExpr: ".post-content-slide",
speed: 400,
prev: ".prev-' . $tie_random_id . '",
next: ".next-' . $tie_random_id . '",
});
function onBefore() {
var h = jQuery(this).outerHeight() ;
jQuery(this).parent().height( h );
}
});
</script>
<div class="post-content-slideshow-outer">
<div id="post-slideshow-' . $tie_random_id . '" class="post-content-slideshow">
<div class="post-tslideshow-nav-outer">
<div class="slideshow-nav-' . $tie_random_id . ' post-slideshow-nav"></div>
<a class="next-' . $tie_random_id . ' post-slideshow-next" href="#"> ' . __ti("Next") . ' <i class="fa fa-angle-right"></i></a>
<a class="prev-' . $tie_random_id . ' post-slideshow-prev" href="#"><i class="fa fa-angle-left"></i> ' . __ti("Prev") . '</a>
</div><!-- post-tslideshow-nav-outer -->
' . do_shortcode($content) . '
<div class="post-tslideshow-nav-outer-bottom">
<div class="slideshow-nav-' . $tie_random_id . ' post-slideshow-nav"></div>
<a class="next-' . $tie_random_id . ' post-slideshow-next" href="#">' . __ti('Next') . ' <i class="fa fa-angle-right"></i></a>
<a class="prev-' . $tie_random_id . ' post-slideshow-prev" href="#"><i class="fa fa-angle-left"></i> ' . __ti("Prev") . '</a>
</div><!-- post-tslideshow-nav-outer-bottom -->
</div><!-- post-content-slideshow -->
</div><!-- post-content-slideshow-outer -->';
return $out;
}
示例8: printf
?>
<?php
if (tie_get_option('post_cats')) {
?>
<span class="post-cats"><i class="fa fa-folder"></i><?php
printf('%1$s', get_the_category_list(', '));
?>
</span>
<?php
}
?>
<?php
if (tie_get_option('post_comments')) {
?>
<span class="post-comments"><i class="fa fa-comments"></i><?php
comments_popup_link(__ti('Leave a comment'), __ti('1 Comment'), __ti('% Comments'));
?>
</span>
<?php
}
if (tie_get_option('post_views')) {
$text = __ti('Views');
echo tie_views($text);
}
?>
</p>
<div class="clear"></div>
<?php
}
示例9: _eti
function _eti($text)
{
echo __ti($text);
}
示例10: tie_posts_column_views
function tie_posts_column_views($defaults)
{
$defaults['tie_post_views'] = __ti('Views');
return $defaults;
}
示例11: tie_pagenavi_init
function tie_pagenavi_init()
{
$pagenavi_options = array();
$pagenavi_options['pages_text'] = __ti('Page %CURRENT_PAGE% of %TOTAL_PAGES%');
$pagenavi_options['current_text'] = '%PAGE_NUMBER%';
$pagenavi_options['page_text'] = '%PAGE_NUMBER%';
$pagenavi_options['first_text'] = __ti('« First');
$pagenavi_options['last_text'] = __ti('Last »');
$pagenavi_options['next_text'] = __('»', 'tie');
$pagenavi_options['prev_text'] = __('«', 'tie');
$pagenavi_options['dotright_text'] = '...';
$pagenavi_options['dotleft_text'] = '...';
$pagenavi_options['num_pages'] = 5;
$pagenavi_options['always_show'] = 0;
$pagenavi_options['num_larger_page_numbers'] = 3;
$pagenavi_options['larger_page_numbers_multiple'] = 10;
return $pagenavi_options;
}
示例12: form
function form($instance)
{
$tie_random_id = substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 5);
$id = explode("-", $this->get_field_id("widget_id"));
$widget_id = $id[1] . "-" . $tie_random_id;
$defaults = array('posts_order' => 'popular', 'posts_number' => 5);
$instance = wp_parse_args((array) $instance, $defaults);
?>
<script type="text/javascript">
jQuery(document).ready(function($) {
jQuery( "#<?php
echo $widget_id;
?>
-order" ).sortable({
placeholder: "ui-state-highlight",
stop: function(event, ui) {
var data = "";
jQuery( "#<?php
echo $widget_id;
?>
-order li" ).each(function(i, el){
var p = jQuery( this ).data( 'tab' );
data += p+",";
});
jQuery("#<?php
echo $widget_id;
?>
-tabs-order").val(data.slice(0, -1));
}
});
});
</script>
<div id="<?php
echo $widget_id;
?>
-tabs">
<p>
<label for="<?php
echo $this->get_field_id('tabs_order');
?>
"><?php
_e('Order of tabs:', 'tie');
?>
</label>
<?php
if ($id[2] == '__i__') {
echo '<p style="background-color: #fefbed;padding: 5px;color: #9F6000;border: 1px solid #f1e7bc;" class"tie_message_hint">' . __("click Save button to be able to change the order of tabs .", "tie") . '</p>';
}
?>
<input id="<?php
echo $widget_id;
?>
-tabs-order" name="<?php
echo $this->get_field_name('tabs_order');
?>
" value="<?php
if (!empty($instance['tabs_order'])) {
echo $instance['tabs_order'];
}
?>
" type="hidden" />
<ul id="<?php
echo $widget_id;
?>
-order" class="tab_sortable" <?php
if ($id[2] == '__i__') {
echo 'style="opacity:.5;"';
}
?>
>
<?php
$tabs_order = 'r,p,c,t';
if (!empty($instance['tabs_order'])) {
$tabs_order = $instance['tabs_order'];
}
$tabs_order_array = explode(',', $tabs_order);
foreach ($tabs_order_array as $tab) {
if ($tab == 'p') {
echo '<li data-tab="p"> ' . __ti("Popular") . ' </li>';
}
if ($tab == 'r') {
echo '<li data-tab="r"> ' . __ti("Recent") . ' </li>';
}
if ($tab == 'c') {
echo '<li data-tab="c"> ' . __ti("Comments") . ' </li>';
}
if ($tab == 't') {
echo '<li data-tab="t"> ' . __ti("Tags") . ' </li>';
}
}
?>
</ul>
//.........这里部分代码省略.........
示例13: tie_breadcrumbs
function tie_breadcrumbs()
{
if (tie_get_option('breadcrumbs')) {
$delimiter = '<span class="delimiter">';
$delimiter .= tie_get_option('breadcrumbs_delimiter') ? tie_get_option('breadcrumbs_delimiter') : '»';
$delimiter .= '</span>';
$before = '<span class="current">';
$after = '</span>';
if (!is_home() && !is_front_page() || is_paged()) {
echo '<div xmlns:v="http://rdf.data-vocabulary.org/#" id="crumbs">';
global $post;
$homeLink = home_url();
echo '<span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" class="crumbs-home" href="' . $homeLink . '">' . __ti('Home') . '</a></span> ' . $delimiter . ' ';
if (is_category()) {
global $wp_query;
$cat_obj = $wp_query->get_queried_object();
$thisCat = $cat_obj->term_id;
$thisCat = get_category($thisCat);
$parentCat = get_category($thisCat->parent);
if ($thisCat->parent != 0) {
if (!is_wp_error($cat_code = get_category_parents($parentCat, TRUE, ' ' . $delimiter . ' '))) {
$cat_code = str_replace('<a', '<span typeof="v:Breadcrumb"><a rel="v:url" property="v:title"', $cat_code);
echo $cat_code = str_replace('</a>', '</a></span>', $cat_code);
}
}
echo $before . '' . single_cat_title('', false) . '' . $after;
} elseif (is_day()) {
echo '<span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a></span> ' . $delimiter . ' ';
echo '<span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '">' . get_the_time('F') . '</a></span> ' . $delimiter . ' ';
echo $before . get_the_time('d') . $after;
} elseif (is_month()) {
echo '<span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a></span> ' . $delimiter . ' ';
echo $before . get_the_time('F') . $after;
} elseif (is_year()) {
echo $before . get_the_time('Y') . $after;
} elseif (is_single() && !is_attachment()) {
if (get_post_type() != 'post') {
$post_type = get_post_type_object(get_post_type());
$slug = $post_type->rewrite;
echo '<span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . $homeLink . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a></span> ' . $delimiter . ' ';
echo $before . get_the_title() . $after;
} else {
$cat = get_the_category();
$cat = $cat[0];
if (!empty($cat)) {
if (!is_wp_error($cat_code = get_category_parents($cat, TRUE, ' ' . $delimiter . ' '))) {
$cat_code = str_replace('<a', '<span typeof="v:Breadcrumb"><a rel="v:url" property="v:title"', $cat_code);
echo $cat_code = str_replace('</a>', '</a></span>', $cat_code);
}
}
echo $before . get_the_title() . $after;
}
} elseif (is_page() && !$post->post_parent || function_exists('bp_current_component') && bp_current_component()) {
echo $before . get_the_title() . $after;
} elseif (is_search()) {
echo $before;
printf(__ti('Search Results for: %s'), get_search_query());
echo $after;
} elseif (!is_single() && !is_page() && get_post_type() != 'post') {
$post_type = get_post_type_object(get_post_type());
echo $before . $post_type->labels->singular_name . $after;
} elseif (is_attachment()) {
$parent = get_post($post->post_parent);
$cat = get_the_category($parent->ID);
$cat = $cat[0];
echo '<span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_permalink($parent) . '">' . $parent->post_title . '</a></span> ' . $delimiter . ' ';
echo $before . get_the_title() . $after;
} elseif (is_page() && $post->post_parent) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = '<span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a></span>';
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
foreach ($breadcrumbs as $crumb) {
echo $crumb . ' ' . $delimiter . ' ';
}
echo $before . get_the_title() . $after;
} elseif (is_tag()) {
echo $before;
printf(__ti('Tag Archives: %s'), single_tag_title('', false));
echo $after;
} elseif (is_author()) {
global $author;
$userdata = get_userdata($author);
echo $before;
echo $userdata->display_name;
echo $after;
} elseif (is_404()) {
echo $before;
_eti('Not Found');
echo $after;
}
if (get_query_var('paged')) {
if (is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author()) {
echo ' (';
}
echo __ti('page') . ' ' . get_query_var('paged');
//.........这里部分代码省略.........
示例14: comments_number
comments_number(__ti('No comments'), __ti('One comment'), '% ' . __ti('comments'));
?>
</h3><div class="stripe-line"></div>
</div>
<div class="post-listing">
<?php
if (get_comment_pages_count() > 1 && get_option('page_comments')) {
?>
<div class="navigation">
<div class="nav-previous"><?php
previous_comments_link(__ti('<span>←</span> Older Comments'));
?>
</div>
<div class="nav-next"><?php
next_comments_link(__ti('Newer Comments <span>→</span>'));
?>
</div>
</div> <!-- .navigation -->
<?php
}
?>
<?php
$comments_by_type = separate_comments($comments);
?>
<?php
if (!empty($comments_by_type['comment'])) {
?>
示例15: widget
function widget($args, $instance)
{
global $post;
extract($args);
wp_reset_query();
if (is_single()) {
$no_of_posts = $instance['no_of_posts'];
$see_all = $instance['see_all'];
$authorID = get_the_author_meta('ID');
$args = array('author' => $authorID, 'post__not_in' => array($post->ID), 'posts_per_page' => $no_of_posts, 'no_found_rows' => 1);
$my_query = new wp_query($args);
if ($my_query->have_posts()) {
echo $before_widget;
echo $before_title;
printf(__ti('By %s'), get_the_author());
echo $after_title;
?>
<ul>
<?php
while ($my_query->have_posts()) {
$my_query->the_post();
?>
<li><a href="<?php
the_permalink();
?>
" rel="bookmark" title="<?php
the_title();
?>
"><?php
the_title();
?>
</a></li>
<?php
}
?>
</ul>
<?php
if ($see_all) {
?>
<a href="<?php
echo get_author_posts_url(get_the_author_meta('ID'));
?>
"> <?php
_eti('All Posts');
?>
(<?php
echo count_user_posts($authorID);
?>
)</a>
<?php
}
?>
<?php
wp_reset_query();
echo $after_widget;
}
}
}