Changeset 7173
- Timestamp:
- 04/26/2018 10:18:32 PM (7 years ago)
- Location:
- sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/bootstrap.php
r3784 r7173 1 1 <?php 2 2 3 /* 3 4 Plugin Name: WordCamp Coming Soon Page -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/classes/wccsp-customizer.php
r5819 r7173 8 8 */ 9 9 public function __construct() { 10 add_action( 'init', array( $this, 'init' ), 11 ); // after WCCSP_Settings::init()10 add_action( 'init', array( $this, 'init' ), 11 ); // After WCCSP_Settings::init(). 11 11 add_action( 'customize_register', array( $this, 'register_customizer_components' ) ); 12 12 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_customizer_scripts' ) ); … … 29 29 'wccsp_live_preview', 30 30 array( 31 'capability' => $GLOBALS['WCCSP_Settings']::REQUIRED_CAPABILITY, 32 'title' => __( 'Coming Soon Page', 'wordcamporg' ), 33 31 'capability' => $GLOBALS['WCCSP_Settings']::REQUIRED_CAPABILITY, 32 'title' => __( 'Coming Soon Page', 'wordcamporg' ), 34 33 'description' => __( 35 34 'When enabled, the Coming Soon page will be displayed to logged-out users, giving you a chance to setup all of your content before your site is visible to the world.', 36 35 'wordcamporg' 37 36 ) . $GLOBALS['WCCSP_Settings']->render_admin_notices(), 38 37 ) 39 38 ); … … 52 51 'wccsp_settings[enabled]', 53 52 array( 54 'section' 55 'type' 56 'choices' 57 'priority' 58 'capability' 53 'section' => 'wccsp_live_preview', 54 'type' => 'radio', 55 'choices' => array( 'on' => 'On', 'off' => 'Off' ), 56 'priority' => 1, 57 'capability' => $GLOBALS['WCCSP_Settings']::REQUIRED_CAPABILITY, 59 58 ) 60 59 ); -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/classes/wccsp-settings.php
r5603 r7173 12 12 13 13 /** 14 * Constructor 14 * Constructor. 15 15 */ 16 16 public function __construct() { … … 28 28 29 29 /** 30 * Retrieves all of the settings from the database 30 * Retrieves all of the settings from the database. 31 31 * 32 32 * @return array … … 34 34 public function get_settings() { 35 35 $defaults = array( 36 'enabled' => 'off', // so that sites created before the plugin was deployed won't display the home page when the plugin is activated36 'enabled' => 'off', // So that sites created before the plugin was deployed won't display the home page when the plugin is activated. 37 37 'body_background_color' => '#0073AA', 38 38 'image_id' => 0, 39 39 'background_id' => 0, 40 'container_background_color' => '#FFFFFF', // deprecated41 'text_color' => '#000000', // deprecated40 'container_background_color' => '#FFFFFF', // Deprecated. 41 'text_color' => '#000000', // Deprecated. 42 42 'introduction' => '', 43 43 ); … … 52 52 53 53 /** 54 * Add a link to the Settings menu 54 * Add a link to the Settings menu. 55 55 * 56 56 * Even though this lives in the Customizer, having a link in the regular admin menus helps with … … 76 76 77 77 /** 78 * Clear the static page cache 78 * Clear the static page cache. 79 * 79 80 * Changing the settings will change the how the page looks, so the cache needs to be refreshed. 80 81 */ -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/classes/wordcamp-coming-soon-page.php
r6664 r7173 9 9 */ 10 10 public function __construct() { 11 add_action( 'init', array( $this, 'init' ), 11 ); // after WCCSP_Settings::init()12 add_action( 'wp_enqueue_scripts', array( $this, 'manage_plugin_theme_stylesheets' ), 99 ); // (hopefully) after all plugins/themes have enqueued their styles13 add_action( 'wp_head', array( $this, 'render_dynamic_styles' ));14 add_filter( 'template_include', array( $this, 'override_theme_template' ));15 add_action( 'template_redirect', array( $this, 'disable_jetpacks_open_graph' ));16 add_filter( 'rest_authentication_errors', array( $this, 'disable_rest_endpoints' ));17 add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu_item' ), 1000);18 add_action( 'admin_head', array( $this, 'admin_bar_styling' ));19 add_action( 'wp_head', array( $this, 'admin_bar_styling' ));20 add_action( 'admin_notices', array( $this, 'block_new_post_admin_notice' ));11 add_action( 'init', array( $this, 'init' ), 11 ); // After WCCSP_Settings::init(). 12 add_action( 'wp_enqueue_scripts', array( $this, 'manage_plugin_theme_stylesheets' ), 99 ); // (Hopefully) after all plugins/themes have enqueued their styles. 13 add_action( 'wp_head', array( $this, 'render_dynamic_styles' ) ); 14 add_filter( 'template_include', array( $this, 'override_theme_template' ) ); 15 add_action( 'template_redirect', array( $this, 'disable_jetpacks_open_graph' ) ); 16 add_filter( 'rest_authentication_errors', array( $this, 'disable_rest_endpoints' ) ); 17 add_action( 'admin_bar_menu', array( $this, 'admin_bar_menu_item' ), 1000 ); 18 add_action( 'admin_head', array( $this, 'admin_bar_styling' ) ); 19 add_action( 'wp_head', array( $this, 'admin_bar_styling' ) ); 20 add_action( 'admin_notices', array( $this, 'block_new_post_admin_notice' ) ); 21 21 add_filter( 'get_post_metadata', array( $this, 'jetpack_dont_email_post_to_subs' ), 10, 4 ); 22 22 … … 29 29 public function init() { 30 30 $settings = $GLOBALS['WCCSP_Settings']->get_settings(); 31 $show_page = 'on' == $settings['enabled'] && ! current_user_can( 'edit_posts' );31 $show_page = 'on' === $settings['enabled'] && ! current_user_can( 'edit_posts' ); 32 32 $this->override_theme_template = $show_page || $this->is_coming_soon_preview(); 33 33 } … … 77 77 */ 78 78 protected function dequeue_all_stylesheets() { 79 foreach ( $GLOBALS['wp_styles']->queue as $stylesheet ) {79 foreach ( $GLOBALS['wp_styles']->queue as $stylesheet ) { 80 80 wp_dequeue_style( $stylesheet ); 81 81 } … … 141 141 * @return array 142 142 */ 143 function get_template_variables() {143 public function get_template_variables() { 144 144 $variables = array( 145 145 'image_url' => $this->get_image_url(), … … 167 167 } 168 168 169 // If they never changed from the old default background color, then use the new default 169 // If they never changed from the old default background color, then use the new default. 170 170 $background = $settings['body_background_color']; 171 171 if ( '#666666' === $background ) { … … 173 173 } 174 174 175 // Just in case we can't find Jetpack_Color 175 // Just in case we can't find Jetpack_Color. 176 176 if ( class_exists( 'Jetpack_Color' ) ) { 177 177 $color = new Jetpack_Color( $background, 'hex' ); … … 181 181 $color_hsl['h'], 182 182 $color_hsl['s'], 183 ( $color_hsl['l'] >= 85 ) ? 100 : $color_hsl['l'] + 15 183 ( $color_hsl['l'] >= 85 ) ? 100 : $color_hsl['l'] + 15, 184 184 ), 'hsl' ); 185 185 … … 187 187 $color_hsl['h'], 188 188 $color_hsl['s'], 189 ( $color_hsl['l'] < 10 ) ? 0 : $color_hsl['l'] - 10 189 ( $color_hsl['l'] < 10 ) ? 0 : $color_hsl['l'] - 10, 190 190 ), 'hsl' ); 191 191 … … 201 201 $colors['darker'] = $background_darker; 202 202 203 // Not currently customizable 203 // Not currently customizable. 204 204 $colors['text'] = '#32373c'; 205 205 $colors['light-text'] = '#b4b9be'; … … 210 210 211 211 /** 212 * Retrieve the URL of the logo image displayed in the template 212 * Retrieve the URL of the logo image displayed in the template. 213 213 * 214 214 * @return string|false … … 224 224 225 225 /** 226 * Retrieve the URL of the background image displayed in the template 226 * Retrieve the URL of the background image displayed in the template. 227 227 * 228 228 * @return string|false … … 242 242 */ 243 243 public function get_dates() { 244 $dates = false;244 $dates = false; 245 245 $wordcamp_post = get_wordcamp_post(); 246 246 247 247 if ( isset( $wordcamp_post->ID ) ) { 248 248 if ( ! empty( $wordcamp_post->meta['Start Date (YYYY-mm-dd)'][0] ) ) { 249 // translators: date format, see https://php.net/date 250 $dates = date_i18n( __( 'F jS Y' 249 // translators: date format, see https://php.net/date. 250 $dates = date_i18n( __( 'F jS Y', 'wordcamporg' ), $wordcamp_post->meta['Start Date (YYYY-mm-dd)'][0] ); 251 251 252 252 if ( ! empty( $wordcamp_post->meta['End Date (YYYY-mm-dd)'][0] ) ) { 253 253 if ( $wordcamp_post->meta['Start Date (YYYY-mm-dd)'][0] !== $wordcamp_post->meta['End Date (YYYY-mm-dd)'][0] ) { 254 // translators: date format, see https://php.net/date 255 $dates .= ' - ' . date_i18n( __( 'F jS Y' 254 // translators: date format, see https://php.net/date. 255 $dates .= ' - ' . date_i18n( __( 'F jS Y', 'wordcamporg' ), $wordcamp_post->meta['End Date (YYYY-mm-dd)'][0] ); 256 256 } 257 257 } … … 310 310 */ 311 311 public function get_introduction() { 312 $settings 312 $settings = $GLOBALS['WCCSP_Settings']->get_settings(); 313 313 314 314 return $settings['introduction']; … … 318 318 * Display notice in admin bar when Coming Soon mode is on. 319 319 * 320 * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference 321 */ 322 function admin_bar_menu_item( $wp_admin_bar ) {320 * @param WP_Admin_Bar $wp_admin_bar WP_Admin_Bar instance, passed by reference. 321 */ 322 public function admin_bar_menu_item( $wp_admin_bar ) { 323 323 $settings = $GLOBALS['WCCSP_Settings']->get_settings(); 324 if ( $settings['enabled'] !== 'on' ) { 324 325 if ( 'on' !== $settings['enabled'] ) { 325 326 return; 326 327 } 327 328 328 $menu_slug 329 $menu_slug = add_query_arg( 329 330 array( 330 331 'autofocus[section]' => 'wccsp_live_preview', … … 353 354 public function admin_bar_styling() { 354 355 $settings = $GLOBALS['WCCSP_Settings']->get_settings(); 355 if ( $settings['enabled'] !== 'on' ) { 356 357 if ( 'on' !== $settings['enabled'] ) { 356 358 return; 357 359 } … … 370 372 } 371 373 372 /* 374 /** 373 375 * Show a notice if Coming Soon is enabled. 374 376 * … … 377 379 public function block_new_post_admin_notice() { 378 380 $settings = $GLOBALS['WCCSP_Settings']->get_settings(); 379 if ( $settings['enabled'] !== 'on' ) { 381 382 if ( 'on' !== $settings['enabled'] ) { 380 383 return; 381 384 } 382 385 383 $menu_slug 386 $menu_slug = add_query_arg( 384 387 array( 385 388 'autofocus[section]' => 'wccsp_live_preview', … … 389 392 ); 390 393 $setting_url = admin_url( $menu_slug ); 391 392 $screen = get_current_screen(); 393 if ( trim( $screen->id ) == 'post') {394 $class = 'notice notice-warning';394 $screen = get_current_screen(); 395 396 if ( 'post' === trim( $screen->id ) ) { 397 $class = 'notice notice-warning'; 395 398 $message = sprintf( 396 399 __( '<a href="%s">Coming Soon mode</a> is enabled. Site subscribers will not receive email notifications about published posts.', 'wordcamporg' ), … … 402 405 } 403 406 404 printf( '<div class="%1$s"><p>%2$s</p></div>', $class, $message);407 printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), wp_kses_data( $message ) ); 405 408 } 406 409 } … … 414 417 * @param string $meta_key Meta key. 415 418 * @param bool $single Whether to return only the first value of the specified $meta_key. 416 */ 417 function jetpack_dont_email_post_to_subs( $value, $object_id, $meta_key, $single ) { 419 * 420 * @return null|array|string 421 */ 422 public function jetpack_dont_email_post_to_subs( $value, $object_id, $meta_key, $single ) { 418 423 if ( '_jetpack_dont_email_post_to_subs' === $meta_key ) { 419 424 $settings = $GLOBALS['WCCSP_Settings']->get_settings(); 420 425 421 if ( $settings['enabled'] === 'on') {426 if ( 'on' === $settings['enabled'] ) { 422 427 return true; 423 428 } … … 427 432 } 428 433 429 } // end WordCamp_Coming_Soon_Page 434 } // end WordCamp_Coming_Soon_Page. -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/css/template-coming-soon-dynamic.php
r3784 r7173 16 16 background: url('<?php echo esc_url( $background_url ); ?>') no-repeat center; 17 17 background-size: cover; 18 <?php else : ?>18 <?php else : ?> 19 19 background: <?php echo esc_attr( $colors['main'] ); ?>; 20 20 background: linear-gradient( -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/views/settings-admin-notices.php
r3784 r7173 3 3 <?php foreach ( $inactive_required_modules as $module ) : ?> 4 4 <li> 5 <?php // translators: %s is the name of the jetpack module ?>6 <?php printf( __( "Please activate Jetpack's %s module.", 'wordcamporg' ), esc_html( $module ) ); ?>5 <?php // translators: %s is the name of the jetpack module. ?> 6 <?php printf( esc_html__( "Please activate Jetpack's %s module.", 'wordcamporg' ), esc_html( $module ) ); ?> 7 7 </li> 8 8 <?php endforeach; ?> -
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-coming-soon-page/views/template-coming-soon.php
r7172 r7173 47 47 <?php printf( 48 48 /* translators: %s is the name of the blog. */ 49 __(49 esc_html__( 50 50 '%s is in the early planning stages. In the meantime, you can subscribe to updates above, or contact the organizers below to get involved.', 51 51 'wordcamporg' … … 59 59 <?php if ( in_array( 'contact-form', $active_modules ) && $contact_form_shortcode ) : ?> 60 60 <div class="wccsp-contact"> 61 <h2><?php esc_html_e( 'Contact the Organizers' 61 <h2><?php esc_html_e( 'Contact the Organizers', 'wordcamporg' ); ?></h2> 62 62 63 <?php echo $contact_form_shortcode; // intentionally not escaping because it's the output of do_shortcode()?>63 <?php echo $contact_form_shortcode; // Intentionally not escaping because it's the output of do_shortcode(). ?> 64 64 </div> 65 65 <?php endif; ?>
Note: See TracChangeset
for help on using the changeset viewer.