Changeset 6611
- Timestamp:
- 02/12/2018 10:23:27 PM (7 years ago)
- Location:
- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/sponsor-payment-stripe.php
r6602 r6611 6 6 namespace WordCamp\Budgets\Sponsor_Payment_Stripe; 7 7 use WordCamp\Utilities\Stripe_Client; 8 use WordCamp_Loader; 8 9 use WordCamp_Budgets; 9 10 use Exception; … … 34 35 'keys' => $keys, 35 36 'step' => STEP_SELECT_INVOICE, 36 'wordcamp s' => _get_wordcamps(),37 'wordcamp_query_options' => get_wordcamp_query_options(), 37 38 'currencies' => WordCamp_Budgets::get_currencies(), 38 39 'errors' => array(), … … 64 65 65 66 /** 66 * Return a list of valid WordCamp posts. 67 * 68 * @return array An array or WP_Post objects for all public WordCamps. 69 */ 70 function _get_wordcamps() { 71 static $wordcamps; 72 73 if ( ! isset( $wordcamps ) ) { 74 $wordcamps = get_posts( array( 75 'post_type' => 'wordcamp', 76 'post_status' => \WordCamp_Loader::get_public_post_statuses(), 77 'posts_per_page' => - 1, 78 'orderby' => 'title', 79 'order' => 'asc', 80 81 'meta_query' => array( 82 array( 83 'key' => 'Start Date (YYYY-mm-dd)', 84 'value' => strtotime( '-3 months' ), 85 'compare' => '>' 86 ) 67 * Returns query options to be used with `get_wordcamps()`. 68 * 69 * This provides a consistent and canonical source for the query options, so that all callers are in sync. 70 * 71 * @return array 72 */ 73 function get_wordcamp_query_options() { 74 return array( 75 'post_status' => WordCamp_Loader::get_public_post_statuses(), 76 'orderby' => 'title', 77 'order' => 'asc', 78 79 'meta_query' => array( 80 array( 81 'key' => 'Start Date (YYYY-mm-dd)', 82 'value' => strtotime( '-3 months' ), 83 'compare' => '>' 87 84 ) 88 ) ); 89 } 90 91 return $wordcamps; 85 ) 86 ); 92 87 } 93 88 … … 136 131 // Make sure the selected WordCamp is valid. 137 132 $wordcamp_id = absint( $_POST['wordcamp_id'] ); 138 $valid_ids = wp_list_pluck( _get_wordcamps(), 'ID' );133 $valid_ids = wp_list_pluck( get_wordcamps( get_wordcamp_query_options() ), 'ID' ); 139 134 140 135 if ( ! in_array( $wordcamp_id, $valid_ids ) ) { -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/views/sponsor-payment/main.php
r6603 r6611 29 29 <label><?php esc_html_e( 'Event', 'wordcamporg' ); ?></label> 30 30 <div class="control"> 31 <select name="wordcamp_id"> 32 <option value="" disabled selected><?php esc_html_e( 'Select a WordCamp', 'wordcamporg' ); ?></option> 33 <?php foreach ( $data['wordcamps'] as $wordcamp ) : ?> 34 <option value="<?php echo esc_attr( $wordcamp->ID ); ?>"><?php echo esc_html( $wordcamp->post_title ); ?></option> 35 <?php endforeach; ?> 36 </select> 31 <?php echo get_wordcamp_dropdown( 'wordcamp_id', $data['wordcamp_query_options'] ); ?> 37 32 </div> 38 33
Note: See TracChangeset
for help on using the changeset viewer.