Changeset 8085 for sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/class-wordcamp-application.php
- Timestamp:
- 01/16/2019 03:36:24 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/class-wordcamp-application.php
r8083 r8085 14 14 const SHORTCODE_SLUG = 'wordcamp-organizer-application'; 15 15 16 static function get_event_label() { 16 /** 17 * Return publicly displayed name of the event 18 * 19 * @return string 20 */ 21 public static function get_event_label() { 17 22 return __( 'WordCamp', 'wordcamporg' ); 18 23 } … … 23 28 * @return string 24 29 */ 25 static function get_event_type() {30 public static function get_event_type() { 26 31 return WCPT_POST_TYPE_ID; 27 32 } … … 30 35 * Enqueue scripts and stylesheets 31 36 */ 32 function enqueue_assets() {37 public function enqueue_assets() { 33 38 global $post; 34 39 … … 53 58 * @return null|void 54 59 */ 55 function render_application_form( $countries ) {60 public function render_application_form( $countries ) { 56 61 render_wordcamp_application_form( $countries ); 57 62 } … … 64 69 * @return array|\WP_Error 65 70 */ 66 function validate_data( $unsafe_data ) {71 public function validate_data( $unsafe_data ) { 67 72 $safe_data = array(); 68 73 $unsafe_data = shortcode_atts( $this->get_default_application_values(), $unsafe_data ); … … 98 103 * @return array 99 104 */ 100 function get_default_application_values() {105 public function get_default_application_values() { 101 106 $values = array( 102 // Part 1 107 // Part 1. 103 108 'q_1079074_first_name' => '', 104 109 'q_1079074_last_name' => '', … … 118 123 'q_1068223_hope_to_accomplish_other' => '', 119 124 120 // Part 2 125 // Part 2. 121 126 'q_1045950_active_meetup' => '', 122 127 'q_1045953_role_in_meetup' => '', … … 128 133 'q_1079082_other_tech_events_success' => '', 129 134 130 // Part 3 135 // Part 3. 131 136 'q_1079103_wordcamp_location' => '', 132 137 'q_1046006_wordcamp_date' => '', … … 149 154 'q_1079098_anything_else' => '', 150 155 151 // Bonus 156 // Bonus. 152 157 'q_1079112_best_describes_you' => '', 153 158 'q_1079112_best_describes_you_other' => '', … … 172 177 */ 173 178 public static function get_application_report_url() { 174 return "https://central.wordcamp.org/reports/application-status/";179 return 'https://central.wordcamp.org/reports/application-status/'; 175 180 } 176 181 … … 182 187 * @return bool|\WP_Error 183 188 */ 184 function create_post( $data ) {185 // Create the post 189 public function create_post( $data ) { 190 // Create the post. 186 191 $user = wcorg_get_user_by_canonical_names( $data['q_4236565_wporg_username'] ); 187 192 $statues = \WordCamp_Loader::get_post_statuses(); … … 192 197 'post_title' => 'WordCamp ' . $data['q_1079103_wordcamp_location'], 193 198 'post_status' => WCPT_DEFAULT_STATUS, 194 'post_author' => is_a( $user, 'WP_User' ) ? $user->ID : 7694169, // Set `wordcamp` as author if supplied username is not valid 199 'post_author' => is_a( $user, 'WP_User' ) ? $user->ID : 7694169, // Set `wordcamp` as author if supplied username is not valid. 195 200 ); 196 201 … … 201 206 } 202 207 203 // Populate the meta fields 208 // Populate the meta fields. 204 209 add_post_meta( $post_id, '_application_data', $data ); 205 210 add_post_meta( $post_id, '_application_submitter_ip_address', $_SERVER['REMOTE_ADDR'] ); 206 211 207 208 212 add_post_meta( 209 $post_id, 'Organizer Name', sprintf( 213 $post_id, 214 'Organizer Name', 215 sprintf( 210 216 '%s %s', 211 217 $data['q_1079074_first_name'], … … 220 226 221 227 add_post_meta( 222 $post_id, 'Mailing Address', sprintf( 228 $post_id, 229 'Mailing Address', 230 sprintf( 223 231 "%s\n%s%s%s %s\n%s", 224 232 $data['q_1079060_add1'], … … 232 240 233 241 add_post_meta( 234 $post_id, '_status_change', array( 242 $post_id, 243 '_status_change', 244 array( 235 245 'timestamp' => time(), 236 246 'user_id' => is_a( $user, 'WP_User' ) ? $user->ID : 0, … … 248 258 * @return null|string 249 259 */ 250 function get_organizer_email() {260 public function get_organizer_email() { 251 261 if ( isset( $this->post ) && isset( $this->post->ID ) ) { 252 262 return get_post_meta( $this->post->ID, 'Email Address', true ); … … 259 269 * @return null|string 260 270 */ 261 function get_event_location() {271 public function get_event_location() { 262 272 if ( isset( $this->post ) && isset( $this->post->ID ) ) { 263 273 return get_post_meta( $this->post->ID, 'Location', true );
Note: See TracChangeset
for help on using the changeset viewer.