PluginProbe
Bogo / 2.4
Bogo v2.4
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 | admin/includes/widgets.php +12 -40 trunk2.4 View file →
@@ -2,11 +2,9 @@
2 2
3 3 add_action( 'in_widget_form', 'bogo_in_widget_form', 10, 3 );
4 4
5 5 function bogo_in_widget_form( $widget, $return, $instance ) {
6 - $available_languages = bogo_available_languages( array(
7 - 'orderby' => 'value',
8 - ) );
6 + $available_languages = bogo_available_languages( 'orderby=value' );
9 7
10 8 if ( empty( $available_languages ) ) {
11 9 return;
12 10 }
@@ -19,54 +17,28 @@
19 17
20 18 ?>
21 19 <fieldset class="bogo-locale-options">
22 20 <legend><?php echo esc_html( __( 'Displayed on pages in', 'bogo' ) ); ?></legend>
23 -<?php
24 -
25 - foreach ( $available_languages as $locale => $language ) {
26 - $checked = in_array( $locale, $selected_languages );
27 -
28 - $id_attr = sprintf(
29 - '%s-%s',
30 - $widget->get_field_id( 'bogo_locales' ),
31 - $locale
32 - );
33 -
34 - $checkbox = sprintf(
35 - '<label %1$s><input %2$s />%3$s</label>',
36 - bogo_format_atts( array(
37 - 'class' => 'bogo-locale-option' . ( $checked ? ' checked' : '' ),
38 - 'for' => $id_attr,
39 - ) ),
40 - bogo_format_atts( array(
41 - 'type' => 'checkbox',
42 - 'id' => $id_attr,
43 - 'name' => sprintf( '%s[]', $widget->get_field_name( 'bogo_locales' ) ),
44 - 'value' => $locale,
45 - 'checked' => $checked,
46 - ) ),
47 - $language
48 - );
49 -
50 - echo wp_kses( $checkbox, 'bogo_form_inside' ) . "\n";
51 - }
52 -
21 +<?php foreach ( $available_languages as $locale => $language ) :
22 + $checked = in_array( $locale, $selected_languages );
23 + $id_attr = $widget->get_field_id( 'bogo_locales' ) . '-' . $locale;
53 24 ?>
25 +<label class="bogo-locale-option<?php echo $checked ? ' checked' : ''; ?>" for="<?php echo $id_attr; ?>">
26 +<input type="checkbox" id="<?php echo $id_attr; ?>" name="<?php echo $widget->get_field_name( 'bogo_locales' ); ?>[]" value="<?php echo esc_attr( $locale ); ?>"<?php echo $checked ? ' checked="checked"' : ''; ?> /><?php echo esc_html( $language ); ?>
27 +</label>
28 +<?php endforeach; ?>
54 29 </fieldset>
55 30 <?php
56 31 }
57 32
58 -
59 33 add_filter( 'widget_update_callback', 'bogo_widget_update_callback', 10, 4 );
60 34
61 35 function bogo_widget_update_callback( $instance, $new_instance, $old_instance, $widget ) {
62 - if (
63 - isset( $new_instance['bogo_locales'] ) and
64 - is_array( $new_instance['bogo_locales'] )
65 - ) {
36 + if ( isset( $new_instance['bogo_locales'] ) && is_array( $new_instance['bogo_locales'] ) )
66 37 $instance['bogo_locales'] = $new_instance['bogo_locales'];
67 - } else {
38 + else
68 39 $instance['bogo_locales'] = array();
69 - }
70 40
71 41 return $instance;
72 42 }
43 +
44 +?>