PluginProbe ʕ •ᴥ•ʔ
Translate WordPress – Google Language Translator / 3.0.8
Translate WordPress – Google Language Translator v3.0.8
trunk 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 4.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.7 4.0.8 4.0.9 5.0 5.0.0 5.0.01 5.0.02 5.0.03 5.0.04 5.0.05 5.0.06 5.0.07 5.0.08 5.0.09 5.0.10 5.0.11 5.0.12 5.0.13 5.0.14 5.0.15 5.0.16 5.0.17 5.0.18 5.0.19 5.0.20 5.0.21 5.0.22 5.0.23 5.0.24 5.0.25 5.0.26 5.0.27 5.0.28 5.0.29 5.0.30 5.0.31 5.0.32 5.0.33 5.0.34 5.0.35 5.0.36 5.0.37 5.0.38 5.0.39 5.0.40 5.0.41 5.0.42 5.0.43 5.0.44 5.0.45 5.0.46 5.0.47 5.0.48 5.0.49 6.0.0 6.0.1 6.0.10 6.0.11 6.0.12 6.0.13 6.0.14 6.0.15 6.0.16 6.0.19 6.0.2 6.0.20 6.0.3 6.0.4 6.0.5 6.0.6 6.0.7 6.0.8 6.0.9
google-language-translator / widget.php
google-language-translator Last commit date
css 12 years ago images 12 years ago js 12 years ago google-language-translator.php 12 years ago readme.txt 12 years ago widget.php 12 years ago
widget.php
53 lines
1 <?php
2
3 class glt_widget extends WP_Widget {
4
5 function __construct() {
6 parent::__construct(
7 'glt_widget', // Base ID
8 __('Google Language Translator', 'text_domain'), // Name
9 array( 'description' => __( 'Add the Google Language Translator website tool.', 'text_domain' ), ) // Args
10 );
11 }
12
13 public function widget( $args, $instance ) {
14 $title = apply_filters( 'widget_title', $instance['title'] );
15
16 echo $args['before_widget'];
17 if ( ! empty( $title ) )
18 echo $args['before_title'] . $title . $args['after_title'];
19 $google_language_translator_class = new google_language_translator();
20 $glt_shortcode = $google_language_translator_class->google_translator_shortcode();
21 echo $glt_shortcode;
22 echo $args['after_widget'];
23 }
24
25 public function form( $instance ) {
26 if ( isset( $instance[ 'title' ] ) ) {
27 $title = $instance[ 'title' ];
28 }
29 else {
30 $title = __( 'Translate:', 'text_domain' );
31 }
32 ?>
33 <p>
34 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
35 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>">
36 </p>
37 <?php
38 }
39
40 public function update( $new_instance, $old_instance ) {
41 $instance = array();
42 $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
43
44 return $instance;
45 }
46
47 } // class glt_widget
48
49 // register Foo_Widget widget
50 function register_foo_widget() {
51 register_widget( 'glt_widget' );
52 }
53 add_action( 'widgets_init', 'register_foo_widget' );