Version Description
- Enhancement: Make translations of core widget classes optional instead of default. #29
- Enhancement: Allow vertical resize of defined classes box for CSS3 compatible browsers.
Download this release
Release Info
Developer | keraweb |
Plugin | Widget CSS Classes |
Version | 1.5.2 |
Comparing to | |
See all releases |
Code changes from version 1.5.1 to 1.5.2
includes/widget-css-classes-library.class.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Method library
|
6 |
* @author C.M. Kendrick <cindy@cleverness.org>
|
7 |
* @package widget-css-classes
|
8 |
-
* @version 1.5.
|
9 |
*/
|
10 |
|
11 |
/**
|
@@ -56,7 +56,7 @@ class WCSSC_Lib {
|
|
56 |
}
|
57 |
|
58 |
if ( $file === $this_plugin ) {
|
59 |
-
$settings_link = '<a href="' . admin_url( 'options-general.php?page=widget-css-classes-settings' ) . '">' . esc_attr__( 'Settings',
|
60 |
array_unshift( $links, $settings_link );
|
61 |
}
|
62 |
|
@@ -72,10 +72,10 @@ class WCSSC_Lib {
|
|
72 |
public static function admin_footer() {
|
73 |
$plugin_data = get_plugin_data( WCSSC_FILE );
|
74 |
echo $plugin_data['Title'] // @codingStandardsIgnoreLine >> no valid esc function.
|
75 |
-
|
76 |
-
|
77 |
. ' | <a href="http://codebrainmedia.com">CodeBrain Media</a>'
|
78 |
-
|
79 |
<br />';
|
80 |
}
|
81 |
|
@@ -122,9 +122,9 @@ class WCSSC_Lib {
|
|
122 |
}
|
123 |
|
124 |
if ( version_compare( $version, '1.2', '<' ) ) {
|
125 |
-
$settings['show_number'] =
|
126 |
-
$settings['show_location'] =
|
127 |
-
$settings['show_evenodd'] =
|
128 |
}
|
129 |
|
130 |
if ( version_compare( $version, '1.3', '<' ) ) {
|
@@ -134,12 +134,19 @@ class WCSSC_Lib {
|
|
134 |
}
|
135 |
// dropdown settings are renamed to defined_classes
|
136 |
if ( ! isset( $settings['dropdown'] ) ) {
|
137 |
-
$settings['dropdown'] =
|
138 |
}
|
139 |
$settings['defined_classes'] = $settings['dropdown'];
|
140 |
unset( $settings['dropdown'] );
|
141 |
}
|
142 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
self::update_settings( $settings );
|
144 |
}
|
145 |
|
@@ -326,6 +333,7 @@ class WCSSC_Lib {
|
|
326 |
'show_evenodd' => true,
|
327 |
'fix_widget_params' => false,
|
328 |
'filter_unique' => false,
|
|
|
329 |
);
|
330 |
|
331 |
// Prevent passing by reference.
|
5 |
* Method library
|
6 |
* @author C.M. Kendrick <cindy@cleverness.org>
|
7 |
* @package widget-css-classes
|
8 |
+
* @version 1.5.2
|
9 |
*/
|
10 |
|
11 |
/**
|
56 |
}
|
57 |
|
58 |
if ( $file === $this_plugin ) {
|
59 |
+
$settings_link = '<a href="' . admin_url( 'options-general.php?page=widget-css-classes-settings' ) . '">' . esc_attr__( 'Settings', self::DOMAIN ) . '</a>';
|
60 |
array_unshift( $links, $settings_link );
|
61 |
}
|
62 |
|
72 |
public static function admin_footer() {
|
73 |
$plugin_data = get_plugin_data( WCSSC_FILE );
|
74 |
echo $plugin_data['Title'] // @codingStandardsIgnoreLine >> no valid esc function.
|
75 |
+
. ' | ' . esc_attr__( 'Version', WCSSC_Lib::DOMAIN ) . ' ' . esc_html( $plugin_data['Version'] )
|
76 |
+
. ' | ' . $plugin_data['Author'] // @codingStandardsIgnoreLine >> no valid esc function.
|
77 |
. ' | <a href="http://codebrainmedia.com">CodeBrain Media</a>'
|
78 |
+
. ' | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=cindy@cleverness.org">' . esc_attr__( 'Donate', self::DOMAIN ) . '</a>
|
79 |
<br />';
|
80 |
}
|
81 |
|
122 |
}
|
123 |
|
124 |
if ( version_compare( $version, '1.2', '<' ) ) {
|
125 |
+
$settings['show_number'] = true;
|
126 |
+
$settings['show_location'] = true;
|
127 |
+
$settings['show_evenodd'] = true;
|
128 |
}
|
129 |
|
130 |
if ( version_compare( $version, '1.3', '<' ) ) {
|
134 |
}
|
135 |
// dropdown settings are renamed to defined_classes
|
136 |
if ( ! isset( $settings['dropdown'] ) ) {
|
137 |
+
$settings['dropdown'] = array();
|
138 |
}
|
139 |
$settings['defined_classes'] = $settings['dropdown'];
|
140 |
unset( $settings['dropdown'] );
|
141 |
}
|
142 |
|
143 |
+
if ( version_compare( $version, '1.5.2', '<' ) ) {
|
144 |
+
// set on true because this was default in previous versions.
|
145 |
+
if ( ! isset( $settings['translate_classes'] ) ) {
|
146 |
+
$settings['translate_classes'] = true;
|
147 |
+
}
|
148 |
+
}
|
149 |
+
|
150 |
self::update_settings( $settings );
|
151 |
}
|
152 |
|
333 |
'show_evenodd' => true,
|
334 |
'fix_widget_params' => false,
|
335 |
'filter_unique' => false,
|
336 |
+
'translate_classes' => false,
|
337 |
);
|
338 |
|
339 |
// Prevent passing by reference.
|
includes/widget-css-classes-settings.class.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Settings
|
6 |
* @author C.M. Kendrick <cindy@cleverness.org>
|
7 |
* @package widget-css-classes
|
8 |
-
* @version 1.5.
|
9 |
*/
|
10 |
|
11 |
/**
|
@@ -44,20 +44,34 @@ class WCSSC_Settings {
|
|
44 |
|
45 |
register_setting( $this->general_key, $this->general_key, array( $this, 'validate_input' ) );
|
46 |
add_settings_section( 'section_general', esc_attr__( 'Widget CSS Classes Settings', WCSSC_Lib::DOMAIN ), array( $this, 'section_general_desc' ), $this->general_key );
|
47 |
-
add_settings_field( 'show_number', esc_attr__( 'Add Widget Number Classes', WCSSC_Lib::DOMAIN ), array( $this, 'show_yes_no_option' ), $this->general_key, 'section_general', array(
|
48 |
-
|
49 |
-
|
50 |
-
add_settings_field( '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
add_settings_field( 'type', esc_attr__( 'Class Field Type', WCSSC_Lib::DOMAIN ), array( $this, 'type_option' ), $this->general_key, 'section_general' );
|
52 |
add_settings_field( 'defined_classes', esc_attr__( 'Predefined Classes', WCSSC_Lib::DOMAIN ), array( $this, 'defined_classes_option' ), $this->general_key, 'section_general' );
|
53 |
add_settings_field( 'fix_widget_params', esc_attr__( 'Fix widget parameters', WCSSC_Lib::DOMAIN ), array( $this, 'show_yes_no_option' ), $this->general_key, 'section_general', array(
|
54 |
-
'key'
|
55 |
'desc' => esc_html__( 'Wrap widget in a <div> element if the parameters are invalid.', WCSSC_Lib::DOMAIN ),
|
56 |
) );
|
57 |
add_settings_field( 'filter_unique', esc_attr__( 'Remove duplicate classes', WCSSC_Lib::DOMAIN ), array( $this, 'show_yes_no_option' ), $this->general_key, 'section_general', array(
|
58 |
-
'key'
|
59 |
'desc' => esc_html__( 'Plugins that run after this plugin could still add duplicates.', WCSSC_Lib::DOMAIN ),
|
60 |
) );
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
do_action( 'widget_css_classes_settings' );
|
62 |
}
|
63 |
|
@@ -122,6 +136,11 @@ class WCSSC_Settings {
|
|
122 |
<?php
|
123 |
}
|
124 |
|
|
|
|
|
|
|
|
|
|
|
125 |
public function register_importexport_settings() {
|
126 |
|
127 |
if ( ! current_user_can( 'manage_options' ) ) {
|
5 |
* Settings
|
6 |
* @author C.M. Kendrick <cindy@cleverness.org>
|
7 |
* @package widget-css-classes
|
8 |
+
* @version 1.5.2
|
9 |
*/
|
10 |
|
11 |
/**
|
44 |
|
45 |
register_setting( $this->general_key, $this->general_key, array( $this, 'validate_input' ) );
|
46 |
add_settings_section( 'section_general', esc_attr__( 'Widget CSS Classes Settings', WCSSC_Lib::DOMAIN ), array( $this, 'section_general_desc' ), $this->general_key );
|
47 |
+
add_settings_field( 'show_number', esc_attr__( 'Add Widget Number Classes', WCSSC_Lib::DOMAIN ), array( $this, 'show_yes_no_option' ), $this->general_key, 'section_general', array(
|
48 |
+
'key' => 'show_number',
|
49 |
+
) );
|
50 |
+
add_settings_field( 'show_location', esc_attr__( 'Add First/Last Classes', WCSSC_Lib::DOMAIN ), array( $this, 'show_yes_no_option' ), $this->general_key, 'section_general', array(
|
51 |
+
'key' => 'show_location',
|
52 |
+
) );
|
53 |
+
add_settings_field( 'show_evenodd', esc_attr__( 'Add Even/Odd Classes', WCSSC_Lib::DOMAIN ), array( $this, 'show_yes_no_option' ), $this->general_key, 'section_general', array(
|
54 |
+
'key' => 'show_evenodd',
|
55 |
+
) );
|
56 |
+
add_settings_field( 'show_id', esc_attr__( 'Show Additional Field for ID', WCSSC_Lib::DOMAIN ), array( $this, 'show_yes_no_option' ), $this->general_key, 'section_general', array(
|
57 |
+
'key' => 'show_id',
|
58 |
+
) );
|
59 |
add_settings_field( 'type', esc_attr__( 'Class Field Type', WCSSC_Lib::DOMAIN ), array( $this, 'type_option' ), $this->general_key, 'section_general' );
|
60 |
add_settings_field( 'defined_classes', esc_attr__( 'Predefined Classes', WCSSC_Lib::DOMAIN ), array( $this, 'defined_classes_option' ), $this->general_key, 'section_general' );
|
61 |
add_settings_field( 'fix_widget_params', esc_attr__( 'Fix widget parameters', WCSSC_Lib::DOMAIN ), array( $this, 'show_yes_no_option' ), $this->general_key, 'section_general', array(
|
62 |
+
'key' => 'fix_widget_params',
|
63 |
'desc' => esc_html__( 'Wrap widget in a <div> element if the parameters are invalid.', WCSSC_Lib::DOMAIN ),
|
64 |
) );
|
65 |
add_settings_field( 'filter_unique', esc_attr__( 'Remove duplicate classes', WCSSC_Lib::DOMAIN ), array( $this, 'show_yes_no_option' ), $this->general_key, 'section_general', array(
|
66 |
+
'key' => 'filter_unique',
|
67 |
'desc' => esc_html__( 'Plugins that run after this plugin could still add duplicates.', WCSSC_Lib::DOMAIN ),
|
68 |
) );
|
69 |
+
add_settings_field( 'translate_classes', esc_attr__( 'Translate classes', WCSSC_Lib::DOMAIN ), array( $this, 'show_yes_no_option' ), $this->general_key, 'section_general', array(
|
70 |
+
'key' => 'translate_classes',
|
71 |
+
'desc' => esc_html__( 'Translate classes like `widget-first` and `widget-even`.', WCSSC_Lib::DOMAIN )
|
72 |
+
// Translators: %s stands for a link to translate.wordpress.org.
|
73 |
+
. ' ' . sprintf( esc_html__( 'Translations are taken from %s', WCSSC_Lib::DOMAIN ), '<a href="https://translate.wordpress.org/projects/wp-plugins/widget-css-classes" target="_blank">translate.wordpress.org</a>' ),
|
74 |
+
) );
|
75 |
do_action( 'widget_css_classes_settings' );
|
76 |
}
|
77 |
|
136 |
<?php
|
137 |
}
|
138 |
|
139 |
+
/**
|
140 |
+
* @todo Move to separate class or split in different methods.
|
141 |
+
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
142 |
+
* @SuppressWarnings(PHPMD.NPathComplexity)
|
143 |
+
*/
|
144 |
public function register_importexport_settings() {
|
145 |
|
146 |
if ( ! current_user_can( 'manage_options' ) ) {
|
includes/widget-css-classes.class.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Loader
|
6 |
* @author C.M. Kendrick <cindy@cleverness.org>
|
7 |
* @package widget-css-classes
|
8 |
-
* @version 1.5.
|
9 |
*/
|
10 |
|
11 |
/**
|
@@ -22,6 +22,20 @@ class WCSSC {
|
|
22 |
*/
|
23 |
public static $widget_counter = array();
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
/**
|
26 |
* Default capabilities to display the WCC form in widgets.
|
27 |
* @static
|
@@ -34,6 +48,10 @@ class WCSSC {
|
|
34 |
'defined' => 'edit_theme_options',
|
35 |
);
|
36 |
|
|
|
|
|
|
|
|
|
37 |
public static function init() {
|
38 |
static $done;
|
39 |
if ( $done ) return;
|
@@ -70,6 +88,30 @@ class WCSSC {
|
|
70 |
$done = true;
|
71 |
}
|
72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
/**
|
74 |
* Adds form fields to Widget
|
75 |
* @static
|
@@ -113,7 +155,7 @@ class WCSSC {
|
|
113 |
} else {
|
114 |
$fields .= self::do_hidden( $widget->get_field_name( 'classes' ), $instance['classes'] );
|
115 |
}
|
116 |
-
|
117 |
case 2:
|
118 |
// show classes predefined only.
|
119 |
if ( $access_predefined ) {
|
@@ -121,7 +163,7 @@ class WCSSC {
|
|
121 |
} else {
|
122 |
$fields .= self::do_hidden( $widget->get_field_name( 'classes' ), $instance['classes'] );
|
123 |
}
|
124 |
-
|
125 |
case 3:
|
126 |
// show both.
|
127 |
if ( $access_predefined ) {
|
@@ -129,7 +171,7 @@ class WCSSC {
|
|
129 |
} else {
|
130 |
$fields .= self::do_hidden( $widget->get_field_name( 'classes' ), $instance['classes'] );
|
131 |
}
|
132 |
-
|
133 |
}
|
134 |
|
135 |
if ( $fields ) {
|
@@ -230,29 +272,39 @@ class WCSSC {
|
|
230 |
|
231 |
// Do we have existing classes and is the user allowed to select defined classes?
|
232 |
if ( ! empty( $instance['classes'] ) ) {
|
|
|
233 |
$text_classes = explode( ' ', $instance['classes'] );
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
|
|
|
|
242 |
$instance['classes'] = implode( ' ', $text_classes );
|
243 |
}
|
244 |
|
245 |
$style = array(
|
246 |
'padding' => 'padding: 5px;',
|
247 |
-
'max-height' => 'max-height:
|
248 |
'overflow' => 'overflow: hidden;',
|
249 |
'overflow-y' => 'overflow-y: auto;',
|
250 |
'border' => 'border: 1px solid #ddd;',
|
251 |
'box-shadow' => 'box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07) inset;',
|
252 |
'color' => 'color: #32373c;',
|
253 |
-
|
254 |
);
|
255 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
256 |
if ( null !== $do_class_field ) {
|
257 |
if ( $do_class_field ) {
|
258 |
$field .= self::do_class_field( $widget, $instance );
|
@@ -480,7 +532,7 @@ class WCSSC {
|
|
480 |
}
|
481 |
|
482 |
if ( WCSSC_Lib::get_settings( 'show_number' ) ) {
|
483 |
-
$class = apply_filters( 'widget_css_classes_number',
|
484 |
array_unshift( $classes, $class );
|
485 |
}
|
486 |
|
@@ -488,8 +540,8 @@ class WCSSC {
|
|
488 |
isset( $arr_registered_widgets[ $this_id ] ) &&
|
489 |
is_array( $arr_registered_widgets[ $this_id ] )
|
490 |
) {
|
491 |
-
$widget_first = apply_filters( 'widget_css_classes_first',
|
492 |
-
$widget_last
|
493 |
if ( 1 === (int) self::$widget_counter[ $this_id ] ) {
|
494 |
array_unshift( $classes, $widget_first );
|
495 |
}
|
@@ -499,8 +551,8 @@ class WCSSC {
|
|
499 |
}
|
500 |
|
501 |
if ( WCSSC_Lib::get_settings( 'show_evenodd' ) ) {
|
502 |
-
$widget_even = apply_filters( 'widget_css_classes_even',
|
503 |
-
$widget_odd = apply_filters( 'widget_css_classes_odd',
|
504 |
$class = ( ( self::$widget_counter[ $this_id ] % 2 ) ? $widget_odd : $widget_even );
|
505 |
array_unshift( $classes, $class );
|
506 |
}
|
5 |
* Loader
|
6 |
* @author C.M. Kendrick <cindy@cleverness.org>
|
7 |
* @package widget-css-classes
|
8 |
+
* @version 1.5.2
|
9 |
*/
|
10 |
|
11 |
/**
|
22 |
*/
|
23 |
public static $widget_counter = array();
|
24 |
|
25 |
+
/**
|
26 |
+
* Container for core class tipes.
|
27 |
+
* @static
|
28 |
+
* @since 1.5.2
|
29 |
+
* @var array
|
30 |
+
*/
|
31 |
+
public static $core_classes = array(
|
32 |
+
'widget_prefix' => 'widget-',
|
33 |
+
'widget_first' => 'widget-first',
|
34 |
+
'widget_last' => 'widget-last',
|
35 |
+
'widget_even' => 'widget-even',
|
36 |
+
'widget_odd' => 'widget-odd',
|
37 |
+
);
|
38 |
+
|
39 |
/**
|
40 |
* Default capabilities to display the WCC form in widgets.
|
41 |
* @static
|
48 |
'defined' => 'edit_theme_options',
|
49 |
);
|
50 |
|
51 |
+
/**
|
52 |
+
* Initializer for plugin backend.
|
53 |
+
* @since 1.5.0
|
54 |
+
*/
|
55 |
public static function init() {
|
56 |
static $done;
|
57 |
if ( $done ) return;
|
88 |
$done = true;
|
89 |
}
|
90 |
|
91 |
+
/**
|
92 |
+
* Initializer for plugin frontend.
|
93 |
+
* @since 1.5.2
|
94 |
+
*/
|
95 |
+
public static function init_front() {
|
96 |
+
static $done;
|
97 |
+
if ( $done ) return;
|
98 |
+
|
99 |
+
/**
|
100 |
+
* Do not translate by default but make it optionally.
|
101 |
+
* @since 1.5.2
|
102 |
+
*/
|
103 |
+
if ( WCSSC_Lib::get_settings( 'translate_classes' ) ) {
|
104 |
+
// Translate with readable string instead of variable for compatibility.
|
105 |
+
self::$core_classes['widget_prefix'] = __( 'widget-', WCSSC_Lib::DOMAIN );
|
106 |
+
self::$core_classes['widget_first'] = __( 'widget-first', WCSSC_Lib::DOMAIN );
|
107 |
+
self::$core_classes['widget_last'] = __( 'widget-last', WCSSC_Lib::DOMAIN );
|
108 |
+
self::$core_classes['widget_even'] = __( 'widget-even', WCSSC_Lib::DOMAIN );
|
109 |
+
self::$core_classes['widget_odd'] = __( 'widget-odd', WCSSC_Lib::DOMAIN );
|
110 |
+
}
|
111 |
+
|
112 |
+
$done = true;
|
113 |
+
}
|
114 |
+
|
115 |
/**
|
116 |
* Adds form fields to Widget
|
117 |
* @static
|
155 |
} else {
|
156 |
$fields .= self::do_hidden( $widget->get_field_name( 'classes' ), $instance['classes'] );
|
157 |
}
|
158 |
+
break;
|
159 |
case 2:
|
160 |
// show classes predefined only.
|
161 |
if ( $access_predefined ) {
|
163 |
} else {
|
164 |
$fields .= self::do_hidden( $widget->get_field_name( 'classes' ), $instance['classes'] );
|
165 |
}
|
166 |
+
break;
|
167 |
case 3:
|
168 |
// show both.
|
169 |
if ( $access_predefined ) {
|
171 |
} else {
|
172 |
$fields .= self::do_hidden( $widget->get_field_name( 'classes' ), $instance['classes'] );
|
173 |
}
|
174 |
+
break;
|
175 |
}
|
176 |
|
177 |
if ( $fields ) {
|
272 |
|
273 |
// Do we have existing classes and is the user allowed to select defined classes?
|
274 |
if ( ! empty( $instance['classes'] ) ) {
|
275 |
+
|
276 |
$text_classes = explode( ' ', $instance['classes'] );
|
277 |
+
|
278 |
+
// Get the classes that exist in the predefined classes and merge them with the existing.
|
279 |
+
$exists_defined = array_intersect( $text_classes, $predefined_classes );
|
280 |
+
|
281 |
+
// Add them to the defined classes of this instance.
|
282 |
+
$instance['classes-defined'] = array_merge( $instance['classes-defined'], $exists_defined );
|
283 |
+
|
284 |
+
// Remove classes that exist in the predefined classes from the normal (custom) classes.
|
285 |
+
$text_classes = array_diff( $text_classes, $predefined_classes );
|
286 |
+
|
287 |
$instance['classes'] = implode( ' ', $text_classes );
|
288 |
}
|
289 |
|
290 |
$style = array(
|
291 |
'padding' => 'padding: 5px;',
|
292 |
+
'max-height' => 'max-height: 75px;',
|
293 |
'overflow' => 'overflow: hidden;',
|
294 |
'overflow-y' => 'overflow-y: auto;',
|
295 |
'border' => 'border: 1px solid #ddd;',
|
296 |
'box-shadow' => 'box-shadow: 0 1px 2px rgba(0, 0, 0, 0.07) inset;',
|
297 |
'color' => 'color: #32373c;',
|
298 |
+
'margin-top' => 'margin-top: 1px;',
|
299 |
);
|
300 |
|
301 |
+
// @since 1.5.2
|
302 |
+
if ( 3 < count( $predefined_classes ) ) {
|
303 |
+
unset( $style['max-height'] );
|
304 |
+
$style['height'] = 'height: 75px;';
|
305 |
+
$style['resize'] = 'resize: vertical;';
|
306 |
+
}
|
307 |
+
|
308 |
if ( null !== $do_class_field ) {
|
309 |
if ( $do_class_field ) {
|
310 |
$field .= self::do_class_field( $widget, $instance );
|
532 |
}
|
533 |
|
534 |
if ( WCSSC_Lib::get_settings( 'show_number' ) ) {
|
535 |
+
$class = apply_filters( 'widget_css_classes_number', self::$core_classes['widget_prefix'] ) . self::$widget_counter[ $this_id ];
|
536 |
array_unshift( $classes, $class );
|
537 |
}
|
538 |
|
540 |
isset( $arr_registered_widgets[ $this_id ] ) &&
|
541 |
is_array( $arr_registered_widgets[ $this_id ] )
|
542 |
) {
|
543 |
+
$widget_first = apply_filters( 'widget_css_classes_first', self::$core_classes['widget_first'] );
|
544 |
+
$widget_last = apply_filters( 'widget_css_classes_last', self::$core_classes['widget_last'] );
|
545 |
if ( 1 === (int) self::$widget_counter[ $this_id ] ) {
|
546 |
array_unshift( $classes, $widget_first );
|
547 |
}
|
551 |
}
|
552 |
|
553 |
if ( WCSSC_Lib::get_settings( 'show_evenodd' ) ) {
|
554 |
+
$widget_even = apply_filters( 'widget_css_classes_even', self::$core_classes['widget_even'] );
|
555 |
+
$widget_odd = apply_filters( 'widget_css_classes_odd', self::$core_classes['widget_odd'] );
|
556 |
$class = ( ( self::$widget_counter[ $this_id ] % 2 ) ? $widget_odd : $widget_even );
|
557 |
array_unshift( $classes, $class );
|
558 |
}
|
readme.txt
CHANGED
@@ -8,7 +8,8 @@ License: GPLv2 or later
|
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
Requires at least: 3.3
|
10 |
Tested up to: 4.8
|
11 |
-
|
|
|
12 |
|
13 |
Add custom classes and ids plus first, last, even, odd, and numbered classes to your widgets.
|
14 |
|
@@ -94,6 +95,10 @@ Visit [the plugin website](http://cleverness.org/plugins/widget-css-classes/) an
|
|
94 |
|
95 |
== Changelog ==
|
96 |
|
|
|
|
|
|
|
|
|
97 |
= 1.5.1 =
|
98 |
* **Fix:** Widget Logic `widget_content` filter compatibility. [#27](https://github.com/cleverness/widget-css-classes/issues/27)
|
99 |
* **Enhancement:** Make uninstall script compatible with network installations.
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
Requires at least: 3.3
|
10 |
Tested up to: 4.8
|
11 |
+
Requires PHP: 5.2.4
|
12 |
+
Stable tag: 1.5.2
|
13 |
|
14 |
Add custom classes and ids plus first, last, even, odd, and numbered classes to your widgets.
|
15 |
|
95 |
|
96 |
== Changelog ==
|
97 |
|
98 |
+
= 1.5.2 =
|
99 |
+
* **Enhancement:** Make translations of core widget classes optional instead of default. [#29](https://github.com/cleverness/widget-css-classes/issues/29)
|
100 |
+
* **Enhancement:** Allow vertical resize of defined classes box for CSS3 compatible browsers.
|
101 |
+
|
102 |
= 1.5.1 =
|
103 |
* **Fix:** Widget Logic `widget_content` filter compatibility. [#27](https://github.com/cleverness/widget-css-classes/issues/27)
|
104 |
* **Enhancement:** Make uninstall script compatible with network installations.
|
widget-css-classes.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: Widget CSS Classes
|
4 |
-
* Version: 1.5.
|
5 |
* Description: Add custom, first, last, even, odd, and numbered classes to your widgets.
|
6 |
* Author: C.M. Kendrick
|
7 |
* Author URI: http://cleverness.org
|
@@ -27,7 +27,7 @@ function widget_css_classes_loader() {
|
|
27 |
|
28 |
if ( is_admin() ) {
|
29 |
|
30 |
-
if ( ! defined( 'WCSSC_PLUGIN_VERSION' ) ) define( 'WCSSC_PLUGIN_VERSION', '1.5.
|
31 |
if ( ! defined( 'WCSSC_FILE' ) ) define( 'WCSSC_FILE', __FILE__ );
|
32 |
if ( ! defined( 'WCSSC_BASENAME' ) ) define( 'WCSSC_BASENAME', plugin_basename( __FILE__ ) );
|
33 |
if ( ! defined( 'WCSSC_PLUGIN_DIR' ) ) define( 'WCSSC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
@@ -46,6 +46,7 @@ function widget_css_classes_loader() {
|
|
46 |
function widget_css_classes_frontend_hook() {
|
47 |
if ( ! is_admin() ) {
|
48 |
include_once 'includes/widget-css-classes.class.php';
|
|
|
49 |
add_filter( 'dynamic_sidebar_params', array( 'WCSSC', 'add_widget_classes' ) );
|
50 |
}
|
51 |
}
|
@@ -66,7 +67,7 @@ function widget_css_classes_activation() {
|
|
66 |
}
|
67 |
|
68 |
if ( ! defined( 'WCSSC_BASENAME' ) ) define( 'WCSSC_BASENAME', plugin_basename( __FILE__ ) );
|
69 |
-
if ( ! defined( 'WCSSC_DB_VERSION' ) ) define( 'WCSSC_DB_VERSION', '1.5' );
|
70 |
if ( ! defined( 'WCSSC_FILE' ) ) define( 'WCSSC_FILE', __FILE__ );
|
71 |
include_once 'includes/widget-css-classes-library.class.php';
|
72 |
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: Widget CSS Classes
|
4 |
+
* Version: 1.5.2
|
5 |
* Description: Add custom, first, last, even, odd, and numbered classes to your widgets.
|
6 |
* Author: C.M. Kendrick
|
7 |
* Author URI: http://cleverness.org
|
27 |
|
28 |
if ( is_admin() ) {
|
29 |
|
30 |
+
if ( ! defined( 'WCSSC_PLUGIN_VERSION' ) ) define( 'WCSSC_PLUGIN_VERSION', '1.5.2' );
|
31 |
if ( ! defined( 'WCSSC_FILE' ) ) define( 'WCSSC_FILE', __FILE__ );
|
32 |
if ( ! defined( 'WCSSC_BASENAME' ) ) define( 'WCSSC_BASENAME', plugin_basename( __FILE__ ) );
|
33 |
if ( ! defined( 'WCSSC_PLUGIN_DIR' ) ) define( 'WCSSC_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
46 |
function widget_css_classes_frontend_hook() {
|
47 |
if ( ! is_admin() ) {
|
48 |
include_once 'includes/widget-css-classes.class.php';
|
49 |
+
WCSSC::init_front();
|
50 |
add_filter( 'dynamic_sidebar_params', array( 'WCSSC', 'add_widget_classes' ) );
|
51 |
}
|
52 |
}
|
67 |
}
|
68 |
|
69 |
if ( ! defined( 'WCSSC_BASENAME' ) ) define( 'WCSSC_BASENAME', plugin_basename( __FILE__ ) );
|
70 |
+
if ( ! defined( 'WCSSC_DB_VERSION' ) ) define( 'WCSSC_DB_VERSION', '1.5.2' );
|
71 |
if ( ! defined( 'WCSSC_FILE' ) ) define( 'WCSSC_FILE', __FILE__ );
|
72 |
include_once 'includes/widget-css-classes-library.class.php';
|
73 |
|