Changeset 3780 for sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/classes/wordcamp-coming-soon-page.php
- Timestamp:
- 08/07/2016 12:11:37 AM (8 years ago)
- 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 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 }
Note: See TracChangeset
for help on using the changeset viewer.