Ticket #3075: 3075.patch
File 3075.patch, 3.5 KB (added by , 8 years ago) |
---|
-
trunk/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( … … 117 117 if ( $post->recurring == 'weekly' || $post->recurring === '1' ) { 118 118 try { 119 119 // from the start date, advance the week until it's past now 120 $start = new DateTime( $post->start_date.' '.$post->time.' GMT' );121 $now = new DateTime();122 $interval = $start->diff( $now);120 $start = new DateTime( $post->start_date . ' ' . $post->time . ' GMT' ); 121 $now = new DateTime(); 122 $interval = $start->diff( $now ); 123 123 // add one to days to account for events that happened earlier today 124 $weekdiff = ceil( ($interval->days+1) / 7 );125 $next = strtotime( "{$post->start_date} + {$weekdiff} weeks" );126 $post->next_date = date( 'Y-m-d', $next);127 } catch ( Exception $e) {124 $weekdiff = ceil( ( $interval->days + 1 ) / 7 ); 125 $next = strtotime( "{$post->start_date} + {$weekdiff} weeks" ); 126 $post->next_date = date( 'Y-m-d', $next ); 127 } catch ( Exception $e ) { 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' || $post->recurring === '1' ) { 132 try { 133 // from the start date, advance the week until it's past now 134 $start = new DateTime( $post->start_date . ' ' . $post->time . ' GMT' ); 135 $now = new DateTime(); 136 $interval = $start->diff( $now ); 137 // add one to days to account for events that happened earlier today 138 $weekdiff = ceil( ( $interval->days + 1 ) / 14 ); 139 $next = strtotime( "{$post->start_date} + {$weekdiff} weeks" ); 140 $post->next_date = date( 'Y-m-d', $next ); 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 … … 257 271 <label for="recurring"><?php _e( 'Recurring: ', 'wporg' ); ?> 258 272 <label for="weekly"><?php _e( 'Weekly', 'wporg' ); ?></label> 259 273 <input type="radio" name="recurring" value="weekly" class="regular-radio" <?php checked( $recurring, 'weekly' ); ?>> 274 <label for="Biweekly"><?php _e( 'Biweekly', 'wporg' ); ?></label> 275 <input type="radio" name="recurring" value="Biweekly" class="regular-radio" <?php checked( $recurring, 'Biweekly' ); ?>> 260 276 <label for="monthly"><?php _e( 'Monthly', 'wporg' ); ?></label> 261 277 <input type="radio" name="recurring" value="monthly" class="regular-radio" <?php checked( $recurring, 'monthly' ); ?>> 262 278 </label>