Perform add to cart and go to checkout after subscription

parent 8ed731f1
......@@ -2,11 +2,57 @@
namespace wp_SexHackMe;
if(!class_exists('PmsWoocommerceRegistrationIntegration')) {
function get_wc_subscription_products($spid=false)
{
if($spid) $meta = array(
'key' => '_pms_woo_subscription_id',
'value' => $spid,
'compare' => '=',
);
else $meta = array(
'key' => '_pms_woo_subscription_id',
'compare' => 'like',
);
$args = array(
'posts_per_page' => 100,
'post_type' => 'product',
'post_status' => 'publish',
'meta_key' => '_pms_woo_subscription_id',
'meta_query' => array($meta),
);
$query = new \WP_Query( $args );
return $query;
}
function get_wc_subscription_products_priced($price, $pid=false)
{
$res = array();
$pages = get_wc_subscription_products($pid);
if ( $pages->have_posts() )
{
foreach($pages->posts as $post)
{
$product = wc_get_product($post->ID);
if(is_object($product) && (strval($price) == strval($product->get_regular_price())))
{
$res[] = $product;
}
}
}
return $res;
}
class PmsWoocommerceRegistrationIntegration
{
public function __construct()
{
//$this->addcart = false;
sexhack_log('PmsWoocommerceRegistrationIntegration() Instanced');
// Register new endpoint (URL) for My Account page
......@@ -20,7 +66,7 @@ if(!class_exists('PmsWoocommerceRegistrationIntegration')) {
/* Add content to the new tab
* NOTE: add_action must follow 'woocommerce_account_{your-endpoint-slug}_endpoint' format */
add_action( 'woocommerce_account_subscriptions_endpoint', array($this, 'subscriptions_content') );
add_action( 'woocommerce_account_subscriptions_endpoint', array($this, 'subscriptions_content'), 50, 6 );
/* Inject random generate pass as we don't send it from the registration form */
// XXX BUG! we should initialize this when is the right page and the right POST,
......@@ -38,7 +84,16 @@ if(!class_exists('PmsWoocommerceRegistrationIntegration')) {
add_action( 'init', array($this, 'gen_random_pwd'), 5); // This need to happen before PMS detect the form at "10" sequence firing
// Sending email with link to set user password
add_action("pms_register_form_after_create_user", array($this, "send_register_email_reset_password") );
add_action("pms_register_form_after_create_user", array($this, "send_register_email_reset_password") );
// Manage manual payments for Paid Member Subscriptions plugin
// ( expecially for new users and change of subscription plan )
add_action('pms_get_redirect_url', array($this, 'redirect_after_manual_payment') );
// Manage checkout ( as we use only woocommerce for payments )
// XXX This is a dirty hack, we are not going to filter anything!
//add_filter("init", array($this, "redirect_to_checkout") );
// Reorder membership subscription in registration page
......@@ -53,6 +108,91 @@ if(!class_exists('PmsWoocommerceRegistrationIntegration')) {
}
}
*/
/*
public function add_to_cart()
{
sexhack_log("ADD_TO_CART()");
if($this->addcart)
{
WC()->cart->add_to_cart( $this->addcart );
wp_redirect(wc_get_checkout_url());
}
}
*/
// NOTE: This is the "better way" for the checkout
// redirect (look the following commented function)
public function redirect_after_manual_payment($url)
{
if( !isset( $_POST['pay_gate'] ) || $_POST['pay_gate'] != 'manual' )
return $url;
$subscription_plan = pms_get_subscription_plan( $_POST['subscription_plans']);
if( !isset( $subscription_plan->id ) || $subscription_plan->price == 0 )
return $url;
else
{
sexhack_log("CHECKOUT: ");
//sexhack_log($subscription_plan);
$prodid = get_option('sexhack-wcpms-'.strval($subscription_plan->id), false);
$product = false;
if($prodid) $product = wc_get_product($prodid);
if(($product) && ($product->get_regular_price()==$subscription_plan->price)) $wcprods = array($product);
else $wcprods = get_wc_subscription_products_priced($subscription_plan->price, $subscription_plan->id);
sexhack_log($wcprods);
if(count($wcprods) > 0)
{
// XXX we can't use WC() here as this is called in "init", while
// WC() can't be only called after wp_loaded, but here we have an
// immediate redirect, before wp_loaded, so, i can't do it that way.
//$this->addcart = $wcprods[0]->get_id();
//add_action('wp_loaded', array($this, 'add_to_cart'));
//WC()->cart->add_to_cart( $this->addcart );
return wc_get_checkout_url()."?add-to-cart=".$wcprods[0]->get_id()."&quantity=1";
}
return $url; //home_url('/payment-info');
}
}
// XXX For Paid Membership subscription....
// Depends on it!
// XXX We found a better way.
/*
public function redirect_to_checkout()
{
//pms_gateway_payment_id=NDQ&pmsscscd=c3Vic2NyaXB0aW9uX3BsYW5z&pms_gateway_payment_action=cmVnaXN0ZXI
//$pid = 46 $pact = register $scscd = subscription_plans
if(isset($_GET['pms_gateway_payment_id'])
//&& is_integer(base64_decode($_GET['pms_gateway_payment_id']))
&& isset($_GET['pms_gateway_payment_action'])
&& isset($_GET['pmsscscd'])
&& (base64_decode($_GET['pmsscscd'])=="subscription_plans")
)
{
// Here we go we have to pay!
$pid = base64_decode($_GET['pms_gateway_payment_id']);
$pact = base64_decode($_GET['pms_gateway_payment_action']);
$scscd = base64_decode($_GET['pmsscscd']);
sexhack_log("ANTANI! $pid $pact $scscd");
switch($pact)
{
case 'register':
$payment = pms_get_payment($pid);
sexhack_log("PAYMENT: ");
sexhack_log($payment);
break;
default:
sexhack_log("UNMANAGED REQUEST WITH PACT: $pact in redirect_to_checkout()");
}
}
} */
// Register new endpoint (URL) for My Account page
// Note: Re-save Permalinks or it will give 404 error
......@@ -93,6 +233,7 @@ if(!class_exists('PmsWoocommerceRegistrationIntegration')) {
echo do_shortcode( '[pms-payment-history]');
}
public function send_register_email_reset_password($user_data)
{
$mailpage = get_option('sexhack_registration_mail_endpoint', false);
......@@ -114,7 +255,75 @@ if(!class_exists('PmsWoocommerceRegistrationIntegration')) {
}
function wcpms_adminpage()
{
$plans = pms_get_subscription_plans();
sexhack_log($plans);
?>
<div class="wrap">
<?php do_settings_sections( 'sexhackme-wcpms-settings' ); ?>
<form method="post" action="/wp-admin/options.php">
<?php settings_fields( 'sexhackme-wcpms-settings' ); ?>
<table class="form-table">
<?php
foreach($plans as $plan)
{
if($plan->price > 0)
{
?>
<tr align="top">
<td>
<label><b><?php echo $plan->name ?> woocommerce product</b></label><br>
<select id="sexhack-wcpms-<?php echo $plan->id;?>" name="sexhack-wcpms-<?php echo $plan->id; ?>" class="widefat">
<?php
$opt = get_option('sexhack-wcpms-'.strval($plan->id));
foreach(get_wc_subscription_products_priced($plan->price, $plan->id) as $prod)
{
?>
<option value='<?php echo $prod->id; ?>' <?php if($opt == $prod->id) echo "selected"; ?> >
<?php echo $prod->get_title() ?> (<?php echo $prod->id; ?>)
</option>
<?php
}
?>
</select>
</td>
</tr>
<?php
}
}
?>
</table>
<?php submit_button(); ?>
</form>
</div>
<?php
}
function settings_wcpms_section()
{
echo "<h2>SexHackMe PMS - WooCommerce integration Settings</h2>";
}
function wcpms_initialize_options()
{
$plans = pms_get_subscription_plans();
add_settings_section('sexhackme-wcpms-settings', ' ', 'wp_SexHackMe\settings_wcpms_section', 'sexhackme-wcpms-settings');
register_setting('sexhackme-wcpms-settings', 'sexhack-wcpms-checkout');
foreach($plans as $plan)
{
if($plan->price > 0)
{
register_setting('sexhackme-wcpms-settings', 'sexhack-wcpms-'.strval($plan->id));
}
}
}
add_action('admin_init', 'wp_SexHackMe\wcpms_initialize_options');
$SEXHACK_SECTION = array(
'class' => 'PmsWoocommerceRegistrationIntegration',
......@@ -123,6 +332,12 @@ $SEXHACK_SECTION = array(
'require-page' => array(
array('post_type' => 'page', 'title' => 'Set password mail page', 'option' => 'sexhack_registration_mail_endpoint')
),
'adminmenu' => array(
array('title' => 'WC-PMS Integration',
'slug' => 'wcpms-integration',
'callback' => 'wp_SexHackMe\wcpms_adminpage')
),
'slugs' => array('account', 'register', 'login', 'password-reset')
);
......
<?php
namespace wp_SexHackMe;
$SEXHACK_GALLERY_DEFAULTSLUG = 'v';
......@@ -156,14 +155,15 @@ if(!class_exists('SexHackVideoGallery')) {
public function query_vars($vars)
{
$vars[] = 'wooprod';
$vars[] = 'wooprod';
$vars[] = 'videoaccess';
return $vars;
}
public function sexhack_video_template($template)
{
$template='video.php';
if(isset($GET['SEXHACKDEBUG'])) $template='newvideo.php';
if(isset($_GET['SEXHACKDEBUG'])) $template='newvideo.php';
$is_sexhack_video = get_query_var('wooprod', false);
if($is_sexhack_video ) {
set_query_var( 'post_type', 'sexhack_video' );
......@@ -227,14 +227,22 @@ if(!class_exists('SexHackVideoGallery')) {
// there are a lot more available arguments, but the above is plenty for now
));
$projects_structure = '/'.$DEFAULTSLUG.'/%wooprod%/';
$projects_structure = '/'.$DEFAULTSLUG.'/%wooprod%/';
$rules = $wp_rewrite->wp_rewrite_rules();
if(array_key_exists($DEFAULTSLUG.'/([^/]+)/?$', $rules)) {
sexhack_log("REWRITE: rules OK: ".$DEFAULTSLUG.'/([^/]+)/?$ => '.$rules[$DEFAULTSLUG.'/([^/]+)/?$']);
} else {
sexhack_log("REWRITE: Need to add and flush our rules!");
$wp_rewrite->add_rewrite_tag("%wooprod%", '([^/]+)', "post_type=sexhack_video&wooprod=");
$wp_rewrite->add_rewrite_tag("%videoaccess%", '([^/]+)', "videoaccess=");
$wp_rewrite->add_permastruct($DEFAULTSLUG, $projects_structure, false);
$wp_rewrite->add_permastruct($DEFAULTSLUG, $projects_structure."%videoaccess%/", false);
//$wp_rewrite->add_permastruct($DEFAULTSLUG.'public', $projects_structure.'public/', false);
//$wp_rewrite->add_permastruct($DEFAULTSLUG.'members', $projects_structure.'members/', false);
//$wp_rewrite->add_permastruct($DEFAULTSLUG.'subscribers', $projects_structure.'subscribers/', false);
//$wp_rewrite->add_permastruct($DEFAULTSLUG.'vrpub', $projects_structure.'vrpub/', false);
//$wp_rewrite->add_permastruct($DEFAULTSLUG.'vrmem', $projects_structure.'vrmem/', false);
//$wp_rewrite->add_permastruct($DEFAULTSLUG.'vrsub', $projects_structure.'vrsub/', false);
update_option('need_rewrite_flush', 1);
}
......
......@@ -62,12 +62,55 @@ ul.products li.sexhack_thumbli {
background-color: #283747;
}
.sexhack-videonotify {
margin: 0 0 0 0;
text-align: center;
font-weight: bold;
padding: 10% 0;
}
.sexhack-videonotify a {
font-weight: bold;
}
.sexhack-video-container {
border: solid 1px white;
border-top: solid 0px;
border-radius: 0px 0px 8px 8px;
}
.sexhack_videopreview {
width: 100%;
}
.sexhack-tabs {
margin-left: 10px;
}
.sexhack_tab_button {
border-radius: 0 0 4px 4px;
}
.sexhack_toggled_button {
background-color: black;
color: white;
border-bottom: 1px solid white;
border-left: 1px solid white;
border-right: 1px solid white;
outline: 2px solid black;
}
@media screen and (max-width: 767px) {
.sexhack_gallery_thumbnail {
width:90%;
display: block;
}
.sexhack-video-container {
min-height: 100px;
}
.sexhack_gallery_row {
display: block;
}
......@@ -95,6 +138,10 @@ ul.products li.sexhack_thumbli {
//overflow: hidden;
}
.sexhack-video-container {
min-height: 200px;
}
.sexhack_gallery_row {
display: table-row;
}
......
......@@ -81,8 +81,8 @@ function send_changepwd_mail($user_login, $baseurl=false){
if ( false === ( $activation_keys = get_option( 'pms_recover_password_activation_keys' ) ) ) {
$activation_keys = array();
}
$activation_keys[$user->ID]['key'] = $key;
$activation_keys[$user->ID]['time'] = time();
$activation_keys[$user_data->ID]['key'] = $key;
$activation_keys[$user_data->ID]['time'] = time();
update_option( 'pms_recover_password_activation_keys', $activation_keys );
if ( $message && !wp_mail($user_email, $title, $message) )
......
......@@ -40,103 +40,175 @@ get_header(); ?>
}
}
$videoslug = get_option('sexhack_gallery_slug', 'v');
$vurl = str_replace("/product/", "/".$videoslug."/", esc_url( get_the_permalink() ));
$prod = wc_get_product(get_the_ID());
$hls = $prod->get_attribute("hls_public");
$hls_member = $prod->get_attribute("hls_members");
$hls_members = $prod->get_attribute("hls_members");
$hls_premium = $prod->get_attribute("hls_premium");
$video_preview = $prod->get_attribute("video_preview");
$gif_preview = $prod->get_attribute("gif_preview");
$vr_premium = $prod->get_attribute("vr_premium");
$vr_member = $prod->get_attribute("vr_members");
$vr_members = $prod->get_attribute("vr_members");
$vr_public = $prod->get_attribute("vr_public");
$vr_preview = $prod->get_attribute("vr_preview");
$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_member) AND wp_SexHackMe\starts_with('/', $hls_member)) $hls_member = site_url().$hls_member;
if(($hls_members) AND wp_SexHackMe\starts_with('/', $hls_members)) $hls_members = site_url().$hls_members;
if(($hls_premium) AND wp_SexHackMe\starts_with('/', $hls_premium)) $hls_premium = site_url().$hls_premium;
if(($video_preview) AND wp_SexHackMe\starts_with('/', $video_preview)) $video_preview = site_url().$video_preview;
if(($vr_public) AND wp_SexHackMe\starts_with('/', $vr_public)) $vr_public = site_url().$vr_public;
if(($vr_member) AND wp_SexHackMe\starts_with('/', $vr_member)) $vr_member = site_url().$vr_member;
if(($vr_members) AND wp_SexHackMe\starts_with('/', $vr_members)) $vr_members = site_url().$vr_members;
if(($vr_premium) AND wp_SexHackMe\starts_with('/', $vr_premium)) $vr_premium = site_url().$vr_premium;
if(($vr_preview) AND wp_SexHackMe\starts_with('/', $vr_preview)) $vr_preview = site_url().$vr_preview;
//if (($hls) OR ($hls_member) OR ($hls_premium) OR ($video_preview) OR ($gif_preview)) : ?>
$thumb = wp_get_attachment_url($prod->get_image_id());
$avail = array();
$tabtext = array('subscribers' => 'Subscribers',
'vrsub' => 'Subscribers',
'members' => 'Members',
'vrmem' => 'Members',
'vrpub' => 'Public',
'public' => 'Public');
if($hls || $video_preview ) $avail[] = 'public';
if($vr_public || $vr_preview) $avail[] = 'vrpub';
if($hls_members) $avail[] = 'members';
if($vr_members) $avail[] = 'vrmem';
if($hls_premium) $avail[] = 'subscribers';
if($vr_premium) $avail[] = 'vrsub';
$videoaccess = get_query_var('videoaccess', false);
if($videoaccess && in_array($videoaccess, $avail))
{
$tab = $videoaccess;
}
else
{
if($sexhack_pms->is_premium()) {
if($hls_premium) $tab = 'subscribers';
elseif($vr_premium) $tab = 'vrsub';
elseif($hls_members) $tab = 'members';
elseif($vr_members) $tab = 'vrmem';
elseif($vr_public || $vr_preview) $tab = 'vrpub';
else $tab = 'public';
}
elseif($sexhack_pms->is_member()) // free membership
{
if($hls_members) $tab = 'members';
elseif($vr_members) $tab = 'vrmem';
elseif($vr_public) $tab = 'vrpub';
else $tab = 'public';
}
else // public
{
if($vr_public) $tab = 'vrpub';
else $tab = 'public';
}
}
?>
<article id="post-<?php echo get_the_ID();?>" class="post-<?php echo get_the_ID();?> product type-product">
<header class="entry-header">
<h2 class="alpha entry-title sexhack_video_title">
<?php the_title() ?>
</h2>
</header><!-- .entry-header -->
<?php
//$thumb = wp_get_attachment_image_src(get_post_thumbnail_id( get_the_ID(), 'full' ));
$thumb = wp_get_attachment_url($prod->get_image_id());
$endhtml = '<br><hr>';
if($sexhack_pms->is_premium())
{
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($hls_member) echo do_shortcode( "[sexhls url=\"".$hls_member."\" posters=\"".$thumb."\"]" );
else if($vr_member) echo do_shortcode( "[sexvideo url=\"".$vr_member."\" posters=\"".$thumb."\"]" );
else 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($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($gif_preview) echo '<img src="'.$gif_preview.'" loading="lazy"></img>';
else echo '<img src="'.$thumb.'" loading="lazy"></img>';
echo $htmltags;
}
elseif($sexhack_pms->is_member()) // free membership
{
if($hls_member) echo do_shortcode( "[sexhls url=\"".$hls_member."\" posters=\"".$thumb."\"]" );
else if($vr_member) echo do_shortcode( "[sexvideo url=\"".$vr_member."\" posters=\"".$thumb."\"]" );
else 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($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($gif_preview) echo '<img src="'.$gif_preview.'" loading="lazy"></img>';
else echo '<img src="'.$thumb.'" loading="lazy"></img>';
echo $htmltags;
if($hls_premium) $endhtml .= "<h3><a href='/product-category/subscriptions/'>Premium full lenght version available here</a></h3>";
if($vr_premium) $endhtml .= "<h3><a href='/product-category/subscriptions/'>VR 3D Premium full lenght version available here</a></h3>";
}
else // public
{
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($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($gif_preview) echo '<img src="'.$gif_preview.'" loading="lazy"></img>';
else echo '<img src="'.$thumb.'" loading="lazy"></img>';
echo $htmltags;
if($hls_premium) $endhtml .= "<h3><a href='/product-category/subscriptions/'>Premium full lenght version available here</a></h3>";
if($hls_member) $endhtml .= "<h3><a href='/login'>Free members only version available! Sign up or Login to watch</a></h3>";
if($vr_premium) $endhtml .= "<h3><a href='/product-category/subscriptions/'>VR 3D Premium full lenght version available here</a></h3>";
if($vr_member) $endhtml .= "<h3><a href='/login'>VR 3D Free members only version available! Sign up or Login to watch</a></h3>";
}
?>
<?php
//else :
// get_template_part( 'content', get_post_format() ); // get_post_format() return empty for us
//endif;
echo $endhtml;
?>
<h3><a href="<?php echo get_the_permalink(); ?>">Download the full lenght hi-res version of this video</a><h3>
<br><hr>
<header class="entry-header">
<h2 class="alpha entry-title sexhack_video_title">
<?php the_title(); echo " (".$tabtext[$tab]." version)"; ?>
</h2>
</header><!-- .entry-header -->
<div class="sexhack-video-container">
<?php
if(in_array($tab, $avail))
{
switch($tab)
{
case "members":
case "vrmem":
if($sexhack_pms->is_premium() || $sexhack_pms->is_member())
{
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 echo "<h3 class='sexhack-videonotify'>SOMETHING WENT BADLY WRONG. I CAN'T FIND THE VIDEO</h3>";
}
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>';
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>";
}
break;
case "subscribers":
case "vrsub":
if($sexhack_pms->is_premium())
{
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 echo "<h3 class='sexhack-videonotify'>SOMETHING WENT BADLY WRONG. I CAN'T FIND THE VIDEO</h3>";
}
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>';
echo "<h3 class='sexhack-videonotify'><a href='/product-category/subscriptions/'>YOU NEED A SUBSCRIPTION TO ACCESS THIS VIDEO</a></h3>";
}
break;
case "vrpub":
default: // public too!
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($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($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 // if(in_array($tab, $avail))
{
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($gif_preview) echo '<img class="sexhack_videopreview" src="'.$gif_preview.'" 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>
<?php
}
?>
</div> <!-- video container -->
<div class="sexhack-tabs">
<?php
foreach($avail as $vaval)
{
if(!(in_array('vrpub', $avail) && ($vaval == 'public'))) {
$hrefurl = $vurl.'/'.$vaval.'/';
$bclass = '';
if(isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0) $hrefurl .= '?'.$_SERVER['QUERY_STRING'];
if($vaval == $tab) $bclass='sexhack_toggled_button';
?>
<a class="sexhack_tab_a" href="<?php echo $hrefurl; ?>">
<button name="<?php echo $vaval; ?>" class="sexhack_tab_button <?php echo $bclass; ?>">
<?php echo $tabtext[$vaval]; ?>
</button>
</a>
<?php
}
}
?>
</div>
<br><hr>
<?php
echo $htmltags;
?>
<h3><a href="<?php echo get_the_permalink(); ?>">Download the full lenght hi-res version of this video</a><h3>
<hr>
<?php
echo do_shortcode("[sexadv adv=".get_option('sexadv_video_bot')."]");
endwhile;
......
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