Changeset 1536371
- Timestamp:
- 11/18/2016 03:31:00 PM (9 years ago)
- Location:
- opentickets-community-edition/trunk
- Files:
-
- 1 added
- 19 edited
-
assets/css/admin/base.css (modified) (1 diff)
-
assets/js/admin/event-ui.js (modified) (2 diffs)
-
inc/core/calendar.class.php (modified) (2 diffs)
-
inc/core/post-type.class.php (modified) (15 diffs)
-
inc/event-area/general-admission-area-type.class.php (modified) (1 diff)
-
inc/event-area/post-type.class.php (modified) (1 diff)
-
inc/sys/admin-settings.php (modified) (1 diff)
-
inc/sys/extensions/settings/licenses.php (modified) (2 diffs)
-
inc/sys/pages/system-status.page.php (modified) (1 diff)
-
inc/sys/rewrite.php (modified) (2 diffs)
-
inc/sys/settings-page.abstract.php (modified) (2 diffs)
-
inc/sys/settings/dates.php (added)
-
inc/sys/settings/frontend.php (modified) (2 diffs)
-
inc/sys/utils.php (modified) (2 diffs)
-
launcher.php (modified) (2 diffs)
-
readme.txt (modified) (1 diff)
-
templates/checkin/already-occupied.php (modified) (1 diff)
-
templates/checkin/occupy-failure.php (modified) (1 diff)
-
templates/checkin/occupy-success.php (modified) (1 diff)
-
templates/tickets/ticket/event-meta.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
opentickets-community-edition/trunk/assets/css/admin/base.css
r1465000 r1536371 265 265 .qsot-mb .image-preview { max-width:100%; } 266 266 .qsot-mb .image-preview img { max-width:100%; } 267 .qsot-mb .field .at-time { display:block; margin-left:1.5em; position:relative; width:auto; } 268 .qsot-mb .field .at-time::before { content:"@"; left:-1.5em; line-height:28px; position:absolute; } 267 269 268 270 /* licenses */ -
opentickets-community-edition/trunk/assets/js/admin/event-ui.js
r1458303 r1536371 102 102 103 103 function normalize_time( str ) { 104 var matches = str.toLowerCase().match( /^(\d{1,2})(:(\d{1,2})( :(\d{1,2}))?)?([pa]m?)?$/ ),104 var matches = str.toLowerCase().match( /^(\d{1,2})(:(\d{1,2})(.?(\d{1,2})?)?)?.?([pa]m?)?$/ ), 105 105 res = matches 106 106 ? { … … 825 825 return EventUI; 826 826 })(jQuery); 827 828 // single event edit page 829 ( function( $ ) { 830 $( document ).on( 'change.qsot keyup.qsot', '.single-event-settings input, .single-event-settings select, .single-event-settings textarea', function() { 831 if ( $( this ).not( '#qsot-update-permalink' ).length ) { 832 $( '#qsot-update-permalink' ).prop( 'checked', 'checked' ); 833 } 834 } ); 835 } )( jQuery ); -
opentickets-community-edition/trunk/inc/core/calendar.class.php
r1511879 r1536371 598 598 $method = get_post_meta( $post->ID, '_calendar_start_method', true ); 599 599 $date = get_post_meta( $post->ID, '_calendar_start_manual', true ); 600 $date = ! $date ? date( 'c' ) : $date; 600 601 601 602 // default the settings to 'today' (above) … … 619 620 <label class="screen-reader-text" for="qsot-cal-start-manual"><?php _e( 'Manually entered date', 'opentickets-community-edition' ) ?></label> 620 621 <input size="11" type="text" class="use-datepicker" id="qsot-cal-start-manual-display" name="_calendar_start_manual_display" 621 value="<?php echo esc_attr( date( __( 'm-d-Y', 'opentickets-community-edition' ), strtotime( $date ) ) ) ?>"622 value="<?php echo esc_attr( date( QSOT_Date_Formats::php_date_format( 'm-d-Y' ), strtotime( $date ) ) ) ?>" 622 623 real="#qsot-cal-start-manual" scope="[rel='extra-manual']" frmt="<?php echo esc_attr( __( 'mm-dd-yy', 'opentickets-community-edition' ) ) ?>" /> 623 624 <input type="hidden" id="qsot-cal-start-manual" name="_calendar_start_manual" value="<?php echo esc_attr( $date ) ?>" /> -
opentickets-community-edition/trunk/inc/core/post-type.class.php
r1532350 r1536371 55 55 // ** I cannot replicate this problem in independent tests, outside wp, but I can reliably get this to happen within. 56 56 add_action( 'save_post', 'qsot_noop', 998 ); 57 58 // save child events 59 add_action( 'save_post', array( __CLASS__, 'save_child_event' ), 100000, 3 ); 60 add_action( 'post_updated', array( __CLASS__, 'record_old_slug' ), PHP_INT_MAX, 3 ); 57 61 58 62 // action that is used to actually handle the saving of sub-events … … 1258 1262 1259 1263 // add the date/time to the title 1260 $date = date( __( 'm/d/Y', 'opentickets-community-edition' ), $start );1261 $time = date( __( 'g:ia', 'opentickets-community-edition' ), $start );1264 $date = date( QSOT_Date_Formats::php_date_format( 'm/d/Y' ), $start ); 1265 $time = date( QSOT_Date_Formats::php_date_format( 'g:ia' ), $start ); 1262 1266 $format = '%1$s'; 1263 1267 if ( $needs['date'] ) … … 1325 1329 if ( isset( $_POST['qsot-event-title-settings'] ) && wp_verify_nonce( $_POST['qsot-event-title-settings'], 'qsot-event-title' ) ) 1326 1330 add_action( 'wp_insert_post', array( __CLASS__, 'save_event_title_settings' ), 100, 3 ); 1331 } 1332 1333 // handle the saving of an individual child event 1334 public static function save_child_event( $post_id, $post=null, $updated=false ) { 1335 static $ran_for = array(); 1336 // only run this function once for a post 1337 if ( isset( $ran_for[ 'post-' . $post_id ] ) ) 1338 return; 1339 $ran_for[ 'post-' . $post_id ] = 1; 1340 1341 // load the post, just in case it was not sent 1342 $post = get_post( $post_id ); 1343 1344 // handle saving of the event date time changes 1345 if ( isset( $_POST['qsot-single-event-settings'] ) && wp_verify_nonce( $_POST['qsot-single-event-settings'], 'qsot-save-single-event-settings' ) ) { 1346 $dt = $_POST['qsot-single-event']; 1347 // if some settings are missing, bail now 1348 if ( ! isset( $dt['start_date'], $dt['start_time'], $dt['end_date'], $dt['end_time'] ) ) 1349 return; 1350 1351 // normalize the time entered, to a usable timestamp 1352 $start_time = QSOT_Utils::to_24_hour( $dt['start_time'] ); 1353 $end_time = QSOT_Utils::to_24_hour( $dt['end_time'] ); 1354 1355 // construct date time stamps 1356 $offset = QSOT_Utils::non_dst_tz_offset(); 1357 $start = preg_replace( '#^(\d{4}-\d{2}-\d{2})(?:T| )(\d{2}:\d{2}:\d{2}).*$#', '\1T\2', $dt['start_date'] . ' ' . $start_time ) . $offset; 1358 $end = preg_replace( '#^(\d{4}-\d{2}-\d{2})(?:T| )(\d{2}:\d{2}:\d{2}).*$#', '\1T\2', $dt['end_date'] . ' ' . $end_time ) . $offset; 1359 1360 // if the times are in the correct format, then save them 1361 if ( preg_match( '#^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+|-)\d{2}:\d{2}$#', $start ) && preg_match( '#^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\+|-)\d{2}:\d{2}$#', $end ) ) { 1362 update_post_meta( $post_id, '_start', $start ); 1363 update_post_meta( $post_id, '_end', $end ); 1364 1365 // if we need to update the permalink too, do that now. this is the reason this function has recursion protection 1366 if ( isset( $_POST['qsot-update-permalink'] ) ) { 1367 // update the post_name 1368 $post_arr = array( 1369 'ID' => $post_id, 1370 'post_name' => date( QSOT_Date_Formats::php_date_format( 'Y-m-d_gia' ), QSOT_Utils::local_timestamp( $start ) ), 1371 ); 1372 wp_update_post( $post_arr ); 1373 } 1374 } 1375 } 1376 } 1377 1378 // on event update, record the old slug if needed 1379 public static function record_old_slug( $post_id, $post, $post_before ) { 1380 // Don't bother if it hasn't changed. 1381 if ( $post->post_name == $post_before->post_name ) { 1382 return; 1383 } 1384 1385 // We're only concerned with published, non-hierarchical objects. 1386 if ( 'qsot-event' !== $post->post_type || ! ( 'publish' === $post->post_status || ( 'attachment' === get_post_type( $post ) && 'inherit' === $post->post_status ) ) ) { 1387 return; 1388 } 1389 1390 $old_slugs = (array) get_post_meta( $post_id, '_wp_old_slug' ); 1391 $parent = get_post( $post_before->post_parent ); 1392 $old_slug = $parent->post_name . '/' . $post_before->post_name; 1393 $new_slug = $parent->post_name . '/' . $post->post_name; 1394 1395 // If we haven't added this old slug before, add it now. 1396 if ( ! empty( $post_before->post_name ) && ! in_array( $old_slug, $old_slugs ) ) { 1397 add_post_meta( $post_id, '_wp_old_slug', $old_slug ); 1398 } 1399 1400 // If the new slug was used previously, delete it from the list. 1401 if ( in_array( $new_slug, $old_slugs ) ) { 1402 delete_post_meta( $post_id, '_wp_old_slug', $new_slug ); 1403 } 1327 1404 } 1328 1405 … … 1384 1461 $tmp = ! is_scalar( $item ) ? $item : @json_decode( stripslashes( $item ) ); 1385 1462 1463 // update the timestamps to be non-dst for storage 1464 $tmp->start = QSOT_Utils::make_non_dst( $tmp->start ); 1465 $tmp->end = QSOT_Utils::make_non_dst( $tmp->end ); 1466 1386 1467 // if the settings are a valid set of settings, then continue with this item 1387 1468 if ( is_object( $tmp ) ) { 1388 1469 // change the title to be the date, which makes for better permalinks 1389 $tmp->title = date( _x( 'Y-m-d_gia', 'Permalink date', 'opentickets-community-edition' ), QSOT_Utils::local_timestamp( $tmp->start ) );1470 $tmp->title = date( QSOT_Date_Formats::php_date_format( 'Y-m-d_gia' ), QSOT_Utils::local_timestamp( $tmp->start ) ); 1390 1471 // if the post_id was passed in with the settings, then we know what subevent post to modify with these settings already. therefore we do not need to match it up to an existing 1391 1472 // subevent or create a new subevent. lets throw it directly into the update list for usage later … … 1429 1510 'meta' => array( // setup the meta to save 1430 1511 self::$o->{'meta_key.capacity'} => $tmp->capacity, // max occupants 1431 self::$o->{'meta_key.end'} => QSOT_Utils::make_non_dst( $tmp->end ), // end time, for lookup and display purposes later1432 self::$o->{'meta_key.start'} => QSOT_Utils::make_non_dst( $tmp->start ), // start time for lookup and display purposes later1512 self::$o->{'meta_key.end'} => $tmp->end, // end time, for lookup and display purposes later 1513 self::$o->{'meta_key.start'} => $tmp->start, // start time for lookup and display purposes later 1433 1514 self::$o->{'meta_key.purchase_limit'} => $tmp->purchase_limit, // the specific child event purchase limit 1434 1515 ), … … 1503 1584 'meta' => array( // set the meta 1504 1585 self::$o->{'meta_key.capacity'} => $tmp->capacity, // occupant capacity 1505 self::$o->{'meta_key.end'} => QSOT_Utils::make_non_dst( $tmp->end ), // event end date/time for later lookup and display1506 self::$o->{'meta_key.start'} => QSOT_Utils::make_non_dst( $tmp->start ), // event start data/time for later lookup and display1586 self::$o->{'meta_key.end'} => $tmp->end, // event end date/time for later lookup and display 1587 self::$o->{'meta_key.start'} => $tmp->start, // event start data/time for later lookup and display 1507 1588 self::$o->{'meta_key.purchase_limit'} => $tmp->purchase_limit, // the specific child event purchase limit 1508 1589 ), … … 1546 1627 'meta' => array( // set meta 1547 1628 self::$o->{'meta_key.capacity'} => $item->capacity, // occupant copacity 1548 self::$o->{'meta_key.end'} => QSOT_Utils::make_non_dst( $item->end ), // end data for lookup and display1549 self::$o->{'meta_key.start'} => QSOT_Utils::make_non_dst( $item->start ), // start date for lookup and display1629 self::$o->{'meta_key.end'} => $item->end, // end data for lookup and display 1630 self::$o->{'meta_key.start'} => $item->start, // start date for lookup and display 1550 1631 self::$o->{'meta_key.purchase_limit'} => $tmp->purchase_limit, // the specific child event purchase limit 1551 1632 ), … … 1738 1819 ); 1739 1820 // setup the child event metaboxes 1740 /*1741 1821 } else if ( is_object( $post ) && 0 != $post->post_parent ) { 1742 1822 add_meta_box( … … 1745 1825 array( __CLASS__, 'mb_single_event_settings' ), 1746 1826 self::$o->core_post_type, 1747 ' normal',1827 'side', 1748 1828 'high' 1749 1829 ); 1750 */1751 1830 } 1752 1831 } … … 1754 1833 // metabox for editing a single event's settings 1755 1834 public static function mb_single_event_settings( $post, $mb ) { 1756 // adjust the start and end times for our WP offset setting 1757 $start_raw = QSOT_Utils::gmt_timestamp( get_post_meta( $post->ID, '_start', true ) ); 1758 $end_raw = QSOT_Utils::gmt_timestamp( get_post_meta( $post->ID, '_end', true ) ); 1759 1760 // create the various date parts 1761 $start = date( 'c', $start_raw ); 1762 $start_time = date( 'H:i:s', $start_raw ); 1763 $end = date( 'c', $end_raw ); 1764 $end_time = date( 'H:i:s', $end_raw ); 1835 // load actual start/end datetime 1836 $start = get_post_meta( $post->ID, '_start', true ); 1837 $start_c = QSOT_Utils::to_c( $start ); 1838 $end = get_post_meta( $post->ID, '_end', true ); 1839 $end_c = QSOT_Utils::to_c( $end ); 1840 1841 // get just the date and time portions 1842 $start_time = date( QSOT_Date_Formats::php_date_format( 'g:ia' ), QSOT_Utils::gmt_timestamp( $start_c, 'from', 'g:ia' ) ); 1843 $end_time = date( QSOT_Date_Formats::php_date_format( 'g:ia' ), QSOT_Utils::gmt_timestamp( $end_c, 'from', 'g:ia' ) ); 1844 1845 // render the settings box 1846 ?> 1847 <div class="qsot-mb single-event-settings"> 1848 <input type="hidden" name="qsot-single-event-settings" value="<?php echo esc_attr( wp_create_nonce( 'qsot-save-single-event-settings' ) ) ?>" /> 1849 1850 <div class="field"> 1851 <label for="qsot-single-event-start-date"><?php _e( 'Start Date/time', 'opentickets-community-edition' ) ?></label> 1852 <input type="text" class="widefat use-i18n-datepicker" name="qsot-single-event[start_date]" value="<?php echo esc_attr( $start_c ) ?>" 1853 data-display-format="<?php echo QSOT_Date_Formats::jquery_date_format( 'mm-dd-yy' ) ?>" role="from" scope=".qsot-mb" /> 1854 <span class="at-time"><input type="text" class="widefat use-timepicker" name="qsot-single-event[start_time]" value="<?php echo esc_attr( $start_time ) ?>" /></span> 1855 </div> 1856 1857 <div class="field"> 1858 <label for="qsot-single-event-end-date"><?php _e( 'End Date/time', 'opentickets-community-edition' ) ?></label> 1859 <input type="text" class="widefat use-i18n-datepicker" name="qsot-single-event[end_date]" value="<?php echo esc_attr( $end_c ) ?>" 1860 data-display-format="<?php echo QSOT_Date_Formats::jquery_date_format( 'mm-dd-yy' ) ?>" role="to" scope=".qsot-mb" /> 1861 <span class="at-time"><input type="text" class="widefat use-timepicker" name="qsot-single-event[end_time]" value="<?php echo esc_attr( $end_time ) ?>" /></span> 1862 </div> 1863 1864 <div class="field"> 1865 <label for="qsot-update-permalink"><?php _e( 'Permalink', 'opentickets-community-edition' ) ?></label> 1866 <span class="cb-wrap"> 1867 <input type="checkbox" value="1" name="qsot-update-permalink" id="qsot-update-permalink" /> 1868 <span class="cb-words"><?php _e( 'Yes, update the permalink upon save.', 'opentickets-community-edition' ) ?></span> 1869 </span> 1870 </div> 1871 </div> 1872 <?php 1765 1873 } 1766 1874 … … 1969 2077 1970 2078 public static function mb_event_date_time_settings($post, $mb) { 1971 $now = current_time( 'timestamp' ); 2079 $ts = $now = date( 'c' ); 2080 $ts_1_week = date( 'c', strtotime( $ts . ' +1 week' ) ); 2081 $now = QSOT_Utils::local_timestamp( $now, 'from' ); 1972 2082 $end = strtotime( '+1 hour', $now ); 1973 2083 $one_week = strtotime( '+1 week', $now ); … … 1986 2096 <input type="text" class="use-i18n-datepicker date-text" name="start-date" scope="td" data-link-with=".repeat-options [role='from']" 1987 2097 data-display-format="<?php echo esc_attr( __( 'mm-dd-yy', 'opentickets-community-edition' ) ) ?>" 1988 value="<?php echo date( __( 'm-d-Y', 'opentickets-community-edition' ), $now )?>" title="<?php _e('Start Date','opentickets-community-edition') ?>" role="from" />2098 value="<?php echo $ts ?>" title="<?php _e('Start Date','opentickets-community-edition') ?>" role="from" /> 1989 2099 <input type="text" class="time-text" name="start-time" value="<?php echo date(__('h:ia','opentickets-community-edition'), $now) ?>" title="<?php _e('Start Time','opentickets-community-edition') ?>" /> 1990 2100 … … 1993 2103 <input type="text" class="use-i18n-datepicker date-text" name="end-date" scope="td" data-link-with=".repeat-options [role='from']" 1994 2104 data-display-format="<?php echo esc_attr( __( 'mm-dd-yy', 'opentickets-community-edition' ) ) ?>" 1995 value="<?php echo date( __( 'm-d-Y', 'opentickets-community-edition' ), $end )?>" title="<?php _e('End Date','opentickets-community-edition') ?>" role="to" />2105 value="<?php echo $ts ?>" title="<?php _e('End Date','opentickets-community-edition') ?>" role="to" /> 1996 2106 <input type="text" class="time-text" name="end-time" value="<?php echo date(__('h:ia','opentickets-community-edition'), $end) ?>" title="<?php _e('End Time','opentickets-community-edition') ?>" /> 1997 2107 … … 2076 2186 <input type="text" class="widefat date-text use-i18n-datepicker ends-on" name="repeat-starts" scope=".repeat-options" 2077 2187 data-display-format="<?php echo esc_attr( __( 'mm-dd-yy', 'opentickets-community-edition' ) ) ?>" 2078 value="<?php echo esc_attr( date( __( 'm-d-Y', 'opentickets-community-edition' ), $now )) ?>" role="from" />2188 value="<?php echo esc_attr( $ts ) ?>" role="from" /> 2079 2189 </td> 2080 2190 </tr> … … 2091 2201 <input type="text" class="widefat date-text use-i18n-datepicker" name="repeat-ends-on" scope=".repeat-options" 2092 2202 data-display-format="<?php echo esc_attr( __( 'mm-dd-yy', 'opentickets-community-edition' ) ) ?>" 2093 value="<?php echo esc_attr( date( __( 'm-d-Y', 'opentickets-community-edition' ), $one_week )) ?>" role="to" />2203 value="<?php echo esc_attr( $ts_1_week ) ?>" role="to" /> 2094 2204 </li> 2095 2205 <li> -
opentickets-community-edition/trunk/inc/event-area/general-admission-area-type.class.php
r1479172 r1536371 929 929 public function admin_ajax_load_event( $data, $event, $event_area, $order ) { 930 930 // add the html versions of the start and end date 931 $frmt = __( 'D, F jS, Y h:ia', 'opentickets-community-edition' );931 $frmt = QSOT_Date_Formats::php_date_format( 'D, F jS, Y h:ia' ); 932 932 $data['_html_date'] = sprintf( '<span class="from">%s</span> - <span class="to">%s</span>', date_i18n( $frmt, QSOT_Utils::local_timestamp( $event->meta->start ) ), date_i18n( $frmt, QSOT_Utils::local_timestamp( $event->meta->end ) ) ); 933 933 -
opentickets-community-edition/trunk/inc/event-area/post-type.class.php
r1529668 r1536371 1199 1199 1200 1200 $event_start = get_post_meta( $event->ID, '_start', true ); 1201 $event_date_time = date_i18n( get_option( 'date_format', __( 'Y-m-d', 'opentickets-commnunity-edition' )), QSOT_Utils::local_timestamp( $event_start ) ) . ' '1202 . date_i18n( get_option( 'time_format', __( 'H:i:s', 'opentickets-commnunity-edition' )), QSOT_Utils::local_timestamp( $event_start ) );1201 $event_date_time = date_i18n( QSOT_Date_Formats::php_date_format( 'Y-m-d' ), QSOT_Utils::local_timestamp( $event_start ) ) . ' ' 1202 . date_i18n( QSOT_Date_Formats::php_date_format( 'H:i:s' ), QSOT_Utils::local_timestamp( $event_start ) ); 1203 1203 // add a note explaining what we did 1204 1204 $order->add_order_note( apply_filters( 'qsot-removing-cancelled-order-ticket-msg', sprintf( -
opentickets-community-edition/trunk/inc/sys/admin-settings.php
r1369465 r1536371 34 34 $settings[] = include( 'settings/general.php' ); 35 35 $settings[] = include( 'settings/frontend.php' ); 36 $settings[] = include( 'settings/dates.php' ); 36 37 37 38 // allow adding of other pages if needed -
opentickets-community-edition/trunk/inc/sys/extensions/settings/licenses.php
r1314484 r1536371 157 157 <div class="field"> 158 158 <span class="label"><?php _e( 'Expired On', 'opentickets-community-edition' ) ?></span>: 159 <span class="value"><?php echo date_i18n( get_option( 'date_format', 'F jS, Y'), $licenses[ $file ]['expires'] ) ?></span>159 <span class="value"><?php echo date_i18n( get_option( 'date_format', QSOT_Date_Formats::php_date_format( 'F jS, Y' ) ), $licenses[ $file ]['expires'] ) ?></span> 160 160 </div> 161 161 <?php else: ?> … … 179 179 <div class="field"> 180 180 <span class="label"><?php _e( 'Expires On', 'opentickets-community-edition' ) ?></span>: 181 <span class="value"><?php echo date_i18n( get_option( 'date_format', 'F jS, Y'), $licenses[ $file ]['expires'] ) ?></span>181 <span class="value"><?php echo date_i18n( get_option( 'date_format', QSOT_Date_Formats::php_date_format( 'F jS, Y' ) ), $licenses[ $file ]['expires'] ) ?></span> 182 182 </div> 183 183 <?php endif; ?> -
opentickets-community-edition/trunk/inc/sys/pages/system-status.page.php
r1532350 r1536371 1042 1042 } 1043 1043 1044 $subject = '[' . date_i18n( __( 'm-d-Y', 'opentickets-community-edition' ) ) . '] ' . $subject;1044 $subject = '[' . date_i18n( QSOT_Date_Formats::php_date_format( 'm-d-Y' ) ) . '] ' . $subject; 1045 1045 $purl = @parse_url( site_url() ); 1046 1046 $headers = array( 'From: Opentickets Background Process <background@' . $purl['host'] . '>' ); -
opentickets-community-edition/trunk/inc/sys/rewrite.php
r1299061 r1536371 23 23 // during activation, we need to flush the rewrite rules, because there are a few classes that register spcial rules 24 24 add_action( 'qsot-activate', array( __CLASS__, 'on_activate' ), 1000 ); 25 26 // handle old event slug lookups 27 add_action( 'template_redirect', array( __CLASS__, 'old_event_slug_redirect' ), PHP_INT_MAX ); 25 28 } 26 29 … … 180 183 return $out; 181 184 } 185 186 public static function old_event_slug_redirect() { 187 global $wp_query; 188 189 if ( is_404() && '' !== $wp_query->query_vars['name'] && isset( $wp_query->query_vars['qsot-event'] ) && '' !== $wp_query->query_vars['qsot-event'] ) : 190 global $wpdb; 191 192 // Guess the current post_type based on the query vars. 193 if ( get_query_var( 'post_type' ) ) { 194 $post_type = get_query_var( 'post_type' ); 195 } elseif ( get_query_var( 'attachment' ) ) { 196 $post_type = 'attachment'; 197 } elseif ( ! empty( $wp_query->query_vars['pagename'] ) ) { 198 $post_type = 'page'; 199 } else { 200 $post_type = 'post'; 201 } 202 203 if ( is_array( $post_type ) ) { 204 if ( count( $post_type ) > 1 ) 205 return; 206 $post_type = reset( $post_type ); 207 } 208 209 // only redirect event post types 210 if ( 'qsot-event' !== $post_type ) 211 return; 212 213 $query = $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta, $wpdb->posts WHERE ID = post_id AND post_type = %s AND meta_key = '_wp_old_slug' AND meta_value = %s", $post_type, $wp_query->query_vars['qsot-event']); 214 215 // if year, monthnum, or day have been specified, make our query more precise 216 // just in case there are multiple identical _wp_old_slug values 217 if ( '' != $wp_query->query_vars['year'] ) 218 $query .= $wpdb->prepare(" AND YEAR(post_date) = %d", $wp_query->query_vars['year']); 219 if ( '' != $wp_query->query_vars['monthnum'] ) 220 $query .= $wpdb->prepare(" AND MONTH(post_date) = %d", $wp_query->query_vars['monthnum']); 221 if ( '' != $wp_query->query_vars['day'] ) 222 $query .= $wpdb->prepare(" AND DAYOFMONTH(post_date) = %d", $wp_query->query_vars['day']); 223 224 $id = (int) $wpdb->get_var($query); 225 226 if ( ! $id ) 227 return; 228 229 $link = get_permalink( $id ); 230 231 if ( isset( $GLOBALS['wp_query']->query_vars['paged'] ) && $GLOBALS['wp_query']->query_vars['paged'] > 1 ) { 232 $link = user_trailingslashit( trailingslashit( $link ) . 'page/' . $GLOBALS['wp_query']->query_vars['paged'] ); 233 } elseif( is_embed() ) { 234 $link = user_trailingslashit( trailingslashit( $link ) . 'embed' ); 235 } 236 237 /** 238 * Filters the old slug redirect URL. 239 * 240 * @since 4.4.0 241 * 242 * @param string $link The redirect URL. 243 */ 244 $link = apply_filters( 'old_slug_redirect_url', $link ); 245 246 if ( ! $link ) { 247 return; 248 } 249 250 wp_redirect( $link, 301 ); // Permanent redirect 251 exit; 252 endif; 253 } 182 254 } 183 255 -
opentickets-community-edition/trunk/inc/sys/settings-page.abstract.php
r1367916 r1536371 27 27 28 28 echo '</ul><br class="clear" />'; 29 } 30 31 protected function _get_page_settings() { return array(); } 32 33 /** 34 * Get settings array 35 * 36 * @return array 37 */ 38 public function get_page_settings() { 39 global $current_section; 40 return apply_filters( 'qsot-get-page-settings', $this->_get_page_settings(), $this->id, $current_section ); 29 41 } 30 42 … … 64 76 return $fields; 65 77 } 78 79 // setup the basic hooks we need for the settings page 80 protected function _setup_settings_page_hooks() { 81 add_action( 'qsot_sections_' . $this->id, array( $this, 'output_sections' ) ); 82 add_filter( 'qsot_settings_tabs_array', array( $this, 'add_settings_page' ), 20 ); 83 add_action( 'qsot_settings_' . $this->id, array( $this, 'output' ) ); 84 add_action( 'qsot_settings_save_' . $this->id, array( $this, 'save' ) ); 85 } 66 86 } 67 87 -
opentickets-community-edition/trunk/inc/sys/settings/frontend.php
r1367916 r1536371 22 22 $this->label = __( 'Frontend', 'opentickets-community-edition' ); 23 23 24 add_action( 'qsot_sections_' . $this->id, array( $this, 'output_sections' ) ); 25 add_filter( 'qsot_settings_tabs_array', array( $this, 'add_settings_page' ), 20 ); 26 add_action( 'qsot_settings_' . $this->id, array( $this, 'output' ) ); 27 add_action( 'qsot_settings_save_' . $this->id, array( $this, 'save' ) ); 24 $this->_setup_settings_page_hooks(); 28 25 29 26 if ( ( $styles = WC_Frontend_Scripts::get_styles() ) && array_key_exists( 'woocommerce-general', $styles ) ) … … 45 42 46 43 return $sections; 47 }48 49 /**50 * Get settings array51 *52 * @return array53 */54 public function get_page_settings() {55 global $current_section;56 return apply_filters( 'qsot-get-page-settings', array(), $this->id, $current_section );57 44 } 58 45 -
opentickets-community-edition/trunk/inc/sys/utils.php
r1532350 r1536371 250 250 } 251 251 252 // accept a user input value for a time, and convert it to 24 hour time 253 public static function to_24_hour( $raw_time ) { 254 // get the various time parts 255 preg_match( '#^(?P<hour>\d{1,2})(?:[^\dAPMapm]?(?<minute>\d{1,2}))?(?:[^\dAPMapm]?(?<second>\d{1,2}))?(?P<meridiem>[APMapm]+)?$#', $raw_time, $match ); 256 257 // if we have no matches of at least the hour field, then bail 258 if ( ! is_array( $match ) || ! isset( $match['hour'] ) ) 259 return ''; 260 261 $match['hour'] = absint( $match['hour'] ); 262 // update the hour based on meridiem if present 263 if ( isset( $match['meridiem'] ) ) { 264 $mer = strtolower( $match['meridiem'] ); 265 // if it is pm and the hour is not 12pm, then add 12 hours 266 if ( in_array( $mer, array( 'p', 'pm' ) ) && 12 != $match['hour'] ) 267 $match['hour'] = $match['hour'] + 12; 268 // if it is am and the hour is 12am, make it a 0, for midnight 269 if ( in_array( $mer, array( 'a', 'am' ) ) && 12 == $match['hour'] ) 270 $match['hour'] = 0; 271 } 272 273 // glue it back up and fill it in 274 return sprintf( 275 '%02s:%02s:%02s', 276 $match['hour'], 277 isset( $match['minute'] ) ? absint( $match['minute'] ) : 0, 278 isset( $match['second'] ) ? absint( $match['second'] ) : 0 279 ); 280 } 281 252 282 // code to update all the site event start and end times to the same timezone as the SITE, in non-dst, is currently set to 253 283 public static function normalize_event_times() { … … 303 333 } 304 334 } 335 336 // date formatter utils 337 class QSOT_Date_Formats { 338 // map of php-date format letters to base date-time-segment-type 339 protected static $php_format_map = array( 340 // days 341 'd' => 'd', 342 'D' => 'd', 343 'j' => 'd', 344 'l' => 'd', 345 'N' => 'd', 346 'S' => 'd', 347 'w' => 'd', 348 'z' => 'd', 349 350 // month 351 'F' => 'm', 352 'm' => 'm', 353 'M' => 'm', 354 'n' => 'm', 355 't' => 'm', 356 357 // Year 358 'y' => 'Y', 359 'Y' => 'Y', 360 'o' => 'Y', 361 362 // hour 363 'g' => 'h', 364 'G' => 'h', 365 'h' => 'h', 366 'H' => 'h', 367 368 // minute 369 'i' => 'i', 370 371 // second 372 's' => 's', 373 374 // meridiem 375 'a' => 'a', 376 'A' => 'a', 377 378 // timezone 379 'O' => 'z', 380 'P' => 'z', 381 'T' => 'z', 382 'Z' => 'z', 383 384 // nothing important 385 'W' => false, 386 'B' => false, 387 'u' => false, 388 'e' => false, 389 'I' => false, 390 'c' => false, 391 'r' => false, 392 'U' => false, 393 ); 394 395 // list of php-formats used within our plugin that might be customized 396 public static $php_custom_date_formats = array( 397 'D, F jS, Y', 398 'D, F jS, Y h:ia', 399 'D, F jS, Y \@ g:ia', 400 'F jS, Y', 401 'l jS \\o\\f F Y, h:ia', 402 'Y-m-d_gia', 403 'Y-m-d', 404 'm-d-Y', 405 'm/d/Y', 406 ); 407 public static $php_custom_time_formats = array( 408 'g:ia', 409 'h:ia', 410 'H:i:s', 411 ); 412 public static $moment_custom_date_formats = array( 413 'mm-dd-yy', 414 ); 415 public static $moment_custom_time_formats = array( 416 ); 417 public static $jqueryui_custom_date_formats = array( 418 ); 419 public static $jqueryui_custom_time_formats = array( 420 ); 421 422 // report whether this site uses DST or not, according to settings 423 public static function use_dst() { return get_option( 'qsot-use-dst', 'yes' ) == 'yes'; } 424 425 // report date and time format settings 426 public static function date_format() { return get_option( 'qsot-date-format', 'm-d-Y' ); } 427 public static function hour_format() { return get_option( 'qsot-hour-format', '12-hour' ); } 428 public static function is_12_hour() { return get_option( 'qsot-hour-format', '12-hour' ) == '12-hour'; } 429 public static function is_24_hour() { return get_option( 'qsot-hour-format', '12-hour' ) == '24-hour'; } 430 431 // load all custom formats from the db 432 protected static function _load_custom_formats() { 433 $formats = array(); 434 foreach ( self::$php_custom_date_formats as $format ) 435 if ( $value = get_option( 'qsot-custom-php-date-format-' . sanitize_title_with_dashes( $format ), '' ) ) 436 $formats[ $format ] = $value; 437 foreach ( self::$php_custom_time_formats as $format ) 438 if ( $value = get_option( 'qsot-custom-php-date-format-' . sanitize_title_with_dashes( $format ), '' ) ) 439 $formats[ $format ] = $value; 440 return $formats; 441 } 442 443 // reorder a time format, based on the settings 444 public static function php_date_format( $format='m-d-Y' ) { 445 static $conversions = false; 446 // load all custom formats from db, the first time this function is called 447 if ( false === $conversions ) 448 $conversions = self::_load_custom_formats(); 449 // only do this conversion once per input format 450 if ( isset( $conversions[ $format ] ) ) 451 return $conversions[ $format ]; 452 453 $segment = array(); 454 $last_segment = false; 455 $i = 0; 456 $ii = strlen( $format ); 457 // break up the requested format into parts 458 for ( $i = 0; $i < $ii; $i++ ) { 459 // if the next char is a back slash, skip it and the next letter 460 if ( '\\' == $format[ $i ] ) { 461 if ( $last_segment ) 462 $segment[ $last_segment ] .= substr( $format, $i, 2 ); 463 $i++; 464 continue; 465 } 466 467 // if the next letter is not in the php format map, or is irrelevant, then skip it 468 if ( ! isset( self::$php_format_map[ $format[ $i ] ] ) ) { 469 if ( $last_segment ) 470 $segment[ $last_segment ] .= substr( $format, $i, 1 ); 471 continue; 472 } 473 474 // otherwise, add this letter to the relevant segment 475 $last_segment = self::$php_format_map[ $format[ $i ] ]; 476 if ( ! isset( $segment[ self::$php_format_map[ $format[ $i ] ] ] ) ) 477 $segment[ self::$php_format_map[ $format[ $i ] ] ] = ''; 478 $segment[ self::$php_format_map[ $format[ $i ] ] ] .= $format[ $i ]; 479 } 480 481 $date_format_array = explode( '-', self::date_format() ); 482 $date_format = ''; 483 // reorder the date portion of the format, based on the settings 484 foreach ( $date_format_array as $segment_key ) 485 $date_format .= isset( $segment[ $segment_key ] ) ? $segment[ $segment_key ] : ''; 486 487 $time_format = ''; 488 $is_24_hour = self::is_24_hour(); 489 // construct the time format 490 if ( $is_24_hour && isset( $segment['h'] ) ) 491 $time_format .= strtoupper( $segment['h'] ); 492 elseif ( ! $is_24_hour && isset( $segment['h'] ) ) 493 $time_format .= strtolower( $segment['h'] ); 494 if ( isset( $segment['i'] ) ) 495 $time_format .= $segment['i']; 496 if ( isset( $segment['s'] ) ) 497 $time_format .= $segment['s']; 498 if ( ! $is_24_hour && isset( $segment['a'] ) ) 499 $time_format .= $segment['a']; 500 if ( isset( $segment['z'] ) ) 501 $time_format .= $segment['z']; 502 503 // glue that shit together, and return 504 $conversion[ $format ] = trim( $date_format . ' ' . $time_format ); 505 return $conversion[ $format ]; 506 } 507 508 // reorder the time format, based on the settings, for a momentjs format 509 public static function moment_date_format( $format='mm-dd-yy' ) { 510 return $format; 511 } 512 513 // reorder the time format, based on the settings, for a jquery format 514 public static function jquery_date_format( $format='mm-dd-yy' ) { 515 return $format; 516 } 517 } -
opentickets-community-edition/trunk/launcher.php
r1532350 r1536371 4 4 * Plugin URI: http://opentickets.com/ 5 5 * Description: Event Management and Online Ticket Sales Platform 6 * Version: 2. 5.36 * Version: 2.6.0 7 7 * Author: Quadshot Software LLC 8 8 * Author URI: http://quadshot.com/ … … 54 54 'fctm' => 'fc', 55 55 'always_reserve' => 0, 56 'version' => '2. 5.3',56 'version' => '2.6.0', 57 57 'min_wc_version' => '2.6.1', 58 58 'core_post_type' => 'qsot-event', -
opentickets-community-edition/trunk/readme.txt
r1532350 r1536371 171 171 172 172 == Changelog == 173 174 = 2.6.0 - Nov/18/2016 = 175 * [new] major overhaul on displayed time formats. now they are all options in the admin 176 * [new] ability to edit an individual event, change the start/end time, and update the permalink with auto-redirect of old one 177 * [tweak] update to better process manually typed in time values when creating and editing events 173 178 174 179 = 2.5.3 - Nov/11/2016 = -
opentickets-community-edition/trunk/templates/checkin/already-occupied.php
r1437825 r1536371 25 25 <li class="event"><strong><?php _e( 'Event:', 'opentickets-community-edition' ) ?></strong> <?php echo $ticket->event->post_title ?></li> 26 26 <li class="start-date"><strong><?php _e( 'Starts:', 'opentickets-community-edition' ) ?></strong> <?php 27 echo date_i18n( get_option( 'date_format', 'F jS, Y' ) . ' ' . get_option( 'time_format', 'g:ia'), QSOT_Utils::local_timestamp( $ticket->event->meta->start ) )27 echo date_i18n( get_option( 'date_format', QSOT_Date_Formats::php_date_format( 'F jS, Y' ) ) . ' ' . get_option( 'time_format', QSOT_Date_Formats::php_date_format( 'g:ia' ) ), QSOT_Utils::local_timestamp( $ticket->event->meta->start ) ) 28 28 ?></li> 29 29 <li class="checked"><strong><?php _e( 'Checked-In:', 'opentickets-community-edition' ) ?></strong> <?php echo $index ?></li> -
opentickets-community-edition/trunk/templates/checkin/occupy-failure.php
r1437825 r1536371 25 25 <li class="event"><strong><?php _e('Event:','opentickets-community-edition') ?></strong> <?php echo $ticket->event->post_title ?></li> 26 26 <li class="start-date"><strong><?php _e( 'Starts:', 'opentickets-community-edition' ) ?></strong> <?php 27 echo date_i18n( get_option( 'date_format', 'F jS, Y' ) . ' ' . get_option( 'time_format', 'g:ia'), QSOT_Utils::local_timestamp( $ticket->event->meta->start ) )27 echo date_i18n( get_option( 'date_format', QSOT_Date_Formats::php_date_format( 'F jS, Y' ) ) . ' ' . get_option( 'time_format', QSOT_Date_Formats::php_date_format( 'g:ia' ) ), QSOT_Utils::local_timestamp( $ticket->event->meta->start ) ) 28 28 ?></li> 29 29 <li class="checked"><strong><?php _e('Checked-In:','opentickets-community-edition') ?></strong> <?php echo $index ?></li> -
opentickets-community-edition/trunk/templates/checkin/occupy-success.php
r1437825 r1536371 25 25 <li class="event"><strong><?php _e('Event:','opentickets-community-edition') ?></strong> <?php echo $ticket->event->post_title ?></li> 26 26 <li class="start-date"><strong><?php _e( 'Starts:', 'opentickets-community-edition' ) ?></strong> <?php 27 echo date_i18n( get_option( 'date_format', 'F jS, Y' ) . ' ' . get_option( 'time_format', 'g:ia'), QSOT_Utils::local_timestamp( $ticket->event->meta->start ) )27 echo date_i18n( get_option( 'date_format', QSOT_Date_Formats::php_date_format( 'F jS, Y' ) ) . ' ' . get_option( 'time_format', QSOT_Date_Formats::php_date_format( 'g:ia' ) ), QSOT_Utils::local_timestamp( $ticket->event->meta->start ) ) 28 28 ?></li> 29 29 <li class="checked"><strong><?php _e('Checked-In:','opentickets-community-edition') ?></strong> <?php echo $index ?></li> -
opentickets-community-edition/trunk/templates/tickets/ticket/event-meta.php
r1437825 r1536371 8 8 <li> 9 9 <span class="label"><?php _e( 'Starts:', 'opentickets-community-edition' ) ?></span> 10 <span class="value"><?php echo date( __( 'D, F jS, Y', 'opentickets-community-edition' ), $start_time ), __( ' @ ', 'opentickets-community-edition' ), date( __( 'g:ia', 'opentickets-community-edition' ), $start_time ) ?></span>10 <span class="value"><?php echo date( QSOT_Date_Formats::php_date_format( 'D, F jS, Y \@ g:ia' ), $start_time ) ?></span> 11 11 </li> 12 12 <li> 13 13 <span class="label"><?php _e( 'Ends:', 'opentickets-community-edition' ) ?></span> 14 14 <?php if ( $same_day ): ?> 15 <span class="value"><?php echo __( ' @ ', 'opentickets-community-edition' ), date( __( 'g:ia', 'opentickets-community-edition' ), $end_time ) ?></span>15 <span class="value"><?php echo __( ' @ ', 'opentickets-community-edition' ), date( QSOT_Date_Formats::php_date_format( 'g:ia' ), $end_time ) ?></span> 16 16 <?php else: ?> 17 <span class="value"><?php echo date( __( 'D, F jS, Y', 'opentickets-community-edition' ), $end_time ), __( ' @ ', 'opentickets-community-edition' ), date( __( 'g:ia', 'opentickets-community-edition' ), $end_time ) ?></span>17 <span class="value"><?php echo date( QSOT_Date_Formats::php_date_format( 'D, F jS, Y \@ g:ia' ), $end_time ) ?></span> 18 18 <?php endif; ?> 19 19 </li>
Note: See TracChangeset
for help on using the changeset viewer.