Ticket #3075: 3075.2.patch
File 3075.2.patch, 3.5 KB (added by , 8 years ago) |
---|
-
wordpress.org/public_html/wp-content/plugins/wporg-meeting-posttype/wporg-meeting-posttype.php
64 64 'relation'=>'AND', 65 65 array( 66 66 'key'=>'recurring', 67 'value'=>array( 'weekly','monthly', '1'),67 'value'=>array( 'weekly', 'biweekly', 'monthly', '1' ), 68 68 'compare'=>'NOT IN', 69 69 ), 70 70 array( … … 79 79 'relation'=>'AND', 80 80 array( 81 81 'key'=>'recurring', 82 'value'=>array( 'weekly', 'monthly', '1'),82 'value'=>array( 'weekly', 'biweekly', 'monthly', '1' ), 83 83 'compare'=>'IN', 84 84 ), 85 85 array( … … 128 128 // if the datetime is invalid, then set the post->next_date to the start date instead 129 129 $post->next_date = $post->start_date; 130 130 } 131 } else if ( $post->recurring == 'biweekly' ) { 132 try { 133 // advance the start date 2 weeks at a time until it's past now 134 $start = new DateTime( $post->start_date.' '.$post->time.' GMT' ); 135 $next = $start; 136 $now = new DateTime(); 137 while ( $now > $next ) { 138 $next->modify('+2 weeks'); 139 } 140 $post->next_date = $next->format('Y-m-d'); 141 } catch (Exception $e) { 142 // if the datetime is invalid, then set the post->next_date to the start date instead 143 $post->next_date = $post->start_date; 144 } 131 145 } else if ( $post->recurring == 'monthly' ) { 132 146 try { 133 147 // advance the start date 1 month at a time until it's past now … … 255 269 <input type="text" name="time" class="time" value="<?php echo esc_attr($time); ?>"> 256 270 </label> 257 271 <label for="recurring"><?php _e( 'Recurring: ', 'wporg' ); ?> 272 <input type="radio" name="recurring" value="weekly" id="weekly" class="regular-radio" <?php checked( $recurring, 'weekly' ); ?>> 258 273 <label for="weekly"><?php _e( 'Weekly', 'wporg' ); ?></label> 259 <input type="radio" name="recurring" value="weekly" class="regular-radio" <?php checked( $recurring, 'weekly' ); ?>> 274 <input type="radio" name="recurring" value="biweekly" id="biweekly" class="regular-radio" <?php checked( $recurring, 'biweekly' ); ?>> 275 <label for="biweekly"><?php _e( 'Biweekly', 'wporg' ); ?></label> 276 <input type="radio" name="recurring" value="monthly" id="monthly" class="regular-radio" <?php checked( $recurring, 'monthly' ); ?>> 260 277 <label for="monthly"><?php _e( 'Monthly', 'wporg' ); ?></label> 261 <input type="radio" name="recurring" value="monthly" class="regular-radio" <?php checked( $recurring, 'monthly' ); ?>>262 278 </label> 263 279 </p> 264 280 <p> … … 328 344 $meta['start_date'] = ( isset( $_POST['start_date'] ) ? esc_textarea( $_POST['start_date'] ) : '' ); 329 345 $meta['end_date'] = ( isset( $_POST['end_date'] ) ? esc_textarea( $_POST['end_date'] ) : '' ); 330 346 $meta['time'] = ( isset( $_POST['time'] ) ? esc_textarea( $_POST['time'] ) : '' ); 331 $meta['recurring'] = ( isset ( $_POST['recurring'] ) && ( in_array( $_POST['recurring'], array( 'weekly', 'monthly') ) ) ? ( $_POST['recurring'] ) : '' );347 $meta['recurring'] = ( isset ( $_POST['recurring'] ) && ( in_array( $_POST['recurring'], array( 'weekly', 'biweekly', 'monthly' ) ) ) ? ( $_POST['recurring'] ) : '' ); 332 348 $meta['link'] = ( isset( $_POST['link'] ) ? esc_url( $_POST['link'] ) : '' ); 333 349 $meta['location'] = ( isset( $_POST['location'] ) ? esc_textarea( $_POST['location'] ) : '' ); 334 350