File tree Expand file tree Collapse file tree 3 files changed +29
-11
lines changed Expand file tree Collapse file tree 3 files changed +29
-11
lines changed Original file line number Diff line number Diff line change @@ -143,7 +143,25 @@ function dfw_breakpoints_input() {
143143while ( $ i < 5 ) {
144144$ identifier = ( isset ( $ breakpoints [ $ i ]['identifier ' ] ) )? $ breakpoints [ $ i ]['identifier ' ] : '' ;
145145$ min_width = ( isset ( $ breakpoints [ $ i ]['min-width ' ] ) )? $ breakpoints [ $ i ]['min-width ' ] : '' ;
146- $ max_width = ( isset ( $ breakpoints [ $ i ]['max-width ' ] ) )? $ breakpoints [ $ i ]['max-width ' ] : '' ; ?>
146+ $ max_width = ( isset ( $ breakpoints [ $ i ]['max-width ' ] ) )? $ breakpoints [ $ i ]['max-width ' ] : '' ;
147+
148+ // fallbacks for post-https://github.com/INN/doubleclick-for-wp/pull/46 compatibility.
149+ if ( empty ( $ min_width ) && isset ( $ breakpoints [ $ i ][ 'minWidth ' ] ) ) {
150+ $ min_width = ( isset ( $ breakpoints [ $ i ]['minWidth ' ] ) )? $ breakpoints [ $ i ]['minWidth ' ] : '' ;
151+ }
152+ if ( empty ( $ max_width ) && isset ( $ breakpoints [ $ i ][ 'maxWidth ' ] ) ) {
153+ $ max_width = ( isset ( $ breakpoints [ $ i ]['maxWidth ' ] ) )? $ breakpoints [ $ i ]['maxWidth ' ] : '' ;
154+ }
155+
156+ // fallbacks, continued.
157+ if ( empty ( $ min_width ) && isset ( $ breakpoints [ $ i ][ 'min-width ' ] ) ) {
158+ $ min_width = ( isset ( $ breakpoints [ $ i ]['min-width ' ] ) )? $ breakpoints [ $ i ]['min-width ' ] : '' ;
159+ }
160+ if ( empty ( $ max_width ) && isset ( $ breakpoints [ $ i ][ 'max-width ' ] ) ) {
161+ $ max_width = ( isset ( $ breakpoints [ $ i ]['max-width ' ] ) )? $ breakpoints [ $ i ]['max-width ' ] : '' ;
162+ }
163+
164+ ?>
147165<input value="<?php echo esc_attr ( $ identifier ); ?> "
148166placeholder="Name"
149167name="dfw_breakpoints[]"
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ __$identifier__
4444
4545__ $args__
4646
47- ` Array ` An array of properties about the breakpoint. Currently the only keys supported are minWidth and maxWidth .
47+ ` Array ` An array of properties about the breakpoint. Currently the only keys supported are min_width and max_width .
4848
4949* * *
5050
Original file line number Diff line number Diff line change @@ -36,27 +36,27 @@ class DoubleClickBreakpoint {
3636public $ option ;
3737
3838public function __construct ( $ identifier , $ args = null ) {
39+ // specify all the options because there has been come confusion, historically
3940if ( isset ( $ args ['min_width ' ] ) ) {
4041$ this ->min_width = $ args ['min_width ' ];
42+ } else if ( isset ( $ args ['minWidth ' ] ) ) {
43+ $ this ->min_width = $ args ['minWidth ' ];
44+ } else if ( isset ( $ args ['min-width ' ] ) ) {
45+ $ this ->max_width = $ args ['min-width ' ];
4146}
4247
4348if ( isset ( $ args ['max_width ' ] ) ) {
4449$ this ->max_width = $ args ['max_width ' ];
50+ } else if ( isset ( $ args ['maxWidth ' ] ) ) {
51+ $ this ->max_width = $ args ['maxWidth ' ];
52+ } else if ( isset ( $ args ['max-width ' ] ) ) {
53+ $ this ->max_width = $ args ['max-width ' ];
4554}
4655
4756if ( isset ( $ args ['_option ' ] ) && $ args ['_option ' ] ) {
4857$ this ->option = true ;
4958}
5059
51-
52- // Same, but with different spelling
53- if ( isset ( $ args ['max-width ' ] ) ) {
54- $ this ->max_width = $ args ['max-width ' ];
55- }
56- if ( isset ( $ args ['min-width ' ] ) ) {
57- $ this ->min_width = $ args ['min-width ' ];
58- }
59-
6060$ this ->identifier = $ identifier ;
6161}
6262
You can’t perform that action at this time.
0 commit comments