csp4-functions.php (13974B)
1 <?php 2 /** 3 * Display the legacy free coming soon page 4 */ 5 if ( ! function_exists( 'seedprod_lite_csp4_render_comingsoon_page' ) ) { 6 function seedprod_lite_csp4_render_comingsoon_page() { 7 extract( seedprod_lite_seed_csp4_get_settings() ); 8 9 if ( ! isset( $status ) ) { 10 $err = new WP_Error( 'error', __( 'Please enter your settings.', 'coming-soon' ) ); 11 echo $err->get_error_message(); 12 exit(); 13 } 14 15 if ( empty( $_GET['cs_preview'] ) ) { 16 $_GET['cs_preview'] = false; 17 } 18 19 // Check if Preview 20 $is_preview = false; 21 if ( ( isset( $_GET['cs_preview'] ) && $_GET['cs_preview'] == 'true' ) ) { 22 $is_preview = true; 23 } 24 25 // Exit if a custom login page 26 if ( empty( $disable_default_excluded_urls ) ) { 27 if ( preg_match( '/login|admin|dashboard|account/i', $_SERVER['REQUEST_URI'] ) > 0 && $is_preview == false ) { 28 return false; 29 } 30 } 31 32 // Check if user is logged in. 33 if ( $is_preview === false ) { 34 if ( is_user_logged_in() ) { 35 return false; 36 } 37 } 38 39 // set headers 40 if ( $status == '2' ) { 41 header( 'HTTP/1.1 503 Service Temporarily Unavailable' ); 42 header( 'Status: 503 Service Temporarily Unavailable' ); 43 header( 'Retry-After: 86400' ); // retry in a day 44 $csp4_maintenance_file = WP_CONTENT_DIR . '/maintenance.php'; 45 if ( ! empty( $enable_maintenance_php ) and file_exists( $csp4_maintenance_file ) ) { 46 include_once $csp4_maintenance_file; 47 exit(); 48 } 49 } 50 51 // Prevetn Plugins from caching 52 // Disable caching plugins. This should take care of: 53 // - W3 Total Cache 54 // - WP Super Cache 55 // - ZenCache (Previously QuickCache) 56 if ( ! defined( 'DONOTCACHEPAGE' ) ) { 57 define( 'DONOTCACHEPAGE', true ); 58 } 59 if ( ! defined( 'DONOTCDN' ) ) { 60 define( 'DONOTCDN', true ); 61 } 62 if ( ! defined( 'DONOTCACHEDB' ) ) { 63 define( 'DONOTCACHEDB', true ); 64 } 65 if ( ! defined( 'DONOTMINIFY' ) ) { 66 define( 'DONOTMINIFY', true ); 67 } 68 if ( ! defined( 'DONOTCACHEOBJECT' ) ) { 69 define( 'DONOTCACHEOBJECT', true ); 70 } 71 //ob_end_clean(); 72 nocache_headers(); 73 74 // render template tags 75 if ( empty( $html ) ) { 76 $template = file_get_contents( SEEDPROD_PLUGIN_PATH . 'app/backwards/themes/default/index.php' ); 77 $template_tags = array( 78 '{Title}' => seedprod_lite_seed_csp4_title(), 79 '{MetaDescription}' => seedprod_lite_seed_csp4_metadescription(), 80 '{Privacy}' => seedprod_lite_seed_csp4_privacy(), 81 '{Favicon}' => seedprod_lite_seed_csp4_favicon(), 82 '{CustomCSS}' => seedprod_lite_seed_csp4_customcss(), 83 '{Head}' => seedprod_lite_seed_csp4_head(), 84 '{Footer}' => seedprod_lite_seed_csp4_footer(), 85 '{Logo}' => seedprod_lite_seed_csp4_logo(), 86 '{Headline}' => seedprod_lite_seed_csp4_headline(), 87 '{Description}' => seedprod_lite_seed_csp4_description(), 88 '{Credit}' => seedprod_lite_seed_csp4_credit(), 89 '{Append_HTML}' => seed_csp4_append_html(), 90 ); 91 echo strtr( $template, $template_tags ); 92 } else { 93 echo $html; 94 } 95 exit(); 96 } 97 } 98 99 // Template Tags 100 if ( ! function_exists( 'seedprod_lite_seed_csp4_title' ) ) { 101 function seedprod_lite_seed_csp4_title() { 102 $o = seedprod_lite_seed_csp4_get_settings(); 103 extract( $o ); 104 105 $output = ''; 106 107 if ( ! empty( $seo_title ) ) { 108 $output = esc_html( $seo_title ); 109 } 110 return $output; 111 } 112 } 113 114 if ( ! function_exists( 'seedprod_lite_seed_csp4_metadescription' ) ) { 115 function seedprod_lite_seed_csp4_metadescription() { 116 $o = seedprod_lite_seed_csp4_get_settings(); 117 extract( $o ); 118 119 $output = ''; 120 121 if ( ! empty( $seo_description ) ) { 122 $output = '<meta name="description" content="' . esc_attr( $seo_description ) . '">'; 123 } 124 125 return $output; 126 } 127 } 128 129 if ( ! function_exists( 'seedprod_lite_seed_csp4_privacy' ) ) { 130 function seedprod_lite_seed_csp4_privacy() { 131 $output = ''; 132 133 if ( get_option( 'blog_public' ) == 0 ) { 134 $output = "<meta name='robots' content='noindex,nofollow' />"; 135 } 136 137 return $output; 138 } 139 } 140 141 if ( ! function_exists( 'seedprod_lite_seed_csp4_favicon' ) ) { 142 function seedprod_lite_seed_csp4_favicon() { 143 $o = seedprod_lite_seed_csp4_get_settings(); 144 extract( $o ); 145 146 $output = ''; 147 148 if ( ! empty( $favicon ) ) { 149 $output .= "<!-- Favicon -->\n"; 150 $output .= '<link href="' . esc_attr( $favicon ) . '" rel="shortcut icon" type="image/x-icon" />'; 151 } 152 153 return $output; 154 } 155 } 156 157 if ( ! function_exists( 'seedprod_lite_seed_csp4_customcss' ) ) { 158 function seedprod_lite_seed_csp4_customcss() { 159 $o = seedprod_lite_seed_csp4_get_settings(); 160 extract( $o ); 161 162 $output = ''; 163 164 if ( ! empty( $custom_css ) ) { 165 $output = '<style type="text/css">' . esc_html( $custom_css ) . '</style>'; 166 } 167 168 return $output; 169 } 170 } 171 172 if ( ! function_exists( 'seed_csp4_head' ) ) { 173 function seedprod_lite_seed_csp4_head() { 174 $o = seedprod_lite_seed_csp4_get_settings(); 175 extract( $o ); 176 177 // CSS 178 $output = ''; 179 180 $output .= "<!-- Bootstrap and default Style -->\n"; 181 $output .= '<link rel="stylesheet" href="' . SEEDPROD_PLUGIN_URL . 'app/backwards/themes/default/bootstrap/css/bootstrap.min.css">' . "\n"; 182 $output .= '<link rel="stylesheet" href="' . SEEDPROD_PLUGIN_URL . 'app/backwards/themes/default/style.css">' . "\n"; 183 if ( is_rtl() ) { 184 $output .= '<link rel="stylesheet" href="' . SEEDPROD_PLUGIN_URL . 'app/backwards/themes/default/rtl.css">' . "\n"; 185 } 186 $output .= '<style type="text/css">' . "\n"; 187 188 // Calculated Styles 189 190 $output .= '/* calculated styles */' . "\n"; 191 ob_start(); ?> 192 193 /* Background Style */ 194 html{ 195 <?php 196 if ( ! empty( $bg_image ) ) : 197 ; 198 ?> 199 <?php if ( isset( $bg_cover ) && in_array( '1', $bg_cover ) ) : ?> 200 background: <?php echo $bg_color; ?> url('<?php echo $bg_image; ?>') no-repeat top center fixed; 201 <?php if ( isset( $bg_size ) && $bg_size == 'contain' ) : ?> 202 -webkit-background-size: contain; 203 -moz-background-size: contain; 204 -o-background-size: contain; 205 background-size: contain; 206 <?php else : ?> 207 208 -webkit-background-size: cover; 209 -moz-background-size: cover; 210 -o-background-size: cover; 211 background-size: cover; 212 <?php endif ?> 213 <?php else : ?> 214 background: <?php echo $bg_color; ?> url('<?php echo $bg_image; ?>') <?php echo $bg_repeat; ?> <?php echo $bg_position; ?> <?php echo $bg_attahcment; ?>; 215 <?php endif ?> 216 <?php 217 else : 218 if ( ! empty( $bg_color ) ) : 219 ?> 220 background: <?php echo $bg_color; ?>; 221 <?php 222 endif; 223 endif; 224 ?> 225 } 226 .seed-csp4 body{ 227 <?php if ( ! empty( $bg_effect ) ) : ?> 228 background: transparent url('<?php echo plugins_url( 'images/bg-' . $bg_effect . '.png', __FILE__ ); ?>') repeat; 229 <?php else : ?> 230 background: transparent; 231 <?php endif; ?> 232 } 233 <?php 234 if ( ! empty( $bg_overlay ) ) : 235 ; 236 ?> 237 #seed-csp4-page{ 238 background-color: rgba(0,0,0,0.5); 239 } 240 <?php endif ?> 241 242 <?php if ( ! empty( $max_width ) ) : ?> 243 #seed-csp4-content{ 244 max-width: <?php echo intval( $max_width ); ?>px; 245 } 246 <?php endif; ?> 247 248 <?php if ( ! empty( $enable_well ) ) : ?> 249 #seed-csp4-content{ 250 min-height: 20px; 251 padding: 19px; 252 background-color: #f5f5f5; 253 border: 1px solid #e3e3e3; 254 border-radius: 4px; 255 } 256 <?php endif; ?> 257 258 /* Text Styles */ 259 <?php if ( ! empty( $text_font ) ) : ?> 260 .seed-csp4 body{ 261 font-family: <?php echo seedprod_lite_seed_csp4_get_font_family( $text_font ); ?> 262 } 263 264 .seed-csp4 h1, .seed-csp4 h2, .seed-csp4 h3, .seed-csp4 h4, .seed-csp4 h5, .seed-csp4 h6{ 265 font-family: <?php echo seedprod_lite_seed_csp4_get_font_family( $text_font ); ?> 266 } 267 <?php endif; ?> 268 269 <?php if ( ! empty( $text_color ) ) { ?> 270 .seed-csp4 body{ 271 color:<?php echo $text_color; ?>; 272 } 273 <?php } ?> 274 275 <?php if ( ! empty( $link_color ) ) { ?> 276 <?php 277 if ( empty( $headline_color ) ) { 278 $headline_color = $link_color; 279 } 280 ?> 281 <?php } ?> 282 283 284 <?php if ( ! empty( $headline_color ) ) { ?> 285 .seed-csp4 h1, .seed-csp4 h2, .seed-csp4 h3, .seed-csp4 h4, .seed-csp4 h5, .seed-csp4 h6{ 286 color:<?php echo $headline_color; ?>; 287 } 288 <?php } ?> 289 290 291 <?php if ( ! empty( $link_color ) ) { ?> 292 .seed-csp4 a, .seed-csp4 a:visited, .seed-csp4 a:hover, .seed-csp4 a:active, .seed-csp4 a:focus{ 293 color:<?php echo $link_color; ?>; 294 } 295 296 297 <?php } ?> 298 299 300 <?php 301 if ( ! empty( $bg_image ) ) : 302 ; 303 ?> 304 <?php if ( isset( $bg_cover ) && in_array( '1', $bg_cover ) ) : ?> 305 @supports (-webkit-overflow-scrolling: touch) { 306 html { 307 height: 100%; 308 overflow: hidden; 309 } 310 body 311 { 312 height:100%; 313 overflow: auto; 314 -webkit-overflow-scrolling: touch; 315 } 316 } 317 <?php endif; ?> 318 <?php endif; ?> 319 320 <?php 321 322 $output .= ob_get_clean(); 323 324 $output .= '</style>' . "\n"; 325 326 // Javascript 327 $output .= "<!-- JS -->\n"; 328 $include_url = includes_url(); 329 $last = $include_url[ strlen( $include_url ) - 1 ]; 330 if ( $last != '/' ) { 331 $include_url = $include_url . '/'; 332 } 333 if ( empty( $enable_wp_head_footer ) ) { 334 $output .= '<script src="' . $include_url . 'js/jquery/jquery.js"></script>' . "\n"; 335 } 336 $output .= '<script src="' . SEEDPROD_PLUGIN_URL . 'app/backwards/themes/default/bootstrap/js/bootstrap.min.js"></script>' . "\n"; 337 338 // Header Scripts 339 if ( ! empty( $header_scripts ) ) { 340 $output .= "<!-- Header Scripts -->\n"; 341 $output .= $header_scripts; 342 } 343 344 // Google Analytics 345 if ( ! empty( $ga_analytics ) ) { 346 $output .= "<!-- Google Analytics -->\n"; 347 $output .= $ga_analytics; 348 } 349 350 return $output; 351 } 352 } 353 354 if ( ! function_exists( 'seedprod_lite_seed_csp4_get_font_family' ) ) { 355 function seedprod_lite_seed_csp4_get_font_family( $font ) { 356 $fonts = array(); 357 $fonts['_arial'] = 'Helvetica, Arial, sans-serif'; 358 $fonts['_arial_black'] = 'Arial Black, Arial Black, Gadget, sans-serif'; 359 $fonts['_georgia'] = 'Georgia,serif'; 360 $fonts['_helvetica_neue'] = '"Helvetica Neue", Helvetica, Arial, sans-serif'; 361 $fonts['_impact'] = 'Charcoal,Impact,sans-serif'; 362 $fonts['_lucida'] = 'Lucida Grande,Lucida Sans Unicode, sans-serif'; 363 $fonts['_palatino'] = 'Palatino,Palatino Linotype, Book Antiqua, serif'; 364 $fonts['_tahoma'] = 'Geneva,Tahoma,sans-serif'; 365 $fonts['_times'] = 'Times,Times New Roman, serif'; 366 $fonts['_trebuchet'] = 'Trebuchet MS, sans-serif'; 367 $fonts['_verdana'] = 'Verdana, Geneva, sans-serif'; 368 369 if ( ! empty( $fonts[ $font ] ) ) { 370 $font_family = $fonts[ $font ]; 371 } else { 372 $font_family = 'Helvetica Neue, Arial, sans-serif'; 373 } 374 375 echo $font_family; 376 } 377 } 378 379 if ( ! function_exists( 'seedprod_lite_seed_csp4_footer' ) ) { 380 function seedprod_lite_seed_csp4_footer() { 381 $o = seedprod_lite_seed_csp4_get_settings(); 382 extract( $o ); 383 384 $output = ''; 385 386 if ( ! empty( $bg_cover ) ) { 387 $output .= '<!--[if lt IE 9]> 388 <script> 389 jQuery(document).ready(function($){'; 390 391 $output .= '$.supersized({'; 392 $output .= "slides:[ {image : '$bg_image'} ]"; 393 $output .= '});'; 394 395 $output .= '}); 396 </script> 397 <![endif]-->'; 398 } 399 400 if ( ! empty( $footer_scripts ) ) { 401 $output .= "<!-- Footer Scripts -->\n"; 402 $output .= $footer_scripts; 403 } 404 405 return $output; 406 } 407 } 408 409 if ( ! function_exists( 'seedprod_lite_seed_csp4_logo' ) ) { 410 function seedprod_lite_seed_csp4_logo() { 411 $o = seedprod_lite_seed_csp4_get_settings(); 412 extract( $o ); 413 414 $output = ''; 415 416 if ( ! empty( $logo ) ) { 417 $output .= "<img id='seed-csp4-image' src='" . esc_attr( $logo ) . "'>"; 418 } 419 420 return $output; 421 } 422 } 423 424 if ( ! function_exists( 'seedprod_lite_seed_csp4_headline' ) ) { 425 function seedprod_lite_seed_csp4_headline() { 426 $o = seedprod_lite_seed_csp4_get_settings(); 427 extract( $o ); 428 429 $output = ''; 430 431 if ( ! empty( $headline ) ) { 432 $output .= '<h1 id="seed-csp4-headline">' . wp_kses( 433 $headline, 434 array( 435 'a' => array( 436 'href' => array(), 437 'title' => array(), 438 ), 439 'br' => array(), 440 'em' => array(), 441 'strong' => array(), 442 ) 443 ) . '</h1>'; 444 } 445 446 return $output; 447 } 448 } 449 450 if ( ! function_exists( 'seedprod_lite_seed_csp4_description' ) ) { 451 function seedprod_lite_seed_csp4_description() { 452 $o = seedprod_lite_seed_csp4_get_settings(); 453 extract( $o ); 454 455 $output = ''; 456 457 if ( ! empty( $description ) ) { 458 if ( has_shortcode( $description, 'rafflepress' ) ) { 459 $output .= '<div id="seed-csp4-description">' . do_shortcode( shortcode_unautop( wpautop( convert_chars( wptexturize( $description ) ) ) ) ) . '</div>'; 460 } else { 461 $output .= '<div id="seed-csp4-description">' . shortcode_unautop( wpautop( convert_chars( wptexturize( $description ) ) ) ) . '</div>'; 462 } 463 } 464 465 return $output; 466 } 467 } 468 469 if ( ! function_exists( 'seed_csp4_append_html' ) ) { 470 function seed_csp4_append_html() { 471 $o = seedprod_lite_seed_csp4_get_settings(); 472 extract( $o ); 473 474 $output = ''; 475 476 if ( ! empty( $append_html ) ) { 477 $output .= '<div id="coming-soon-custom-html">' . $append_html . '</div>'; 478 } 479 480 return $output; 481 } 482 } 483 484 if ( ! function_exists( 'seedprod_lite_seed_csp4_credit' ) ) { 485 function seedprod_lite_seed_csp4_credit() { 486 $o = seedprod_lite_seed_csp4_get_settings(); 487 extract( $o ); 488 489 $output = ''; 490 491 if ( ! empty( $footer_credit ) ) { 492 $output = '<div id="seed-csp4-credit">'; 493 $output .= '<a target="_blank" href="http://www.seedprod.com/?utm_source=coming-soon-credit-link&utm_medium=banner&utm_campaign=coming-soon-plugin-credit-link"><img style="width:75px" src="' . SEEDPROD_PLUGIN_URL . 'public/svg/powered-by-logo.svg"></a>'; 494 $output .= '</div>'; 495 } 496 497 return $output; 498 } 499 } 500 501 if ( ! function_exists( 'seedprod_lite_seed_csp4_get_settings' ) ) { 502 function seedprod_lite_seed_csp4_get_settings() { 503 $s1 = get_option( 'seed_csp4_settings_content' ); 504 $s2 = get_option( 'seed_csp4_settings_design' ); 505 $s3 = get_option( 'seed_csp4_settings_advanced' ); 506 507 if ( empty( $s1 ) ) { 508 $s1 = array(); 509 } 510 511 if ( empty( $s2 ) ) { 512 $s2 = array(); 513 } 514 515 if ( empty( $s3 ) ) { 516 $s3 = array(); 517 } 518 519 $settings = $s1 + $s2 + $s3; 520 521 return apply_filters( 'seedprod_lite_seed_csp4_get_settings', $settings ); 522 } 523 } 524 525