本文整理汇总了PHP中icl_t函数的典型用法代码示例。如果您正苦于以下问题:PHP icl_t函数的具体用法?PHP icl_t怎么用?PHP icl_t使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了icl_t函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: translated_attribute_label
function translated_attribute_label($label, $name)
{
global $sitepress;
if (is_admin() && !wpml_is_ajax()) {
global $wpdb, $sitepress_settings;
if ($sitepress_settings['admin_default_language'] == $sitepress_settings['st']['strings_language']) {
return $label;
} else {
$string_id = icl_get_string_id('taxonomy singular name: ' . $label, 'WordPress');
if ($string_id) {
$string = $wpdb->get_var($wpdb->prepare("SELECT value FROM {$wpdb->prefix}icl_string_translations WHERE string_id = %s and language = %s", $string_id, $sitepress_settings['admin_default_language']));
if ($string) {
return $string;
}
}
}
}
$name = woocommerce_sanitize_taxonomy_name($name);
$lang = $sitepress->get_current_language();
$trnsl_labels = get_option('wcml_custom_attr_translations');
if (isset($trnsl_labels[$lang][$name])) {
return $trnsl_labels[$lang][$name];
}
return icl_t('WordPress', 'taxonomy singular name: ' . $label, $label);
}
示例2: widget
/**
* How to display the widget on the screen.
*/
function widget($args, $instance)
{
extract($args);
/* Our variables from the widget settings. */
$title = apply_filters('widget_title', $instance['title']);
if (function_exists('icl_t')) {
$text_code = icl_t('rehub_theme', 'widget_content_' . $this->id, $instance['text_code']);
} else {
$text_code = $instance['text_code'];
}
/* Before widget (defined by themes). */
echo $before_widget;
/* Display the widget title if one was input (before and after defined by themes). */
if ($title) {
echo $before_title . $title . $after_title;
}
?>
<?php
echo do_shortcode($text_code);
wp_enqueue_script('custom_scroll');
?>
<?php
/* After widget (defined by themes). */
echo $after_widget;
}
示例3: widget
function widget($args, $instance)
{
if (get_option('embed_autourls')) {
$wp_embed = $GLOBALS['wp_embed'];
add_filter('widget_text', array($wp_embed, 'run_shortcode'), 8);
add_filter('widget_text', array($wp_embed, 'autoembed'), 8);
}
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$text = apply_filters('widget_text', $instance['text'], $instance);
if (function_exists('icl_t')) {
$title = icl_t("Widgets", 'widget title - ' . md5($title), $title, $hasTranslation, true);
$text = icl_t("Widgets", 'widget body - ' . $this->id_base . '-' . $this->number, $text, $hasTranslation, true);
}
$text = do_shortcode($text);
echo $before_widget;
if (!empty($title)) {
echo $before_title . $title . $after_title;
}
?>
<div class="textwidget"><?php
echo $text;
?>
</div>
<?php
echo $after_widget;
}
示例4: wpcf_translate
/**
* WPML translate call.
*
* @param type $name
* @param type $string
* @return type
*/
function wpcf_translate($name, $string, $context = 'plugin Types')
{
if (!function_exists('icl_t')) {
return $string;
}
return icl_t($context, $name, stripslashes($string));
}
示例5: ot_wpml_filter
function ot_wpml_filter($options, $option_id)
{
// Return translated strings using WMPL
if (function_exists('icl_t')) {
$settings = get_option('option_tree_settings');
if (isset($settings['settings'])) {
foreach ($settings['settings'] as $setting) {
// List Item & Slider
if ($option_id == $setting['id'] && in_array($setting['type'], array('list-item', 'slider'))) {
foreach ($options[$option_id] as $key => $value) {
foreach ($value as $ckey => $cvalue) {
$id = $option_id . '_' . $ckey . '_' . $key;
$_string = icl_t('Theme Options', $id, $cvalue);
if (!empty($_string)) {
$options[$option_id][$key][$ckey] = $_string;
}
}
}
// All other acceptable option types
} else {
if ($option_id == $setting['id'] && in_array($setting['type'], apply_filters('ot_wpml_option_types', array('text', 'textarea', 'textarea-simple', 'upload')))) {
$_string = icl_t('Theme Options', $option_id, $options[$option_id]);
if (!empty($_string)) {
$options[$option_id] = $_string;
}
}
}
}
}
}
return $options[$option_id];
}
示例6: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$image = empty($instance['image']) ? '' : esc_url($instance['image']);
$text = apply_filters('widget_text', empty($instance['text']) ? '' : $instance['text'], $instance);
$url = empty($instance['url']) ? '' : esc_url($instance['url']);
$title_string = $url ? '<a href="' . $url . '">' . $title . '</a>' : $title;
$image_string = $url ? '<a href="' . $url . '"><img src="' . $image . '" alt="' . esc_attr($title) . '" class="img-circle aligncenter" /></a>' : '<img src="' . $image . '" alt="' . esc_attr($title) . '" class="img-circle aligncenter" />';
// WPML Compatibility
if (function_exists('icl_register_string')) {
icl_register_string('Widgets', 'ward_pro_widget_text_' . $this->number, $text);
}
if (function_exists('icl_t')) {
$text = icl_t('Widgets', 'ward_pro_widget_text_' . $this->number, $text);
}
echo $before_widget;
if (!empty($image)) {
echo $image_string;
}
if ($title) {
echo $before_title . $title_string . $after_title;
}
?>
<div class="textwidget">
<?php
echo !empty($instance['filter']) ? wpautop($text) : $text;
?>
</div>
<?php
echo $after_widget;
}
示例7: cred_translate
/**
* WPML translate call.
*
* @param type $name
* @param type $string
* @return type
*/
function cred_translate($name, $string, $context = 'CRED_CRED')
{
if (!function_exists('icl_t')) {
return $string;
}
return icl_t($context, $name, stripslashes($string));
}
示例8: widget
/**
* widget function.
*
* @see WP_Widget
* @access public
* @param array $args
* @param array $instance
* @return void
*/
public function widget($args, $instance)
{
if ($this->get_cached_widget($args)) {
return;
}
ob_start();
extract($args);
if (function_exists('icl_register_string')) {
icl_register_string('MediaCenter', 'Tab #1 title ' . $this->widget_id, $instance['title_tab_1']);
icl_register_string('MediaCenter', 'Tab #2 title ' . $this->widget_id, $instance['title_tab_2']);
icl_register_string('MediaCenter', 'Tab #3 title ' . $this->widget_id, $instance['title_tab_3']);
}
if (function_exists('icl_t')) {
$instance['title_tab_1'] = icl_t('MediaCenter', 'Tab #1 title ' . $this->widget_id, $instance['title_tab_1']);
$instance['title_tab_2'] = icl_t('MediaCenter', 'Tab #2 title ' . $this->widget_id, $instance['title_tab_2']);
$instance['title_tab_3'] = icl_t('MediaCenter', 'Tab #3 title ' . $this->widget_id, $instance['title_tab_3']);
}
$vars['title_tab_1'] = apply_filters('widget_text', $instance['title_tab_1']);
$sc_tab_1 = $instance['content_tab_1'];
$vars['title_tab_2'] = apply_filters('widget_text', $instance['title_tab_2']);
$sc_tab_2 = $instance['content_tab_2'];
$vars['title_tab_3'] = apply_filters('widget_text', $instance['title_tab_3']);
$sc_tab_3 = $instance['content_tab_3'];
echo $before_widget;
$vars['content_tab_1'] = do_shortcode('[' . $sc_tab_1 . ' product_item_size="size-medium" screen_width="100" per_page="4"]');
$vars['content_tab_2'] = do_shortcode('[' . $sc_tab_2 . ' product_item_size="size-medium" screen_width="100" per_page="4"]');
$vars['content_tab_3'] = do_shortcode('[' . $sc_tab_3 . ' product_item_size="size-medium" screen_width="100" per_page="4"]');
echo wc_get_template('framework/templates/widgets/home-page-tabs.php', $vars);
echo $after_widget;
$content = ob_get_clean();
echo $content;
$this->cache_widget($args, $content);
}
示例9: translate_footer_text
function translate_footer_text()
{
global $hybrid, $hybrid_settings;
$translation = icl_t('theme ' . $this->name, 'Footer text', $hybrid_settings['footer_insert']);
$hybrid_settings['footer_insert'] = $translation;
$hybrid->settings['footer_insert'] = $translation;
}
示例10: widget
function widget($args, $instance)
{
extract($args);
if (function_exists('icl_t')) {
$instance['supertitle'] = icl_t('PRESSO Widget', $this->id . '_supertitle', $instance['supertitle']);
$instance['title'] = icl_t('PRESSO Widget', $this->id . '_title', $instance['title']);
$instance['content'] = icl_t('PRESSO Widget', $this->id . '_content', $instance['content']);
}
$supertitle_html = '';
if (!empty($instance['supertitle'])) {
$supertitle_html = sprintf(__('<span class="super-title">%s</span>', 'envirra'), $instance['supertitle']);
}
$title_html = '';
if (!empty($instance['title'])) {
$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
$title_html = $supertitle_html . $title;
}
echo $before_widget;
if ($instance['title']) {
echo $before_title . $title_html . $after_title;
}
?>
<?php
echo $instance['content'];
?>
<div class="site-social-icons"><?php
vw_render_site_social_icons();
?>
</div>
<?php
echo $after_widget;
}
示例11: post_availability
function post_availability($content)
{
$out = '';
if (is_singular()) {
$languages = icl_get_languages('skip_missing=true');
if (1 < count($languages)) {
//$out .= $this->settings['post_available_before'] ? $this->settings['post_available_before'] : '';
foreach ($languages as $l) {
if (!$l['active']) {
$langs[] = '<a href="' . apply_filters('WPML_filter_link', $l['url'], $l) . '">' . $l['translated_name'] . '</a>';
}
}
$out .= join(', ', $langs);
//$out .= $this->settings['post_available_after'] ? $this->settings['post_available_after'] : '';
if (!function_exists('icl_t')) {
function icl_t($c, $n, $str)
{
return $str;
}
}
$out = '<p>' . sprintf(icl_t('WPML', 'Text for alternative languages for posts', $this->settings['icl_post_availability_text']), $out) . '</p>';
}
}
if ($this->settings['icl_post_availability_position'] == 'above') {
return $out . $content;
} else {
return $content . $out;
}
}
示例12: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
$img = $instance['img'];
if (function_exists('icl_t')) {
$text_code = icl_t(THEME_NAME, 'widget_content_' . $this->id, $instance['text_code']);
} else {
$text_code = $instance['text_code'];
}
echo $before_widget;
echo $before_title;
echo $title;
echo $after_title;
?>
<div class="author-avatar">
<img alt="" src="<?php
echo $img;
?>
">
</div>
<div class="author-description">
<?php
echo do_shortcode($text_code);
?>
</div><div class="clear"></div>
<?php
echo $after_widget;
}
示例13: translated_attribute_label
function translated_attribute_label($label, $name)
{
global $sitepress;
if (is_admin() && !wpml_is_ajax()) {
global $wpdb, $sitepress_settings;
$string_id = icl_get_string_id('taxonomy singular name: ' . $label, 'WordPress');
if (defined('ICL_SITEPRESS_VERSION') && version_compare(ICL_SITEPRESS_VERSION, '3.2', '>=')) {
$strings_language = icl_st_get_string_language($string_id);
} else {
$strings_language = $sitepress_settings['st']['strings_language'];
}
if ($string_id && $sitepress_settings['admin_default_language'] != $strings_language) {
$string = $wpdb->get_var($wpdb->prepare("SELECT value FROM {$wpdb->prefix}icl_string_translations WHERE string_id = %s and language = %s", $string_id, $sitepress_settings['admin_default_language']));
if ($string) {
return $string;
}
} else {
return $label;
}
}
$name = sanitize_title($name);
$lang = $sitepress->get_current_language();
$trnsl_labels = get_option('wcml_custom_attr_translations');
if (isset($trnsl_labels[$lang][$name])) {
return $trnsl_labels[$lang][$name];
}
return icl_t('WordPress', 'taxonomy singular name: ' . $label, $label);
}
示例14: widget
function widget($args, $instance)
{
extract($args);
if (function_exists('icl_t')) {
$instance['supertitle'] = icl_t('PRESSO Widget', $this->id . '_supertitle', $instance['supertitle']);
$instance['title'] = icl_t('PRESSO Widget', $this->id . '_title', $instance['title']);
}
$supertitle_html = '';
if (!empty($instance['supertitle'])) {
$supertitle_html = sprintf(__('<span class="super-title">%s</span>', 'envirra'), $instance['supertitle']);
}
$title_html = '';
if (!empty($instance['title'])) {
$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
$title_html = $supertitle_html . $title;
}
$count = intval($instance['count']);
echo $before_widget;
if ($instance['title']) {
echo $before_title . $title_html . $after_title;
}
global $post;
$posts = get_posts(array('post_type' => 'post', 'order' => 'DECS', 'orderby' => 'comment_count', 'posts_per_page' => $count));
echo '<div class="post-box-list">';
foreach ($posts as $post) {
setup_postdata($post);
get_template_part('templates/post-box/comment-count', get_post_format());
}
echo '</div>';
wp_reset_postdata();
echo $after_widget;
}
示例15: widget
function widget($args, $instance)
{
extract($args);
$instance = wp_parse_args($instance, $this->default);
if (function_exists('icl_t')) {
$instance['supertitle'] = icl_t('PRESSO Widget', $this->id . '_supertitle', $instance['supertitle']);
$instance['title'] = icl_t('PRESSO Widget', $this->id . '_title', $instance['title']);
$instance['subtitle'] = icl_t('PRESSO Widget', $this->id . '_subtitle', $instance['subtitle']);
}
$supertitle_html = '';
if (!empty($instance['supertitle'])) {
$supertitle_html = sprintf(__('<span class="super-title">%s</span>', 'envirra'), $instance['supertitle']);
}
$title_html = '';
if (!empty($instance['title'])) {
$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
$title_html = $supertitle_html . $title;
}
$subtitle_html = '';
if (!empty($instance['subtitle'])) {
$subtitle_html = sprintf(__('<p class="section-description">%s</p>', 'envirra'), $instance['subtitle']);
}
$category = intval($instance['category']);
$thumbnail = $instance['thumbnail'];
$format = $instance['format'];
$count = intval($instance['count']);
echo $before_widget;
if ($instance['title']) {
echo $before_title . $title_html . $after_title . $subtitle_html;
}
global $post;
$args = array('post_type' => 'post', 'orderby' => 'post_date', 'ignore_sticky_posts' => true, 'posts_per_page' => $count);
if ($category > 0) {
$args['cat'] = $category;
}
if (!empty($format)) {
$args['tax_query'] = array(array('taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-' . $format)));
}
$the_query = new WP_Query($args);
echo '<div class="post-box-list">';
if ('large' == $thumbnail || 'small' == $thumbnail) {
while ($the_query->have_posts()) {
$the_query->the_post();
get_template_part('templates/post-box/' . $thumbnail . '-thumbnail', get_post_format());
}
} else {
if ($the_query->have_posts()) {
$the_query->the_post();
get_template_part('templates/post-box/large-thumbnail', get_post_format());
}
while ($the_query->have_posts()) {
$the_query->the_post();
get_template_part('templates/post-box/small-thumbnail', get_post_format());
}
}
echo '</div>';
wp_reset_postdata();
echo $after_widget;
}