Changeset 1233
- Timestamp:
- 02/06/2015 10:01:22 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php
r1232 r1233 1 1 <?php 2 2 3 if ( ! class_exists( 'WordCamp_Admin' ) ) :3 if ( ! class_exists( 'WordCamp_Admin' ) ) : 4 4 /** 5 5 * WCPT_Admin … … 60 60 * @uses add_meta_box 61 61 */ 62 function metabox () {63 add_meta_box (62 function metabox() { 63 add_meta_box( 64 64 'wcpt_information', 65 65 __( 'WordCamp Information', 'wcpt' ), … … 70 70 ); 71 71 72 add_meta_box (72 add_meta_box( 73 73 'wcpt_organizer_info', 74 74 __( 'Organizing Team', 'wcpt' ), … … 79 79 ); 80 80 81 add_meta_box (81 add_meta_box( 82 82 'wcpt_venue_info', 83 83 __( 'Venue Information', 'wcpt' ), … … 97 97 * @return int 98 98 */ 99 function metabox_save ( $post_id ) {99 function metabox_save( $post_id ) { 100 100 101 101 // Don't add/remove meta on revisions and auto-saves … … 113 113 // Get post value 114 114 $post_value = wcpt_key_to_str( $key, 'wcpt_' ); 115 $values[ $key] = isset( $_POST[$post_value] ) ? esc_attr( $_POST[$post_value] ) : '';115 $values[ $key ] = isset( $_POST[ $post_value ] ) ? esc_attr( $_POST[ $post_value ] ) : ''; 116 116 117 117 switch ( $value ) { 118 118 case 'text' : 119 119 case 'textarea' : 120 update_post_meta( $post_id, $key, $values[ $key] );120 update_post_meta( $post_id, $key, $values[ $key ] ); 121 121 break; 122 122 123 123 case 'checkbox' : 124 124 if ( ! empty( $values[ $key ] ) && 'on' == $values[ $key ] ) { … … 130 130 131 131 case 'date' : 132 if ( !empty( $values[ $key] ) )133 $values[ $key] = strtotime( $values[$key] );134 135 update_post_meta( $post_id, $key, $values[ $key] );132 if ( !empty( $values[ $key ] ) ) 133 $values[ $key ] = strtotime( $values[ $key ] ); 134 135 update_post_meta( $post_id, $key, $values[ $key ] ); 136 136 break; 137 137 … … 151 151 * @return array 152 152 */ 153 function meta_keys ( $meta_group = '' ) {153 function meta_keys( $meta_group = '' ) { 154 154 155 155 /* … … 159 159 160 160 switch ( $meta_group ) { 161 case 'organizer' :161 case 'organizer': 162 162 $retval = array ( 163 163 'Organizer Name' => 'text', … … 176 176 break; 177 177 178 case 'venue' :178 case 'venue': 179 179 $retval = array ( 180 180 'Venue Name' => 'text', … … 188 188 break; 189 189 190 case 'wordcamp' :190 case 'wordcamp': 191 191 $retval = array ( 192 192 'Start Date (YYYY-mm-dd)' => 'date', … … 202 202 break; 203 203 204 case 'all' :205 default :204 case 'all': 205 default: 206 206 $retval = array( 207 207 'Start Date (YYYY-mm-dd)' => 'date', … … 254 254 if ( get_post_type() == WCPT_POST_TYPE_ID ) : 255 255 ?> 256 <script> 257 jQuery(document).ready(function($) { 258 $('.date-field').datepicker({ 259 dateFormat: 'yy-mm-dd', 260 changeMonth: true, 261 changeYear: true 262 }); 263 }); 264 </script> 256 257 <script> 258 jQuery( document ).ready( function( $ ) { 259 $( '.date-field' ).datepicker( { 260 dateFormat: 'yy-mm-dd', 261 changeMonth: true, 262 changeYear: true 263 } ); 264 } ); 265 </script> 266 265 267 <?php 266 268 endif; … … 279 281 * Add some general styling to the admin area 280 282 */ 281 function admin_head () {283 function admin_head() { 282 284 if ( !empty( $_GET['post_type'] ) && $_GET['post_type'] == WCPT_POST_TYPE_ID ) : ?> 283 285 … … 295 297 * @todo Everything 296 298 */ 297 function user_profile_update ( $user_id ) {299 function user_profile_update( $user_id ) { 298 300 if ( !wcpt_has_access() ) 299 301 return false; … … 308 310 * @todo Everything 309 311 */ 310 function user_profile_wordcamp ( $profileuser ) {312 function user_profile_wordcamp( $profileuser ) { 311 313 312 314 if ( !wcpt_has_access() ) 313 315 return false; 314 316 315 ?> 317 ?> 318 316 319 <h3><?php _e( 'WordCamps', 'wcpt' ); ?></h3> 317 320 <table class="form-table"> … … 323 326 </tr> 324 327 </table> 325 <?php 328 329 <?php 326 330 } 327 331 … … 334 338 * @return array $columns 335 339 */ 336 function column_headers ( $columns ) {340 function column_headers( $columns ) { 337 341 $columns = array ( 338 342 'cb' => '<input type="checkbox" />', … … 355 359 * @param int $post_id 356 360 */ 357 function column_data ( $column, $post_id ) {361 function column_data( $column, $post_id ) { 358 362 if ( $_GET['post_type'] !== WCPT_POST_TYPE_ID ) 359 363 return $column; … … 388 392 case 'wcpt_organizer' : 389 393 echo wcpt_get_wordcamp_organizer_name() ? wcpt_get_wordcamp_organizer_name() : __( 'No Organizer', 'wcpt' ); 390 391 394 break; 392 395 … … 406 409 * @return array $actions 407 410 */ 408 function post_row_actions ( $actions, $post ) {411 function post_row_actions( $actions, $post ) { 409 412 if ( WCPT_POST_TYPE_ID == $post->post_type ) { 410 413 unset( $actions['inline hide-if-no-js'] ); … … 653 656 * Functions for displaying specific meta boxes 654 657 */ 655 function wcpt_wordcamp_metabox () {658 function wcpt_wordcamp_metabox() { 656 659 $meta_keys = $GLOBALS['wordcamp_admin']->meta_keys( 'wordcamp' ); 657 660 wcpt_metabox( $meta_keys ); 658 661 } 659 662 660 function wcpt_organizer_metabox () {663 function wcpt_organizer_metabox() { 661 664 $meta_keys = $GLOBALS['wordcamp_admin']->meta_keys( 'organizer' ); 662 665 wcpt_metabox( $meta_keys ); 663 666 } 664 667 665 function wcpt_venue_metabox () {668 function wcpt_venue_metabox() { 666 669 $meta_keys = $GLOBALS['wordcamp_admin']->meta_keys( 'venue' ); 667 670 wcpt_metabox( $meta_keys ); … … 677 680 * @since WordCamp Post Type (0.1) 678 681 */ 679 function wcpt_metabox ( $meta_keys ) {682 function wcpt_metabox( $meta_keys ) { 680 683 global $post_id; 681 684 682 685 foreach ( $meta_keys as $key => $value ) : 683 686 $object_name = wcpt_key_to_str( $key, 'wcpt_' ); 684 ?> 687 688 ?> 685 689 686 690 <div class="inside"> … … 693 697 694 698 <?php else : ?> 695 <?php // todo indent the contents (and do other whitespace cleanup) in the next commit. avoid doing here because of diff noise. ?> 696 <p> 697 <strong><?php echo $key; ?></strong> 698 </p> 699 <p> 700 <label class="screen-reader-text" for="<?php echo $object_name; ?>"><?php echo $key; ?></label> 701 702 <?php switch ( $value ) { 703 case 'text' : ?> 704 705 <input type="text" size="36" name="<?php echo $object_name; ?>" id="<?php echo $object_name; ?>" value="<?php echo esc_attr( get_post_meta( $post_id, $key, true ) ); ?>" /> 706 707 <?php break; 708 709 case 'date' : 710 711 // Quick filter on dates 712 if ( $date = get_post_meta( $post_id, $key, true ) ) { 713 $date = date( 'Y-m-d', $date ); 714 } 715 716 ?> 717 718 <input type="text" size="36" class="date-field" name="<?php echo $object_name; ?>" id="<?php echo $object_name; ?>" value="<?php echo $date; ?>" /> 719 720 <?php break; 721 722 case 'textarea' : ?> 723 724 <textarea rows="4" cols="23" name="<?php echo $object_name; ?>" id="<?php echo $object_name; ?>"><?php echo esc_attr( get_post_meta( $post_id, $key, true ) ); ?></textarea> 725 726 <?php break; 727 728 default: 729 do_action( 'wcpt_metabox_value', $key, $value, $object_name ); 730 break; 731 } ?> 732 733 </p> 699 700 <p> 701 <strong><?php echo $key; ?></strong> 702 </p> 703 704 <p> 705 <label class="screen-reader-text" for="<?php echo $object_name; ?>"><?php echo $key; ?></label> 706 707 <?php switch ( $value ) : 708 case 'text' : ?> 709 710 <input type="text" size="36" name="<?php echo $object_name; ?>" id="<?php echo $object_name; ?>" value="<?php echo esc_attr( get_post_meta( $post_id, $key, true ) ); ?>" /> 711 712 <?php break; 713 case 'date' : 714 715 // Quick filter on dates 716 if ( $date = get_post_meta( $post_id, $key, true ) ) { 717 $date = date( 'Y-m-d', $date ); 718 } 719 720 ?> 721 722 <input type="text" size="36" class="date-field" name="<?php echo $object_name; ?>" id="<?php echo $object_name; ?>" value="<?php echo $date; ?>" /> 723 724 <?php break; 725 case 'textarea' : ?> 726 727 <textarea rows="4" cols="23" name="<?php echo $object_name; ?>" id="<?php echo $object_name; ?>"><?php echo esc_attr( get_post_meta( $post_id, $key, true ) ); ?></textarea> 728 729 <?php break; 730 731 default: 732 do_action( 'wcpt_metabox_value', $key, $value, $object_name ); 733 break; 734 735 endswitch; ?> 736 </p> 737 738 <?php endif; ?> 734 739 </div> 735 <?php endif; ?> 736 737 <?php 738 739 endforeach; 740 741 <?php endforeach; 740 742 } 741 742 ?>
Note: See TracChangeset
for help on using the changeset viewer.