balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

seedprod-preview.php (10816B)


      1 <?php
      2 		// Load WooCommerce default styles if WooCommerce is active
      3 if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
      4 	wp_enqueue_style(
      5 		'seedprod-woocommerce-layout',
      6 		str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/css/woocommerce-layout.css',
      7 		'',
      8 		defined( 'WC_VERSION' ) ? WC_VERSION : null,
      9 		'all'
     10 	);
     11 	wp_enqueue_style(
     12 		'seedprod-woocommerce-smallscreen',
     13 		str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/css/woocommerce-smallscreen.css',
     14 		'',
     15 		defined( 'WC_VERSION' ) ? WC_VERSION : null,
     16 		'only screen and (max-width: 1088px)' // 768px default break + 320px for sidebar
     17 	);
     18 	wp_enqueue_style(
     19 		'seedprod-woocommerce-general',
     20 		str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/css/woocommerce.css',
     21 		'',
     22 		defined( 'WC_VERSION' ) ? WC_VERSION : null,
     23 		'all'
     24 	);
     25 }
     26 // get settings
     27 if ( empty( $settings ) ) {
     28 	global $wpdb, $post;
     29 	$settings         = json_decode( $post->post_content_filtered );
     30 	$google_fonts_str = seedprod_lite_construct_font_str( json_decode( $post->post_content_filtered, true ) );
     31 	$content          = $post->post_content;
     32 	$lpage_uuid       = get_post_meta( $post->ID, '_seedprod_page_uuid', true );
     33 } else {
     34 	$google_fonts_str = seedprod_lite_construct_font_str( $settings );
     35 	$content          = $page->post_content;
     36 	$lpage_uuid       = get_post_meta( $page->ID, '_seedprod_page_uuid', true );
     37 }
     38 
     39 // remove vue comment bug
     40 $content = str_replace( 'function(e,n,r,i){return fn(t,e,n,r,i,!0)}', '', $content );
     41 
     42 $plugin_url = SEEDPROD_PLUGIN_URL;
     43 
     44 
     45 
     46 //check to see if we have a shortcode, form or giveaway
     47 $settings_str = serialize( $settings );
     48 if ( strpos( $settings_str, 'contact-form' ) !== false ) {
     49 	$settings->no_conflict_mode = false;
     50 }
     51 if ( strpos( $settings_str, 'giveaway' ) !== false ) {
     52 	$settings->no_conflict_mode = false;
     53 }
     54 
     55 $include_seed_fb_sdk   = false;
     56 $include_seedprod_headline_sdk = false;
     57 
     58 
     59 
     60 
     61 // get url
     62 $scheme = 'http';
     63 if ( $_SERVER['SERVER_PORT'] == '443' ) {
     64 	$scheme = 'https';
     65 }
     66 if ( ! empty( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) {
     67 	$scheme = 'https';
     68 }
     69 $ogurl = "$scheme://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
     70 
     71 // subscriber callback
     72 $seedprod_subscribe_callback_ajax_url = html_entity_decode( wp_nonce_url( admin_url() . 'admin-ajax.php?action=seedprod_lite_subscribe_callback', 'seedprod_lite_subscribe_callback' ) );
     73 
     74 // If site uses WP Rocket, disable minify
     75 seedprod_lite_wprocket_disable_minify();
     76 
     77 // Check if WooCommerce is active
     78 if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
     79 
     80 	add_filter( 'woocommerce_enqueue_styles', 'seedprod_lite_wc_dequeue_styles' );
     81 
     82 	function seedprod_lite_wc_dequeue_styles( $enqueue_styles ) {
     83 		// Dequeue main syles as it may serve theme-specific styles for themes that may not match SeedProd page
     84 		unset( $enqueue_styles['woocommerce-general'] );
     85 
     86 		// Enqueue generic WooCommerce stylesheet for predictable defaults on SeedProd pages
     87 		$enqueue_styles['woocommerce-general'] = array(
     88 			'src'     => str_replace( array( 'http:', 'https:' ), '', WC()->plugin_url() ) . '/assets/css/woocommerce.css',
     89 			'deps'    => '',
     90 			'version' => defined( 'WC_VERSION' ) ? WC_VERSION : null,
     91 			'media'   => 'all',
     92 			'has_rtl' => true,
     93 		);
     94 		return $enqueue_styles;
     95 	}
     96 }
     97 
     98 if ( ! empty( $settings ) ) {
     99 	?>
    100 <!DOCTYPE html>
    101 <html class="sp-html 
    102 	<?php
    103 	if ( wp_is_mobile() ) {
    104 		echo 'sp-is-mobile';
    105 	}
    106 	?>
    107 	 <?php
    108 		if ( is_user_logged_in() ) {
    109 				echo 'sp-is-logged-in';
    110 		}
    111 		?>
    112 	 sp-seedprod sp-h-full">
    113 <head>
    114 	<?php
    115 	if ( ! empty( $settings->no_conflict_mode ) ) {
    116 		?>
    117 		<?php if ( ! empty( $settings->seo_title ) ) : ?>
    118 <title><?php echo esc_html( $settings->seo_title ); ?></title>
    119 <?php endif; ?>
    120 		<?php if ( ! empty( $settings->seo_description ) ) : ?>
    121 <meta name="description" content="<?php echo esc_attr( $settings->seo_description ); ?>">
    122 <?php endif; ?>
    123 		<?php if ( ! empty( $settings->favicon ) ) : ?>
    124 <link href="<?php echo esc_attr( $settings->favicon ); ?>" rel="shortcut icon" type="image/x-icon" />
    125 <?php endif; ?>
    126 
    127 
    128 		<?php if ( ! empty( $settings->no_index ) ) : ?>
    129 <meta name="robots" content="noindex">
    130 <?php endif; ?>
    131 
    132 
    133 
    134 <!-- Open Graph -->
    135 <meta property="og:url" content="<?php echo esc_url_raw($ogurl); ?>" />
    136 <meta property="og:type" content="website" />
    137 		<?php if ( ! empty( $settings->seo_title ) ) : ?>
    138 <meta property="og:title" content="<?php echo esc_attr( $settings->seo_title ); ?>" />
    139 <?php endif; ?>
    140 		<?php if ( ! empty( $settings->seo_description ) ) : ?>
    141 <meta property="og:description" content="<?php echo esc_attr( $settings->seo_description ); ?>" />
    142 <?php endif; ?>
    143 		<?php if ( ! empty( $settings->social_thumbnail ) ) : ?>
    144 <meta property="og:image" content="<?php echo esc_url_raw($settings->social_thumbnail); ?>" />
    145 <?php elseif ( ! empty( $settings->logo ) ) : ?>
    146 <meta property="og:image" content="<?php echo esc_url_raw($settings->logo); ?>" />
    147 <?php endif; ?>
    148 
    149 <!-- Twitter Card -->
    150 <meta name="twitter:card" content="summary" />
    151 		<?php if ( ! empty( $settings->seo_title ) ) : ?>
    152 <meta name="twitter:title" content="<?php echo esc_attr( $settings->seo_title ); ?>" />
    153 <?php endif; ?>
    154 		<?php if ( ! empty( $settings->seo_description ) ) : ?>
    155 <meta name="twitter:description" content="<?php echo esc_attr( $settings->seo_description ); ?>" />
    156 <?php endif; ?>
    157 		<?php if ( ! empty( $settings->social_thumbnail ) ) : ?>
    158 <meta property="twitter:image" content="<?php echo esc_url_raw($settings->social_thumbnail); ?>" />
    159 <?php endif; ?>
    160 
    161 		<?php
    162 	}
    163 	?>
    164 	<?php if ( empty( $settings->no_conflict_mode ) ) : ?>
    165 <title><?php wp_title(); ?></title>
    166 <?php endif; ?>
    167 <meta charset="UTF-8">
    168 <meta name="viewport" content="width=device-width, initial-scale=1.0">
    169 <!-- Default CSS -->
    170 <link rel='stylesheet' id='seedprod-css-css'  href='<?php echo $plugin_url; ?>public/css/tailwind.min.css?ver=1.2.7.1' type='text/css' media='all' />
    171 <link rel='stylesheet' id='seedprod-fontawesome-css'  href='<?php echo $plugin_url; ?>public/fontawesome/css/all.min.css?ver=1.2.7.1' type='text/css' media='all' />
    172 	<?php if ( ! empty( $google_fonts_str ) ) : ?>
    173 <!-- Google Font -->
    174 <link rel="stylesheet" href="<?php echo $google_fonts_str; ?>">
    175 <?php endif; ?>
    176 
    177 
    178 <?php
    179 ?>
    180 
    181 <!-- Global Styles -->
    182 <style>
    183 	<?php echo $settings->document->settings->headCss; ?>
    184 
    185 	<?php if ( ! empty( $settings->document->settings->placeholderCss ) ) { ?>
    186 		<?php echo $settings->document->settings->placeholderCss; ?>
    187 <?php } ?>
    188 
    189 	<?php // Replace classnames for device visibility like below ?>
    190 
    191 	@media only screen and (max-width: 480px) {
    192 		<?php if ( ! empty( $settings->document->settings->mobileCss ) ) { ?>
    193 			<?php echo str_replace( '.sp-mobile-view', '', $settings->document->settings->mobileCss ); ?>
    194 		<?php } ?>
    195 
    196 		<?php if ( ! empty( $settings->document->settings->mobileVisibilityCss ) ) { ?>
    197 			<?php echo str_replace( '.sp-mobile-view', '', $settings->document->settings->mobileVisibilityCss ); ?>
    198 		<?php } ?>
    199 	}
    200 
    201 	@media only screen and (min-width: 480px) {
    202 		<?php if ( ! empty( $settings->document->settings->desktopVisibilityCss ) ) { ?>
    203 			<?php echo $settings->document->settings->desktopVisibilityCss; ?>
    204 		<?php } ?>
    205 	}
    206 
    207 	<?php
    208 	// Get mobile css & Remove inline data attributes.
    209 	preg_match_all( '/data-mobile-css="([^"]*)"/', $content, $matches );
    210 	if ( ! empty( $matches ) ) {
    211 		// remove inline data attributes
    212 		foreach ( $matches[0] as $v ) {
    213 			$content = str_replace( $v, '', $content );
    214 		}
    215 	}
    216 
    217 	preg_match_all( '/data-mobile-visibility="([^"]*)"/', $content, $matches );
    218 	if ( ! empty( $matches ) ) {
    219 		// remove inline data attributes
    220 		foreach ( $matches[0] as $v ) {
    221 			$content = str_replace( $v, '', $content );
    222 		}
    223 	}
    224 
    225 	preg_match_all( '/data-desktop-visibility="([^"]*)"/', $content, $matches );
    226 	if ( ! empty( $matches ) ) {
    227 		// remove inline data attributes
    228 		foreach ( $matches[0] as $v ) {
    229 			$content = str_replace( $v, '', $content );
    230 		}
    231 	}
    232 	?>
    233 
    234 
    235 	<?php if ( ! empty( $settings->document->settings->customCss ) ) { ?>
    236 /* Custom CSS */
    237 		<?php
    238 		echo $settings->document->settings->customCss;
    239 		?>
    240 	<?php } ?>
    241 </style>
    242 
    243 <!-- JS -->
    244 <script>
    245 </script>
    246 	<?php 
    247 	?>
    248 <script src="<?php echo $plugin_url; ?>public/js/sp-scripts.min.js" defer></script>
    249 	<?php
    250 	?>
    251 
    252 	<?php if ( ! empty( $settings->document->settings->useVideoBg ) ) { ?>
    253 <script src="<?php echo $plugin_url; ?>public/js/tubular.js" defer></script>
    254 	<?php } ?>
    255 
    256 <?php 
    257 ?>
    258 
    259 
    260 	<?php
    261 	if ( empty( $settings->no_conflict_mode ) ) {
    262 		wp_enqueue_script( 'jquery' );
    263 		wp_head();
    264 	} else {
    265 		$include_url = trailingslashit( includes_url() );
    266 		if ( empty( $settings->enable_wp_head_footer ) ) {
    267 			echo '<script src="' . $include_url . 'js/jquery/jquery.js"></script>' . "\n";
    268 		}
    269 	}
    270 
    271 	?>
    272 	<?php
    273 	if ( ! empty( $settings->header_scripts ) ) {
    274 		echo $settings->header_scripts;
    275 	}
    276 	?>
    277 </head>
    278 <body class="spBg<?php echo esc_attr($settings->document->settings->bgPosition); ?> sp-h-full sp-antialiased sp-bg-slideshow">
    279 	<?php
    280 	if ( ! empty( $settings->body_scripts ) ) {
    281 		echo $settings->body_scripts;
    282 	}
    283 	?>
    284 
    285 	<?php 
    286 	?>
    287 
    288 	<script>
    289 		window.twttr = (function (d,s,id) {
    290 			var t, js, fjs = d.getElementsByTagName(s)[0];
    291 			if (d.getElementById(id)) return; js=d.createElement(s); js.id=id;
    292 			js.src="https://platform.twitter.com/widgets.js";
    293 			fjs.parentNode.insertBefore(js, fjs);
    294 			return window.twttr || (t = { _e: [], ready: function(f){ t._e.push(f) } });
    295 		}(document, "script", "twitter-wjs"));
    296 	</script>
    297 
    298 	<?php
    299 	$actual_link = urlencode( ( isset( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http' ) . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]" );
    300 	$content     = str_replace( 'the_link', $actual_link, $content );
    301 	echo do_shortcode( $content );
    302 	?>
    303 
    304 
    305 
    306 <div class="tv">
    307 	<div class="screen mute" id="tv"></div>
    308 </div>
    309 
    310 	<?php
    311 	if ( ! empty( $settings->show_powered_by_link ) ) {
    312 		$aff_link = 'https://www.seedprod.com/?utm_source=seedprod-plugin&utm_medium=seedprod-frontend&utm_campaign=powered-by-link';
    313 		if ( ! empty( $settings->affiliate_url ) ) {
    314 			$aff_link = $settings->affiliate_url;
    315 		}
    316 
    317 		?>
    318 <div class="sp-credit" >
    319 	<a target="_blank" href="<?php echo esc_url($aff_link); ?>" rel="nofollow"><span>made with</span><img src="<?php echo $plugin_url; ?>public/svg/powered-by-logo.svg"></a>
    320 </div>
    321 		<?php
    322 	}
    323 	?>
    324 
    325 <script>
    326 	 <?php if ( wp_is_mobile() ) { echo 'var sp_is_mobile = true;';} else {echo 'var sp_is_mobile = false;';}?>
    327 	<?php 
    328 	?>
    329 
    330 </script>
    331 
    332 	<?php
    333 	if ( empty( $settings->no_conflict_mode ) ) {
    334 		wp_footer();
    335 	}
    336 	?>
    337 	<?php
    338 	if ( ! empty( $settings->footer_scripts ) ) {
    339 		echo $settings->footer_scripts;
    340 	}
    341 	?>
    342 </body>
    343 
    344 </html>
    345 
    346 	<?php
    347 } ?>