Changeset 968
- Timestamp:
- 11/07/2014 07:27:05 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php
r935 r968 21 21 add_action( 'admin_print_styles', array( $this, 'admin_css' ) ); 22 22 add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); 23 add_action( 'admin_print_footer_scripts', array( $this, 'admin_print_scripts' ) ); 23 24 add_action( 'wp_enqueue_scripts', array( $this, 'wp_enqueue_scripts' ) ); 24 25 … … 194 195 195 196 function admin_enqueue_scripts() { 197 global $post_type; 196 198 wp_enqueue_style( 'campicons', plugins_url( 'fonts/campicons.css', __FILE__ ), array(), 1 ); 197 } 198 199 200 // Enqueues scripts and styles for session admin page 201 if ( 'wcb_session' == $post_type ) { 202 wp_enqueue_script( 'jquery-ui-datepicker' ); 203 wp_enqueue_style( 'jquery-ui' ); 204 wp_enqueue_style( 'wp-datepicker-skins' ); 205 } 206 } 207 208 /* 209 * Print our JavaScript 210 */ 211 function admin_print_scripts() { 212 global $post_type; 213 214 // DatePicker for Session posts 215 if ( 'wcb_session' == $post_type ) : 216 ?> 217 218 <script type="text/javascript"> 219 jQuery( document ).ready( function( $ ) { 220 $( '#wcpt-session-date' ).datepicker( { 221 dateFormat: 'yy-mm-dd', 222 changeMonth: true, 223 changeYear: true 224 } ); 225 } ); 226 </script> 227 228 <?php 229 endif; 230 } 231 199 232 function wp_enqueue_scripts() { 200 233 wp_enqueue_style( 'wcb_shortcodes', plugins_url( 'css/shortcodes.css', __FILE__ ), array(), 2 ); … … 1017 1050 <?php while ( $sponsors->have_posts() ) : $sponsors->the_post(); ?> 1018 1051 <?php $website = get_post_meta( get_the_ID(), '_wcpt_sponsor_website', true ); ?> 1019 1052 1020 1053 <div id="wcorg-sponsor-<?php the_ID(); ?>" class="wcorg-sponsor"> 1021 1054 <?php if ( 'website' == $attr['link'] && $website ) : ?> … … 1024 1057 <h3><?php the_title(); ?></h3> 1025 1058 <?php endif; ?> 1026 1059 1027 1060 <div class="wcorg-sponsor-description"> 1028 1061 <?php if ( 'website' == $attr['link'] && $website ) : ?> … … 1031 1064 <?php the_post_thumbnail(); ?> 1032 1065 <?php endif; ?> 1033 1066 1034 1067 <?php the_content(); ?> 1035 1068 </div> … … 1330 1363 $post = get_post(); 1331 1364 $session_time = absint( get_post_meta( $post->ID, '_wcpt_session_time', true ) ); 1332 $session_time = ( $session_time ) ? date( 'Y-m-d H:i:s', $session_time ) : ''; 1365 $session_date = ( $session_time ) ? date( 'Y-m-d', $session_time ) : date( 'Y-m-d' ); 1366 $session_hours = ( $session_time ) ? date( 'g', $session_time ) : date( 'g' ); 1367 $session_minutes = ( $session_time ) ? date( 'i', $session_time ) : '00'; 1368 $session_meridiem = ( $session_time ) ? date( 'a', $session_time ) : 'am'; 1333 1369 $session_type = get_post_meta( $post->ID, '_wcpt_session_type', true ); 1334 1370 ?> 1335 1371 <?php wp_nonce_field( 'edit-session-info', 'wcpt-meta-session-info' ); ?> 1336 1372 <p> 1337 <label for="wcpt-session-time"><?php _e( 'When:', 'wordcamporg' ); ?></label> 1338 <input type="text" class="widefat" id="wcpt-session-time" name="wcpt-session-time" value="<?php echo esc_attr( $session_time ); ?>" /> 1339 <span style="display: block; margin-top: 4px;" class="description">For example: <?php echo date( 'Y-m-d H:i:s' ); ?></span> 1373 <label for="wcpt-session-date"><?php _e( 'Date:', 'wordcamporg' ); ?></label> 1374 <input type="text" id="wcpt-session-date" data-date="<?php echo esc_attr( $session_date ); ?>" name="wcpt-session-date" value="<?php echo esc_attr( $session_date ); ?>" /><br /> 1375 <label><?php _e( 'Time:', 'wordcamporg' ); ?></label> 1376 1377 <select name="wcpt-session-hour" aria-label="<?php _e( 'Session Start Hour', 'wordcamporg' ); ?>"> 1378 <?php for ( $i = 1; $i <= 12; $i++ ) : ?> 1379 <option value="<?php echo esc_attr( $i ); ?>" <?php selected( $i, $session_hours ) ?>> 1380 <?php echo esc_html( $i ); ?> 1381 </option> 1382 <?php endfor; ?> 1383 </select> : 1384 1385 <select name="wcpt-session-minutes" aria-label="<?php _e( 'Session Start Minutes', 'wordcamporg' ); ?>"> 1386 <?php for ( $i = '00'; (int) $i <= 55; $i = sprintf( '%02d', (int) $i + 5 ) ) : ?> 1387 <option value="<?php echo esc_attr( $i ); ?>" <?php selected( $i, $session_minutes ) ?>> 1388 <?php echo esc_html( $i ); ?> 1389 </option> 1390 <?php endfor; ?> 1391 </select> 1392 1393 <select name="wcpt-session-meridiem" aria-label="<?php _e( 'Session Meridiem', 'wordcamporg' ); ?>"> 1394 <option value="am" <?php selected( 'am', $session_meridiem ) ?>>am</option> 1395 <option value="pm" <?php selected( 'pm', $session_meridiem ) ?>>pm</option> 1396 </select> 1340 1397 </p> 1398 1341 1399 <p> 1342 1400 <label for="wcpt-session-type"><?php _e( 'Type:', 'wordcamporg' ); ?></label> … … 1355 1413 $website = get_post_meta( $sponsor->ID, '_wcpt_sponsor_website', true ); 1356 1414 wp_nonce_field( 'edit-sponsor-info', 'wcpt-meta-sponsor-info' ); 1357 1415 1358 1416 ?> 1359 1417 1360 1418 <p> 1361 1419 <label for="_wcpt_sponsor_website"><?php _e( 'Website:', 'wordcampbase' ); ?></label> 1362 1420 <input type="text" class="widefat" id="_wcpt_sponsor_website" name="_wcpt_sponsor_website" value="<?php echo esc_attr( esc_url( $website ) ); ?>" /> 1363 1421 </p> 1364 1422 1365 1423 <?php 1366 1424 } … … 1439 1497 // Update session time. 1440 1498 if ( isset( $_POST['wcpt-meta-session-info'] ) && wp_verify_nonce( $_POST['wcpt-meta-session-info'], 'edit-session-info' ) ) { 1441 $session_time = sanitize_text_field( $_POST['wcpt-session-time'] ); 1442 $session_time = strtotime( $session_time ); 1499 $session_time = strtotime( sprintf( 1500 '%s %d:%02d %s', 1501 sanitize_text_field( $_POST['wcpt-session-date'] ), 1502 absint( $_POST['wcpt-session-hour'] ), 1503 absint( $_POST['wcpt-session-minutes'] ), 1504 'am' == $_POST['wcpt-session-meridiem'] ? 'am' : 'pm' 1505 ) ); 1443 1506 update_post_meta( $post_id, '_wcpt_session_time', $session_time ); 1444 1507 … … 1483 1546 foreach ( $speaker_ids as $speaker_id ) 1484 1547 add_post_meta( $post_id, '_wcpt_speaker_id', $speaker_id ); 1485 1548 1486 1549 // Set the speaker as the author of the session post, so the single 1487 1550 // view doesn't confuse users who see "posted by [organizer name]" … … 1489 1552 $wporg_user_id = get_post_meta( $speaker_post, '_wcpt_user_id', true ); 1490 1553 $user = get_user_by( 'id', $wporg_user_id ); 1491 1554 1492 1555 if ( $user ) { 1493 1556 remove_action( 'save_post', array( $this, 'save_post_session' ), 10, 2 ); // avoid infinite recursion … … 1497 1560 ) ); 1498 1561 add_action( 'save_post', array( $this, 'save_post_session' ), 10, 2 ); 1499 1562 1500 1563 break; 1501 1564 } … … 1513 1576 if ( isset( $_POST['wcpt-meta-sponsor-info'] ) && wp_verify_nonce( $_POST['wcpt-meta-sponsor-info'], 'edit-sponsor-info' ) ) { 1514 1577 $website = esc_url_raw( $_POST['_wcpt_sponsor_website'] ); 1515 1578 1516 1579 // TODO: maybe only allows links to home page, depending on outcome of http://make.wordpress.org/community/2013/12/31/irs-rules-for-corporate-sponsorship-of-wordcamp/ 1517 1580
Note: See TracChangeset
for help on using the changeset viewer.