PluginProbe
Bogo / 2.6
Bogo v2.6
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 +11 -39 3.9.32.6 View file →
@@ -3,10 +3,10 @@
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 6 $available_languages = bogo_available_languages( array(
7 - 'orderby' => 'value',
8 - ) );
7 + 'exclude_enus_if_inactive' => true,
8 + 'orderby' => 'value' ) );
9 9
10 10 if ( empty( $available_languages ) ) {
11 11 return;
12 12 }
@@ -19,54 +19,26 @@
19 19
20 20 ?>
21 21 <fieldset class="bogo-locale-options">
22 22 <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 -
23 +<?php foreach ( $available_languages as $locale => $language ) :
24 + $checked = in_array( $locale, $selected_languages );
25 + $id_attr = $widget->get_field_id( 'bogo_locales' ) . '-' . $locale;
53 26 ?>
27 +<label class="bogo-locale-option<?php echo $checked ? ' checked' : ''; ?>" for="<?php echo $id_attr; ?>">
28 +<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 ); ?>
29 +</label>
30 +<?php endforeach; ?>
54 31 </fieldset>
55 32 <?php
56 33 }
57 34
58 -
59 35 add_filter( 'widget_update_callback', 'bogo_widget_update_callback', 10, 4 );
60 36
61 37 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 - ) {
38 + if ( isset( $new_instance['bogo_locales'] ) && is_array( $new_instance['bogo_locales'] ) )
66 39 $instance['bogo_locales'] = $new_instance['bogo_locales'];
67 - } else {
40 + else
68 41 $instance['bogo_locales'] = array();
69 - }
70 42
71 43 return $instance;
72 44 }