Making WordPress.org


Ignore:
Timestamp:
08/07/2016 12:11:37 AM (8 years ago)
Author:
iandunn
Message:

WordCamp Coming Soon Page: Trim trailing whitespace.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/classes/wordcamp-coming-soon-page.php

    r2186 r3780  
    44    protected $override_theme_template;
    55    const VERSION = '0.1';
    6    
     6
    77    /**
    88     * Constructor
     
    3333            return;
    3434        }
    35        
     35
    3636        $this->dequeue_all_stylesheets();
    3737        $this->register_twentythirteen_styles();
     
    4949     */
    5050    protected function dequeue_all_stylesheets() {
    51         foreach( $GLOBALS['wp_styles']->queue as $stylesheet ) { 
     51        foreach( $GLOBALS['wp_styles']->queue as $stylesheet ) {
    5252            wp_dequeue_style( $stylesheet );
    5353        }
     
    6060     */
    6161    protected function register_twentythirteen_styles() {
    62         $twentythirteen_uri = get_theme_root_uri( 'twentythirteen' ) . '/twentythirteen'; 
    63        
     62        $twentythirteen_uri = get_theme_root_uri( 'twentythirteen' ) . '/twentythirteen';
     63
    6464        if ( ! wp_style_is( 'twentythirteen-fonts', 'registered' ) ) {
    6565            wp_register_style( 'twentythirteen-fonts', '//fonts.googleapis.com/css?family=Source+Sans+Pro%3A300%2C400%2C700%2C300italic%2C400italic%2C700italic%7CBitter%3A400%2C700&subset=latin%2Clatin-ext', array(), null );
     
    8282            return;
    8383        }
    84        
     84
    8585        $settings = $GLOBALS['WCCSP_Settings']->get_settings();
    8686        ?>
    87        
     87
    8888        <!-- BEGIN wordcamp-coming-soon-page -->
    8989        <style type="text/css">
     
    9191                color: <?php echo esc_html( $settings['text_color'] ); ?>;
    9292            }
    93            
     93
    9494            #wccsp-container,
    9595            .widget  {
     
    110110    /**
    111111     * Load the Coming Soon template instead of a theme template
    112      * 
     112     *
    113113     * @param string $template
    114114     * @return string
     
    118118            $template = dirname( __DIR__ ) . '/views/template-coming-soon.php';
    119119        }
    120        
     120
    121121        return $template;
    122122    }
     
    125125     * Collect all of the variables the Coming Soon template will need
    126126     * Doing this here keeps the template less cluttered and more of a pure view
    127      * 
     127     *
    128128     * @return array
    129129     */
     
    141141    /**
    142142     * Retrieve the URL of the image displayed in the template
    143      * 
     143     *
    144144     * @return string|false
    145145     */
     
    147147        $settings   = $GLOBALS['WCCSP_Settings']->get_settings();
    148148        $image_meta = wp_get_attachment_metadata( $settings['image_id'] );
    149         $size       = isset( $image_meta['sizes']['wccsp_image_medium_rectangle'] ) ? 'wccsp_image_medium_rectangle' : 'full'; 
     149        $size       = isset( $image_meta['sizes']['wccsp_image_medium_rectangle'] ) ? 'wccsp_image_medium_rectangle' : 'full';
    150150        $image      = wp_get_attachment_image_src( $settings['image_id'], $size );
    151        
     151
    152152        return $image ? $image[0] : false;
    153153    }
     
    155155    /**
    156156     * Retrieve the dates of the WordCamp
    157      * 
     157     *
    158158     * @return string|false
    159159     */
     
    175175            }
    176176        }
    177        
     177
    178178        return $dates;
    179179    }
     
    185185     * This is somewhat fragile, though. It should work in most cases because the first $page that contains [contact-form] will be the one we automatically create
    186186     * when the site is created, but if the organizers delete that and then add multiple forms, the wrong form could be displayed. The alternative approaches also
    187      * have problems, though, and #102 should be fixed relatively soon, so hopefully this will be good enough until it can be refactored. 
     187     * have problems, though, and #102 should be fixed relatively soon, so hopefully this will be good enough until it can be refactored.
    188188     * todo Refactor this once #102-jetpack is fixed.
    189      *       
     189     *
    190190     * @return string|false
    191191     */
     
    193193        $contact_form_shortcode = false;
    194194        $shortcode_regex        = get_shortcode_regex();
    195        
     195
    196196        $all_pages = get_posts( array(
    197197            'post_type'      => 'page',
    198198            'posts_per_page' => -1,
    199199        ) );
    200        
     200
    201201        foreach ( $all_pages as $page ) {
    202202            preg_match_all( '/' . $shortcode_regex . '/s', $page->post_content, $matches, PREG_SET_ORDER );
     
    207207                    $post = $page;
    208208                    setup_postdata( $post );
    209                    
     209
    210210                    ob_start();
    211211                    echo do_shortcode( $shortcode[0] );
    212212                    $contact_form_shortcode = ob_get_clean();
    213                    
     213
    214214                    wp_reset_postdata();
    215215                    break;
     
    217217            }
    218218        }
    219        
     219
    220220        return $contact_form_shortcode;
    221221    }
Note: See TracChangeset for help on using the changeset viewer.