function icl_register_admin_options($array, $key = "", $option = array()) { if (is_object($option)) { $option = object_to_array($option); } foreach ($array as $k => $v) { $option = $key === '' ? array($k => maybe_unserialize($this->get_option_without_filtering($k))) : $option; if (is_array($v)) { $this->icl_register_admin_options($v, $key . '[' . $k . ']', $option[$k]); } else { $context = $this->get_context($key, $k); if ($v === '') { icl_unregister_string($context, $key . $k); } elseif (isset($option[$k]) && ($key === '' || preg_match_all('#\\[([^\\]]+)\\]#', (string) $key, $opt_key_matches) > 0)) { icl_register_string($context, $key . $k, $option[$k]); $vals = array($k => 1); $opt_keys = isset($opt_key_matches) ? array_reverse($opt_key_matches[1]) : array(); foreach ($opt_keys as $opt) { $vals = array($opt => $vals); } update_option('_icl_admin_option_names', array_merge_recursive((array) get_option('_icl_admin_option_names'), $vals)); } } } }
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; }
function __construct() { parent::__construct(); if (!is_admin()) { foreach ($this->translatable_strings as $option => $value) { $option_value = get_option($option); if (!$option_value) { continue; } $this->current_option = $option; add_filter('option_' . $option, array(&$this, 'filter_option')); } add_filter('option_headspace_options', array(&$this, 'filter_option_firsttimevisitor')); } else { foreach ($this->translatable_strings as $option => $value) { $option_value = get_option($option); if (!$option_value) { continue; } foreach ($value['values'] as $v) { if (!$option_value[$v]) { continue; } icl_register_string($this->context, $value['title'] . ' - ' . $this->make_title($v), $option_value[$v]); } } $first_time = get_option('headspace_options'); if (isset($first_time['site']['hss_firsttimevisitor']['message']) && !empty($first_time['site']['hss_firsttimevisitor']['message'])) { icl_register_string($this->context, 'Site Modules - First time visitor message', $first_time['site']['hss_firsttimevisitor']['message']); } } }
/** * 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); }
private function build_label_array($singular_label, $label) { global $sitepress, $wpdb; $return = array(); $str_name_singular = 'taxonomy singular name: ' . $singular_label; $return['id_singular'] = icl_get_string_id($singular_label, 'WordPress', $str_name_singular); if (!$return['id_singular']) { $return['id_singular'] = icl_register_string('WordPress', $str_name_singular, $singular_label); } $str_name_general = 'taxonomy general name: ' . $label; $return['id_general'] = icl_get_string_id($label, 'WordPress', $str_name_general); if (!$return['id_general']) { $return['id_general'] = icl_register_string('WordPress', $str_name_general, $label); } $active_lang_codes = array_keys($sitepress->get_active_languages(true)); foreach ($active_lang_codes as $language) { $exists_singular = null; $translated_label = icl_translate('WordPress', $str_name_singular, $singular_label, false, $exists_singular, $language); if ($exists_singular) { $return[$language]['singular'] = $translated_label; } $exists_plural = null; $translated_label = icl_translate('WordPress', $str_name_general, $label, false, $exists_plural, $language); if ($exists_plural) { $return[$language]['general'] = $translated_label; } } $string = new WPML_ST_String($return['id_singular'], $wpdb); $return[$string->get_language()] = array('singular' => $singular_label, 'general' => $label, 'original' => true); $return['st_default_lang'] = $string->get_language(); return $return; }
private function build_label_array($singular_label, $label, $str_lang, $corrections) { global $sitepress; $return = array('en' => array('singular' => $singular_label, 'general' => $label, 'original' => true)); $str_lang = $str_lang ? $str_lang : 'en'; $str_name_singular = 'taxonomy singular name: ' . $singular_label; $return['id_singular'] = icl_get_string_id($singular_label, 'WordPress', $str_name_singular); if (!$return['id_singular'] && ($str_lang == 'en' || $corrections == 2)) { $return['id_singular'] = icl_register_string('WordPress', $str_name_singular, $singular_label); } $str_name_general = 'taxonomy general name: ' . $label; $return['id_general'] = icl_get_string_id($label, 'WordPress', $str_name_general); if (!$return['id_general'] && ($str_lang === 'en' || $corrections == 2)) { $return['id_general'] = icl_register_string('WordPress', $str_name_general, $label); } $active_lang_codes = array_keys($sitepress->get_active_languages(true)); foreach ($active_lang_codes as $language) { if ($language == 'en') { continue; } $exists_singular = null; $translated_label = icl_translate('WordPress', $str_name_singular, $singular_label, false, $exists_singular, $language); if ($exists_singular) { $return[$language]['singular'] = $translated_label; } $exists_plural = null; $translated_label = icl_translate('WordPress', $str_name_general, $label, false, $exists_plural, $language); if ($exists_plural) { $return[$language]['general'] = $translated_label; } } return $return; }
function __construct() { parent::__construct(); $wpage = ICL_PLUGIN_FOLDER . '/menu/languages.php'; $title = 'Thematic - '; // Header switcher $this->add_option_checkbox($wpage, __('Add a list of languages to the site\'s header', 'sitepress'), 'header_language_selector', $title . __('Language selector options', 'sitepress'), 'checked'); $this->add_option_checkbox($wpage, __('Only include languages with translation in the languages list header', 'sitepress'), 'header_skip_languages', $title . __('More options', 'sitepress'), 'checked'); $this->add_option_checkbox($wpage, __('Load CSS for header languages list', 'sitepress'), 'header_load_css', $title . __('More options', 'sitepress'), 'checked'); if ($this->settings['header_language_selector']) { add_action('thematic_aboveheader', array(&$this, 'language_selector_header')); if ($this->settings['header_load_css']) { $this->load_css('css/selector-header.css'); } $this->check_sidebar_language_selector_widget(); } add_filter('wp_page_menu', array(&$this, 'filter_home_link')); add_action('thematic_header', array(&$this, 'remove_thematic_blogtitle'), 0); $footer_text = get_option('thm_footertext', true); if ($footer_text) { icl_register_string('theme ' . $this->name, 'Footer text', $footer_text); add_filter('thematic_footertext', array(&$this, 'translate_footer_text')); } $this->load_css('css/compatibility-package.css'); }
function register_strings() { global $bfa_ata; foreach ($this->translatable_strings as $string) { icl_register_string('theme ' . $this->name, $this->make_title($string), $bfa_ata[$string]); } }
function init() { global $sitepress_settings; $this->settings = $sitepress_settings; if (!empty($this->settings['icl_lang_sel_footer'])) { add_action('wp_head', array(&$this, 'language_selector_footer_style'), 19); add_action('wp_footer', array(&$this, 'language_selector_footer'), 19); } if (is_admin()) { add_action('icl_language_switcher_options', array(&$this, 'admin'), 1); } else { if (!empty($this->settings['icl_post_availability'])) { if (function_exists('icl_register_string')) { icl_register_string('WPML', 'Text for alternative languages for posts', $this->settings['icl_post_availability_text']); } add_filter('the_content', array(&$this, 'post_availability')); } } // the language selector widget $this->language_selector_widget_init(); if (is_admin() && isset($_GET['page']) && $_GET['page'] == ICL_PLUGIN_FOLDER . '/menu/languages.php') { add_action('admin_head', 'icl_lang_sel_nav_css', 1, 1, true); add_action('admin_head', array(&$this, 'custom_language_switcher_style')); } if (!is_admin()) { add_action('wp_head', array(&$this, 'custom_language_switcher_style')); } if (!empty($sitepress_settings['display_ls_in_menu'])) { add_filter('wp_nav_menu_items', array($this, 'wp_nav_menu_items_filter'), 10, 2); } }
function tie_save_settings($data, $refresh = 0) { global $array_options; foreach ($array_options as $option) { if (isset($data[$option])) { array_walk_recursive($data[$option], 'tie_clean_options'); update_option($option, $data[$option]); if (function_exists('icl_register_string') && $option == 'tie_home_cats') { foreach ($data[$option] as $item) { if (!empty($item['boxid'])) { icl_register_string(THEME_NAME, $item['boxid'], $item['title']); } if (!empty($item['type']) && $item['type'] == 'ads' && !empty($item['boxid'])) { icl_register_string(THEME_NAME, $item['boxid'], $item['text']); } } } } elseif (!isset($data[$option]) && $option != 'tie_options') { delete_option($option); } } if ($refresh == 2) { die('2'); } elseif ($refresh == 1) { die('1'); } }
/** * Registers theme_mod strings into WPML * * @since 1.6.0 */ public function register_strings() { if (function_exists('icl_register_string') && ($strings = wpex_register_theme_mod_strings())) { foreach ($strings as $string => $default) { icl_register_string('Theme Mod', $string, get_theme_mod($string, $default)); } } }
/** * Register widget strings with WPML * * @param array $instance the widget's custom strings */ public function register_widget($instance) { if (function_exists('icl_register_string')) { $context = 'Petition ' . $instance['petition_id']; icl_register_string($context, 'widget title', $instance['title']); icl_register_string($context, 'widget call to action', $instance['call_to_action']); } }
function translate_date_format($format) { if (function_exists('icl_translate')) { icl_register_string('Formats', 'Date Format', $format); $format = icl_translate('Formats', 'Date Format', $format); } return $format; }
function youxi_widgets_icl_register_string_social($instance, $id) { if (isset($instance['items'])) { foreach ($instance['items'] as $idx => &$item) { icl_register_string('Youxi Widgets', sprintf("[%s] item-title-%d", $id, $idx), $item['title']); } } return $instance; }
function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = $new_instance['title']; if (function_exists('icl_register_string')) { icl_register_string('wpestate_Multiple_currency_widget', 'Multiple_currency_widget_title', $new_instance['title']); } return $instance; }
public function options_wpml($oldvalue, $newvalue, $option) { global $webdados_fb; if ($webdados_fb->is_wpml_active()) { // Homepage description icl_register_string('wd-fb-og', 'wd_fb_og_desc_homepage_customtext', trim($newvalue['fb_desc_homepage_customtext'])); // Default description icl_register_string('wd-fb-og', 'wd_fb_og_fb_desc_default', trim($newvalue['fb_desc_default'])); } }
function update($new_instance, $old_instance) { $instance = $old_instance; $new_instance = wp_parse_args((array) $new_instance, $this->default); $instance['title'] = $new_instance['title']; if (function_exists('icl_register_string')) { icl_register_string(VW_THEME_NAME . ' Widget', $this->id . '_title', $instance['title']); } return $instance; }
/** * 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; }
/** * Add registration for multilanguage string (contain hook) * * @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 register_string($plugin_name_human_format, $string_name, $value) { if (function_exists('icl_register_string')) { icl_register_string($plugin_name_human_format, $string_name, $value); } elseif (has_filter('cml_my_translations')) { CMLTranslations::add($string_name, $value, str_replace(' ', '-', $plugin_name_human_format)); } elseif (function_exists('pll_register_string')) { $plugin_name_human_format_replaced = str_replace(' ', '-', $plugin_name_human_format); pll_register_string($plugin_name_human_format_replaced, $string_name); } }
function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); $instance['img'] = $new_instance['img']; $instance['text_code'] = $new_instance['text_code']; if (function_exists('icl_register_string')) { icl_register_string(THEME_NAME, 'widget_content_' . $this->id, $new_instance['text_code']); } return $instance; }
/** * Update the widget settings. */ function update($new_instance, $old_instance) { $instance = $old_instance; /* Strip tags for title and name to remove HTML (important for text inputs). */ $instance['title'] = strip_tags($new_instance['title']); $instance['text_code'] = $new_instance['text_code']; if (function_exists('icl_register_string')) { icl_register_string('rehub_theme', 'widget_content_' . $this->id, $new_instance['text_code']); } return $instance; }
/** * Add registration for multilanguage string (contain hook) * * @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 register_string($plugin_name_human_format, $string_name, $value) { if (function_exists('icl_register_string')) { icl_register_string($plugin_name_human_format, $string_name, $value); } elseif (has_filter('cml_my_translations')) { add_filter('cml_my_translations', create_function("{$groups}, {$plugin_name_human_format}", "\n {$plugin_name_human_format_replaced} = str_replace( ' ', '-', {$plugin_name_human_format} );\n CMLTranslations:add( {$string_name}, {$value}, {$plugin_name_human_format} );\n {$groups[$plugin_name_human_format_replaced]} = {$plugin_name_human_format};\n return {$groups};")); } elseif (function_exists('pll_register_string')) { $plugin_name_human_format_replaced = str_replace(' ', '-', $plugin_name_human_format); pll_register_string($plugin_name_human_format_replaced, $string_name); } }
function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); $instance['text_code'] = $new_instance['text_code']; $instance['feedburner'] = strip_tags($new_instance['feedburner']); if (function_exists('icl_register_string')) { icl_register_string(theme_name, 'widget_content_' . $this->id, $new_instance['text_code']); } return $instance; }
/** * @param int $user_id */ private function register_user_strings($user_id) { if ($this->is_user_role_translatable($user_id)) { $fields = $this->get_translatable_meta_fields(); foreach ($fields as $field) { $name = $this->get_string_name($field, $user_id); $value = get_the_author_meta($field, $user_id); icl_register_string($this->context, $name, $value, true); } } }
function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = sanitize_text_field($new_instance['title']); $instance['limit'] = sanitize_text_field($new_instance['limit']); if (function_exists('icl_register_string')) { icl_register_string('reales_featured_agents_widget', 'featured_agents_widget_title', sanitize_text_field($new_instance['title'])); icl_register_string('reales_featured_agents_widget', 'featured_agents_widget_limit', sanitize_text_field($new_instance['limit'])); } return $instance; }
function tie_save_builder($post_id) { global $post; if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return $post_id; } if (isset($_POST['tie_hidden_flag'])) { $custom_meta_fields = array('home_exc_length', 'box_meta_score', 'box_meta_author', 'box_meta_date', 'box_meta_cats', 'box_meta_comments', 'box_meta_views', 'featured_posts', 'featured_auto', 'featured_posts_speed', 'featured_posts_time', 'featured_posts_number', 'featured_posts_query', 'featured_posts_tag', 'featured_posts_posts', 'featured_posts_pages', 'featured_posts_custom', 'slider', 'slider_type', 'elastic_slider_effect', 'elastic_slider_autoplay', 'elastic_slider_interval', 'elastic_slider_speed', 'flexi_slider_effect', 'flexi_slider_speed', 'flexi_slider_time', 'slider_caption', 'slider_caption_length', 'slider_pos', 'slider_number', 'slider_query', 'slider_tag', 'slider_posts', 'slider_pages', 'slider_custom', 'slider_cat', 'featured_posts_cat'); foreach ($custom_meta_fields as $custom_meta_field) { if (isset($_POST[$custom_meta_field]) && !empty($_POST[$custom_meta_field])) { $custom_meta_field_data = $_POST[$custom_meta_field]; if (is_array($custom_meta_field_data)) { $custom_meta_field_data = array_filter($custom_meta_field_data); if (!empty($custom_meta_field_data)) { update_post_meta($post_id, $custom_meta_field, $custom_meta_field_data); } else { delete_post_meta($post_id, $custom_meta_field); } } else { if (!empty($custom_meta_field_data)) { update_post_meta($post_id, $custom_meta_field, htmlspecialchars(stripslashes($custom_meta_field_data))); } else { delete_post_meta($post_id, $custom_meta_field); } } } else { delete_post_meta($post_id, $custom_meta_field); } } //Builder if (isset($_POST['tie_builder_active']) && !empty($_POST['tie_builder_active']) && $_POST['tie_builder_active'] == 'yes') { update_post_meta($post_id, 'tie_builder_active', 'yes'); } else { delete_post_meta($post_id, 'tie_builder_active'); } if (isset($_POST['tie_home_cats']) && !empty($_POST['tie_home_cats'])) { array_walk_recursive($_POST['tie_home_cats'], 'tie_clean_options'); update_post_meta($post_id, 'tie_builder', $_POST['tie_home_cats']); if (function_exists('icl_register_string')) { foreach ($_POST['tie_home_cats'] as $item) { if (!empty($item['boxid'])) { icl_register_string(THEME_NAME, 'wpml-' . $page_id . '-' . $item['boxid'], $item['title']); } if (!empty($item['type']) && $item['type'] == 'ads' && !empty($item['boxid'])) { icl_register_string(THEME_NAME, 'wpml-' . $page_id . '-' . $item['boxid'], $item['text']); } } } } else { delete_post_meta($post_id, 'tie_builder'); } } }
public function register_column_labels() { // don't load this unless required by WPML if (!isset($_GET['page']) || 'wpml-string-translation/menu/string-translation.php' !== $_GET['page']) { return; } foreach (cpac()->get_storage_models() as $storage_model) { foreach ($storage_model->get_stored_columns() as $column_name => $options) { icl_register_string('Admin Columns', $storage_model->key . '_' . $column_name, stripslashes($options['label'])); } } }
function init() { global $pagenow; //register shipping label if ($pagenow == 'admin.php' && isset($_GET['page']) && $_GET['page'] == 'shipping_zones' && isset($_POST['shipping_label']) && isset($_POST['woocommerce_table_rate_title'])) { icl_register_string('woocommerce', $_POST['woocommerce_table_rate_title'] . '_shipping_method_title', $_POST['woocommerce_table_rate_title']); $shipping_labels = array_map('woocommerce_clean', $_POST['shipping_label']); foreach ($shipping_labels as $shipping_label) { icl_register_string('woocommerce', $shipping_label . '_shipping_method_title', $shipping_label); } } }
function update($new_instance, $old_instance) { $instance = $old_instance; $new_instance = wp_parse_args((array) $new_instance, $this->default); $instance['supertitle'] = strip_tags($new_instance['supertitle']); $instance['title'] = strip_tags($new_instance['title']); $instance['count'] = intval($new_instance['count']); if (function_exists('icl_register_string')) { icl_register_string('PRESSO Widget', $this->id . '_supertitle', $instance['supertitle']); icl_register_string('PRESSO Widget', $this->id . '_title', $instance['title']); } return $instance; }
function register_addons_strings($id, $addons) { foreach ($addons as $addon) { //register name icl_register_string('wc_product_addons_strings', $id . '_addon_' . $addon['type'] . '_' . $addon['position'] . '_name', $addon['name']); //register description icl_register_string('wc_product_addons_strings', $id . '_addon_' . $addon['type'] . '_' . $addon['position'] . '_description', $addon['description']); //register options labels foreach ($addon['options'] as $key => $option) { icl_register_string('wc_product_addons_strings', $id . '_addon_' . $addon['type'] . '_' . $addon['position'] . '_option_label_' . $key, $option['label']); } } }