Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 220 |
|
0.00% |
0 / 5 |
CRAP | n/a |
0 / 0 |
|
| A8C\FSE\Coming_soon\get_current_locale | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
| A8C\FSE\Coming_soon\original_request_url | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
42 | |||
| A8C\FSE\Coming_soon\get_wpcom_redirect_to | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
12 | |||
| A8C\FSE\Coming_soon\get_login_url | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
| A8C\FSE\Coming_soon\get_onboarding_url | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Coming Soon fallback page. |
| 4 | * |
| 5 | * This page is used when the site is set to Coming Soon mode, but no |
| 6 | * Coming Soon page id has been set. |
| 7 | * |
| 8 | * @package A8C\FSE\Coming_soon |
| 9 | */ |
| 10 | |
| 11 | namespace A8C\FSE\Coming_soon; |
| 12 | |
| 13 | use Automattic\Jetpack\Jetpack_Mu_Wpcom\Common; |
| 14 | |
| 15 | /** |
| 16 | * Returns the current locale |
| 17 | * |
| 18 | * @return string Language slug |
| 19 | */ |
| 20 | function get_current_locale() { |
| 21 | $language = function_exists( 'get_blog_lang_code' ) ? get_blog_lang_code() : get_locale(); |
| 22 | return Common\get_iso_639_locale( $language ); |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * Returns request URL for self-hosted and/or Atomic sites (non-WordPress.com sites) |
| 27 | * |
| 28 | * @return string The redirect URL |
| 29 | */ |
| 30 | function original_request_url() { |
| 31 | if ( empty( $_SERVER['SERVER_NAME'] ) || empty( $_SERVER['REQUEST_URI'] ) ) { |
| 32 | return get_onboarding_url(); |
| 33 | } |
| 34 | |
| 35 | $origin = ( is_ssl() ? 'https://' : 'http://' ) . sanitize_text_field( wp_unslash( $_SERVER['SERVER_NAME'] ) ); |
| 36 | |
| 37 | if ( ! empty( $_SERVER['SERVER_PORT'] ) && ! in_array( $_SERVER['SERVER_PORT'], array( 80, 443 ), true ) ) { |
| 38 | $origin .= ':' . sanitize_text_field( wp_unslash( $_SERVER['SERVER_PORT'] ) ); |
| 39 | } |
| 40 | |
| 41 | return $origin . strtok( sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ), '?' ); |
| 42 | } |
| 43 | |
| 44 | /** |
| 45 | * Returns an unencoded redirect URL for post-login flow in WordPress.com. |
| 46 | * |
| 47 | * @return string The redirect URL |
| 48 | */ |
| 49 | function get_wpcom_redirect_to() { |
| 50 | // Redirect to the current URL. |
| 51 | // If, for any reason, the superglobals aren't available, set a default redirect. |
| 52 | if ( empty( $_SERVER['HTTP_HOST'] ) || empty( $_SERVER['REQUEST_URI'] ) ) { |
| 53 | return get_onboarding_url(); |
| 54 | } |
| 55 | |
| 56 | return 'https://' . sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) . sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Returns a localized login URL with redirect query param |
| 61 | * |
| 62 | * @return string The login URL |
| 63 | */ |
| 64 | function get_login_url() { |
| 65 | $default_url = site_url() . '/wp-login.php?redirect_to=' . set_url_scheme( original_request_url() ); |
| 66 | |
| 67 | return apply_filters( 'wpcom_public_coming_soon_login_url', $default_url, get_wpcom_redirect_to() ); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Returns a localized onboarding URL with redirect query param |
| 72 | * |
| 73 | * @return string The URL |
| 74 | */ |
| 75 | function get_onboarding_url() { |
| 76 | $locale = get_current_locale(); |
| 77 | $locale_subdomain = 'en' === $locale ? '' : $locale . '.'; |
| 78 | |
| 79 | return apply_filters( 'wpcom_public_coming_soon_onboarding_url', 'https://' . $locale_subdomain . 'wordpress.com/?ref=coming_soon' ); |
| 80 | } |
| 81 | |
| 82 | nocache_headers(); |
| 83 | |
| 84 | ?> |
| 85 | <!DOCTYPE html> |
| 86 | <html <?php language_attributes(); ?>> |
| 87 | <head> |
| 88 | <title><?php echo esc_html( get_bloginfo( 'name' ) ); ?></title> |
| 89 | <meta charset="<?php esc_attr( bloginfo( 'charset' ) ); ?>" /> |
| 90 | <meta name="description" content="<?php echo esc_attr( get_bloginfo( 'description' ) ); ?>" /> |
| 91 | <meta name="viewport" content="width=device-width" /> |
| 92 | <?php wp_head(); ?> |
| 93 | <style type="text/css"> |
| 94 | html { |
| 95 | /* No admin bar nor marketing bar on this page */ |
| 96 | margin-top: 0 !important; |
| 97 | height: 100%; |
| 98 | } |
| 99 | .wpcom-coming-soon-body { |
| 100 | background: #3858e9; |
| 101 | color: #fff; |
| 102 | font-family: inter-variable-web,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; height: 100%; |
| 103 | display: flex; |
| 104 | flex-direction: column; |
| 105 | } |
| 106 | .wpcom-coming-soon-outer { |
| 107 | display: grid; |
| 108 | grid-gap: 24px; |
| 109 | -ms-grid-columns: (1fr)[1]; |
| 110 | grid-template-columns: repeat(1, 1fr); |
| 111 | flex-grow: 1; |
| 112 | } |
| 113 | .wpcom-coming-soon-inner { |
| 114 | display: flex; |
| 115 | align-items: center; |
| 116 | -ms-grid-column: 1; |
| 117 | grid-column-start: 1; |
| 118 | -ms-grid-column-span: 1; |
| 119 | grid-column-end: span 1; |
| 120 | padding-right: 24px; |
| 121 | padding-left: 24px; |
| 122 | } |
| 123 | .wpcom-coming-soon-description { |
| 124 | color: #fff; |
| 125 | font-size: 40px; |
| 126 | line-height: 1.15; |
| 127 | padding: 0; |
| 128 | text-align: left; |
| 129 | } |
| 130 | .wpcom-coming-soon-description { |
| 131 | font-family: Georgia, "Times New Roman", Times, serif; |
| 132 | } |
| 133 | .wpcom-coming-soon-description span { |
| 134 | display: block; |
| 135 | } |
| 136 | .wpcom-coming-soon-description span:last-child { |
| 137 | padding-left: 60px; |
| 138 | } |
| 139 | .wpcom-coming-soon-marketing { |
| 140 | padding-bottom: 8px; |
| 141 | padding-right: 24px; |
| 142 | padding-left: 24px; |
| 143 | } |
| 144 | .wpcom-coming-soon-marketing-copy { |
| 145 | display: flex; |
| 146 | align-items: center; |
| 147 | margin-bottom: 20px; |
| 148 | } |
| 149 | .wpcom-coming-soon-wplogo { |
| 150 | margin-right: 16px; |
| 151 | margin-bottom: 0; |
| 152 | } |
| 153 | .wpcom-coming-soon-wplogo a { |
| 154 | border: none; |
| 155 | } |
| 156 | .wpcom-coming-soon-marketing-copy-text { |
| 157 | line-height: 1.4; |
| 158 | margin: 0; |
| 159 | } |
| 160 | .wpcom-coming-soon-marketing-buttons .button { |
| 161 | background: #fff; |
| 162 | border-radius: 4px; |
| 163 | border: 1px solid #fff; |
| 164 | box-sizing: border-box; |
| 165 | color: #3858e9; |
| 166 | display: block; |
| 167 | font-size: 16px; |
| 168 | font-weight: 500; |
| 169 | line-height: 21px; |
| 170 | padding: 13px; |
| 171 | text-align: center; |
| 172 | text-overflow: ellipsis; |
| 173 | text-decoration: none; |
| 174 | transition: opacity .15s ease-out; |
| 175 | white-space: nowrap; |
| 176 | width: 100%; |
| 177 | } |
| 178 | .wpcom-coming-soon-marketing-buttons .button-secondary, |
| 179 | .wpcom-coming-soon-marketing-buttons .button-secondary:hover, |
| 180 | .wpcom-coming-soon-marketing-buttons .button-secondary:focus { |
| 181 | background: transparent; |
| 182 | color: #fff; |
| 183 | } |
| 184 | .wpcom-coming-soon-marketing-buttons .button:hover, |
| 185 | .wpcom-coming-soon-marketing-buttons .button:focus { |
| 186 | opacity: .85; |
| 187 | } |
| 188 | .wpcom-coming-soon-marketing-buttons p { |
| 189 | margin: 1em 0; |
| 190 | } |
| 191 | @media screen and ( min-width: 660px ) { |
| 192 | .wpcom-coming-soon-description { |
| 193 | font-family: Recoleta, Georgia, "Times New Roman", Times, serif; |
| 194 | } |
| 195 | .wpcom-coming-soon-name { |
| 196 | font-size: 23px; |
| 197 | } |
| 198 | .wpcom-coming-soon-description { |
| 199 | font-size: 69px; |
| 200 | } |
| 201 | .wpcom-coming-soon-marketing { |
| 202 | align-items: center; |
| 203 | display: flex; |
| 204 | justify-content: space-between; |
| 205 | padding-bottom: 24px; |
| 206 | } |
| 207 | .wpcom-coming-soon-marketing-copy { |
| 208 | margin-right: 16px; |
| 209 | margin-bottom: 0; |
| 210 | } |
| 211 | .wpcom-coming-soon-marketing-buttons { |
| 212 | display: flex; |
| 213 | } |
| 214 | .wpcom-coming-soon-marketing-buttons p { |
| 215 | margin: 0; |
| 216 | } |
| 217 | .wpcom-coming-soon-marketing-buttons p:nth-child(2) { |
| 218 | margin-left: 16px; |
| 219 | } |
| 220 | .wpcom-coming-soon-marketing-buttons .button { |
| 221 | min-width: 145px; |
| 222 | } |
| 223 | } |
| 224 | @media screen and ( min-width: 661px ) { |
| 225 | p, ul, ol { |
| 226 | font-size: 16px; |
| 227 | letter-spacing: 0; |
| 228 | } |
| 229 | } |
| 230 | @media screen and ( min-width: 960px ) { |
| 231 | .wpcom-coming-soon-name { |
| 232 | font-size: 28px; |
| 233 | margin-bottom: 16px; |
| 234 | } |
| 235 | .wpcom-coming-soon-description { |
| 236 | font-size: 99px; |
| 237 | } |
| 238 | .wpcom-coming-soon-marketing-copy-text { |
| 239 | font-size: 19px; |
| 240 | } |
| 241 | } |
| 242 | @media screen and ( min-width: 1040px ) { |
| 243 | .wpcom-coming-soon-outer { |
| 244 | -ms-grid-columns: (1fr)[12]; |
| 245 | grid-template-columns: repeat(12, 1fr); |
| 246 | } |
| 247 | .wpcom-coming-soon-inner { |
| 248 | -ms-grid-column: 2; |
| 249 | grid-column-start: 2; |
| 250 | -ms-grid-column-span: 10; |
| 251 | grid-column-end: span 10; |
| 252 | } |
| 253 | .wpcom-coming-soon-marketing { |
| 254 | padding-bottom: 32px; |
| 255 | padding-left: 32px; |
| 256 | padding-right: 32px; |
| 257 | } |
| 258 | } |
| 259 | </style> |
| 260 | </head> |
| 261 | <body class="wpcom-coming-soon-body"> |
| 262 | <div class="wpcom-coming-soon-outer"> |
| 263 | <div class="wpcom-coming-soon-inner"> |
| 264 | <div class="wpcom-coming-soon-main"> |
| 265 | <div class="wpcom-coming-soon-description"> |
| 266 | <?php |
| 267 | echo wp_kses( |
| 268 | __( '<span>A bright idea,</span> <span>coming soon</span>', 'jetpack-mu-wpcom' ), |
| 269 | array( |
| 270 | 'span' => array(), |
| 271 | ) |
| 272 | ); |
| 273 | ?> |
| 274 | </div> |
| 275 | </div> |
| 276 | </div> |
| 277 | </div> |
| 278 | <div class="wpcom-coming-soon-marketing"> |
| 279 | <?php if ( ! is_user_logged_in() ) : ?> |
| 280 | <div class="wpcom-coming-soon-marketing-copy"> |
| 281 | <div class="wpcom-coming-soon-wplogo"> |
| 282 | <a href="<?php echo esc_url( get_onboarding_url() ); ?>" title="WordPress.com"> |
| 283 | <svg width="40px" height="40px" viewBox="0 0 40 40" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> |
| 284 | <title>WordPress.com</title> |
| 285 | <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> |
| 286 | <g transform="translate(-701.000000, -950.000000)" fill="#FFFFFF"> |
| 287 | <path d="M730.04024,985.542 L735.53216,969.66248 C736.55848,967.09712 736.89992,965.046 736.89992,963.222 C736.89992,962.56 736.85632,961.94544 736.7788,961.3728 C738.18232,963.93376 738.9812,966.87296 738.9812,969.99976 C738.9812,976.63312 735.38624,982.42536 730.04024,985.542 L730.04024,985.542 Z M723.47808,961.56864 C724.56048,961.51192 725.53592,961.39784 725.53592,961.39784 C726.5048,961.28336 726.39072,959.8592 725.4216,959.91616 C725.4216,959.91616 722.50896,960.14464 720.6288,960.14464 C718.86176,960.14464 715.8928,959.91616 715.8928,959.91616 C714.92328,959.8592 714.80944,961.34048 715.77904,961.39784 C715.77904,961.39784 716.69616,961.51192 717.6648,961.56864 L720.466,969.2444 L716.53008,981.0464 L709.98288,961.56864 C711.06624,961.51192 712.04056,961.39784 712.04056,961.39784 C713.0092,961.28336 712.89464,959.8592 711.92552,959.91616 C711.92552,959.91616 709.01352,960.14464 707.13336,960.14464 C706.79616,960.14464 706.39824,960.13608 705.97552,960.12264 C709.19128,955.24152 714.7176,952.01808 720.99976,952.01808 C725.68112,952.01808 729.94352,953.80776 733.1424,956.7392 C733.06536,956.73408 732.98944,956.72448 732.90984,956.72448 C731.14328,956.72448 729.89008,958.26312 729.89008,959.91616 C729.89008,961.39784 730.74488,962.65128 731.6564,964.13336 C732.34008,965.33096 733.13872,966.86944 733.13872,969.09216 C733.13872,970.63208 732.68224,972.5684 731.77048,974.90568 L729.97656,980.89832 L723.47808,961.56864 Z M720.99976,987.98328 C719.23488,987.98328 717.53104,987.72376 715.92024,987.25072 L721.31592,971.57256 L726.84248,986.71584 C726.8788,986.80384 726.92336,986.88536 726.97136,986.96312 C725.1024,987.62072 723.09392,987.98328 720.99976,987.98328 L720.99976,987.98328 Z M703.01856,969.99976 C703.01856,967.3924 703.57776,964.91736 704.57576,962.68128 L713.1532,986.18272 C707.154,983.2684 703.01856,977.11744 703.01856,969.99976 L703.01856,969.99976 Z M720.99976,950 C709.97208,950 701,958.97184 701,969.99976 C701,981.02856 709.97208,990.00112 720.99976,990.00112 C732.02768,990.00112 741,981.02856 741,969.99976 C741,958.97184 732.02768,950 720.99976,950 L720.99976,950 Z" id="wpcom-wmark"></path> |
| 288 | </g> |
| 289 | </g> |
| 290 | </svg> |
| 291 | </a> |
| 292 | </div> |
| 293 | <p class="wpcom-coming-soon-marketing-copy-text"><?php esc_html_e( 'Build a website. Sell something. Blog. And so much more.', 'jetpack-mu-wpcom' ); ?></p> |
| 294 | </div> |
| 295 | <div class="wpcom-coming-soon-marketing-buttons"> |
| 296 | <p><a class="button button-secondary" href="<?php echo esc_url( get_login_url() ); ?>"><?php esc_html_e( 'Log in', 'jetpack-mu-wpcom' ); ?></a></p> |
| 297 | <p><a class="button button-primary has-background" href="<?php echo esc_url( get_onboarding_url() ); ?>"><?php esc_html_e( 'Start a website', 'jetpack-mu-wpcom' ); ?></a></p> |
| 298 | </div> |
| 299 | <?php endif; ?> |
| 300 | </div> |
| 301 | <?php wp_footer(); ?> |
| 302 | <!-- WordPress.com Editing Toolkit Plugin - Coming Soon --> |
| 303 | </body> |
| 304 | </html> |