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); }
/** * 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; }
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; }
/** * 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)); }
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]; }
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; }
/** * 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)); }
/** * 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); }
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; }
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; }
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; } }
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; }
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); }
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; }
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; }
/** * Get the translated string * * @param string $value The default value that will be returned if string hasn't been translated * @param string $name The name of the string * @param string $context The context of the string * * @package Graphene * @since Graphene 1.8 */ function graphene_icl_t($name, $value = '', $context = 'Graphene theme') { if (!function_exists('icl_t')) { return $value; } else { return icl_t($context, $name, $value); } }
function filter_option_firsttimevisitor($value) { if (!isset($value['site']['hss_firsttimevisitor']['message']) || empty($value['site']['hss_firsttimevisitor']['message'])) { return $value; } $value['site']['hss_firsttimevisitor']['message'] = icl_t($this->context, 'Site Modules - First time visitor message', $value['site']['hss_firsttimevisitor']['message']); return $value; }
public function register_translated_label($label, $column_name, $column_options, $storage_model) { if (function_exists('icl_t')) { $name = $storage_model->key . '_' . $column_name; $label = icl_t('Admin Columns', $name, $label); } return $label; }
/** * Return WPML translation string of $value if WPML is active. * If WPML is not active, just return $value. * * @param string The name of the text need to translate. * @param string The value of the text need to translate. * @param string The textdomain to be used for the translation. * @return string WPML translated text */ public function getWPMLText($name, $value, $textdomain = 'csa-slplus') { if ($this->isActive()) { return icl_t($textdomain, $name, $value); } else { return $value; } }
function filter_options() { global $bfa_ata; $bfa_ata['get_option_home'] = rtrim(icl_get_home_url(), '/'); foreach ($this->translatable_strings as $string) { $bfa_ata[$string] = icl_t('theme ' . $this->name, $this->make_title($string), $bfa_ata[$string]); } }
/** * Get the translated string * * @param string $value The default value that will be returned if string hasn't been translated * @param string $name The name of the string * @param string $context The context of the string * */ function franz_icl_t($name, $value = '', $context = 'Franz Josef theme') { if (!function_exists('icl_t')) { return $value; } else { return icl_t($context, $name, $value); } }
function wppb_icl_t($context, $name, $value) { if (function_exists('icl_t')) { return icl_t($context, $name, $value); } else { return $value; } }
function wcml_translate_single_string_filter($original_value, $context, $name, $language_code = null, $has_translation = null, $disable_auto_register = false) { if (is_string($name) && function_exists('icl_t')) { return icl_t($context, $name, $original_value, $has_translation, $disable_auto_register, $language_code); } else { return $original_value; } }
function youxi_widgets_icl_t_social($instance, $id) { if (isset($instance['items'])) { foreach ($instance['items'] as $idx => &$item) { $item['title'] = icl_t('Youxi Widgets', sprintf("[%s] item-title-%d", $id, $idx), $item['title']); } } return $instance; }
public function get_translated_dynamic_string($name, $value) { if (function_exists('icl_t')) { //if ($name == 'Tour tab') // echo 'icl_t' . $name . ' ' . $value; return icl_t('BookYourTravel Theme', $name, $value); } return $value; }
/** * Get multilanguage string * * @since 1.0.0 * * @param string $plugin_name_human_format The Plugin name * @param string $string_name The name of the string * @param string $value The value */ function get_string($plugin_name_human_format, $string_name, $value) { if (function_exists('icl_t')) { return icl_t($plugin_name_human_format, $string_name, $value); } elseif (has_filter('cml_my_translations')) { return CMLTranslations::get(CMLLanguage::get_current_id(), $string_name, str_replace(' ', '-', $plugin_name_human_format)); } elseif (function_exists('pll__')) { return pll__($string_name); } }
/** * Passes a string to WPML for translation. * * @param string context The context for the translation. Usually, the plugin name. * @param string name The string name, for identification. * @param string value The original text. * @param bool allow_empty Indicates if the value can be empty. * @param bool has_translation Indicates if a translation for the string was found. * @return int */ function aelia_t($context, $name, $value, $allow_empty = false, &$has_translation = null) { if (function_exists('icl_register_string')) { icl_register_string($context, $name, $value, $allow_empty); } if (function_exists('icl_t')) { $value = icl_t($context, $name, $value, $has_translation); } return $value; }
/** * 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']; } $feedburner = $instance['feedburner']; /* 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; } ?> <form action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open('http://feedburner.google.com/fb/a/mailverify?uri=<?php echo $feedburner; ?> ', 'popupwindow', 'scrollbars=yes,width=550,height=520');return true"> <input class="feedburner-email" type="text" name="email" onblur="if (value == '') {value = '<?php _e('Enter e-mail address', 'rehub_framework'); ?> '}" onfocus="if (value == '<?php _e('Enter e-mail address', 'rehub_framework'); ?> ') {value = ''}" value="<?php _e('Enter e-mail address', 'rehub_framework'); ?> "/> <input class="feedburner-subscribe" type="submit" name="submit" value="<?php _e('GO', 'rehub_framework'); ?> "/> <input type="hidden" value="<?php echo $feedburner; ?> " name="uri"> <input type="hidden" name="loc" value="<?php echo get_locale(); ?> "> </form> <p><i class="fa fa-rss"></i> <?php echo $text_code; ?> </p> <?php /* After widget (defined by themes). */ echo $after_widget; }
function tfwpml_get_admin_options($value, $option) { $translation = false; if (function_exists('icl_t')) { $translation = icl_t('ThemeFuse', $option, $value); } if (!$translation) { return $value; } return $translation; }
/** * How to display the widget on the screen. */ function widget($args, $instance) { extract($args); /* Our variables from the widget settings. */ $side = 'left'; $fixed = 'fixed'; if (!empty($instance['side'])) { $side = 'right'; } if (!empty($instance['fixed'])) { $fixed = 'absolute'; } $margin = $instance['margin']; $width = $instance['width']; if ($side == 'left') { $position = -604 - $width; } if ($side == 'right') { $position = 604; } if (function_exists('icl_t')) { $text_code = icl_t('Widget content code', 'widget_content_' . $this->id, $instance['text_code']); } else { $text_code = $instance['text_code']; } /* Before widget (defined by themes). */ echo $before_widget; ?> <div class="mediad outer_mediad_<?php echo $side; ?> " style="margin-left: <?php echo $position; ?> px; top: <?php echo $margin; ?> px; width: <?php echo $width; ?> px; position: <?php echo $fixed; ?> ; left: 50%"><?php echo $text_code; ?> </div> <?php /* After widget (defined by themes). */ echo $after_widget; }