Making WordPress.org

Changeset 6765


Ignore:
Timestamp:
02/26/2018 06:38:23 PM (7 years ago)
Author:
iandunn
Message:

WordCamp Forms to Drafts: Apply coding standards.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-forms-to-drafts/wordcamp-forms-to-drafts.php

    r3878 r6765  
    11<?php
     2
    23/*
    34Plugin Name: WordCamp Forms to Drafts
     
    89*/
    910
    10 if ( ! defined( 'ABSPATH' ) ) {
    11     die( 'Access denied.' );
    12 }
    13 
    1411/*
    1512 * @todo
    1613 * - Refactor the update_post_meta() loop in each method into a DRY function.
    1714 */
     15
     16if ( ! defined( 'ABSPATH' ) ) {
     17    die( 'Access denied.' );
     18}
    1819
    1920class WordCamp_Forms_To_Drafts {
     
    8889        );
    8990
    90         // Prevent wpautop() from converting tabs into empty paragraphs in #wcorg-login-message
     91        // Prevent wpautop() from converting tabs into empty paragraphs in #wcorg-login-message.
    9192        $please_login_message = trim( str_replace( "\t", '', $please_login_message ) );
    9293
     
    141142
    142143        $current_user = wp_get_current_user();
    143         $form_id = get_post_meta( $post->ID, 'wcfd-key', true );
     144        $form_id      = get_post_meta( $post->ID, 'wcfd-key', true );
    144145
    145146        switch ( $form_id ) {
     
    170171     * @todo submit Jetpack PR to modularize that logic so we can just call it directly instead of duplicating it
    171172     *
    172      * @param int $page_id
     173     * @param int    $page_id
    173174     * @param string $label
    174175     *
     
    248249     * Yes, this is an ugly hack.
    249250     *
    250      * @param $post_type
     251     * @param string $post_type
    251252     */
    252253    protected function simulate_post_type( $post_type ) {
     
    286287        $this->simulate_post_type( 'wordcamp' );
    287288
    288         // Create the post
     289        // Create the post.
    289290        $draft_id = wp_insert_post( array(
    290291            'post_type'    => 'wcb_sponsor',
     
    295296        ) );
    296297
    297         // Create the post meta
     298        // Create the post meta.
    298299        if ( $draft_id ) {
    299300            foreach ( $sponsor_to_form_key_map as $sponsor_key => $form_key ) {
     
    356357            'post_type'      => 'wcb_speaker',
    357358            'posts_per_page' => 1,
    358             'post_status'    => array( 'publish', 'pending', 'draft', 'future', 'private' ),    // Trashed speakers are ignored because they'll likely be deleted
     359            'post_status'    => array( 'publish', 'pending', 'draft', 'future', 'private' ),    // Trashed speakers are ignored because they'll likely be deleted.
    359360
    360361            'meta_query' => array(
     
    390391
    391392        if ( $speaker_id ) {
    392             update_post_meta( $speaker_id, '_wcb_speaker_email', $speaker[ 'Email Address' ] );
     393            update_post_meta( $speaker_id, '_wcb_speaker_email', $speaker['Email Address'] );
    393394            update_post_meta( $speaker_id, '_wcpt_user_id',      $this->get_user_id_from_username( $speaker['WordPress.org Username'] ) );
    394395        }
Note: See TracChangeset for help on using the changeset viewer.