Fix tabs

parent 4650e2f2
...@@ -24,29 +24,29 @@ if ( ! defined( 'ABSPATH' ) ) exit; ...@@ -24,29 +24,29 @@ if ( ! defined( 'ABSPATH' ) ) exit;
get_header(); ?> get_header(); ?>
<div id="primary" class="content-area"> <div id="primary" class="content-area">
<main id="main" class="site-main" role="main"> <main id="main" class="site-main" role="main">
<?php if ( have_posts() ) : ?> <?php if ( have_posts() ) : ?>
<header class="page-header"> <header class="page-header">
<?php <?php
//the_archive_title( '<h1 class="page-title">', '</h1>' ); //the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="taxonomy-description">', '</div>' ); // XXX Check it? what it does? the_archive_description( '<div class="taxonomy-description">', '</div>' ); // XXX Check it? what it does?
?> ?>
</header><!-- .page-header --> </header><!-- .page-header -->
<?php <?php
do_action( 'storefront_loop_before' ); do_action( 'storefront_loop_before' );
//print_r($sexhack_pms->plans); //print_r($sexhack_pms->plans);
while ( have_posts() ) : while ( have_posts() ) :
the_post(); the_post();
echo do_shortcode("[sexadv adv=".get_option('sexadv_video_top')."]"); echo do_shortcode("[sexadv adv=".get_option('sexadv_video_top')."]");
$htmltags = '<span><b>TAGS: </b></span>'; $htmltags = '<span><b>TAGS: </b></span>';
$tags = get_the_terms( get_the_ID(), 'product_tag' ); $tags = get_the_terms( get_the_ID(), 'product_tag' );
if ( ! empty( $tags ) && ! is_wp_error( $tags ) ) if ( ! empty( $tags ) && ! is_wp_error( $tags ) )
{ {
...@@ -55,20 +55,20 @@ get_header(); ?> ...@@ -55,20 +55,20 @@ get_header(); ?>
} }
} }
$videoslug = get_option('sexhack_gallery_slug', 'v'); $videoslug = get_option('sexhack_gallery_slug', 'v');
$vurl = str_replace("/product/", "/".$videoslug."/", esc_url( get_the_permalink() )); $vurl = str_replace("/product/", "/".$videoslug."/", esc_url( get_the_permalink() ));
$prod = wc_get_product(get_the_ID()); $prod = wc_get_product(get_the_ID());
$hls = $prod->get_attribute("hls_public"); $hls = $prod->get_attribute("hls_public");
$hls_members = $prod->get_attribute("hls_members"); $hls_members = $prod->get_attribute("hls_members");
$hls_premium = $prod->get_attribute("hls_premium"); $hls_premium = $prod->get_attribute("hls_premium");
$video_preview = $prod->get_attribute("video_preview"); $video_preview = $prod->get_attribute("video_preview");
$gif_preview = $prod->get_attribute("gif_preview"); $gif_preview = $prod->get_attribute("gif_preview");
$vr_premium = $prod->get_attribute("vr_premium"); $vr_premium = $prod->get_attribute("vr_premium");
$vr_members = $prod->get_attribute("vr_members"); $vr_members = $prod->get_attribute("vr_members");
$vr_public = $prod->get_attribute("vr_public"); $vr_public = $prod->get_attribute("vr_public");
$vr_preview = $prod->get_attribute("vr_preview"); $vr_preview = $prod->get_attribute("vr_preview");
$categories = explode(", ", wp_SexHackMe\html2text( wc_get_product_category_list($id))); $categories = explode(", ", wp_SexHackMe\html2text( wc_get_product_category_list($id)));
if(($hls) AND wp_SexHackMe\starts_with('/', $hls)) $hls = site_url().$hls; if(($hls) AND wp_SexHackMe\starts_with('/', $hls)) $hls = site_url().$hls;
if(($hls_members) AND wp_SexHackMe\starts_with('/', $hls_members)) $hls_members = site_url().$hls_members; if(($hls_members) AND wp_SexHackMe\starts_with('/', $hls_members)) $hls_members = site_url().$hls_members;
...@@ -82,49 +82,49 @@ get_header(); ?> ...@@ -82,49 +82,49 @@ get_header(); ?>
$thumb = wp_get_attachment_url($prod->get_image_id()); $thumb = wp_get_attachment_url($prod->get_image_id());
$avail = array(); $avail = array();
$tabtext = array('subscribers' => 'Subscribers', $tabtext = array('subscribers' => 'Subscribers',
'vrsub' => 'Subscribers', 'vrsub' => 'Subscribers',
'members' => 'Members', 'members' => 'Members',
'vrmem' => 'Members', 'vrmem' => 'Members',
'vrpub' => 'Public', 'vrpub' => 'Public',
'public' => 'Public'); 'public' => 'Public');
if($hls || $video_preview ) $avail[] = 'public'; if($hls || $video_preview ) $avail[] = 'public';
if($vr_public || $vr_preview) $avail[] = 'vrpub'; if($vr_public || $vr_preview) $avail[] = 'vrpub';
if($hls_members) $avail[] = 'members'; if($hls_members) $avail[] = 'members';
if($vr_members) $avail[] = 'vrmem'; if($vr_members) $avail[] = 'vrmem';
if($hls_premium) $avail[] = 'subscribers'; if($hls_premium) $avail[] = 'subscribers';
if($vr_premium) $avail[] = 'vrsub'; if($vr_premium) $avail[] = 'vrsub';
$videoaccess = get_query_var('videoaccess', false); $videoaccess = get_query_var('videoaccess', false);
if($videoaccess && in_array($videoaccess, $avail)) if($videoaccess && in_array($videoaccess, $avail))
{ {
$tab = $videoaccess; $tab = $videoaccess;
} }
else else
{ {
if(wp_SexHackMe\user_has_premium_access()) { if(wp_SexHackMe\user_has_premium_access()) {
if($hls_premium) $tab = 'subscribers'; if($hls_premium) $tab = 'subscribers';
elseif($vr_premium) $tab = 'vrsub'; elseif($vr_premium) $tab = 'vrsub';
elseif($hls_members) $tab = 'members'; elseif($hls_members) $tab = 'members';
elseif($vr_members) $tab = 'vrmem'; elseif($vr_members) $tab = 'vrmem';
elseif($vr_public || $vr_preview) $tab = 'vrpub'; elseif($vr_public || $vr_preview) $tab = 'vrpub';
else $tab = 'public'; else $tab = 'public';
} }
elseif(wp_SexHackMe\user_has_member_access()) // free membership elseif(wp_SexHackMe\user_has_member_access()) // free membership
{ {
if($hls_members) $tab = 'members'; if($hls_members) $tab = 'members';
elseif($vr_members) $tab = 'vrmem'; elseif($vr_members) $tab = 'vrmem';
elseif($vr_public) $tab = 'vrpub'; elseif($vr_public) $tab = 'vrpub';
else $tab = 'public'; else $tab = 'public';
} }
else // public else // public
{ {
if($vr_public) $tab = 'vrpub'; if($vr_public) $tab = 'vrpub';
else $tab = 'public'; else $tab = 'public';
} }
} }
?> ?>
<article id="post-<?php echo get_the_ID();?>" class="post-<?php echo get_the_ID();?> product type-product"> <article id="post-<?php echo get_the_ID();?>" class="post-<?php echo get_the_ID();?> product type-product">
<header class="entry-header"> <header class="entry-header">
<h2 class="alpha entry-title sexhack_video_title"> <h2 class="alpha entry-title sexhack_video_title">
...@@ -134,117 +134,117 @@ get_header(); ?> ...@@ -134,117 +134,117 @@ get_header(); ?>
<div class="sexhack-video-container"> <div class="sexhack-video-container">
<?php <?php
if(in_array($tab, $avail)) if(in_array($tab, $avail))
{ {
switch($tab) switch($tab)
{ {
case "members": case "members":
case "vrmem": case "vrmem":
if(wp_SexHackMe\user_has_member_access()) if(wp_SexHackMe\user_has_member_access())
{ {
if($hls_members) echo do_shortcode( "[sexhls url=\"".$hls_members."\" posters=\"".$thumb."\"]" ); if($hls_members) echo do_shortcode( "[sexhls url=\"".$hls_members."\" posters=\"".$thumb."\"]" );
else if($vr_members) echo do_shortcode( "[sexvideo url=\"".$vr_members."\" posters=\"".$thumb."\"]" ); else if($vr_members) echo do_shortcode( "[sexvideo url=\"".$vr_members."\" posters=\"".$thumb."\"]" );
else echo "<h3 class='sexhack-videonotify'>SOMETHING WENT BADLY WRONG. I CAN'T FIND THE VIDEO</h3>"; else echo "<h3 class='sexhack-videonotify'>SOMETHING WENT BADLY WRONG. I CAN'T FIND THE VIDEO</h3>";
} }
else else
{ {
if($gif_preview) echo '<img class="sexhack_videopreview" src="'.$gif_preview.'" loading="lazy"></img>'; if($gif_preview) echo '<img class="sexhack_videopreview" src="'.$gif_preview.'" loading="lazy"></img>';
else echo '<img class="sexhack_videopreview" src="'.$thumb.'" loading="lazy"></img>'; else echo '<img class="sexhack_videopreview" src="'.$thumb.'" loading="lazy"></img>';
echo "<h3 class='sexhack-videonotify'><a href='/login'>YOU NEED TO LOGIN TO ACCESS THIS VIDEO</a></h3>"; echo "<h3 class='sexhack-videonotify'><a href='/login'>YOU NEED TO LOGIN TO ACCESS THIS VIDEO</a></h3>";
echo "<div style='width: 80%; margin-left: 10%;' >".do_shortcode('[pms-login redirect_url="/account" ]')."</div>"; echo "<div style='width: 80%; margin-left: 10%;' >".do_shortcode('[pms-login redirect_url="/account" ]')."</div>";
} }
break; break;
case "subscribers": case "subscribers":
case "vrsub": case "vrsub":
if(wp_SexHackMe\user_has_premium_access()) if(wp_SexHackMe\user_has_premium_access())
{ {
if($hls_premium) echo do_shortcode( "[sexhls url=\"".$hls_premium."\" posters=\"".$thumb."\"]" ); if($hls_premium) echo do_shortcode( "[sexhls url=\"".$hls_premium."\" posters=\"".$thumb."\"]" );
else if($vr_premium) echo do_shortcode( "[sexvideo url=\"".$vr_premium."\" posters=\"".$thumb."\"]" ); else if($vr_premium) echo do_shortcode( "[sexvideo url=\"".$vr_premium."\" posters=\"".$thumb."\"]" );
else echo "<h3 class='sexhack-videonotify'>SOMETHING WENT BADLY WRONG. I CAN'T FIND THE VIDEO</h3>"; else echo "<h3 class='sexhack-videonotify'>SOMETHING WENT BADLY WRONG. I CAN'T FIND THE VIDEO</h3>";
} }
else else
{ {
if($gif_preview) echo '<img class="sexhack_videopreview" src="'.$gif_preview.'" loading="lazy"></img>'; if($gif_preview) echo '<img class="sexhack_videopreview" src="'.$gif_preview.'" loading="lazy"></img>';
else echo '<img class="sexhack_videopreview" src="'.$thumb.'" loading="lazy"></img>'; else echo '<img class="sexhack_videopreview" src="'.$thumb.'" loading="lazy"></img>';
echo "<h3 class='sexhack-videonotify'><a href='/product-category/subscriptions/'>YOU NEED A SUBSCRIPTION TO ACCESS THIS VIDEO</a></h3>"; echo "<h3 class='sexhack-videonotify'><a href='/product-category/subscriptions/'>YOU NEED A SUBSCRIPTION TO ACCESS THIS VIDEO</a></h3>";
} }
break; break;
case "vrpub": case "vrpub":
default: // public too! default: // public too!
if($hls) echo do_shortcode( "[sexhls url=\"".$hls."\" posters=\"".$thumb."\"]" ); if($hls) echo do_shortcode( "[sexhls url=\"".$hls."\" posters=\"".$thumb."\"]" );
else if($vr_public) echo do_shortcode( "[sexvideo url=\"".$vr_public."\" posters=\"".$thumb."\"]" ); else if($vr_public) echo do_shortcode( "[sexvideo url=\"".$vr_public."\" posters=\"".$thumb."\"]" );
else if($video_preview) echo '<video src='."'$video_preview'".' controls autoplay muted playsinline loop poster="'.$thumb.'"></video>'; else if($video_preview) echo '<video src='."'$video_preview'".' controls autoplay muted playsinline loop poster="'.$thumb.'"></video>';
else if($vr_preview) echo do_shortcode( "[sexvideo url=\"".$vr_preview."\" posters=\"".$thumb."\"]" ); else if($vr_preview) echo do_shortcode( "[sexvideo url=\"".$vr_preview."\" posters=\"".$thumb."\"]" );
else if($gif_preview) echo '<img class="sexhack_videopreview" src="'.$gif_preview.'" loading="lazy"></img>'; else if($gif_preview) echo '<img class="sexhack_videopreview" src="'.$gif_preview.'" loading="lazy"></img>';
else echo '<img class="sexhack_videopreview" src="'.$thumb.'" loading="lazy"></img>'; else echo '<img class="sexhack_videopreview" src="'.$thumb.'" loading="lazy"></img>';
} }
} }
else // if(in_array($tab, $avail)) else // if(in_array($tab, $avail))
{ {
if($video_preview) echo '<video src='."'$video_preview'".' controls autoplay muted playsinline loop poster="'.$thumb.'"></video>'; if($video_preview) echo '<video src='."'$video_preview'".' controls autoplay muted playsinline loop poster="'.$thumb.'"></video>';
else if($vr_preview) echo do_shortcode( "[sexvideo url=\"".$vr_preview."\" posters=\"".$thumb."\"]" ); else if($vr_preview) echo do_shortcode( "[sexvideo url=\"".$vr_preview."\" posters=\"".$thumb."\"]" );
else if($gif_preview) echo '<img class="sexhack_videopreview" src="'.$gif_preview.'" loading="lazy"></img>'; else if($gif_preview) echo '<img class="sexhack_videopreview" src="'.$gif_preview.'" loading="lazy"></img>';
else echo '<img class="sexhack_videopreview" src="'.$thumb.'" loading="lazy"></img>'; else echo '<img class="sexhack_videopreview" src="'.$thumb.'" loading="lazy"></img>';
?> ?>
<h2 class='sexhack-videonotify'><b>PUBLIC VIDEO NOT AVAILABLE</b></h2> <h2 class='sexhack-videonotify'><b>PUBLIC VIDEO NOT AVAILABLE</b></h2>
<?php <?php
} }
?> ?>
</div> <!-- video container --> </div> <!-- video container -->
<div class="sexhack-tabs"> <div class="sexhack-tabs">
<?php <?php
foreach($avail as $vaval) foreach($avail as $vaval)
{ {
if(!(in_array('vrpub', $avail) && ($vaval == 'public'))) { if(!(in_array('vrpub', $avail) && ($vaval == 'public'))) {
$hrefurl = $vurl.'/'.$vaval.'/'; $hrefurl = $vurl.'/'.$vaval.'/';
$bclass = ''; $bclass = '';
if(isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) $hrefurl .= '?'.$_SERVER['QUERY_STRING']; if(isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) $hrefurl .= '?'.$_SERVER['QUERY_STRING'];
if($vaval == $tab) $bclass='sexhack_toggled_button'; if($vaval == $tab) $bclass='sexhack_toggled_button';
?> ?>
<a class="sexhack_tab_a" href="<?php echo $hrefurl; ?>"> <a class="sexhack_tab_a" href="<?php echo $hrefurl; ?>">
<button name="<?php echo $vaval; ?>" class="sexhack_tab_button <?php echo $bclass; ?>"> <button name="<?php echo $vaval; ?>" class="sexhack_tab_button <?php echo $bclass; ?>">
<?php echo $tabtext[$vaval]; ?> <?php echo $tabtext[$vaval]; ?>
</button> </button>
</a> </a>
<?php <?php
} }
} }
?> ?>
</div> </div>
<br><hr> <br><hr>
<?php <?php
echo $htmltags; echo $htmltags;
?> ?>
<h3><a href="<?php echo get_the_permalink(); ?>">Download the full lenght hi-res version of this video</a><h3> <h3><a href="<?php echo get_the_permalink(); ?>">Download the full lenght hi-res version of this video</a><h3>
<hr> <hr>
<?php <?php
echo do_shortcode("[sexadv adv=".get_option('sexadv_video_bot')."]"); echo do_shortcode("[sexadv adv=".get_option('sexadv_video_bot')."]");
endwhile; endwhile;
/** /**
* Functions hooked in to storefront_paging_nav action * Functions hooked in to storefront_paging_nav action
* *
* @hooked storefront_paging_nav - 10 * @hooked storefront_paging_nav - 10
*/ */
do_action( 'storefront_loop_after' ); do_action( 'storefront_loop_after' );
else : else :
get_template_part( 'content', 'none' ); get_template_part( 'content', 'none' );
endif; endif;
?> ?>
</main><!-- #main --> </main><!-- #main -->
</div><!-- #primary --> </div><!-- #primary -->
<?php <?php
do_action( 'storefront_sidebar' ); do_action( 'storefront_sidebar' );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment