Changeset 1348327
- Timestamp:
- 02/11/2016 03:25:45 PM (8 years ago)
- Location:
- ft-calendar/trunk/classes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ft-calendar/trunk/classes/class-calendars.php
r1307441 r1348327 294 294 " || ( ftc.r_end = 0 || ( ftc.r_end = 1 && ftc.r_end_datetime <= '$end_date' ) ) ) ) ) " . 295 295 " && posts.post_status = 'publish' "; 296 296 297 // If 'all' was checked, we don't care about other options. 298 $slugs = explode( ',', $calendar ); 299 if ( in_array( 'all', $slugs ) ) { 300 $calendar = 'all'; 301 } 302 297 303 if ( 'all' != $calendar ) { 298 304 $where .= " && ( "; -
ft-calendar/trunk/classes/class-widgets.php
r1347833 r1348327 115 115 116 116 extract( wp_parse_args( (array) $instance, $defaults ) ); 117 117 118 118 $checked_calendars = explode( ',', $calendars ); 119 119 … … 136 136 <br /> 137 137 <?php /* This is a little tricksy, the get_field_name function gets a really long field name encapsulated with brackets, but this is a form that needs an HTML array... so I trick the fieldname into included an ending []... it's hacky but it works. */ ?> 138 <input type="checkbox" value="all" name="<?php echo $this->get_field_name('calendars]['); ?>" id="<?php echo $this->get_field_id( $calendar->slug ); ?>" <?php checked( in_array( 'all', $checked_calendars ) ) ?> class="checkbox" /> 139 <label for="<?php echo $this->get_field_id( $calendar->slug ); ?>"><?php _e( 'All Calendars', 'ftcalendar' ); ?></label> 138 <?php /* It's tricksier now, because as of WP 4.4 get_field_name accepts a proper array specifier. */ ?> 139 <?php $ft_array_spec = version_compare(get_bloginfo('version'), '4.4', '<') ? '][' : '[]'; ?> 140 <input type="checkbox" value="all" name="<?php echo $this->get_field_name('calendars' . $ft_array_spec); ?>" id="<?php echo $this->get_field_id( 'all' ); ?>" <?php checked( in_array( 'all', $checked_calendars ) ) ?> class="checkbox" /> 141 <label for="<?php echo $this->get_field_id( 'all' ); ?>"><?php _e( 'All Calendars', 'ftcalendar' ); ?></label> 140 142 <?php foreach ( (array)$available_calendars as $key => $calendar ) : ?> 141 143 <br /> 142 <input type="checkbox" value="<?php echo $calendar->slug; ?>" name="<?php echo $this->get_field_name('calendars ]['); ?>" id="<?php echo $this->get_field_id( $calendar->slug ); ?>" <?php checked( in_array( $calendar->slug, $checked_calendars ) ) ?> class="checkbox" />144 <input type="checkbox" value="<?php echo $calendar->slug; ?>" name="<?php echo $this->get_field_name('calendars); ?>" id="<?php echo $this->get_field_id( $calendar->slug ); ?>" <?php checked( in_array( $calendar->slug, $checked_calendars ) ) ?> class="checkbox" /> 143 145 <label for="<?php echo $this->get_field_id( $calendar->slug ); ?>"><?php echo $calendar->name ?></label> 144 146 <?php endforeach; ?> … … 321 323 <br /> 322 324 <?php /* This is a little tricksy, the get_field_name function gets a really long field name encapsulated with brackets, but this is a form that needs an HTML array... so I trick the fieldname into included an ending []... it's hacky but it works. */ ?> 323 <input type="checkbox" value="all" name="<?php echo $this->get_field_name('calendars]['); ?>" id="<?php echo $this->get_field_id( $calendar->slug ); ?>" <?php checked( in_array( 'all', $checked_calendars ) ) ?> class="checkbox" /> 324 <label for="<?php echo $this->get_field_id( $calendar->slug ); ?>"><?php _e( 'All Calendars', 'ftcalendar' ); ?></label> 325 <?php /* It's tricksier now, because as of WP 4.4 get_field_name accepts a proper array specifier. */ ?> 326 <?php $ft_array_spec = version_compare(get_bloginfo('version'), '4.4', '<') ? '][' : '[]'; ?> 327 <input type="checkbox" value="all" name="<?php echo $this->get_field_name('calendars' . $ft_array_spec); ?>" id="<?php echo $this->get_field_id( 'all' ); ?>" <?php checked( in_array( 'all', $checked_calendars ) ) ?> class="checkbox" /> 328 <label for="<?php echo $this->get_field_id( 'all' ); ?>"><?php _e( 'All Calendars', 'ftcalendar' ); ?></label> 325 329 <?php foreach ( (array)$available_calendars as $key => $calendar ) : ?> 326 330 <br /> 327 <input type="checkbox" value="<?php echo $calendar->slug; ?>" name="<?php echo $this->get_field_name('calendars ]['); ?>" id="<?php echo $this->get_field_id( $calendar->slug ); ?>" <?php checked( in_array( $calendar->slug, $checked_calendars ) ) ?> class="checkbox" />331 <input type="checkbox" value="<?php echo $calendar->slug; ?>" name="<?php echo $this->get_field_name('calendars); ?>" id="<?php echo $this->get_field_id( $calendar->slug ); ?>" <?php checked( in_array( $calendar->slug, $checked_calendars ) ) ?> class="checkbox" /> 328 332 <label for="<?php echo $this->get_field_id( $calendar->slug ); ?>"><?php echo $calendar->name ?></label> 329 333 <?php endforeach; ?>
Note: See TracChangeset
for help on using the changeset viewer.