'widget_text_icl', 'description' => __( 'Multilingual arbitrary text or HTML', 'wpml-string-translation' ), ); parent::__construct( 'text_icl', __( 'Multilingual Text', 'wpml-string-translation' ), $widget_ops ); } function widget( $args, $instance ) { extract( $args ); $before_widget = $args['before_widget']; $after_widget = $args['after_widget']; $before_title = $args['before_title']; $after_title = $args['after_title']; if ( $instance['icl_language'] != 'multilingual' && $instance['icl_language'] != ICL_LANGUAGE_CODE ) { return; } elseif ( $instance['icl_language'] == 'multilingual' && function_exists( 'icl_t' ) ) { // Get translations $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $was_hooked = remove_filter( 'widget_text', 'icl_sw_filters_widget_text', self::FILTER_PRIORITY ); $text = apply_filters( 'widget_text', icl_t( self::STRING_DOMAIN, 'widget body - ' . $this->id, $instance['text'] ), $instance ); if ( $was_hooked ) { add_filter( 'widget_text', 'icl_sw_filters_widget_text', self::FILTER_PRIORITY ); } } else { remove_filter( 'widget_title', 'icl_sw_filters_widget_title' ); $was_hooked = remove_filter( 'widget_text', 'icl_sw_filters_widget_text', self::FILTER_PRIORITY ); $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $text = apply_filters( 'widget_text', $instance['text'], $instance ); add_filter( 'widget_title', 'icl_sw_filters_widget_title' ); if ( $was_hooked ) { add_filter( 'widget_text', 'icl_sw_filters_widget_text', self::FILTER_PRIORITY ); } } echo $before_widget; if ( ! empty( $title ) ) { echo $before_title . $title . $after_title; } ?>
get_row( $wpdb->prepare( "SELECT id, value, status FROM {$wpdb->prefix}icl_strings WHERE context=%s AND name=%s", self::STRING_DOMAIN, 'widget body - ' . $this->id ) ); if ( $string ) { icl_st_update_string_actions( self::STRING_DOMAIN, 'widget body - ' . $this->id, $old_instance['text'], $instance['text'] ); } else { icl_register_string( self::STRING_DOMAIN, 'widget body - ' . $this->id, $instance['text'] ); } } $instance['icl_language'] = $new_instance['icl_language']; return $instance; } function form( $instance ) { $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '', 'icl_language' => 'multilingual', 'icl_converted_from' => -1, ) ); $title = strip_tags( $instance['title'] ); $text = esc_textarea( $instance['text'] ); $language = $instance['icl_language']; ?>

/> 

get_field_name( 'icl_language' ) ); return ''; } }