PluginProbe
Bogo / 2.9
Bogo v2.9
3.9.3 trunk 1.0 1.1 2.0 2.0.1 2.1 2.1.1 2.1.2 2.1.3 2.2 2.3 2.4 2.4.1 2.4.2 2.4.3 2.5 2.6 2.6.1 2.7 2.8 2.8.1 2.9 3.0 3.0.1 All 52 releases
← All changes | includes/widgets.php +19 -44 trunk2.9 View file →
@@ -1,9 +1,9 @@
1 1 <?php
2 2
3 3 /* Language Switcher Widget */
4 4
5 -add_action( 'widgets_init', 'bogo_widgets_init', 10, 0 );
5 +add_action( 'widgets_init', 'bogo_widgets_init' );
6 6
7 7 function bogo_widgets_init() {
8 8 register_widget( 'Bogo_Widget_Language_Switcher' );
9 9 }
@@ -11,72 +11,46 @@
11 11 class Bogo_Widget_Language_Switcher extends WP_Widget {
12 12
13 13 function __construct() {
14 14 $widget_ops = array(
15 - 'description' => __( 'Language switcher widget by Bogo plugin', 'bogo' ),
16 - );
15 + 'description' => __( 'Language switcher widget by Bogo plugin', 'bogo' ) );
17 16
18 17 $control_ops = array();
19 18
20 19 WP_Widget::__construct( 'bogo_language_switcher',
21 20 __( 'Language Switcher', 'bogo' ),
22 - $widget_ops, $control_ops
23 - );
21 + $widget_ops, $control_ops );
24 22 }
25 23
26 24 function widget( $args, $instance ) {
25 + extract( $args );
26 +
27 27 $title = apply_filters( 'widget_title',
28 - empty( $instance['title'] )
29 - ? __( 'Language Switcher', 'bogo' )
30 - : $instance['title'],
31 - $instance, $this->id_base
32 - );
28 + empty( $instance['title'] ) ? __( 'Language Switcher', 'bogo' ) : $instance['title'],
29 + $instance, $this->id_base );
33 30
34 - echo wp_kses_post( $args['before_widget'] );
31 + echo $before_widget;
35 32
36 - if ( $title ) {
37 - echo wp_kses_post(
38 - $args['before_title'] . $title . $args['after_title']
39 - );
40 - }
33 + if ( $title )
34 + echo $before_title . $title . $after_title;
41 35
42 - echo wp_kses_post( bogo_language_switcher() );
36 + echo bogo_language_switcher();
43 37
44 - echo wp_kses_post( $args['after_widget'] );
38 + echo $after_widget;
45 39 }
46 40
47 41 function form( $instance ) {
48 42 $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
49 - $title = wp_strip_all_tags( $instance['title'] );
43 + $title = strip_tags( $instance['title'] );
50 44
51 - $html = sprintf(
52 - '<p><label %1$s>%2$s</label> <input %3$s /></p>',
53 - bogo_format_atts( array(
54 - 'for' => $this->get_field_id( 'title' ),
55 - ) ),
56 - __( 'Title:', 'bogo' ),
57 - bogo_format_atts( array(
58 - 'class' => 'widefat',
59 - 'id' => $this->get_field_id( 'title' ),
60 - 'name' => $this->get_field_name( 'title' ),
61 - 'type' => 'text',
62 - 'value' => $title,
63 - ) )
64 - );
65 -
66 - echo wp_kses( $html, 'bogo_form_inside' );
45 + echo '<p><label for="' . $this->get_field_id( 'title' ) . '">' . esc_html( __( 'Title:', 'bogo' ) ) . '</label> <input class="widefat" id="' . $this->get_field_id( 'title' ) . '" name="' . $this->get_field_name( 'title' ) . '" type="text" value="' . esc_attr( $title ) . '" /></p>';
67 46 }
68 47
69 48 function update( $new_instance, $old_instance ) {
70 49 $instance = $old_instance;
50 + $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '' ) );
51 + $instance['title'] = strip_tags( $new_instance['title'] );
71 52
72 - $new_instance = wp_parse_args(
73 - (array) $new_instance,
74 - array( 'title' => '' )
75 - );
76 -
77 - $instance['title'] = wp_strip_all_tags( $new_instance['title'] );
78 -
79 53 return $instance;
80 54 }
81 55
82 56 }
@@ -88,11 +62,12 @@
88 62 function bogo_widget_display_callback( $instance, $widget, $args ) {
89 63 if ( isset( $instance['bogo_locales'] ) ) {
90 64 $locale = get_locale();
91 65
92 - if ( ! in_array( $locale, (array) $instance['bogo_locales'] ) ) {
66 + if ( ! in_array( $locale, (array) $instance['bogo_locales'] ) )
93 67 $instance = false;
94 - }
95 68 }
96 69
97 70 return $instance;
98 71 }
72 +
73 +?>