Changeset 2898
- Timestamp:
- 04/05/2016 04:05:02 PM (9 years ago)
- Location:
- sites/trunk/wordcamp.org
- Files:
-
- 21 edited
- 4 copied
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org
-
Property
svn:mergeinfo
set to
/sites/branches/application-tracking/wordcamp.org merged eligible
-
Property
svn:mergeinfo
set to
-
sites/trunk/wordcamp.org/public_html/wp-content/mu-plugins/wcorg-json-api.php
r2358 r2898 1 1 <?php 2 3 2 /* 4 3 * Customizations to the JSON REST API … … 23 22 // Allow some routes to skip the JSON REST API v1 plugin. 24 23 add_action( 'parse_request', 'wcorg_json_v2_compat', 9 ); 24 25 // Allow users to read new post statuses. 26 add_filter( 'json_check_post_read_permission', 'wcorg_json_check_post_read_permission', 10, 2 ); 25 27 26 28 /** … … 372 374 return; 373 375 } 376 377 function wcorg_json_check_post_read_permission( $permission, $post ) { 378 if ( $permission || ! defined( 'WCPT_POST_TYPE_ID' ) ) { 379 return $permission; 380 } 381 382 if ( $post['post_type'] != WCPT_POST_TYPE_ID ) { 383 return $permission; 384 } 385 386 return in_array( $post['post_status'], WordCamp_Loader::get_public_post_statuses() ); 387 } -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-admin.php
r171 r2898 85 85 */ 86 86 function admin_head () { 87 ?> 87 ?> 88 88 89 <style type="text/css" media="screen"> 89 /*<![CDATA[*/ 90 <?php 91 // Add extra actions to WordCamp Post Type admin header area 92 do_action( 'wcpt_admin_head' ); 93 ?> 90 /*<![CDATA[*/ 91 <?php 92 // Add extra actions to WordCamp Post Type admin header area 93 do_action( 'wcpt_admin_head' ); 94 ?> 95 /*]]>*/ 96 </style> 94 97 95 /*]]>*/ 96 </style> 97 <?php 98 <?php 98 99 } 99 100 … … 125 126 return false; 126 127 127 ?> 128 <h3><?php _e( 'WordCamps', 'wcpt' ); ?></h3> 129 <table class="form-table"> 130 <tr valign="top"> 131 <th scope="row"><?php _e( 'WordCamps', 'wcpt' ); ?></th> 132 <td> 128 ?> 129 <h3><?php _e( 'WordCamps', 'wcpt' ); ?></h3> 133 130 134 </td> 135 </tr> 136 </table> 137 <?php 131 <table class="form-table"> 132 <tr valign="top"> 133 <th scope="row"><?php _e( 'WordCamps', 'wcpt' ); ?></th> 134 <td> 135 136 </td> 137 </tr> 138 </table> 139 <?php 138 140 139 141 // Add extra actions to WordCamp Post Type profile update … … 171 173 // Loop through menu order and do some rearranging 172 174 foreach ( $menu_order as $index => $item ) { 173 174 175 // Current item is our forum CPT, so set our separator here 175 176 if ( ( ( 'edit.php?post_type=' . WCPT_POST_TYPE_ID ) == $item ) ) { … … 181 182 if ( !in_array( $item, array( 'separator-wcpt' ) ) ) 182 183 $wcpt_menu_order[] = $item; 183 184 184 } 185 185 -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-functions.php
r171 r2898 44 44 */ 45 45 function wcpt_has_access () { 46 47 46 if ( is_super_admin () ) 48 47 $has_access = true; … … 86 85 } 87 86 88 ?> 87 /** 88 * Render the Log metabox 89 * 90 * @param WP_Post $post 91 */ 92 function wcpt_log_metabox( $post ) { 93 $entries = wcpt_get_log_entries( $post->ID ); 94 95 require_once( __DIR__ . '/views/common/metabox-log.php' ); 96 } 97 98 /** 99 * Get all the the entries 100 * 101 * @param int $wordcamp_id 102 * 103 * @return array 104 */ 105 function wcpt_get_log_entries( $wordcamp_id ) { 106 $entries = array(); 107 $notes = get_post_meta( $wordcamp_id, '_note' ); 108 $status_changes = get_post_meta( $wordcamp_id, '_status_change' ); 109 110 foreach ( array( 'note' => $notes, 'status_change' => $status_changes ) as $entry_type => $raw_entries ) { 111 foreach ( $raw_entries as $entry ) { 112 $user = get_user_by( 'id', $entry['user_id'] ); 113 114 $entry['type'] = $entry_type; 115 $entry['user_display_name'] = $user->display_name; 116 117 $entries[] = $entry; 118 } 119 } 120 121 usort( $entries, 'wcpt_sort_log_entries' ); 122 123 return $entries; 124 } 125 126 /** 127 * Sort the log entries in reverse-chronological order 128 * 129 * @param array $a 130 * @param array $b 131 * 132 * @return int 133 */ 134 function wcpt_sort_log_entries( $a, $b ) { 135 // If a status change and a note occur at the same time, show the change before the note 136 if ( $a['timestamp'] == $b['timestamp'] ) { 137 return ( 'status_change' == $a['type'] ) ? 1 : -1; 138 } 139 140 return ( $a['timestamp'] > $b['timestamp'] ) ? -1 : 1; 141 } 142 143 /** 144 * Render the Notes metabox 145 * 146 * @param WP_Post $post 147 */ 148 function wcpt_add_note_metabox( $post ) { 149 wp_nonce_field( 'wcpt_notes', 'wcpt_notes_nonce' ); 150 151 require_once( __DIR__ . '/views/common/metabox-notes.php' ); 152 } -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-loader.php
r171 r2898 15 15 */ 16 16 define( 'WCPT_VERSION', '0.1' ); 17 define( 'WCPT_DIR', plugin_dir_path( __FILE__ ) ); 18 define( 'WCPT_URL', plugins_url( '/', __FILE__ ) ); 17 19 18 20 if ( !class_exists( 'WCPT_Loader' ) ) : … … 30 32 * The main WordCamp Post Type loader 31 33 */ 32 function wcpt_loader () { 33 /** COMPONENT HOOKS ***************************************************/ 34 function __construct() { 35 add_action( 'plugins_loaded', array( $this, 'core_admin' ) ); 36 add_action( 'init', array( $this, 'core_text_domain' ) ); 34 37 35 // Attach the wcpt_loaded action to the WordPress plugins_loaded action. 36 add_action( 'plugins_loaded', array ( $this, 'component_loaded' ) ); 37 38 // Attach the wcpt_init to the WordPress init action. 39 add_action( 'init', array ( $this, 'component_init' ) ); 40 41 // Attach constants to wcpt_loaded. 42 add_action( 'wcpt_loaded', array ( $this, 'component_constants' ) ); 43 44 // Attach includes to wcpt_loaded. 45 add_action( 'wcpt_loaded', array ( $this, 'component_includes' ) ); 46 47 // Attach post type registration to wcpt_init. 48 add_action( 'wcpt_init', array ( $this, 'component_post_types' ) ); 49 50 // Attach tag registration wcpt_init. 51 add_action( 'wcpt_init', array ( $this, 'component_taxonomies' ) ); 52 53 /** CORE HOOKS ********************************************************/ 54 55 // Core Constants 56 add_action( 'wcpt_started', array ( $this, 'core_constants' ) ); 57 58 // Core Includes 59 add_action( 'wcpt_started', array ( $this, 'core_includes' ) ); 60 61 // Core Admin 62 add_action( 'wcpt_loaded', array ( $this, 'core_admin' ) ); 63 64 // Attach theme directory wcpt_loaded. 65 add_action( 'wcpt_loaded', array ( $this, 'core_theme_directory' ) ); 66 67 // Attach textdomain to wcpt_init. 68 add_action( 'wcpt_init', array ( $this, 'core_text_domain' ) ); 69 70 // Register WordCamp Post Type activation sequence 71 register_activation_hook( __FILE__, array( $this, 'activation' ) ); 72 73 // Register WordCamp Post Type deactivation sequence 74 register_deactivation_hook( __FILE__, array( $this, 'deactivation' ) ); 75 76 // Get this party started 77 do_action( 'wcpt_started' ); 38 $this->includes(); 78 39 } 79 40 80 41 /** 81 * core_constants ()82 *83 * WordCamp Core Constants84 */85 function core_constants () {86 // Turn debugging on/off87 if ( !defined( 'WCPT_DEBUG' ) )88 define( 'WCPT_DEBUG', WP_DEBUG );89 90 // Default slug for post type91 if ( !defined( 'WCPT_THEMES_DIR' ) )92 define( 'WCPT_THEMES_DIR', apply_filters( 'wcpt_themes_dir', WP_PLUGIN_DIR . '/wcpt-themes' ) );93 94 // WordCamp Post Type root directory95 define( 'WCPT_DIR', WP_PLUGIN_DIR . '/wcpt' );96 define( 'WCPT_URL', plugins_url( $path = '/wcpt' ) );97 98 // Images URL99 define( 'WCPT_IMAGES_URL', WCPT_URL . '/wcpt-images' );100 }101 102 /**103 * core_includes ()104 *105 42 * WordCamp Core File Includes 106 43 */ 107 function core_includes() {44 function includes() { 108 45 // Load the files 109 require_once ( WCPT_DIR . '/wcpt-functions.php' ); 110 require_once ( WCPT_DIR . '/wcpt-wordcamp/wordcamp-loader.php' ); 46 require_once ( WCPT_DIR . 'wcpt-functions.php' ); 47 require_once ( WCPT_DIR . 'wcpt-wordcamp/wordcamp-loader.php' ); 48 require_once ( WCPT_DIR . 'applications/common.php' ); 49 require_once ( WCPT_DIR . 'applications/tracker.php' ); 50 require_once ( WCPT_DIR . 'applications/wordcamp.php' ); 51 111 52 // Require admin files. 112 53 if ( is_admin() ) { 113 require_once ( WCPT_DIR . ' /wcpt-admin.php' );114 require_once ( WCPT_DIR . ' /wcpt-wordcamp/wordcamp-admin.php' );54 require_once ( WCPT_DIR . 'wcpt-admin.php' ); 55 require_once ( WCPT_DIR . 'wcpt-wordcamp/wordcamp-admin.php' ); 115 56 } 116 57 } 117 58 118 function core_admin 59 function core_admin() { 119 60 // Quick admin check 120 61 if ( !is_admin() ) … … 122 63 123 64 // Create admin 124 $GLOBALS['wcpt_admin'] = new WCPT_Admin();125 $GLOBALS['wordcamp_admin'] = new WordCamp_Admin();65 $GLOBALS['wcpt_admin'] = new WCPT_Admin; 66 $GLOBALS['wordcamp_admin'] = new WordCamp_Admin; 126 67 } 127 68 … … 131 72 * Load the translation file for current language 132 73 */ 133 function core_text_domain 74 function core_text_domain() { 134 75 $locale = apply_filters( 'wcpt_textdomain', get_locale() ); 135 136 $mofile = WCPT_DIR . "/wcpt-languages/wcpt-$locale.mo"; 76 $mofile = WCPT_DIR . "wcpt-languages/wcpt-$locale.mo"; 137 77 138 78 load_textdomain( 'wcpt', $mofile ); 139 140 /**141 * Text domain has been loaded142 */143 do_action( 'wcpt_load_textdomain' );144 }145 146 /**147 * core_theme_directory ()148 *149 * Sets up the WordCamp Post Type theme directory to use in WordPress150 *151 * @since WordCamp Post Type (0.1)152 * @uses register_theme_directory153 */154 function core_theme_directory () {155 register_theme_directory( WCPT_THEMES_DIR );156 157 /**158 * Theme directory has been registered159 */160 do_action( 'wcpt_register_theme_directory' );161 }162 163 /**164 * activation ()165 *166 * Runs on WordCamp Post Type activation167 *168 * @since WordCamp Post Type (0.1)169 */170 function activation () {171 register_uninstall_hook( __FILE__, array( $this, 'uninstall' ) );172 173 /**174 * WordCamp Post Type has been activated175 */176 do_action( 'wcpt_activation' );177 }178 179 /**180 * deactivation ()181 *182 * Runs on WordCamp Post Type deactivation183 *184 * @since WordCamp Post Type (0.1)185 */186 function deactivation () {187 do_action( 'wcpt_deactivation' );188 }189 190 /**191 * uninstall ()192 *193 * Runs when uninstalling WordCamp Post Type194 *195 * @since WordCamp Post Type (0.1)196 */197 function uninstall () {198 do_action( 'wcpt_uninstall' );199 }200 201 /**202 * component_constants ()203 *204 * Default component constants that can be overridden or filtered205 */206 function component_constants () {207 do_action( 'wcpt_constants' );208 }209 210 /**211 * component_includes ()212 *213 * Include required files214 *215 */216 function component_includes () {217 do_action( 'wcpt_includes' );218 }219 220 /**221 * component_loaded ()222 *223 * A WordCamp Post Type specific action to say that it has started its224 * boot strapping sequence. It's attached to the existing WordPress225 * action 'plugins_loaded' because that's when all plugins have loaded.226 *227 * @uses is_admin If in WordPress admin, load additional file228 * @uses do_action()229 */230 function component_loaded () {231 do_action( 'wcpt_loaded' );232 }233 234 /**235 * component_init ()236 *237 * Initialize WordCamp Post Type as part of the WordPress initilization process238 *239 * @uses do_action Calls custom action to allow external enhancement240 */241 function component_init () {242 do_action ( 'wcpt_init' );243 }244 245 /**246 * component_post_type ()247 *248 * Setup the post types and taxonomies249 */250 function component_post_types () {251 do_action ( 'wcpt_register_post_types' );252 }253 254 /**255 * component_taxonomies ()256 *257 * Register the built in WordCamp Post Type taxonomies258 *259 * @since WordCamp Post Type (0.1)260 *261 * @uses register_taxonomy()262 * @uses apply_filters()263 */264 function component_taxonomies () {265 do_action ( 'wcpt_register_taxonomies' );266 79 } 267 80 } … … 270 83 271 84 // Load everything up 272 $wcpt_loader = new WCPT_Loader(); 273 $wordcamp_loader = new WordCamp_Loader(); 274 ?> 85 $wcpt_loader = new WCPT_Loader; 86 $wordcamp_loader = new WordCamp_Loader; -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php
r2517 r2898 15 15 16 16 /** 17 * wcpt_admin ()18 *19 17 * Initialize WCPT Admin 20 18 */ 21 function WordCamp_Admin() {19 function __construct() { 22 20 $this->active_admin_notices = array(); 23 21 … … 27 25 // Forum column headers. 28 26 add_filter( 'manage_' . WCPT_POST_TYPE_ID . '_posts_columns', array( $this, 'column_headers' ) ); 27 add_filter( 'display_post_states', array( $this, 'display_post_states' ) ); 29 28 30 29 // Forum columns (in page row) … … 33 32 34 33 // Topic metabox actions 35 add_action( 'ad min_menu',array( $this, 'metabox' ) );36 add_action( 'save_post', array( $this, 'metabox_save' ) );34 add_action( 'add_meta_boxes', array( $this, 'metabox' ) ); 35 add_action( 'save_post', array( $this, 'metabox_save' ), 10, 2 ); 37 36 38 37 // Scripts and CSS … … 43 42 // Post status transitions 44 43 add_action( 'transition_post_status', array( $this, 'trigger_schedule_actions' ), 10, 3 ); 44 add_action( 'transition_post_status', array( $this, 'log_status_changes' ), 10, 3 ); 45 45 add_action( 'wcpt_added_to_planning_schedule', array( $this, 'add_organizer_to_central' ), 10 ); 46 46 add_action( 'wcpt_added_to_planning_schedule', array( $this, 'mark_date_added_to_planning_schedule' ), 10 ); 47 add_filter( 'wp_insert_post_data', array( $this, 'enforce_post_status _progression' ), 10, 2 );48 add_filter( 'wp_insert_post_data', array( $this, 'require_complete_meta_to_publish_wordcamp' ), 1 0, 2 );47 add_filter( 'wp_insert_post_data', array( $this, 'enforce_post_status' ), 10, 2 ); 48 add_filter( 'wp_insert_post_data', array( $this, 'require_complete_meta_to_publish_wordcamp' ), 11, 2 ); // after enforce_post_status 49 49 50 50 // Admin notices … … 87 87 'high' 88 88 ); 89 90 add_meta_box( 91 'wcpt_original_application', 92 'Original Application', 93 array( $this, 'original_application_metabox' ), 94 WCPT_POST_TYPE_ID, 95 'advanced', 96 'low' 97 ); 98 99 // Notes are private, so only show them to network admins 100 if ( current_user_can( 'manage_network' ) ) { 101 add_meta_box( 102 'wcpt_notes', 103 __( 'Add a Note', 'wordcamporg' ), 104 'wcpt_add_note_metabox', 105 WCPT_POST_TYPE_ID, 106 'side', 107 'low' 108 ); 109 110 add_meta_box( 111 'wcpt_log', 112 'Log', 113 'wcpt_log_metabox', 114 WCPT_POST_TYPE_ID, 115 'advanced', 116 'low' 117 ); 118 } 119 120 // Remove core's submitdiv. 121 remove_meta_box( 'submitdiv', WCPT_POST_TYPE_ID, 'side' ); 122 123 $statuses = WordCamp_Loader::get_post_statuses(); 124 125 add_meta_box( 126 'submitdiv', 127 __( 'Status', 'wordcamporg' ), 128 array( $this, 'metabox_status' ), 129 WCPT_POST_TYPE_ID, 130 'side', 131 'high' 132 ); 89 133 } 90 134 … … 97 141 * @return int 98 142 */ 99 function metabox_save( $post_id ) { 100 143 function metabox_save( $post_id, $post ) { 101 144 // Don't add/remove meta on revisions and auto-saves 102 145 if ( wp_is_post_autosave( $post_id ) || wp_is_post_revision( $post_id ) ) … … 110 153 // WordCamp post type only 111 154 if ( WCPT_POST_TYPE_ID != get_post_type() ) { 155 return; 156 } 157 158 // Make sure the requset came from the edit post screen. 159 if ( empty( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'update-post_' . $post_id ) ) { 112 160 return; 113 161 } … … 128 176 // Loop through meta keys and update 129 177 foreach ( $wcpt_meta_keys as $key => $value ) { 130 131 178 // Get post value 132 179 $post_value = wcpt_key_to_str( $key, 'wcpt_' ); … … 159 206 } 160 207 } 208 209 $this->validate_and_add_note( $post_id ); 210 } 211 212 /** 213 * Validate and add a new note 214 * 215 * @param int $post_id 216 */ 217 protected function validate_and_add_note( $post_id ) { 218 check_admin_referer( 'wcpt_notes', 'wcpt_notes_nonce' ); 219 220 $new_note_message = sanitize_text_field( wp_unslash( $_POST['wcpt_new_note'] ) ); 221 222 if ( empty( $new_note_message ) ) { 223 return; 224 } 225 226 add_post_meta( $post_id, '_note', array( 227 'timestamp' => time(), 228 'user_id' => get_current_user_id(), 229 'message' => $new_note_message, 230 ) ); 161 231 } 162 232 … … 197 267 */ 198 268 function meta_keys( $meta_group = '' ) { 199 200 269 /* 201 270 * Warning: These keys are used for both the input field label and the postmeta key, so if you want to … … 212 281 case 'organizer': 213 282 $retval = array ( 214 'Organizer Name' => 'text',215 'WordPress.org Username' => 'text',216 'Email Address' => 'text',// Note: This is the lead organizer's e-mail address, which is different than the "E-mail Address" field217 'Telephone' => 'text',218 'Mailing Address' => 'textarea',219 'Sponsor Wrangler Name' => 'text',220 'Sponsor Wrangler E-mail Address' => 'text',221 'Budget Wrangler Name' => 'text',222 'Budget Wrangler E-mail Address' => 'text',223 'Venue Wrangler Name' => 'text',224 'Venue Wrangler E-mail Address' => 'text',225 'Speaker Wrangler Name' => 'text',226 'Speaker Wrangler E-mail Address' => 'text',227 'Food/Beverage Wrangler Name' => 'text',228 'Food/Beverage Wrangler E-mail Address' => 'text',229 'Swag Wrangler Name' => 'text',230 'Swag Wrangler E-mail Address' => 'text',231 'Volunteer Wrangler Name' => 'text',232 'Volunteer Wrangler E-mail Address' => 'text',233 'Printing Wrangler Name' => 'text',234 'Printing Wrangler E-mail Address' => 'text',235 'Design Wrangler Name' => 'text',236 'Design Wrangler E-mail Address' => 'text',237 'Website Wrangler Name' => 'text',238 'Website Wrangler E-mail Address' => 'text',239 'Social Media/Publicity Wrangler Name' 240 'Social Media/Publicity Wrangler E-mail Address' 241 'A/V Wrangler Name' => 'text',242 'A/V Wrangler E-mail Address' => 'text',243 'Party Wrangler Name' => 'text',244 'Party Wrangler E-mail Address' => 'text',245 'Travel Wrangler Name' => 'text',246 'Travel Wrangler E-mail Address' => 'text',247 'Safety Wrangler Name' => 'text',248 'Safety Wrangler E-mail Address' => 'text',249 'Mentor Name' => 'text',250 'Mentor E-mail Address' => 'text',283 'Organizer Name' => 'text', 284 'WordPress.org Username' => 'text', 285 'Email Address' => 'text', // Note: This is the lead organizer's e-mail address, which is different than the "E-mail Address" field 286 'Telephone' => 'text', 287 'Mailing Address' => 'textarea', 288 'Sponsor Wrangler Name' => 'text', 289 'Sponsor Wrangler E-mail Address' => 'text', 290 'Budget Wrangler Name' => 'text', 291 'Budget Wrangler E-mail Address' => 'text', 292 'Venue Wrangler Name' => 'text', 293 'Venue Wrangler E-mail Address' => 'text', 294 'Speaker Wrangler Name' => 'text', 295 'Speaker Wrangler E-mail Address' => 'text', 296 'Food/Beverage Wrangler Name' => 'text', 297 'Food/Beverage Wrangler E-mail Address' => 'text', 298 'Swag Wrangler Name' => 'text', 299 'Swag Wrangler E-mail Address' => 'text', 300 'Volunteer Wrangler Name' => 'text', 301 'Volunteer Wrangler E-mail Address' => 'text', 302 'Printing Wrangler Name' => 'text', 303 'Printing Wrangler E-mail Address' => 'text', 304 'Design Wrangler Name' => 'text', 305 'Design Wrangler E-mail Address' => 'text', 306 'Website Wrangler Name' => 'text', 307 'Website Wrangler E-mail Address' => 'text', 308 'Social Media/Publicity Wrangler Name' => 'text', 309 'Social Media/Publicity Wrangler E-mail Address' => 'text', 310 'A/V Wrangler Name' => 'text', 311 'A/V Wrangler E-mail Address' => 'text', 312 'Party Wrangler Name' => 'text', 313 'Party Wrangler E-mail Address' => 'text', 314 'Travel Wrangler Name' => 'text', 315 'Travel Wrangler E-mail Address' => 'text', 316 'Safety Wrangler Name' => 'text', 317 'Safety Wrangler E-mail Address' => 'text', 318 'Mentor Name' => 'text', 319 'Mentor E-mail Address' => 'text', 251 320 ); 252 321 … … 292 361 'Multi-Event Sponsor Region' => 'mes-dropdown', 293 362 294 'Organizer Name' => 'text',295 'WordPress.org Username' => 'text',296 'Email Address' => 'text',297 'Telephone' => 'text',298 'Mailing Address' => 'textarea',299 'Sponsor Wrangler Name' => 'text',300 'Sponsor Wrangler E-mail Address' => 'text',301 'Budget Wrangler Name' => 'text',302 'Budget Wrangler E-mail Address' => 'text',303 'Venue Wrangler Name' => 'text',304 'Venue Wrangler E-mail Address' => 'text',305 'Speaker Wrangler Name' => 'text',306 'Speaker Wrangler E-mail Address' => 'text',307 'Food/Beverage Wrangler Name' => 'text',308 'Food/Beverage Wrangler E-mail Address' => 'text',309 'Swag Wrangler Name' => 'text',310 'Swag Wrangler E-mail Address' => 'text',311 'Volunteer Wrangler Name' => 'text',312 'Volunteer Wrangler E-mail Address' => 'text',313 'Printing Wrangler Name' => 'text',314 'Printing Wrangler E-mail Address' => 'text',315 'Design Wrangler Name' => 'text',316 'Design Wrangler E-mail Address' => 'text',317 'Website Wrangler Name' => 'text',318 'Website Wrangler E-mail Address' => 'text',319 'Social Media/Publicity Wrangler Name' 320 'Social Media/Publicity Wrangler E-mail Address' 321 'A/V Wrangler Name' => 'text',322 'A/V Wrangler E-mail Address' => 'text',323 'Party Wrangler Name' => 'text',324 'Party Wrangler E-mail Address' => 'text',325 'Travel Wrangler Name' => 'text',326 'Travel Wrangler E-mail Address' => 'text',327 'Safety Wrangler Name' => 'text',328 'Safety Wrangler E-mail Address' => 'text',329 'Mentor Name' => 'text',330 'Mentor E-mail Address' => 'text',363 'Organizer Name' => 'text', 364 'WordPress.org Username' => 'text', 365 'Email Address' => 'text', 366 'Telephone' => 'text', 367 'Mailing Address' => 'textarea', 368 'Sponsor Wrangler Name' => 'text', 369 'Sponsor Wrangler E-mail Address' => 'text', 370 'Budget Wrangler Name' => 'text', 371 'Budget Wrangler E-mail Address' => 'text', 372 'Venue Wrangler Name' => 'text', 373 'Venue Wrangler E-mail Address' => 'text', 374 'Speaker Wrangler Name' => 'text', 375 'Speaker Wrangler E-mail Address' => 'text', 376 'Food/Beverage Wrangler Name' => 'text', 377 'Food/Beverage Wrangler E-mail Address' => 'text', 378 'Swag Wrangler Name' => 'text', 379 'Swag Wrangler E-mail Address' => 'text', 380 'Volunteer Wrangler Name' => 'text', 381 'Volunteer Wrangler E-mail Address' => 'text', 382 'Printing Wrangler Name' => 'text', 383 'Printing Wrangler E-mail Address' => 'text', 384 'Design Wrangler Name' => 'text', 385 'Design Wrangler E-mail Address' => 'text', 386 'Website Wrangler Name' => 'text', 387 'Website Wrangler E-mail Address' => 'text', 388 'Social Media/Publicity Wrangler Name' => 'text', 389 'Social Media/Publicity Wrangler E-mail Address' => 'text', 390 'A/V Wrangler Name' => 'text', 391 'A/V Wrangler E-mail Address' => 'text', 392 'Party Wrangler Name' => 'text', 393 'Party Wrangler E-mail Address' => 'text', 394 'Travel Wrangler Name' => 'text', 395 'Travel Wrangler E-mail Address' => 'text', 396 'Safety Wrangler Name' => 'text', 397 'Safety Wrangler E-mail Address' => 'text', 398 'Mentor Name' => 'text', 399 'Mentor E-mail Address' => 'text', 331 400 332 401 'Venue Name' => 'text', … … 356 425 function admin_print_scripts() { 357 426 if ( get_post_type() == WCPT_POST_TYPE_ID ) : 427 358 428 ?> 359 429 … … 403 473 if ( !wcpt_has_access() ) 404 474 return false; 405 406 475 } 407 476 … … 414 483 */ 415 484 function user_profile_wordcamp( $profileuser ) { 416 417 485 if ( !wcpt_has_access() ) 418 486 return false; 419 420 487 ?> 421 488 422 489 <h3><?php _e( 'WordCamps', 'wcpt' ); ?></h3> 490 423 491 <table class="form-table"> 424 492 <tr valign="top"> 425 493 <th scope="row"><?php _e( 'WordCamps', 'wcpt' ); ?></th> 494 426 495 <td> 427 428 496 </td> 429 497 </tr> … … 455 523 456 524 /** 525 * Display the status of a WordCamp post 526 * 527 * @param array $states 528 * 529 * @return array 530 */ 531 public function display_post_states( $states ) { 532 global $post; 533 534 if ( $post->post_type != WCPT_POST_TYPE_ID ) { 535 return $states; 536 } 537 538 $status = get_post_status_object( $post->post_status ); 539 if ( get_query_var( 'post_status' ) != $post->post_status ) { 540 $states[ $status->name ] = $status->label; 541 } 542 543 return $states; 544 } 545 546 /** 457 547 * column_data ( $column, $post_id ) 458 548 * … … 472 562 473 563 case 'wcpt_date' : 474 475 564 // Has a start date 476 565 if ( $start = wcpt_get_wordcamp_start_date() ) { … … 526 615 echo implode( ' - ', (array) $wc ); 527 616 } 617 528 618 return $actions; 529 619 } … … 531 621 /** 532 622 * Trigger actions related to WordCamps being scheduled. 533 *534 * When an application is submitted, a `wordcamp` post is created with a `draft` status. When it's accepted535 * to the planning schedule the status changes to `pending`, and when it's accepted for the final schedule536 * the status changes to 'publish'.537 623 * 538 624 * @param string $new_status … … 545 631 } 546 632 633 if ( $new_status == $old_status ) { 634 return; 635 } 636 637 if ( $old_status == 'wcpt-pre-planning' && $new_status == 'wcpt-pre-planning' ) { 638 do_action( 'wcpt_added_to_planning_schedule', $post ); 639 } elseif ( $old_status == 'wcpt-needs-schedule' && $new_status == 'wcpt-scheduled' ) { 640 do_action( 'wcpt_added_to_final_schedule', $post ); 641 } 642 643 // back-compat for old statuses 547 644 if ( 'draft' == $old_status && 'pending' == $new_status ) { 548 645 do_action( 'wcpt_added_to_planning_schedule', $post ); … … 550 647 do_action( 'wcpt_added_to_final_schedule', $post ); 551 648 } 649 650 // todo add new triggers - which ones? 651 } 652 653 /** 654 * Log when the post status changes 655 * 656 * @param string $new_status 657 * @param string $old_status 658 * @param WP_Post $post 659 */ 660 public function log_status_changes( $new_status, $old_status, $post ) { 661 if ( $new_status === $old_status || $new_status == 'auto-draft' ) { 662 return; 663 } 664 665 if ( empty( $post->post_type ) || WCPT_POST_TYPE_ID != $post->post_type ) { 666 return; 667 } 668 669 $old_status = get_post_status_object( $old_status ); 670 $new_status = get_post_status_object( $new_status ); 671 672 add_post_meta( $post->ID, '_status_change', array( 673 'timestamp' => time(), 674 'user_id' => get_current_user_id(), 675 'message' => sprintf( '%s → %s', $old_status->label, $new_status->label ), 676 ) ); 552 677 } 553 678 … … 581 706 582 707 /** 583 * Force WordCamp posts to go through the expected status progression. 584 * 585 * They should start as drafts, then move to pending, and then be published. This is necessary because 586 * many automated processes (e.g., Organizer Reminder emails) are triggered when the post moves from 587 * one status to another, and deviations from the expected progression can cause bugs. 588 * 589 * Posts should still be allowed to move backwards in the progression, though. 708 * Enforce a valid post status for WordCamps. 590 709 * 591 710 * @param array $post_data … … 593 712 * @return array 594 713 */ 595 public function enforce_post_status_progression( $post_data, $post_data_raw ) { 596 if ( WCPT_POST_TYPE_ID == $post_data['post_type'] && ! empty( $_POST ) ) { 597 $previous_post_status = get_post( absint( $_POST['post_ID'] ) ); 598 $previous_post_status = $previous_post_status->post_status; 599 600 if ( 'pending' == $post_data['post_status'] && ! in_array( $previous_post_status, array( 'draft', 'pending', 'publish' ) ) ) { 601 $this->active_admin_notices[] = 2; 602 $post_data['post_status'] = $previous_post_status; 714 public function enforce_post_status( $post_data, $post_data_raw ) { 715 if ( $post_data['post_type'] != WCPT_POST_TYPE_ID || empty( $_POST['post_ID'] ) ) { 716 return $post_data; 717 } 718 719 $post = get_post( $_POST['post_ID'] ); 720 if ( ! $post ) { 721 return $post_data; 722 } 723 724 if ( ! empty( $post_data['post_status'] ) ) { 725 // Only network admins can change WordCamp statuses. 726 if ( ! current_user_can( 'network_admin' ) ) { 727 $post_data['post_status'] = $post->post_status; 603 728 } 604 729 605 if ( 'publish' == $post_data['post_status'] && ! in_array( $previous_post_status, array( 'pending', 'publish' ) ) ) { 606 $this->active_admin_notices[] = 2; 607 $post_data['post_status'] = $previous_post_status; 730 // Enforce a valid status. 731 $statuses = array_keys( WordCamp_Loader::get_post_statuses() ); 732 $statuses = array_merge( $statuses, array( 'trash' ) ); 733 734 if ( ! in_array( $post_data['post_status'], $statuses ) ) { 735 $post_data['post_status'] = $statuses[0]; 608 736 } 609 737 } … … 627 755 $min_site_id = apply_filters( 'wcpt_require_complete_meta_min_site_id', '2416297' ); 628 756 629 $required_p ending_fields = $this->get_required_fields( 'pending' );630 $required_ publish_fields = $this->get_required_fields( 'publish' );757 $required_pre_planning_fields = $this->get_required_fields( 'pre-planning' ); 758 $required_scheduled_fields = $this->get_required_fields( 'scheduled' ); 631 759 632 760 // Check pending posts 633 if ( ' pending' == $post_data['post_status'] && absint( $_POST['post_ID'] ) > $min_site_id ) {634 foreach( $required_p ending_fields as $field ) {761 if ( 'wcpt-approved-pre-pl' == $post_data['post_status'] && absint( $_POST['post_ID'] ) > $min_site_id ) { 762 foreach( $required_pre_planning_fields as $field ) { 635 763 $value = $_POST[ wcpt_key_to_str( $field, 'wcpt_' ) ]; 636 764 637 765 if ( empty( $value ) || 'null' == $value ) { 638 $post_data['post_status'] = 'draft'; 766 $post_data['post_status'] = 'wcpt-interview-sched'; 767 $this->active_admin_notices[] = 1; 768 break; 769 } 770 } 771 } 772 773 // Check published posts 774 if ( 'wcpt-scheduled' == $post_data['post_status'] && isset( $_POST['post_ID'] ) && absint( $_POST['post_ID'] ) > $min_site_id ) { 775 foreach( $required_scheduled_fields as $field ) { 776 $value = $_POST[ wcpt_key_to_str( $field, 'wcpt_' ) ]; 777 778 if ( empty( $value ) || 'null' == $value ) { 779 $post_data['post_status'] = 'wcpt-needs-schedule'; 639 780 $this->active_admin_notices[] = 3; 640 781 break; … … 643 784 } 644 785 645 // Check published posts646 if ( 'publish' == $post_data['post_status'] && isset( $_POST['post_ID'] ) && absint( $_POST['post_ID'] ) > $min_site_id ) {647 foreach( $required_publish_fields as $field ) {648 $value = $_POST[ wcpt_key_to_str( $field, 'wcpt_' ) ];649 650 if ( empty( $value ) || 'null' == $value ) {651 $post_data['post_status'] = 'pending';652 $this->active_admin_notices[] = 1;653 break;654 }655 }656 }657 658 786 return $post_data; 659 787 } … … 662 790 * Get a list of fields required to move to a certain post status 663 791 * 664 * @param string $status 'p ending' | 'publish' | 'any'792 * @param string $status 'pre-planning' | 'scheduled' | 'any' 665 793 * 666 794 * @return array 667 795 */ 668 796 public static function get_required_fields( $status ) { 669 $p ending = array( 'E-mail Address' );670 671 $ publish= array(797 $pre_planning = array( 'E-mail Address' ); 798 799 $scheduled = array( 672 800 // WordCamp 673 801 'Start Date (YYYY-mm-dd)', … … 691 819 692 820 switch ( $status ) { 693 case 'p ending':694 $required_fields = $p ending;821 case 'pre-planning': 822 $required_fields = $pre_planning; 695 823 break; 696 824 697 case ' publish':698 $required_fields = $ publish;825 case 'scheduled': 826 $required_fields = $scheduled; 699 827 break; 700 828 701 829 case 'any': 702 830 default: 703 $required_fields = array_merge( $p ending, $publish);831 $required_fields = array_merge( $pre_planning, $scheduled ); 704 832 break; 705 833 } … … 751 879 1 => array( 752 880 'type' => 'error', 753 'notice' => __( 'This WordCamp cannot be published until all of its required metadata is filled in.', 'wordcamporg' ), 754 ), 755 756 2 => array( 757 'type' => 'error', 758 'notice' => sprintf( 759 __( 760 'WordCamps must start as drafts, then be set as pending, and then be published. The post status has been reset to <strong>%s</strong>.', // todo improve language 761 'wordcamporg' 762 ), 763 $post->post_status 764 ) 881 'notice' => __( 'This WordCamp cannot be approved for pre-planning until all of its required metadata is filled in.', 'wordcamporg' ), 765 882 ), 766 883 767 884 3 => array( 768 885 'type' => 'error', 769 'notice' => __( 'This WordCamp cannot be set to pendinguntil all of its required metadata is filled in.', 'wordcamporg' ),886 'notice' => __( 'This WordCamp cannot be added to the schedule until all of its required metadata is filled in.', 'wordcamporg' ), 770 887 ), 771 888 ); … … 786 903 } 787 904 } 905 } 906 907 /** 908 * Render the WordCamp status meta box. 909 */ 910 public function metabox_status( $post ) { 911 require_once( WCPT_DIR . 'views/wordcamp/metabox-status.php' ); 912 } 913 914 /** 915 * Render the WordCamp status meta box. 916 */ 917 public function original_application_metabox( $post ) { 918 $application_data = get_post_meta( $post->ID, '_application_data', true ); 919 require_once( WCPT_DIR . 'views/wordcamp/metabox-original-application.php' ); 788 920 } 789 921 } … … 885 1017 <?php if ( ! empty( $messages[ $key ] ) ) : ?> 886 1018 <?php if ( 'textarea' == $value ) { echo '<br />'; } ?> 887 1019 888 1020 <span class="description"><?php echo esc_html( $messages[ $key ] ); ?></span> 889 1021 <?php endif; ?> -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-loader.php
r1230 r2898 1 1 <?php 2 2 3 if ( !class_exists( 'WordCamp_Loader' ) ) : 3 define( 'WCPT_POST_TYPE_ID', 'wordcamp' ); 4 define( 'WCPT_YEAR_ID', 'wordcamp_year' ); 5 define( 'WCPT_SLUG', 'wordcamps' ); 6 define( 'WCPT_DEFAULT_STATUS', 'wcpt-needs-vetting' ); 7 define( 'WCPT_FINAL_STATUS', 'wcpt-closed' ); 8 9 if ( ! class_exists( 'WordCamp_Loader' ) ) : 4 10 /** 5 11 * WordCamp_Loader … … 15 21 * The main WordCamp Post Type loader 16 22 */ 17 function wordcamp_loader () { 18 19 // Attach constants to wcpt_loaded. 20 add_action( 'wcpt_constants', array ( $this, 'constants' ) ); 21 22 // Attach includes to wcpt_includes. 23 add_action( 'wcpt_includes', array ( $this, 'includes' ) ); 24 25 // Attach post type registration to wcpt_register_post_types. 26 add_action( 'wcpt_register_post_types', array ( $this, 'register_post_types' ) ); 27 28 // Attach tag registration wcpt_register_taxonomies. 29 //add_action( 'wcpt_register_taxonomies', array ( $this, 'register_taxonomies' ) ); 30 } 31 32 /** 33 * constants () 34 * 35 * Default component constants that can be overridden or filtered 36 */ 37 function constants () { 38 39 // The default post type ID 40 if ( !defined( 'WCPT_POST_TYPE_ID' ) ) 41 define( 'WCPT_POST_TYPE_ID', apply_filters( 'wcpt_post_type_id', 'wordcamp' ) ); 42 43 // The default year ID 44 if ( !defined( 'WCPT_YEAR_ID' ) ) 45 define( 'WCPT_YEAR_ID', apply_filters( 'wcpt_tag_id', 'wordcamp_year' ) ); 46 47 // Default slug for post type 48 if ( !defined( 'WCPT_SLUG' ) ) 49 define( 'WCPT_SLUG', apply_filters( 'wcpt_slug', 'wordcamps' ) ); 23 function __construct() { 24 add_action( 'plugins_loaded', array( $this, 'includes' ) ); 25 add_action( 'init', array( $this, 'register_post_types' ) ); 26 add_action( 'init', array( $this, 'register_post_statuses' ) ); 50 27 } 51 28 … … 58 35 */ 59 36 function includes () { 60 61 37 // Load the files 62 require_once ( WCPT_DIR . ' /wcpt-wordcamp/wordcamp-template.php' );38 require_once ( WCPT_DIR . 'wcpt-wordcamp/wordcamp-template.php' ); 63 39 64 40 // Quick admin check and load if needed 65 41 if ( is_admin() ) 66 require_once ( WCPT_DIR . '/wcpt-wordcamp/wordcamp-admin.php' ); 67 68 require_once( WCPT_DIR . '/wcpt-wordcamp/wordcamp-new-site.php' ); 69 $GLOBALS['wordcamp_new_site'] = new WordCamp_New_Site(); 42 require_once ( WCPT_DIR . 'wcpt-wordcamp/wordcamp-admin.php' ); 43 44 require_once( WCPT_DIR . 'wcpt-wordcamp/wordcamp-new-site.php' ); 45 46 $GLOBALS['wordcamp_new_site'] = new WordCamp_New_Site; 70 47 } 71 48 … … 77 54 * @todo Finish up the post type admin area with messages, columns, etc...* 78 55 */ 79 function register_post_types () { 80 56 function register_post_types() { 81 57 // WordCamp post type labels 82 58 $wcpt_labels = array ( 83 'name' => __( 'WordCamps', 'wcpt' ),84 'singular_name' => __( 'WordCamp', 'wcpt' ),85 'add_new' => __( 'Add New', 'wcpt' ),86 'add_new_item' => __( 'Create New WordCamp', 'wcpt' ),87 'edit' => __( 'Edit', 'wcpt' ),88 'edit_item' => __( 'Edit WordCamp', 'wcpt' ),89 'new_item' => __( 'New WordCamp', 'wcpt' ),90 'view' => __( 'View WordCamp', 'wcpt' ),91 'view_item' => __( 'View WordCamp', 'wcpt' ),92 'search_items' => __( 'Search WordCamps', 'wcpt' ),93 'not_found' => __( 'No WordCamps found', 'wcpt' ),59 'name' => __( 'WordCamps', 'wcpt' ), 60 'singular_name' => __( 'WordCamp', 'wcpt' ), 61 'add_new' => __( 'Add New', 'wcpt' ), 62 'add_new_item' => __( 'Create New WordCamp', 'wcpt' ), 63 'edit' => __( 'Edit', 'wcpt' ), 64 'edit_item' => __( 'Edit WordCamp', 'wcpt' ), 65 'new_item' => __( 'New WordCamp', 'wcpt' ), 66 'view' => __( 'View WordCamp', 'wcpt' ), 67 'view_item' => __( 'View WordCamp', 'wcpt' ), 68 'search_items' => __( 'Search WordCamps', 'wcpt' ), 69 'not_found' => __( 'No WordCamps found', 'wcpt' ), 94 70 'not_found_in_trash' => __( 'No WordCamps found in Trash', 'wcpt' ), 95 'parent_item_colon' => __( 'Parent WordCamp:', 'wcpt' )71 'parent_item_colon' => __( 'Parent WordCamp:', 'wcpt' ) 96 72 ); 97 73 … … 112 88 113 89 // Register WordCamp post type 114 register_post_type ( 115 WCPT_POST_TYPE_ID, 116 apply_filters( 'wcpt_register_post_type', 117 array ( 118 'labels' => $wcpt_labels, 119 'rewrite' => $wcpt_rewrite, 120 'supports' => $wcpt_supports, 121 'menu_position' => '100', 122 'public' => true, 123 'show_ui' => true, 124 'can_export' => true, 125 'capability_type' => 'post', 126 'hierarchical' => false, 127 'has_archive' => true, 128 'query_var' => true, 129 'menu_icon' => 'dashicons-wordpress', 130 ) 131 ) 132 ); 133 } 134 135 /** 136 * register_taxonomies () 137 * 138 * Register the built in WordCamp Post Type taxonomies 139 * 140 * @since WordCamp Post Type (0.1) 141 * 142 * @uses register_taxonomy() 143 * @uses apply_filters() 144 */ 145 function register_taxonomies () { 146 147 // Tag labels 148 $tag_labels = array ( 149 'name' => __( 'Years', 'wcpt' ), 150 'singular_name' => __( 'Year', 'wcpt' ), 151 'search_items' => __( 'Search Years', 'wcpt' ), 152 'popular_items' => __( 'Popular Years', 'wcpt' ), 153 'all_items' => __( 'All Years', 'wcpt' ), 154 'edit_item' => __( 'Edit Year', 'wcpt' ), 155 'update_item' => __( 'Update Year', 'wcpt' ), 156 'add_new_item' => __( 'Add Year', 'wcpt' ), 157 'new_item_name' => __( 'New Year', 'wcpt' ), 158 ); 159 160 // Tag rewrite 161 $tag_rewrite = array ( 162 'slug' => 'year' 163 ); 164 165 // Register the tag taxonomy 166 register_taxonomy ( 167 WCPT_TAG_ID, // The tag ID 168 WCPT_POST_TYPE_ID, // The post type ID 169 apply_filters( 'wcpt_register_year', 170 array ( 171 'labels' => $tag_labels, 172 'rewrite' => $tag_rewrite, 173 //'update_count_callback' => '_update_post_term_count', 174 'query_var' => 'wc-year', 175 'hierarchical' => false, 176 'public' => true, 177 'show_ui' => true, 178 ) 179 ) 180 ); 90 register_post_type( WCPT_POST_TYPE_ID, array( 91 'labels' => $wcpt_labels, 92 'rewrite' => $wcpt_rewrite, 93 'supports' => $wcpt_supports, 94 'menu_position' => '100', 95 'public' => true, 96 'show_ui' => true, 97 'can_export' => true, 98 'capability_type' => 'post', 99 'hierarchical' => false, 100 'has_archive' => true, 101 'query_var' => true, 102 'menu_icon' => 'dashicons-wordpress', 103 ) ); 104 } 105 106 public function register_post_statuses() { 107 foreach ( self::get_post_statuses() as $key => $label ) { 108 register_post_status( $key, array( 109 'label' => $label, 110 'public' => true, 111 'label_count' => _nx_noop( 112 sprintf( '%s <span class="count">(%s)</span>', $label, '%s' ), 113 sprintf( '%s <span class="count">(%s)</span>', $label, '%s' ), 114 'wordcamporg' 115 ), 116 ) ); 117 } 118 } 119 120 /** 121 * Get WordCamp post statuses. 122 * 123 * @return array 124 */ 125 public static function get_post_statuses() { 126 return array( 127 'wcpt-needs-vetting' => _x( 'Needs Vetting', 'wordcamp status', 'wordcamporg' ), 128 'wcpt-needs-orientati' => _x( 'Needs Orientation/Interview', 'wordcamp status', 'wordcamporg' ), 129 'wcpt-more-info-reque' => _x( 'More Info Requested', 'wordcamp status', 'wordcamporg' ), 130 'wcpt-needs-rejection' => _x( 'Needs Rejection E-mail', 'wordcamp status', 'wordcamporg' ), 131 'wcpt-interview-sched' => _x( 'Interview/Orientation Scheduled', 'wordcamp status', 'wordcamporg' ), 132 'wcpt-rejected' => _x( 'Rejected', 'wordcamp status', 'wordcamporg' ), 133 'wcpt-cancelled' => _x( 'Cancelled', 'wordcamp status', 'wordcamporg' ), 134 'wcpt-approved-pre-pl' => _x( 'Approved for Pre-Planning Pending Agreement', 'wordcamp status', 'wordcamporg' ), 135 'wcpt-needs-email' => _x( 'Needs E-mail Address', 'wordcamp status', 'wordcamporg' ), 136 'wcpt-needs-site' => _x( 'Needs Site', 'wordcamp status', 'wordcamporg' ), 137 'wcpt-needs-polldaddy' => _x( 'Needs Polldaddy Account', 'wordcamp status', 'wordcamporg' ), 138 'wcpt-needs-mentor' => _x( 'Needs Mentor', 'wordcamp status', 'wordcamporg' ), 139 'wcpt-needs-pre-plann' => _x( 'Needs to be Added to Pre-Planning Schedule', 'wordcamp status', 'wordcamporg' ), 140 'wcpt-pre-planning' => _x( 'In Pre-Planning', 'wordcamp status', 'wordcamporg' ), 141 'wcpt-needs-budget-re' => _x( 'Needs Budget Review', 'wordcamp status', 'wordcamporg' ), 142 'wcpt-budget-rev-sche' => _x( 'Budget Review Scheduled', 'wordcamp status', 'wordcamporg' ), 143 'wcpt-needs-contract' => _x( 'Needs Contract to be Signed', 'wordcamp status', 'wordcamporg' ), 144 'wcpt-needs-fill-list' => _x( 'Needs to Fill Out WordCamp Listing', 'wordcamp status', 'wordcamporg' ), 145 'wcpt-needs-schedule' => _x( 'Needs to be Added to Official Schedule', 'wordcamp status', 'wordcamporg' ), 146 'wcpt-scheduled' => _x( 'WordCamp Scheduled', 'wordcamp status', 'wordcamporg' ), 147 'wcpt-needs-debrief' => _x( 'Needs Debrief', 'wordcamp status', 'wordcamporg' ), 148 'wcpt-debrief-schedul' => _x( 'Debrief Scheduled', 'wordcamp status', 'wordcamporg' ), 149 'wcpt-closed' => _x( 'WordCamp Closed', 'wordcamp status', 'wordcamporg' ), 150 ); 151 } 152 153 /** 154 * Get post statuses for WordCamps on schedule. 155 * 156 * @return array Post status names. 157 */ 158 public static function get_public_post_statuses() { 159 return array( 160 'wcpt-scheduled', 161 'wcpt-needs-debrief', 162 'wcpt-debrief-schedul', 163 'wcpt-closed', 164 165 // back-compat 166 'public', 167 ); 168 } 169 170 /** 171 * Get post statuses for WordCamps on pre-planning schedule. 172 * 173 * @return array Post status names. 174 */ 175 public static function get_pre_planning_post_statuses() { 176 return array( 177 'wcpt-pre-planning', 178 'wcpt-needs-budget-re', 179 'wcpt-budget-rev-sche', 180 'wcpt-needs-contract', 181 'wcpt-needs-fill-list', 182 'wcpt-needs-schedule', 183 184 // back-compat 185 'pending', 186 ); 187 } 188 189 /** 190 * Get the milestones that correspond to each status 191 * 192 * @return array 193 */ 194 public static function map_statuses_to_milestones() { 195 $milestones = array( 196 'wcpt-needs-vetting' => 'Application received', 197 'wcpt-needs-orientati' => 'Application vetted', 198 'wcpt-more-info-reque' => 'Application vetted', 199 'wcpt-needs-rejection' => 'Application vetted', 200 'wcpt-interview-sched' => 'Interview scheduled', 201 'wcpt-rejected' => 'Sent rejection email', 202 'wcpt-cancelled' => 'WordCamp cancelled', 203 'wcpt-approved-pre-pl' => 'Orientation/interview held', 204 'wcpt-needs-email' => 'Organizer agreement signed', 205 'wcpt-needs-site' => 'Email address/fwd set up', 206 'wcpt-needs-polldaddy' => 'Site created', 207 'wcpt-needs-mentor' => 'Polldaddy account created', 208 'wcpt-needs-pre-plann' => 'Mentor assigned', 209 'wcpt-pre-planning' => 'Added to pre-planning schedule', 210 'wcpt-needs-budget-re' => 'Budget review requested', 211 'wcpt-budget-rev-sche' => 'Budget review scheduled', 212 'wcpt-needs-contract' => 'Budget approved', 213 'wcpt-needs-fill-list' => 'Contract signed', 214 'wcpt-needs-schedule' => 'WordCamp listing filled out', 215 'wcpt-scheduled' => 'WordCamp added to official schedule', 216 'wcpt-needs-debrief' => 'WordCamp held', 217 'wcpt-debrief-schedul' => 'Debrief scheduled', 218 'wcpt-closed' => 'Debrief held', 219 ); 220 221 return $milestones; 222 } 223 224 /** 225 * Return valid transitions given a post status. 226 * 227 * @param string $status Current status. 228 * 229 * @return array Valid transitions. 230 */ 231 public static function get_valid_status_transitions( $status ) { 232 $transitions = array( 233 'wcpt-needs-vetting' => array( 'wcpt-needs-orientati', 'wcpt-more-info-reque', 'wcpt-needs-rejection' ), 234 'wcpt-needs-orientati' => array( 'wcpt-needs-vetting', 'wcpt-interview-sched' ), 235 'wcpt-more-info-reque' => array(), // Allowed from any status, see below 236 'wcpt-needs-rejection' => array( 'wcpt-needs-vetting', 'wcpt-rejected' ), 237 'wcpt-interview-sched' => array( 'wcpt-needs-orientati', 'wcpt-approved-pre-pl' ), 238 'wcpt-rejected' => array( 'wcpt-needs-rejection' ), 239 'wcpt-cancelled' => array(), // Allowed from any status, see below 240 'wcpt-approved-pre-pl' => array( 'wcpt-interview-sched', 'wcpt-needs-email' ), 241 'wcpt-needs-email' => array( 'wcpt-approved-pre-pl', 'wcpt-needs-site' ), 242 'wcpt-needs-site' => array( 'wcpt-needs-email', 'wcpt-needs-polldaddy' ), 243 'wcpt-needs-polldaddy' => array( 'wcpt-needs-site', 'wcpt-needs-mentor' ), 244 'wcpt-needs-mentor' => array( 'wcpt-needs-polldaddy', 'wcpt-needs-pre-plann' ), 245 'wcpt-needs-pre-plann' => array( 'wcpt-needs-mentor', 'wcpt-pre-planning' ), 246 'wcpt-pre-planning' => array( 'wcpt-needs-pre-plann', 'wcpt-needs-budget-re' ), 247 'wcpt-needs-budget-re' => array( 'wcpt-pre-planning', 'wcpt-budget-rev-sche' ), 248 'wcpt-budget-rev-sche' => array( 'wcpt-needs-budget-re', 'wcpt-needs-contract' ), 249 'wcpt-needs-contract' => array( 'wcpt-budget-rev-sche', 'wcpt-needs-fill-list' ), 250 'wcpt-needs-fill-list' => array( 'wcpt-needs-contract', 'wcpt-needs-schedule' ), 251 'wcpt-needs-schedule' => array( 'wcpt-needs-fill-list', 'wcpt-scheduled' ), 252 'wcpt-scheduled' => array( 'wcpt-needs-schedule', 'wcpt-needs-debrief' ), 253 'wcpt-needs-debrief' => array( 'wcpt-scheduled', 'wcpt-debrief-schedul' ), 254 'wcpt-debrief-schedul' => array( 'wcpt-needs-debrief', 'wcpt-closed' ), 255 'wcpt-closed' => array( 'wcpt-debrief-schedul' ), 256 ); 257 258 // Cancelled and More Info Requested can be switched to from any status. 259 foreach ( array_keys( $transitions ) as $key ) { 260 $transitions[ $key ][] = 'wcpt-more-info-reque'; 261 $transitions[ $key ][] = 'wcpt-cancelled'; 262 } 263 264 // Any status can be switched to from More Info Requested and Cancelled. 265 foreach ( array( 'wcpt-more-info-reque', 'wcpt-cancelled' ) as $key ) { 266 $transitions[ $key ] = array_keys( $transitions ); 267 } 268 269 if ( empty( $transitions[ $status ] ) ) 270 return array( 'wcpt-needs-vetting' ); 271 272 return $transitions[ $status ]; 181 273 } 182 274 } -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-new-site.php
r2859 r2898 100 100 } 101 101 102 $url = parse_url( $url );103 if ( ! $url || empty( $url['scheme'] ) || empty( $url['host'] ) ) {102 $url_components = parse_url( $url ); 103 if ( ! $url_components || empty( $url_components['scheme'] ) || empty( $url_components['host'] ) ) { 104 104 return; 105 105 } 106 $path = isset( $url ['path'] ) ? $url['path'] : '';106 $path = isset( $url_components['path'] ) ? $url_components['path'] : ''; 107 107 108 108 $wordcamp_meta = get_post_custom( $wordcamp_id ); 109 109 $lead_organizer = $this->get_user_or_current_user( $wordcamp_meta['WordPress.org Username'][0] ); 110 110 $site_meta = array( 'public' => 1 ); 111 $this->new_site_id = wpmu_create_blog( $url ['host'], $path, 'WordCamp Event', $lead_organizer->ID, $site_meta );111 $this->new_site_id = wpmu_create_blog( $url_components['host'], $path, 'WordCamp Event', $lead_organizer->ID, $site_meta ); 112 112 113 113 if ( is_int( $this->new_site_id ) ) { … … 117 117 // Configure the new site at priority 11, after all the custom fields on the `wordcamp` post have been saved, so that we don't use outdated values 118 118 add_action( 'save_post', array( $this, 'configure_new_site' ), 11, 2 ); 119 120 add_post_meta( $wordcamp_id, '_note', array( 121 'timestamp' => time(), 122 'user_id' => get_current_user_id(), 123 'message' => sprintf( 'Created site at <a href="%s">%s</a>', $url, $url ), 124 ) ); 119 125 } 120 126 } … … 199 205 // Make sure the new blog is https. 200 206 update_option( 'siteurl', set_url_scheme( get_option( 'siteurl' ), 'https' ) ); 201 update_option( 'home', set_url_scheme( get_option( 'home' ),'https' ) );207 update_option( 'home', set_url_scheme( get_option( 'home' ), 'https' ) ); 202 208 } 203 209 -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-template.php
r1652 r2898 14 14 * @return object Multidimensional array of WordCamp information 15 15 */ 16 function wcpt_has_wordcamps 16 function wcpt_has_wordcamps( $args = '' ) { 17 17 global $wcpt_template; 18 18 19 $default = array 19 $default = array( 20 20 // Narrow query down to WordCamp Post Type 21 21 'post_type' => WCPT_POST_TYPE_ID, … … 84 84 * @return object WordCamp information 85 85 */ 86 function wcpt_wordcamps 86 function wcpt_wordcamps() { 87 87 global $wcpt_template; 88 88 return $wcpt_template->have_posts(); … … 101 101 * @return object WordCamp information 102 102 */ 103 function wcpt_the_wordcamp 103 function wcpt_the_wordcamp() { 104 104 global $wcpt_template; 105 105 return $wcpt_template->the_post(); … … 117 117 * @uses wcpt_get_wordcamp_id() 118 118 */ 119 function wcpt_wordcamp_id 119 function wcpt_wordcamp_id() { 120 120 echo wcpt_get_wordcamp_id(); 121 121 } … … 131 131 * @return string WordCamp id 132 132 */ 133 function wcpt_get_wordcamp_id 133 function wcpt_get_wordcamp_id() { 134 134 global $wcpt_template; 135 135 … … 154 154 * @uses wcpt_get_wordcamp_permalink() 155 155 */ 156 function wcpt_wordcamp_permalink 156 function wcpt_wordcamp_permalink( $wordcamp_id = 0 ) { 157 157 echo wcpt_get_wordcamp_permalink( $wordcamp_id ); 158 158 } … … 171 171 * @return string Permanent link to WordCamp 172 172 */ 173 function wcpt_get_wordcamp_permalink 173 function wcpt_get_wordcamp_permalink( $wordcamp_id = 0 ) { 174 174 if ( empty( $wordcamp_id ) ) 175 175 $wordcamp_id = wcpt_get_wordcamp_id(); … … 190 190 * @uses wcpt_get_wordcamp_title() 191 191 */ 192 function wcpt_wordcamp_title 192 function wcpt_wordcamp_title( $wordcamp_id = 0 ) { 193 193 echo wcpt_get_wordcamp_title( $wordcamp_id ); 194 194 } … … 208 208 * 209 209 */ 210 function wcpt_get_wordcamp_title 210 function wcpt_get_wordcamp_title( $wordcamp_id = 0 ) { 211 211 return apply_filters( 'wcpt_get_wordcamp_title', get_the_title( $wordcamp_id ) ); 212 212 } … … 224 224 * @uses wcpt_get_wordcamp_link() 225 225 */ 226 function wcpt_wordcamp_link 226 function wcpt_wordcamp_link( $wordcamp_id = 0 ) { 227 227 echo wcpt_get_wordcamp_link( $wordcamp_id ); 228 228 } … … 242 242 * 243 243 */ 244 function wcpt_get_wordcamp_link 244 function wcpt_get_wordcamp_link( $wordcamp_id = 0 ) { 245 245 246 246 $title = get_the_title( $wordcamp_id ); … … 269 269 * @param int $wordcamp_id optional 270 270 */ 271 function wcpt_wordcamp_start_date 271 function wcpt_wordcamp_start_date( $wordcamp_id = 0, $format = 'F j, Y' ) { 272 272 echo wcpt_get_wordcamp_start_date( $wordcamp_id, $format ); 273 273 } … … 284 284 * @param int $wordcamp_id optional 285 285 */ 286 function wcpt_get_wordcamp_start_date 286 function wcpt_get_wordcamp_start_date( $wordcamp_id = 0, $format = 'F j, Y' ) { 287 287 if ( empty( $wordcamp_id ) ) 288 288 $wordcamp_id = wcpt_get_wordcamp_id(); … … 306 306 * @param int $wordcamp_id optional 307 307 */ 308 function wcpt_wordcamp_end_date 308 function wcpt_wordcamp_end_date( $wordcamp_id = 0, $format = 'F j, Y' ) { 309 309 echo wcpt_get_wordcamp_end_date( $wordcamp_id, $format ); 310 310 } … … 321 321 * @param int $wordcamp_id optional 322 322 */ 323 function wcpt_get_wordcamp_end_date 323 function wcpt_get_wordcamp_end_date( $wordcamp_id = 0, $format = 'F j, Y' ) { 324 324 if ( empty( $wordcamp_id ) ) 325 325 $wordcamp_id = wcpt_get_wordcamp_id(); … … 343 343 * @param int $wordcamp_id optional 344 344 */ 345 function wcpt_wordcamp_location 345 function wcpt_wordcamp_location( $wordcamp_id = 0 ) { 346 346 echo wcpt_get_wordcamp_location( $wordcamp_id ); 347 347 } … … 358 358 * @param int $wordcamp_id optional 359 359 */ 360 function wcpt_get_wordcamp_location 360 function wcpt_get_wordcamp_location( $wordcamp_id = 0 ) { 361 361 if ( empty( $wordcamp_id ) ) 362 362 $wordcamp_id = wcpt_get_wordcamp_id(); … … 377 377 * @param int $wordcamp_id optional 378 378 */ 379 function wcpt_wordcamp_organizer_name 379 function wcpt_wordcamp_organizer_name( $wordcamp_id = 0 ) { 380 380 echo wcpt_get_wordcamp_organizer_name( $wordcamp_id ); 381 381 } … … 392 392 * @param int $wordcamp_id optional 393 393 */ 394 function wcpt_get_wordcamp_organizer_name 394 function wcpt_get_wordcamp_organizer_name( $wordcamp_id = 0 ) { 395 395 if ( empty( $wordcamp_id ) ) 396 396 $wordcamp_id = wcpt_get_wordcamp_id(); … … 411 411 * @param int $wordcamp_id optional 412 412 */ 413 function wcpt_wordcamp_venue_name 413 function wcpt_wordcamp_venue_name( $wordcamp_id = 0 ) { 414 414 echo wcpt_get_wordcamp_venue_name( $wordcamp_id ); 415 415 } … … 426 426 * @param int $wordcamp_id optional 427 427 */ 428 function wcpt_get_wordcamp_venue_name 428 function wcpt_get_wordcamp_venue_name( $wordcamp_id = 0 ) { 429 429 if ( empty( $wordcamp_id ) ) 430 430 $wordcamp_id = wcpt_get_wordcamp_id(); … … 445 445 * @param int $wordcamp_id optional 446 446 */ 447 function wcpt_wordcamp_url 447 function wcpt_wordcamp_url( $wordcamp_id = 0 ) { 448 448 echo wcpt_get_wordcamp_url( $wordcamp_id ); 449 449 } … … 460 460 * @param int $wordcamp_id optional 461 461 */ 462 function wcpt_get_wordcamp_url 462 function wcpt_get_wordcamp_url( $wordcamp_id = 0 ) { 463 463 if ( empty( $wordcamp_id ) ) 464 464 $wordcamp_id = wcpt_get_wordcamp_id(); … … 478 478 * @global WP_Query $wcpt_template 479 479 */ 480 function wcpt_wordcamp_pagination_count 480 function wcpt_wordcamp_pagination_count() { 481 481 echo wcpt_get_wordcamp_pagination_count(); 482 482 } … … 493 493 * @return string 494 494 */ 495 function wcpt_get_wordcamp_pagination_count 495 function wcpt_get_wordcamp_pagination_count() { 496 496 global $wcpt_template; 497 497 … … 521 521 * @since WordCamp Post Type (0.1) 522 522 */ 523 function wcpt_wordcamp_pagination_links 523 function wcpt_wordcamp_pagination_links() { 524 524 echo wcpt_get_wordcamp_pagination_links(); 525 525 } … … 536 536 * @return string 537 537 */ 538 function wcpt_get_wordcamp_pagination_links 538 function wcpt_get_wordcamp_pagination_links() { 539 539 global $wcpt_template; 540 540 … … 547 547 */ 548 548 if ( ! function_exists( 'wcpt_wordcamp_physical_address' ) ) : 549 function wcpt_wordcamp_physical_address( $wordcamp_id = 0 ) {550 echo wp_filter_kses( nl2br( wcpt_get_wordcamp_physical_address( $wordcamp_id ) ) );551 }549 function wcpt_wordcamp_physical_address( $wordcamp_id = 0 ) { 550 echo wp_filter_kses( nl2br( wcpt_get_wordcamp_physical_address( $wordcamp_id ) ) ); 551 } 552 552 endif; 553 553 554 554 if ( ! function_exists( 'wcpt_get_wordcamp_physical_address' ) ) : 555 555 function wcpt_get_wordcamp_physical_address( $wordcamp_id = 0 ) { 556 556 if ( empty( $wordcamp_id ) ) … … 560 560 return apply_filters( 'wcpt_get_wordcamp_physical_address', $address ); 561 561 } 562 562 endif; 563 563 564 564 if ( ! function_exists( 'wcpt_wordcamp_venue_url' ) ) : 565 function wcpt_wordcamp_venue_url( $wordcamp_id = 0 ) {566 echo esc_url( wcpt_get_wordcamp_venue_url( $wordcamp_id ) );567 }565 function wcpt_wordcamp_venue_url( $wordcamp_id = 0 ) { 566 echo esc_url( wcpt_get_wordcamp_venue_url( $wordcamp_id ) ); 567 } 568 568 endif; 569 569 570 570 if ( ! function_exists( 'wcpt_get_wordcamp_venue_url' ) ) : 571 571 function wcpt_get_wordcamp_venue_url( $wordcamp_id = 0 ) { 572 572 if ( empty( $wordcamp_id ) ) … … 576 576 return apply_filters( 'wcpt_get_wordcamp_venue_url', $venue_url ); 577 577 } 578 578 endif; 579 579 580 580 if ( ! function_exists( 'wcpt_get_wordcamp_twitter_screen_name' ) ) : 581 function wcpt_get_wordcamp_twitter_screen_name( $wordcamp_id = 0 ) {582 if ( empty( $wordcamp_id ) )583 $wordcamp_id = wcpt_get_wordcamp_id();584 585 $screen_name = get_post_meta( $wordcamp_id, 'Twitter', true );586 return apply_filters( 'wcpt_get_wordcamp_twitter_screen_name', $screen_name );587 }581 function wcpt_get_wordcamp_twitter_screen_name( $wordcamp_id = 0 ) { 582 if ( empty( $wordcamp_id ) ) 583 $wordcamp_id = wcpt_get_wordcamp_id(); 584 585 $screen_name = get_post_meta( $wordcamp_id, 'Twitter', true ); 586 return apply_filters( 'wcpt_get_wordcamp_twitter_screen_name', $screen_name ); 587 } 588 588 endif; 589 589 … … 648 648 */ 649 649 function add_wordcamp_feed_link_to_head() { 650 if ( ! is_post_type_archive( 'wordcamp') ) {650 if ( ! is_post_type_archive( WCPT_POST_TYPE_ID ) ) { 651 651 ?> 652 652 653 <link rel="alternate" type="<?php echo esc_attr( feed_content_type() ); ?>" title="New WordCamp Announcements" href="<?php echo esc_url( get_post_type_archive_feed_link( 'wordcamp') ); ?>" />653 <link rel="alternate" type="<?php echo esc_attr( feed_content_type() ); ?>" title="New WordCamp Announcements" href="<?php echo esc_url( get_post_type_archive_feed_link( WCPT_POST_TYPE_ID ) ); ?>" /> 654 654 655 655 <?php -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-api/classes/ics.php
r481 r2898 53 53 54 54 $query = new WP_Query( array( 55 'post_type' => WCPT_POST_TYPE_ID, 55 'post_type' => WCPT_POST_TYPE_ID, 56 'post_status' => array( 57 'wcpt-scheduled', 58 'wcpt-needs-debrief', 59 'wcpt-debrief-schedul', 60 'wcpt-closed', 61 62 // back-compat 63 'publish', 64 ), 56 65 'posts_per_page' => 50, 57 66 'meta_key' => 'Start Date (YYYY-mm-dd)', -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/wcor-mailer.php
r2156 r2898 7 7 class WCOR_Mailer { 8 8 public $triggers; 9 9 10 10 /** 11 11 * Constructor … … 61 61 ), 62 62 ); 63 63 64 64 add_action( 'wcor_send_timed_emails', array( $this, 'send_timed_emails' ) ); 65 65 66 66 foreach ( $this->triggers as $trigger_id => $trigger ) { 67 67 foreach( $trigger['actions'] as $action ) { … … 72 72 73 73 /** 74 * Schedule cron job when plugin is activated 74 * Schedule cron job when plugin is activated 75 75 */ 76 76 public function activate() { … … 83 83 } 84 84 } 85 85 86 86 /** 87 87 * Clear cron job when plugin is deactivated … … 94 94 * Wrapper for wp_mail() that customizes the subject, body and headers 95 95 * 96 * We want to make sure that replies go to support@wordcamp.org, rather than the fake address that WordPress sends from, but 96 * We want to make sure that replies go to support@wordcamp.org, rather than the fake address that WordPress sends from, but 97 97 * we don't want to be flagged as spam for forging the From header, so we set the Sender header. 98 98 * @see http://stackoverflow.com/q/4728393/450127 … … 213 213 '[safety_wrangler_name]', 214 214 '[safety_wrangler_email]', 215 215 216 216 // Venue 217 217 '[venue_name]', … … 287 287 $this->get_mes_info( $wordcamp->ID ), 288 288 ); 289 289 290 290 return str_replace( $search, $replace, $content ); 291 291 } … … 454 454 return $this->mail( $recipient, $email->post_title, $email->post_content, array(), $email, $wordcamp ); 455 455 } 456 456 457 457 /** 458 458 * Send e-mails that are scheduled to go out at a specific time (e.g., 3 days before the camp) … … 462 462 'posts_per_page' => -1, 463 463 'post_type' => 'wordcamp', 464 'post_status' => WordCamp_Loader::get_public_post_statuses(), 464 465 'meta_query' => array( 465 466 array( … … 474 475 'posts_per_page' => -1, 475 476 'post_type' => WCPT_POST_TYPE_ID, 476 'post_status' => 'pending',477 'post_status' => WordCamp_Loader::get_pre_planning_post_statuses(), 477 478 ) ); 478 479 … … 490 491 ), 491 492 ) ); 492 493 493 494 foreach ( $wordcamps as $wordcamp ) { 494 495 $sent_email_ids = (array) get_post_meta( $wordcamp->ID, 'wcor_sent_email_ids', true ); … … 496 497 foreach ( $reminder_emails as $email ) { 497 498 $recipient = $this->get_recipients( $wordcamp->ID, $email->ID ); 498 499 499 500 if ( $this->timed_email_is_ready_to_send( $wordcamp, $email, $sent_email_ids ) ) { 500 501 if ( $this->mail( $recipient, $email->post_title, $email->post_content, array(), $email, $wordcamp ) ) { … … 520 521 * @todo It'd be nice to have some unit tests for this function, since there are a lot of different cases, but it seems like that might be 521 522 * hard to do because of having to mock get_post_meta(), current_time(), etc. We could pass that info in, but that doesn't seem very elegant. 522 * 523 * 523 524 * @param WP_Post $wordcamp 524 525 * @param WP_Post $email … … 544 545 if ( 'wcor_send_before' == $send_when ) { 545 546 $days_before = absint( get_post_meta( $email->ID, 'wcor_send_days_before', true ) ); 546 547 547 548 if ( $start_date && $days_before ) { 548 549 $send_date = $start_date - ( $days_before * DAY_IN_SECONDS ); 549 550 550 551 if ( $send_date <= current_time( 'timestamp' ) ) { 551 552 $ready = true; … … 557 558 if ( $end_date && $days_after ) { 558 559 $send_date = $end_date + ( $days_after * DAY_IN_SECONDS ); 559 560 560 561 if ( $send_date <= current_time( 'timestamp' ) ) { 561 562 $ready = true; … … 575 576 } 576 577 } 577 578 578 579 return $ready; 579 580 } -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/wcor-reminder.php
r2152 r2898 53 53 'supports' => array( 'title', 'editor', 'author', 'revisions' ), 54 54 ); 55 55 56 56 register_post_type( self::POST_TYPE_SLUG, $params ); 57 57 } … … 108 108 <td colspan="2"><label for="wcor_send_sponsor_wrangler">The Sponsor Wrangler</label></td> 109 109 </tr> 110 110 111 111 <tr> 112 112 <th><input id="wcor_send_budget_wrangler" name="wcor_send_where[]" type="checkbox" value="wcor_send_budget_wrangler" <?php checked( in_array( 'wcor_send_budget_wrangler', $send_where ) ); ?>></th> 113 113 <td colspan="2"><label for="wcor_send_budget_wrangler">The Budget Wrangler</label></td> 114 114 </tr> 115 115 116 116 <tr> 117 117 <th><input id="wcor_send_venue_wrangler" name="wcor_send_where[]" type="checkbox" value="wcor_send_venue_wrangler" <?php checked( in_array( 'wcor_send_venue_wrangler', $send_where ) ); ?>></th> 118 118 <td colspan="2"><label for="wcor_send_venue_wrangler">The Venue Wrangler</label></td> 119 119 </tr> 120 120 121 121 <tr> 122 122 <th><input id="wcor_send_speaker_wrangler" name="wcor_send_where[]" type="checkbox" value="wcor_send_speaker_wrangler" <?php checked( in_array( 'wcor_send_speaker_wrangler', $send_where ) ); ?>></th> 123 123 <td colspan="2"><label for="wcor_send_speaker_wrangler">The Speaker Wrangler</label></td> 124 124 </tr> 125 125 126 126 <tr> 127 127 <th><input id="wcor_send_food_wrangler" name="wcor_send_where[]" type="checkbox" value="wcor_send_food_wrangler" <?php checked( in_array( 'wcor_send_food_wrangler', $send_where ) ); ?>></th> 128 128 <td colspan="2"><label for="wcor_send_food_wrangler">The Food/Beverage Wrangler</label></td> 129 129 </tr> 130 130 131 131 <tr> 132 132 <th><input id="wcor_send_swag_wrangler" name="wcor_send_where[]" type="checkbox" value="wcor_send_swag_wrangler" <?php checked( in_array( 'wcor_send_swag_wrangler', $send_where ) ); ?>></th> 133 133 <td colspan="2"><label for="wcor_send_swag_wrangler">The Swag Wrangler</label></td> 134 134 </tr> 135 135 136 136 <tr> 137 137 <th><input id="wcor_send_volunteer_wrangler" name="wcor_send_where[]" type="checkbox" value="wcor_send_volunteer_wrangler" <?php checked( in_array( 'wcor_send_volunteer_wrangler', $send_where ) ); ?>></th> 138 138 <td colspan="2"><label for="wcor_send_volunteer_wrangler">The Volunteer Wrangler</label></td> 139 139 </tr> 140 140 141 141 <tr> 142 142 <th><input id="wcor_send_printing_wrangler" name="wcor_send_where[]" type="checkbox" value="wcor_send_printing_wrangler" <?php checked( in_array( 'wcor_send_printing_wrangler', $send_where ) ); ?>></th> 143 143 <td colspan="2"><label for="wcor_send_printing_wrangler">The Printing Wrangler</label></td> 144 144 </tr> 145 145 146 146 <tr> 147 147 <th><input id="wcor_send_design_wrangler" name="wcor_send_where[]" type="checkbox" value="wcor_send_design_wrangler" <?php checked( in_array( 'wcor_send_design_wrangler', $send_where ) ); ?>></th> 148 148 <td colspan="2"><label for="wcor_send_design_wrangler">The Design Wrangler</label></td> 149 149 </tr> 150 150 151 151 <tr> 152 152 <th><input id="wcor_send_website_wrangler" name="wcor_send_where[]" type="checkbox" value="wcor_send_website_wrangler" <?php checked( in_array( 'wcor_send_website_wrangler', $send_where ) ); ?>></th> 153 153 <td colspan="2"><label for="wcor_send_website_wrangler">The Website Wrangler</label></td> 154 154 </tr> 155 155 156 156 <tr> 157 157 <th><input id="wcor_send_social_wrangler" name="wcor_send_where[]" type="checkbox" value="wcor_send_social_wrangler" <?php checked( in_array( 'wcor_send_social_wrangler', $send_where ) ); ?>></th> 158 158 <td colspan="2"><label for="wcor_send_social_wrangler">The Social Media/Publicity Wrangler</label></td> 159 159 </tr> 160 160 161 161 <tr> 162 162 <th><input id="wcor_send_a_v_wrangler" name="wcor_send_where[]" type="checkbox" value="wcor_send_a_v_wrangler" <?php checked( in_array( 'wcor_send_a_v_wrangler', $send_where ) ); ?>></th> 163 163 <td colspan="2"><label for="wcor_send_a_v_wrangler">The A/V Wrangler</label></td> 164 164 </tr> 165 165 166 166 <tr> 167 167 <th><input id="wcor_send_party_wrangler" name="wcor_send_where[]" type="checkbox" value="wcor_send_party_wrangler" <?php checked( in_array( 'wcor_send_party_wrangler', $send_where ) ); ?>></th> 168 168 <td colspan="2"><label for="wcor_send_party_wrangler">The Party Wrangler</label></td> 169 169 </tr> 170 170 171 171 <tr> 172 172 <th><input id="wcor_send_travel_wrangler" name="wcor_send_where[]" type="checkbox" value="wcor_send_travel_wrangler" <?php checked( in_array( 'wcor_send_travel_wrangler', $send_where ) ); ?>></th> 173 173 <td colspan="2"><label for="wcor_send_travel_wrangler">The Travel Wrangler</label></td> 174 174 </tr> 175 175 176 176 <tr> 177 177 <th><input id="wcor_send_safety_wrangler" name="wcor_send_where[]" type="checkbox" value="wcor_send_safety_wrangler" <?php checked( in_array( 'wcor_send_safety_wrangler', $send_where ) ); ?>></th> … … 196 196 </tbody> 197 197 </table> 198 199 198 199 200 200 <h4>When should this e-mail be sent?</h4> 201 201 … … 235 235 <select name="wcor_which_trigger"> 236 236 <option value="null" <?php selected( $which_trigger, false ); ?>></option> 237 237 238 238 <?php foreach ( $GLOBALS['WCOR_Mailer']->triggers as $trigger_id => $trigger ) : ?> 239 239 <option value="<?php echo esc_attr( $trigger_id ); ?>" <?php selected( $which_trigger, $trigger_id ); ?>><?php echo esc_html( $trigger['name'] ); ?></option> … … 365 365 } 366 366 367 $statuses = WordCamp_Loader::get_post_statuses(); 368 $statuses = array_merge( array_keys( $statuses ), array( 'draft', 'pending', 'publish' ) ); 369 367 370 $wordcamps = get_posts( array( 368 371 'post_type' => WCPT_POST_TYPE_ID, 369 'post_status' => array( 'draft', 'pending', 'publish' ),372 'post_status' => $statuses, 370 373 'numberposts' => -1, 371 374 ) ); … … 438 441 /** 439 442 * Checks to make sure the conditions for saving post meta are met 440 * 443 * 441 444 * @param int $post_id 442 445 * @param object $post … … 456 459 return; 457 460 } 458 461 459 462 $this->save_post_meta( $post, $_POST ); 460 463 $this->send_manual_email( $post, $_POST ); … … 463 466 /** 464 467 * Saves the meta data for the reminder post 465 * 468 * 466 469 * @param WP_Post $post 467 470 * @param array $new_meta … … 481 484 if ( isset( $new_meta['wcor_send_custom_address'] ) && is_email( $new_meta['wcor_send_custom_address'] ) ) { 482 485 update_post_meta( $post->ID, 'wcor_send_custom_address', sanitize_email( $new_meta['wcor_send_custom_address'] ) ); 483 } 484 486 } 487 485 488 if ( isset( $new_meta['wcor_send_when'] ) ) { 486 489 if ( in_array( $new_meta['wcor_send_when'], array( 'wcor_send_before', 'wcor_send_after', 'wcor_send_after_pending', 'wcor_send_trigger' ) ) ) { -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments
- Property svn:mergeinfo changed
/sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments (added) merged: 2825,2885
- Property svn:mergeinfo changed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network
- Property svn:mergeinfo changed
/sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments-network (added) merged: 2885
- Property svn:mergeinfo changed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-site-cloner/wordcamp-site-cloner.php
r2745 r2898 120 120 $wordcamps = get_posts( array( 121 121 'post_type' => 'wordcamp', 122 'post_status' => 'publish',122 'post_status' => WordCamp_Loader::get_public_post_statuses(), 123 123 'posts_per_page' => 125, // todo temporary workaround until able to add filters to make hundreds of sites manageable 124 124 'meta_key' => 'Start Date (YYYY-mm-dd)', -
sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-central-2012/functions.php
r2402 r2898 40 40 41 41 add_filter( 'excerpt_more', array( __CLASS__, 'excerpt_more' ), 11 ); 42 // add_filter( 'wcpt_register_post_type', array( __CLASS__, 'wcpt_register_post_type' ) ); // set to public in wcpt plugin43 42 add_filter( 'nav_menu_css_class', array( __CLASS__, 'nav_menu_css_class' ), 10, 3 ); 44 43 add_filter( 'wp_nav_menu_items', array( __CLASS__, 'add_links_to_footer_menu' ), 10, 2 ); … … 277 276 'post_type' => 'wordcamp', 278 277 'posts_per_page' => -1, 278 'post_status' => array_merge( 279 WordCamp_Loader::get_public_post_statuses(), 280 WordCamp_Loader::get_pre_planning_post_statuses() 281 ), 279 282 ); 280 283 281 284 switch( $map_id ) { 282 285 case 'schedule': 283 $parameters['post_status'][] = array( 'publish', 'pending' );284 286 $parameters['meta_query'][] = array( 285 287 'key' => 'Start Date (YYYY-mm-dd)', … … 329 331 static function excerpt_more( $more ) { 330 332 return ' …'; 331 }332 333 /**334 * Filters wcpt_register_post_type, sets post type to public.335 * @todo move to wcpt_register_post_types when ready.336 */337 static function wcpt_register_post_type( $args ) {338 $args['public'] = true;339 return $args;340 333 } 341 334 … … 704 697 $query = new WP_Query( array( 705 698 'post_type' => WCPT_POST_TYPE_ID, 699 'post_status' => WordCamp_Loader::get_public_post_statuses(), 706 700 'posts_per_page' => $count, 707 701 'meta_key' => 'Start Date (YYYY-mm-dd)', … … 816 810 $wordcamps = new WP_Query( array( 817 811 'post_type' => 'wordcamp', 812 'post_status' => WordCamp_Loader::get_public_post_statuses(), 818 813 'posts_per_page' => -1, 819 814 ) ); -
sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-central-2012/sidebar-schedule.php
r842 r2898 11 11 ?> 12 12 13 <?php 13 <?php 14 14 // Get the upcoming approved (published) WordCamps *with dates* 15 15 $args = array( 16 16 'posts_per_page' => -1, 17 'post_status' => 'pending',17 'post_status' => WordCamp_Loader::get_pre_planning_post_statuses(), 18 18 'meta_key' => 'Start Date (YYYY-mm-dd)', 19 19 'orderby' => 'meta_value', -
sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-central-2012/single-wordcamp.php
r842 r2898 81 81 'posts_per_page' => 30, 82 82 'post_type' => 'wordcamp', 83 'post_status' => 'any',83 'post_status' => WordCamp_Loader::get_public_post_statuses(), 84 84 'orderby' => 'ID', 85 85 's' => $wordcamp_title, … … 95 95 'posts_per_page' => 30, 96 96 'order' => 'ASC', 97 'post_status' => 'any',97 'post_status' => WordCamp_Loader::get_public_post_statuses(), 98 98 'post__in' => wp_list_pluck( $wordcamps, 'ID' ), 99 99 ) ) -
sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-central-2012/template-home.php
r1105 r2898 17 17 if ( function_exists( 'wcpt_has_wordcamps' ) && 18 18 wcpt_has_wordcamps( array( 19 'post_status' => array( 20 'wcpt-scheduled', 21 'wcpt-needs-debrief', 22 'wcpt-debrief-schedul', 23 'wcpt-closed', 24 25 // back-compat 26 'publish', 27 ), 19 28 'posts_per_page' => 5, 20 29 'meta_key' => 'Start Date (YYYY-mm-dd)', … … 58 67 $formats[$i] = 'post-format-' . $format; 59 68 60 $news = new WP_Query( array( 61 'posts_per_page' => 1, 69 $news = new WP_Query( array( 70 'posts_per_page' => 1, 62 71 'ignore_sticky_posts' => 1, 63 72 'tax_query' => array( … … 85 94 <?php endif; ?> 86 95 87 <a href="<?php echo home_url( '/news/' ); ?>" class="more">More News →</a> 96 <a href="<?php echo home_url( '/news/' ); ?>" class="more">More News →</a> 88 97 89 98 </div><!-- .wc-news --> -
sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-central-2012/template-past-wordcamps.php
r1143 r2898 11 11 <div id="container" class="wc-schedule"> 12 12 <div id="content" role="main"> 13 13 14 14 <?php if ( have_posts() ) : the_post(); ?> 15 15 … … 22 22 23 23 <?php endif; // end of the loop. ?> 24 24 25 25 <?php // Get the upcoming approved (published) WordCamps 26 26 if ( function_exists( 'wcpt_has_wordcamps' ) && 27 27 wcpt_has_wordcamps( array( 28 'post_status' => array( 29 'wcpt-needs-debrief', 30 'wcpt-debrief-schedul', 31 'wcpt-closed', 32 33 // back-compat 34 'publish', 35 ), 28 36 'posts_per_page' => -1, 29 37 'meta_key' => 'Start Date (YYYY-mm-dd)', … … 76 84 </div><!-- #container --> 77 85 78 <?php 86 <?php 79 87 /*get_sidebar( 'schedule' ); */ 80 get_footer(); 88 get_footer(); 81 89 ?> -
sites/trunk/wordcamp.org/public_html/wp-content/themes/wordcamp-central-2012/template-schedule.php
r1658 r2898 11 11 <div id="container" class="wc-schedule"> 12 12 <div id="content" role="main"> 13 13 14 14 <?php if ( have_posts() ) : the_post(); ?> 15 15 … … 22 22 23 23 <?php endif; // end of the loop. ?> 24 24 25 25 <?php // Get the upcoming approved (published) WordCamps 26 26 if ( function_exists( 'wcpt_has_wordcamps' ) && 27 27 wcpt_has_wordcamps( array( 28 'post_status' => WordCamp_Loader::get_public_post_statuses(), 28 29 'posts_per_page' => -1, 29 30 'meta_key' => 'Start Date (YYYY-mm-dd)', … … 35 36 'compare' => '>' 36 37 ) ) 37 ) ) 38 ) ) 38 39 ) : 39 40 ?> … … 41 42 <ul class="wc-schedule-list"> 42 43 <?php while ( wcpt_wordcamps() ) : wcpt_the_wordcamp(); ?> 43 44 44 45 <li> 45 46 <a href="<?php echo esc_url( wcpt_get_wordcamp_url() ); ?>"> … … 49 50 <div class="wc-image wp-post-image wordcamp-placeholder-thumb" title="<?php the_title(); ?>"></div> 50 51 <?php endif; ?> 51 52 52 53 <h2 class="wc-title"><?php wcpt_wordcamp_title(); ?></h2> 53 54 <span class="wc-country"><?php wcpt_wordcamp_location(); ?></span> … … 77 78 </div><!-- #container --> 78 79 79 <?php 80 get_sidebar( 'schedule' ); 80 <?php 81 get_sidebar( 'schedule' ); 81 82 get_footer();
Note: See TracChangeset
for help on using the changeset viewer.