Making WordPress.org

Changeset 3780


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

WordCamp Coming Soon Page: Trim trailing whitespace.

Location:
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page
Files:
6 edited

Legend:

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

    r398 r3780  
    33    refactor get_contact_form_shortcode() once https://github.com/Automattic/jetpack/issues/102 is fixed
    44        if doesn't happen soon, then add admin notice if missing page w/ contact form or it's not published
    5    
     5
    66Medium priority:
    77    add color pickers
     
    1313        maybe add more custom sizes too
    1414    make the date lookup less fragile? maybe store blog id in wordcamp post type meta so don't have to rely on url, or just parse_url() to make matching easier
    15    
    16    
     15
     16
    1717Low priority:
    1818    styles
     
    2020        make contact box align w/ right edge of intro text properly instead of workaround
    2121    make dashes/underscores consistent in html element ids/names
    22    
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/classes/wccsp-settings.php

    r2186 r3780  
    2525
    2626    /**
    27      * Retrieves all of the settings from the database 
    28      * 
     27     * Retrieves all of the settings from the database
     28     *
    2929     * @return array
    3030     */
     
    3737            'image_id'                   => 0,
    3838        );
    39            
     39
    4040        $settings = shortcode_atts(
    4141            $defaults,
     
    4848    /**
    4949     * Register and enqueue the JavaScript we need for the Settings screen
    50      * 
     50     *
    5151     * @param string $screen
    5252     */
     
    5555            return;
    5656        }
    57        
     57
    5858        wp_register_script(
    5959            'wccsp-settings',
     
    9898        add_settings_section(
    9999            'wccsp_default',
    100             '', 
     100            '',
    101101            array( $this, 'markup_section_headers' ),
    102102            'wccsp_settings'
    103103        );
    104        
     104
    105105
    106106        add_settings_field(
     
    148148            array( 'label_for' => 'wccsp_image_id' )
    149149        );
    150        
     150
    151151
    152152        register_setting(
     
    193193            $new_settings['enabled'] = 'off';
    194194        }
    195        
     195
    196196        $new_settings['body_background_color']      = sanitize_text_field( $new_settings['body_background_color'] );
    197197        $new_settings['container_background_color'] = sanitize_text_field( $new_settings['container_background_color'] );
    198198        $new_settings['text_color']                 = sanitize_text_field( $new_settings['text_color'] );
    199        
     199
    200200        $new_settings['image_id'] = absint( $new_settings['image_id'] );
    201        
     201
    202202        return $new_settings;
    203203    }
     
    218218    public function render_admin_notices() {
    219219        $current_screen = get_current_screen();
    220        
     220
    221221        if ( 'settings_page_wccsp_settings' != $current_screen->id ) {
    222222            return;
     
    229229            'contact-form'  => __( 'Contact Form',  'wordcamporg' ),
    230230        );
    231        
     231
    232232        foreach ( $required_modules as $module_id => $module_name ) {
    233233            if ( ! in_array( $module_id, $active_modules ) ) {
  • 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    }
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/css/template-coming-soon.css

    r1002 r3780  
    1212    overflow: auto;
    1313}
    14    
     14
    1515    #wccsp-image {
    1616        display: block;
     
    1818        margin: 0 auto 40px auto;
    1919    }
    20    
     20
    2121    #wccsp-introduction {
    2222        margin-bottom: 0;
    2323    }
    24    
     24
    2525    .wccsp-box {
    2626        width: 100%;
     
    2929        margin: 40px 40px 0 0;
    3030        padding: 15px;
    31    
     31
    3232        border: 1px solid black;    /* todo box shadow */
    3333    }
    34    
     34
    3535        #wccsp-container .wccsp-box:last-child {
    3636            margin-right: 0;
    3737        }
    38        
     38
    3939        .wccsp-box .widget {
    4040            margin: 0;
    4141            padding: 0;
    4242        }
    43    
     43
    4444        .wccsp-box h2 {
    4545            margin-top: 0;
    4646        }
    47        
     47
    4848        .wccsp-box p:last-child {
    4949            margin-bottom: 0;
    5050        }
    51        
     51
    5252        .wccsp-box input[type="text"],
    5353        .wccsp-box input[type="email"],
     
    5656            margin-bottom: 1em;
    5757            padding: 2px 3px;
    58            
     58
    5959            /* todo not working */
    6060        }
    61        
     61
    6262        .wccsp-box input[type="text"]:last-child {
    6363            margin-bottom: 0;
    6464        }
    65        
     65
    6666        .wccsp-box input[type="submit"] {
    6767            margin: 0 auto;             /*todo not working */
    6868            text-align: center;
    6969        }
    70        
     70
    7171        .wccsp-box textarea {
    7272            height: 8em;
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/javascript/wccsp-settings.js

    r384 r3780  
    11jQuery( document ).ready( function( $ ) {
    2    
     2
    33    var WCCSP_Settings = {
    4        
     4
    55        /**
    66         * Constructor
     
    1212        /**
    1313         * Injects the media modal and assigns the chosen attachment ID to corresponding input field
    14          * 
     14         *
    1515         * @param object event
    1616         * @returns {boolean}
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/views/template-coming-soon.php

    r2426 r3780  
    55    <meta name="viewport" content="width=device-width">
    66    <title><?php echo esc_html( get_bloginfo( 'name' ) ); ?></title>
    7    
     7
    88    <?php wp_head(); ?>
    99    <?php extract( $GLOBALS['WordCamp_Coming_Soon_Page']->get_template_variables() ); ?>
     
    1212<body <?php body_class(); ?>>
    1313    <div id="wccsp-container">
    14        
     14
    1515        <h1><?php echo esc_attr( get_bloginfo( 'name' ) ); ?></h1>
    16        
     16
    1717        <?php if ( $image_url ) : ?>
    1818            <img id="wccsp-image" src="<?php echo esc_attr( $image_url ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>" />
     
    2222            <h2><?php echo esc_html( $dates ); ?></h2>
    2323        <?php endif; ?>
    24        
     24
    2525        <p id="wccsp-introduction">
    2626            <?php printf(
     
    4343            <div class="wccsp-box">
    4444                <h2><?php _e( 'Contact the Organizers' , 'wordcamporg' ); ?></h2>
    45                
     45
    4646                <?php echo $contact_form_shortcode; // intentionally not escaping because it's the output of do_shortcode() ?>
    4747            </div>
    4848        <?php endif; ?>
    49        
     49
    5050    </div><!-- #wccsp_container -->
    51    
     51
    5252    <?php wp_footer(); ?>
    5353</body>
Note: See TracChangeset for help on using the changeset viewer.