'WP_Editor_Widget', 'description' => __( 'Arbitrary text, HTML or rich text through the standard WordPress visual editor.', 'wp-editor-widget' ), ) ); parent::__construct( 'WP_Editor_Widget', $widget_name, $widget_ops ); } // END __construct() /** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget( $args, $instance ) { $title = apply_filters( 'wp_editor_widget_title', $instance['title'] ); $output_title = apply_filters( 'wp_editor_widget_output_title', $instance['output_title'] ); $content = apply_filters( 'wp_editor_widget_content', $instance['content'] ); $show = true; // WPML support? if ( function_exists( 'icl_get_languages' ) ) { $language = apply_filters( 'wp_editor_widget_language', $instance['language'] ); $show = ($language == icl_get_current_language()); } if ( $show ) { $default_html = $args['before_widget']; if ( '1' == $output_title && ! empty( $title ) ) { $default_html .= $args['before_title'] . $title . $args['after_title']; } $default_html .= $content; $default_html .= $args['after_widget']; echo apply_filters( 'wp_editor_widget_html', $default_html, $args['id'], $instance, $args['before_widget'], $args['after_widget'], $output_title, $title, $args['before_title'], $args['after_title'], $content ); } } // END widget() /** * Back-end widget form. * * @see WP_Widget::form() * * @param array $instance Previously saved values from database. */ public function form( $instance ) { if ( isset( $instance['title'] ) ) { $title = $instance['title']; } else { $title = __( 'New title', 'wp-editor-widget' ); } if ( isset( $instance['content'] ) ) { $content = $instance['content']; } else { $content = ''; } $output_title = ( isset( $instance['output_title'] ) && '1' == $instance['output_title'] ? true : false ); ?>