Changeset 3780
- Timestamp:
- 08/07/2016 12:11:37 AM (9 years ago)
- 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 3 3 refactor get_contact_form_shortcode() once https://github.com/Automattic/jetpack/issues/102 is fixed 4 4 if doesn't happen soon, then add admin notice if missing page w/ contact form or it's not published 5 5 6 6 Medium priority: 7 7 add color pickers … … 13 13 maybe add more custom sizes too 14 14 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 17 17 Low priority: 18 18 styles … … 20 20 make contact box align w/ right edge of intro text properly instead of workaround 21 21 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 25 25 26 26 /** 27 * Retrieves all of the settings from the database 28 * 27 * Retrieves all of the settings from the database 28 * 29 29 * @return array 30 30 */ … … 37 37 'image_id' => 0, 38 38 ); 39 39 40 40 $settings = shortcode_atts( 41 41 $defaults, … … 48 48 /** 49 49 * Register and enqueue the JavaScript we need for the Settings screen 50 * 50 * 51 51 * @param string $screen 52 52 */ … … 55 55 return; 56 56 } 57 57 58 58 wp_register_script( 59 59 'wccsp-settings', … … 98 98 add_settings_section( 99 99 'wccsp_default', 100 '', 100 '', 101 101 array( $this, 'markup_section_headers' ), 102 102 'wccsp_settings' 103 103 ); 104 104 105 105 106 106 add_settings_field( … … 148 148 array( 'label_for' => 'wccsp_image_id' ) 149 149 ); 150 150 151 151 152 152 register_setting( … … 193 193 $new_settings['enabled'] = 'off'; 194 194 } 195 195 196 196 $new_settings['body_background_color'] = sanitize_text_field( $new_settings['body_background_color'] ); 197 197 $new_settings['container_background_color'] = sanitize_text_field( $new_settings['container_background_color'] ); 198 198 $new_settings['text_color'] = sanitize_text_field( $new_settings['text_color'] ); 199 199 200 200 $new_settings['image_id'] = absint( $new_settings['image_id'] ); 201 201 202 202 return $new_settings; 203 203 } … … 218 218 public function render_admin_notices() { 219 219 $current_screen = get_current_screen(); 220 220 221 221 if ( 'settings_page_wccsp_settings' != $current_screen->id ) { 222 222 return; … … 229 229 'contact-form' => __( 'Contact Form', 'wordcamporg' ), 230 230 ); 231 231 232 232 foreach ( $required_modules as $module_id => $module_name ) { 233 233 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 4 4 protected $override_theme_template; 5 5 const VERSION = '0.1'; 6 6 7 7 /** 8 8 * Constructor … … 33 33 return; 34 34 } 35 35 36 36 $this->dequeue_all_stylesheets(); 37 37 $this->register_twentythirteen_styles(); … … 49 49 */ 50 50 protected function dequeue_all_stylesheets() { 51 foreach( $GLOBALS['wp_styles']->queue as $stylesheet ) { 51 foreach( $GLOBALS['wp_styles']->queue as $stylesheet ) { 52 52 wp_dequeue_style( $stylesheet ); 53 53 } … … 60 60 */ 61 61 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 64 64 if ( ! wp_style_is( 'twentythirteen-fonts', 'registered' ) ) { 65 65 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 ); … … 82 82 return; 83 83 } 84 84 85 85 $settings = $GLOBALS['WCCSP_Settings']->get_settings(); 86 86 ?> 87 87 88 88 <!-- BEGIN wordcamp-coming-soon-page --> 89 89 <style type="text/css"> … … 91 91 color: <?php echo esc_html( $settings['text_color'] ); ?>; 92 92 } 93 93 94 94 #wccsp-container, 95 95 .widget { … … 110 110 /** 111 111 * Load the Coming Soon template instead of a theme template 112 * 112 * 113 113 * @param string $template 114 114 * @return string … … 118 118 $template = dirname( __DIR__ ) . '/views/template-coming-soon.php'; 119 119 } 120 120 121 121 return $template; 122 122 } … … 125 125 * Collect all of the variables the Coming Soon template will need 126 126 * Doing this here keeps the template less cluttered and more of a pure view 127 * 127 * 128 128 * @return array 129 129 */ … … 141 141 /** 142 142 * Retrieve the URL of the image displayed in the template 143 * 143 * 144 144 * @return string|false 145 145 */ … … 147 147 $settings = $GLOBALS['WCCSP_Settings']->get_settings(); 148 148 $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'; 150 150 $image = wp_get_attachment_image_src( $settings['image_id'], $size ); 151 151 152 152 return $image ? $image[0] : false; 153 153 } … … 155 155 /** 156 156 * Retrieve the dates of the WordCamp 157 * 157 * 158 158 * @return string|false 159 159 */ … … 175 175 } 176 176 } 177 177 178 178 return $dates; 179 179 } … … 185 185 * 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 186 186 * 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. 188 188 * todo Refactor this once #102-jetpack is fixed. 189 * 189 * 190 190 * @return string|false 191 191 */ … … 193 193 $contact_form_shortcode = false; 194 194 $shortcode_regex = get_shortcode_regex(); 195 195 196 196 $all_pages = get_posts( array( 197 197 'post_type' => 'page', 198 198 'posts_per_page' => -1, 199 199 ) ); 200 200 201 201 foreach ( $all_pages as $page ) { 202 202 preg_match_all( '/' . $shortcode_regex . '/s', $page->post_content, $matches, PREG_SET_ORDER ); … … 207 207 $post = $page; 208 208 setup_postdata( $post ); 209 209 210 210 ob_start(); 211 211 echo do_shortcode( $shortcode[0] ); 212 212 $contact_form_shortcode = ob_get_clean(); 213 213 214 214 wp_reset_postdata(); 215 215 break; … … 217 217 } 218 218 } 219 219 220 220 return $contact_form_shortcode; 221 221 } -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/css/template-coming-soon.css
r1002 r3780 12 12 overflow: auto; 13 13 } 14 14 15 15 #wccsp-image { 16 16 display: block; … … 18 18 margin: 0 auto 40px auto; 19 19 } 20 20 21 21 #wccsp-introduction { 22 22 margin-bottom: 0; 23 23 } 24 24 25 25 .wccsp-box { 26 26 width: 100%; … … 29 29 margin: 40px 40px 0 0; 30 30 padding: 15px; 31 31 32 32 border: 1px solid black; /* todo box shadow */ 33 33 } 34 34 35 35 #wccsp-container .wccsp-box:last-child { 36 36 margin-right: 0; 37 37 } 38 38 39 39 .wccsp-box .widget { 40 40 margin: 0; 41 41 padding: 0; 42 42 } 43 43 44 44 .wccsp-box h2 { 45 45 margin-top: 0; 46 46 } 47 47 48 48 .wccsp-box p:last-child { 49 49 margin-bottom: 0; 50 50 } 51 51 52 52 .wccsp-box input[type="text"], 53 53 .wccsp-box input[type="email"], … … 56 56 margin-bottom: 1em; 57 57 padding: 2px 3px; 58 58 59 59 /* todo not working */ 60 60 } 61 61 62 62 .wccsp-box input[type="text"]:last-child { 63 63 margin-bottom: 0; 64 64 } 65 65 66 66 .wccsp-box input[type="submit"] { 67 67 margin: 0 auto; /*todo not working */ 68 68 text-align: center; 69 69 } 70 70 71 71 .wccsp-box textarea { 72 72 height: 8em; -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/javascript/wccsp-settings.js
r384 r3780 1 1 jQuery( document ).ready( function( $ ) { 2 2 3 3 var WCCSP_Settings = { 4 4 5 5 /** 6 6 * Constructor … … 12 12 /** 13 13 * Injects the media modal and assigns the chosen attachment ID to corresponding input field 14 * 14 * 15 15 * @param object event 16 16 * @returns {boolean} -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/views/template-coming-soon.php
r2426 r3780 5 5 <meta name="viewport" content="width=device-width"> 6 6 <title><?php echo esc_html( get_bloginfo( 'name' ) ); ?></title> 7 7 8 8 <?php wp_head(); ?> 9 9 <?php extract( $GLOBALS['WordCamp_Coming_Soon_Page']->get_template_variables() ); ?> … … 12 12 <body <?php body_class(); ?>> 13 13 <div id="wccsp-container"> 14 14 15 15 <h1><?php echo esc_attr( get_bloginfo( 'name' ) ); ?></h1> 16 16 17 17 <?php if ( $image_url ) : ?> 18 18 <img id="wccsp-image" src="<?php echo esc_attr( $image_url ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>" /> … … 22 22 <h2><?php echo esc_html( $dates ); ?></h2> 23 23 <?php endif; ?> 24 24 25 25 <p id="wccsp-introduction"> 26 26 <?php printf( … … 43 43 <div class="wccsp-box"> 44 44 <h2><?php _e( 'Contact the Organizers' , 'wordcamporg' ); ?></h2> 45 45 46 46 <?php echo $contact_form_shortcode; // intentionally not escaping because it's the output of do_shortcode() ?> 47 47 </div> 48 48 <?php endif; ?> 49 49 50 50 </div><!-- #wccsp_container --> 51 51 52 52 <?php wp_footer(); ?> 53 53 </body>
Note: See TracChangeset
for help on using the changeset viewer.