Fix indentation

parent 9a519723
...@@ -34,31 +34,31 @@ if(!class_exists('SH_Admin')) { ...@@ -34,31 +34,31 @@ if(!class_exists('SH_Admin')) {
// Add general settings section // Add general settings section
add_settings_section('sexhackme-settings', ' ', 'wp_SexHackMe\sexhackme_settings_section', 'sexhackme-settings'); add_settings_section('sexhackme-settings', ' ', 'wp_SexHackMe\sexhackme_settings_section', 'sexhackme-settings');
// Add WC-PMS_Integration settings // Add WC-PMS_Integration settings
if( file_exists(SH_PLUGIN_DIR_PATH . 'includes/admin/functions-wcpms.php') ) if( file_exists(SH_PLUGIN_DIR_PATH . 'includes/admin/functions-wcpms.php') )
{ {
include_once SH_PLUGIN_DIR_PATH . 'includes/admin/functions-wcpms.php'; include_once SH_PLUGIN_DIR_PATH . 'includes/admin/functions-wcpms.php';
$plans = sh_get_subscription_plans(); $plans = sh_get_subscription_plans();
add_settings_section('sexhackme-wcpms-settings', ' ', 'wp_SexHackMe\settings_wcpms_section', 'sexhackme-wcpms-settings'); add_settings_section('sexhackme-wcpms-settings', ' ', 'wp_SexHackMe\settings_wcpms_section', 'sexhackme-wcpms-settings');
register_setting('sexhackme-wcpms-settings', 'sexhack-wcpms-checkout'); register_setting('sexhackme-wcpms-settings', 'sexhack-wcpms-checkout');
foreach($plans as $plan) foreach($plans as $plan)
{ {
if($plan->price > 0) if($plan->price > 0)
{ {
register_setting('sexhackme-wcpms-settings', 'sexhack-wcpms-'.strval($plan->id)); register_setting('sexhackme-wcpms-settings', 'sexhack-wcpms-'.strval($plan->id));
} }
} }
add_settings_section('sexhackme-wcpms-settings', ' ', 'wp_SexHackMe\settings_wcpms_section_email', 'sexhackme-wcpms-settings-email'); add_settings_section('sexhackme-wcpms-settings', ' ', 'wp_SexHackMe\settings_wcpms_section_email', 'sexhackme-wcpms-settings-email');
register_setting('sexhackme-wcpms-settings', 'sexhack_registration_mail_endpoint'); register_setting('sexhackme-wcpms-settings', 'sexhack_registration_mail_endpoint');
} }
// Add Advertising settings // Add Advertising settings
if( file_exists(SH_PLUGIN_DIR_PATH . 'includes/admin/functions-advert.php') ) if( file_exists(SH_PLUGIN_DIR_PATH . 'includes/admin/functions-advert.php') )
{ {
include_once SH_PLUGIN_DIR_PATH . 'includes/admin/functions-advert.php'; include_once SH_PLUGIN_DIR_PATH . 'includes/admin/functions-advert.php';
add_settings_section('sexhackme-advert-settings', ' ', 'wp_SexHackMe\settings_advert_section', 'sexhackme-advert-settings'); add_settings_section('sexhackme-advert-settings', ' ', 'wp_SexHackMe\settings_advert_section', 'sexhackme-advert-settings');
register_setting('sexhackme-advert-settings', 'sexadv_video_top'); register_setting('sexhackme-advert-settings', 'sexadv_video_top');
register_setting('sexhackme-advert-settings', 'sexadv_video_bot'); register_setting('sexhackme-advert-settings', 'sexadv_video_bot');
} }
// Gallery settings // Gallery settings
...@@ -73,31 +73,31 @@ if(!class_exists('SH_Admin')) { ...@@ -73,31 +73,31 @@ if(!class_exists('SH_Admin')) {
public static function menu() public static function menu()
{ {
add_menu_page('SexHackMe Settings', 'SexHackMe', 'manage_options', 'sexhackme-settings', add_menu_page('SexHackMe Settings', 'SexHackMe', 'manage_options', 'sexhackme-settings',
'wp_SexHackMe\sexhackme_admin_page', SH_PLUGIN_DIR_URL .'img/admin_icon.png', 31); 'wp_SexHackMe\sexhackme_admin_page', SH_PLUGIN_DIR_URL .'img/admin_icon.png', 31);
// Add The main page again cause with multiple subpages apparently we need to do it. // Add The main page again cause with multiple subpages apparently we need to do it.
add_submenu_page( 'sexhackme-settings', 'SexHackMe Settings', 'General Settings', add_submenu_page( 'sexhackme-settings', 'SexHackMe Settings', 'General Settings',
'manage_options', 'sexhackme-settings'); 'manage_options', 'sexhackme-settings');
// TODO We don't have a main page yet, so, remove it. // TODO We don't have a main page yet, so, remove it.
remove_submenu_page( 'sexhackme-settings', 'sexhackme-settings' ); remove_submenu_page( 'sexhackme-settings', 'sexhackme-settings' );
// Add page WC-PMS_Integration // Add page WC-PMS_Integration
if( file_exists(SH_PLUGIN_DIR_PATH . 'includes/admin/functions-wcpms.php') ) if( file_exists(SH_PLUGIN_DIR_PATH . 'includes/admin/functions-wcpms.php') )
{ {
add_submenu_page( 'sexhackme-settings', // root slug add_submenu_page( 'sexhackme-settings', // root slug
'WC-PMS Integration', // title 'WC-PMS Integration', // title
'WC-PMS Integration', // title 'WC-PMS Integration', // title
'manage_options', // capabilities 'manage_options', // capabilities
'pmswc-integration', // slug 'pmswc-integration', // slug
'wp_SexHackMe\wcpms_adminpage'); // callback 'wp_SexHackMe\wcpms_adminpage'); // callback
} }
// Add Advertising settings // Add Advertising settings
if( file_exists(SH_PLUGIN_DIR_PATH . 'includes/admin/functions-advert.php') ) if( file_exists(SH_PLUGIN_DIR_PATH . 'includes/admin/functions-advert.php') )
{ {
add_submenu_page( 'sexhackme-settings', // root slug add_submenu_page( 'sexhackme-settings', // root slug
'Advertising', // title 'Advertising', // title
'Advertising', // title 'Advertising', // title
...@@ -105,7 +105,7 @@ if(!class_exists('SH_Admin')) { ...@@ -105,7 +105,7 @@ if(!class_exists('SH_Admin')) {
'advert', // slug 'advert', // slug
'wp_SexHackMe\advert_adminpage'); // callback 'wp_SexHackMe\advert_adminpage'); // callback
} }
// Add Gallery settings page // Add Gallery settings page
......
...@@ -57,7 +57,7 @@ if(!class_exists('ChaturbateLive')) { ...@@ -57,7 +57,7 @@ if(!class_exists('ChaturbateLive')) {
} }
} }
} }
if(!class_exists('Cam4Live')) { if(!class_exists('Cam4Live')) {
...@@ -87,15 +87,15 @@ if(!class_exists('Cam4Live')) { ...@@ -87,15 +87,15 @@ if(!class_exists('Cam4Live')) {
} }
if(!class_exists('LiveCamSite')) { if(!class_exists('LiveCamSite')) {
class LiveCamSite class LiveCamSite
{ {
public static function getCamStream($site, $model) public static function getCamStream($site, $model)
{ {
if($site=='chaturbate') return ChaturbateLive::getStream($model); if($site=='chaturbate') return ChaturbateLive::getStream($model);
else if($site=='cam4') return Cam4Live::getStream($model); else if($site=='cam4') return Cam4Live::getStream($model);
return false; return false;
} }
} }
} }
......
...@@ -100,7 +100,7 @@ if(!class_exists('SH_MetaBox')) { ...@@ -100,7 +100,7 @@ if(!class_exists('SH_MetaBox')) {
// Update the meta field in the database. // Update the meta field in the database.
update_post_meta( $post_id, 'video_description', $my_data ); update_post_meta( $post_id, 'video_description', $my_data );
} }
} }
add_action('save_post', array('wp_SexHackMe\SH_MetaBox', '::save_meta_box_data' )); add_action('save_post', array('wp_SexHackMe\SH_MetaBox', '::save_meta_box_data' ));
......
...@@ -28,30 +28,30 @@ if(!class_exists('SH_PMS_Support')) { ...@@ -28,30 +28,30 @@ if(!class_exists('SH_PMS_Support')) {
class SH_PMS_Support class SH_PMS_Support
{ {
public function __construct() public function __construct()
{ {
$this->plans = false; $this->plans = false;
} }
private function set_pms_plans() private function set_pms_plans()
{ {
$plans = array( $plans = array(
'member' => array(), 'member' => array(),
'premium'=> array(), 'premium'=> array(),
'byid' => array() 'byid' => array()
); );
$splans=pms_get_subscription_plans(true); $splans=pms_get_subscription_plans(true);
foreach($splans as $splan) foreach($splans as $splan)
{ {
if(intval($splan->price)==0) $plans['member'][] = $splan->id; if(intval($splan->price)==0) $plans['member'][] = $splan->id;
else $plans['premium'][] = $splan->id; else $plans['premium'][] = $splan->id;
$plans['byid'][$splan->id] = $splan; $plans['byid'][$splan->id] = $splan;
} }
$this->plans = $plans; $this->plans = $plans;
return $plans; return $plans;
} }
public function refresh_plans() public function refresh_plans()
...@@ -100,15 +100,15 @@ if(!class_exists('SH_PMS_Support')) { ...@@ -100,15 +100,15 @@ if(!class_exists('SH_PMS_Support')) {
} }
public function is_member($uid='') public function is_member($uid='')
{ {
return pms_is_member( $uid, $this->get_member_plans() ); return pms_is_member( $uid, $this->get_member_plans() );
} }
public function is_premium($uid='') public function is_premium($uid='')
{ {
return pms_is_member( $uid, $this->get_premium_plans() ); return pms_is_member( $uid, $this->get_premium_plans() );
} }
} }
function instance_SH_PMS_Support() { function instance_SH_PMS_Support() {
...@@ -116,7 +116,7 @@ if(!class_exists('SH_PMS_Support')) { ...@@ -116,7 +116,7 @@ if(!class_exists('SH_PMS_Support')) {
$GLOBALS['sh_pms'] = new SH_PMS_Support(); $GLOBALS['sh_pms'] = new SH_PMS_Support();
// backward compatibility // backward compatibility
$GLOBALS['sexhack_pms'] = $GLOBALS['sh_pms']; $GLOBALS['sexhack_pms'] = $GLOBALS['sh_pms'];
// Do action after instancing the global var to notify is reay // Do action after instancing the global var to notify is reay
do_action('sh_pms_ready'); do_action('sh_pms_ready');
...@@ -133,8 +133,8 @@ if(!class_exists('SexhackPmsPasswordDataLeak')) { ...@@ -133,8 +133,8 @@ if(!class_exists('SexhackPmsPasswordDataLeak')) {
{ {
add_filter( 'pms_recover_password_message', array($this, "change_recover_form_message") ); add_filter( 'pms_recover_password_message', array($this, "change_recover_form_message") );
add_action( 'init', array($this, 'reset_password_form'), 9); add_action( 'init', array($this, 'reset_password_form'), 9);
add_action( 'login_form_rp', array( $this, 'redirect_password_reset' ) ); add_action( 'login_form_rp', array( $this, 'redirect_password_reset' ) );
add_action( 'login_form_resetpass', array( $this, 'redirect_password_reset' ) ); add_action( 'login_form_resetpass', array( $this, 'redirect_password_reset' ) );
} }
public function change_recover_form_message($string) public function change_recover_form_message($string)
...@@ -143,19 +143,19 @@ if(!class_exists('SexhackPmsPasswordDataLeak')) { ...@@ -143,19 +143,19 @@ if(!class_exists('SexhackPmsPasswordDataLeak')) {
return str_replace("<br/>", "<br/>If valid, ", $string); return str_replace("<br/>", "<br/>If valid, ", $string);
} }
public function redirect_password_reset() public function redirect_password_reset()
{ {
// XXX This should be configurable. // XXX This should be configurable.
wp_redirect( home_url( 'password-reset' ) ); wp_redirect( home_url( 'password-reset' ) );
} }
public function reset_password_form() public function reset_password_form()
{ {
/* /*
* Username or Email * Username or Email
*/ */
$error=false; $error=false;
if( isset( $_POST['pms_username_email'] ) ) { if( isset( $_POST['pms_username_email'] ) ) {
//Check recover password form nonce; //Check recover password form nonce;
...@@ -189,7 +189,7 @@ if(!class_exists('SexhackPmsPasswordDataLeak')) { ...@@ -189,7 +189,7 @@ if(!class_exists('SexhackPmsPasswordDataLeak')) {
} }
else $error=true; else $error=true;
} }
} }
// Extra validation // Extra validation
do_action( 'pms_recover_password_form_validation' ); do_action( 'pms_recover_password_form_validation' );
...@@ -208,9 +208,9 @@ if(!class_exists('SexhackPmsPasswordDataLeak')) { ...@@ -208,9 +208,9 @@ if(!class_exists('SexhackPmsPasswordDataLeak')) {
} }
} // isset($_POST[pms_username_email]) } // isset($_POST[pms_username_email])
unset($_POST['pms_username_email']); unset($_POST['pms_username_email']);
} }
} }
......
...@@ -31,8 +31,8 @@ if(!class_exists('SH_PostTypes')) { ...@@ -31,8 +31,8 @@ if(!class_exists('SH_PostTypes')) {
public static function init() public static function init()
{ {
// For some pages we need to add also rewrite rules // For some pages we need to add also rewrite rules
global $wp_rewrite; global $wp_rewrite;
// Advertising // Advertising
register_post_type('sexhackadv', array( register_post_type('sexhackadv', array(
...@@ -57,13 +57,13 @@ if(!class_exists('SH_PostTypes')) { ...@@ -57,13 +57,13 @@ if(!class_exists('SH_PostTypes')) {
// SexHack Videos // SexHack Videos
// TODO: the idea is to have custom post type for models profiles and for videos. // TODO: the idea is to have custom post type for models profiles and for videos.
// Ideally /$DEFAULTSLUG/nomevideo/ finisce sul corrispettivo prodotto woocommerce, // Ideally /$DEFAULTSLUG/nomevideo/ finisce sul corrispettivo prodotto woocommerce,
// /$DEFAULTSLUG/modelname/nomevideo/ finisce sul corrispettivo page sexhackme_video quando show_in_menu e' attivo. // /$DEFAULTSLUG/modelname/nomevideo/ finisce sul corrispettivo page sexhackme_video quando show_in_menu e' attivo.
// //
// Devo pero' verificare le varie taxonomy e attributi della pagina, vedere come creare un prodotto in wordpress // Devo pero' verificare le varie taxonomy e attributi della pagina, vedere come creare un prodotto in wordpress
// per ogni pagina sexhack_video che credo, sincronizzare prodotti e video pagine, gestire prodotti con lo stesso nome // per ogni pagina sexhack_video che credo, sincronizzare prodotti e video pagine, gestire prodotti con lo stesso nome
// ( credo si possa fare dandogli differenti slugs ) // ( credo si possa fare dandogli differenti slugs )
register_post_type('sexhack_video', array( register_post_type('sexhack_video', array(
'labels' => array( 'labels' => array(
'name' => 'Videos', 'name' => 'Videos',
...@@ -92,7 +92,7 @@ if(!class_exists('SH_PostTypes')) { ...@@ -92,7 +92,7 @@ if(!class_exists('SH_PostTypes')) {
'supports' => array('title'), // 'thumbnail', 'editor','excerpt','trackbacks','custom-fields','comments','revisions','author','page-attributes'), 'supports' => array('title'), // 'thumbnail', 'editor','excerpt','trackbacks','custom-fields','comments','revisions','author','page-attributes'),
'taxonomies' => array('category','post_tag'), // TODO Shouldn't we have a "video_type" taxonomy for VR or flat? 'taxonomies' => array('category','post_tag'), // TODO Shouldn't we have a "video_type" taxonomy for VR or flat?
)); ));
$DEFAULTSLUG = get_option('sexhack_gallery_slug', 'v'); $DEFAULTSLUG = get_option('sexhack_gallery_slug', 'v');
$projects_structure = '/'.$DEFAULTSLUG.'/%wooprod%/'; $projects_structure = '/'.$DEFAULTSLUG.'/%wooprod%/';
$rules = $wp_rewrite->wp_rewrite_rules(); $rules = $wp_rewrite->wp_rewrite_rules();
if(array_key_exists($DEFAULTSLUG.'/([^/]+)/?$', $rules)) { if(array_key_exists($DEFAULTSLUG.'/([^/]+)/?$', $rules)) {
...@@ -111,7 +111,7 @@ if(!class_exists('SH_PostTypes')) { ...@@ -111,7 +111,7 @@ if(!class_exists('SH_PostTypes')) {
} }
} }
} }
?> ?>
...@@ -29,24 +29,24 @@ if(!class_exists('SH_Shortcodes')) { ...@@ -29,24 +29,24 @@ if(!class_exists('SH_Shortcodes')) {
class SH_Shortcodes class SH_Shortcodes
{ {
public static function init() { public static function init() {
$shortcodes = array( $shortcodes = array(
'sexhls' => __CLASS__ . '::video_hls', 'sexhls' => __CLASS__ . '::video_hls',
'sexvideo' => __CLASS__ . '::video_xr', 'sexvideo' => __CLASS__ . '::video_xr',
'sh_videoxr' => __CLASS__ . '::video_xr', 'sh_videoxr' => __CLASS__ . '::video_xr',
'sh_videohls' => __CLASS__ . '::video_hls', 'sh_videohls' => __CLASS__ . '::video_hls',
'xfbp' => __CLASS__ . '::xframe_bypass', 'xfbp' => __CLASS__ . '::xframe_bypass',
'sexhacklive' => __CLASS__ . '::sexhacklive', 'sexhacklive' => __CLASS__ . '::sexhacklive',
'sexadv' => __CLASS__ . '::adv_shortcode', 'sexadv' => __CLASS__ . '::adv_shortcode',
'sexgallery' => __CLASS__ . '::videogallery_shortcode', 'sexgallery' => __CLASS__ . '::videogallery_shortcode',
); );
foreach( $shortcodes as $shortcode_tag => $shortcode_func ) { foreach( $shortcodes as $shortcode_tag => $shortcode_func ) {
add_shortcode( $shortcode_tag, $shortcode_func ); add_shortcode( $shortcode_tag, $shortcode_func );
} }
} }
public static function video_hls($attr, $cont) public static function video_hls($attr, $cont)
{ {
...@@ -81,8 +81,8 @@ if(!class_exists('SH_Shortcodes')) { ...@@ -81,8 +81,8 @@ if(!class_exists('SH_Shortcodes')) {
'site' => 'chaturbate', 'site' => 'chaturbate',
'model' => 'sexhackme', 'model' => 'sexhackme',
), $attributes)); ), $attributes));
$ret = LiveCamSite::getCamStream($site, $model); $ret = LiveCamSite::getCamStream($site, $model);
if($ret) return $ret; if($ret) return $ret;
return '<p>CamStreamDL Error: wrong site option '.$site.'</p> '; return '<p>CamStreamDL Error: wrong site option '.$site.'</p> ';
} }
...@@ -117,7 +117,7 @@ if(!class_exists('SH_Shortcodes')) { ...@@ -117,7 +117,7 @@ if(!class_exists('SH_Shortcodes')) {
public static function videogallery_shortcode($attr, $cont) public static function videogallery_shortcode($attr, $cont)
{ {
global $post; global $post;
global $sh_videogallery; global $sh_videogallery;
extract( shortcode_atts(array( extract( shortcode_atts(array(
"category" => "all", "category" => "all",
), $attr)); ), $attr));
...@@ -135,7 +135,7 @@ if(!class_exists('SH_Shortcodes')) { ...@@ -135,7 +135,7 @@ if(!class_exists('SH_Shortcodes')) {
} }
} }
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -31,14 +31,14 @@ if(!class_exists('SexhackAddUnlockLogin')) { ...@@ -31,14 +31,14 @@ if(!class_exists('SexhackAddUnlockLogin')) {
public function __construct() public function __construct()
{ {
add_filter("login_form_bottom", array($this, "add_to_login"), 10, 2); add_filter("login_form_bottom", array($this, "add_to_login"), 10, 2);
add_action("woocommerce_after_order_notes", array($this, "add_to_checkout")); add_action("woocommerce_after_order_notes", array($this, "add_to_checkout"));
add_filter("pms_register_shortcode_content", array($this, "add_to_register"), 10, 2); add_filter("pms_register_shortcode_content", array($this, "add_to_register"), 10, 2);
add_filter("unlock_authenticate_user", array($this, "fix_unlock_user"), 11, 1); add_filter("unlock_authenticate_user", array($this, "fix_unlock_user"), 11, 1);
} }
public function get_proto(){ public function get_proto(){
return get_proto(); return get_proto();
} }
public function fix_unlock_user($user) public function fix_unlock_user($user)
{ {
...@@ -47,72 +47,72 @@ if(!class_exists('SexhackAddUnlockLogin')) { ...@@ -47,72 +47,72 @@ if(!class_exists('SexhackAddUnlockLogin')) {
if(is_object($user) && is_valid_eth_address($user->user_login)) if(is_object($user) && is_valid_eth_address($user->user_login))
{ {
if(!($sexhack_pms->is_member($user->ID)) && !($sexhack_pms->is_premium($user->ID))) if(!($sexhack_pms->is_member($user->ID)) && !($sexhack_pms->is_premium($user->ID)))
{ {
$subscription_plan = $sexhack_pms->get_default_plan(); $subscription_plan = $sexhack_pms->get_default_plan();
if($subscription_plan) if($subscription_plan)
{ {
$data = array( $data = array(
'user_id' => $user->ID, 'user_id' => $user->ID,
'subscription_plan_id' => $subscription_plan->id, 'subscription_plan_id' => $subscription_plan->id,
'start_date' => date( 'Y-m-d H:i:s' ), 'start_date' => date( 'Y-m-d H:i:s' ),
'expiration_date' => $subscription_plan->get_expiration_date(), 'expiration_date' => $subscription_plan->get_expiration_date(),
'status' => 'active', 'status' => 'active',
); );
$member_subscription = new \PMS_Member_Subscription(); $member_subscription = new \PMS_Member_Subscription();
$inserted = $member_subscription->insert( $data ); $inserted = $member_subscription->insert( $data );
} }
} }
} }
return $user; return $user;
} }
public function unlock_get_login_url($redirect_url=false) { public function unlock_get_login_url($redirect_url=false) {
$UNLOCK_BASE_URL = 'https://app.unlock-protocol.com/checkout'; $UNLOCK_BASE_URL = 'https://app.unlock-protocol.com/checkout';
$rurl=apply_filters( 'unlock_protocol_get_redirect_uri', wp_login_url()); $rurl=apply_filters( 'unlock_protocol_get_redirect_uri', wp_login_url());
if($redirect_url) { if($redirect_url) {
$rurl=$redirect_url; $rurl=$redirect_url;
} }
$login_url = add_query_arg( $login_url = add_query_arg(
array( array(
'client_id' => apply_filters( 'unlock_protocol_get_client_id', wp_parse_url( home_url(), PHP_URL_HOST ) ), 'client_id' => apply_filters( 'unlock_protocol_get_client_id', wp_parse_url( home_url(), PHP_URL_HOST ) ),
'redirect_uri' => $rurl, 'redirect_uri' => $rurl,
'state' => wp_create_nonce( 'unlock_login_state' ), 'state' => wp_create_nonce( 'unlock_login_state' ),
), ),
$UNLOCK_BASE_URL $UNLOCK_BASE_URL
); );
return apply_filters( 'unlock_protocol_get_login_url', $login_url ); return apply_filters( 'unlock_protocol_get_login_url', $login_url );
} }
public function unlock_button($string, $args, $redirect_url) public function unlock_button($string, $args, $redirect_url)
{ {
$html=""; $html="";
if(!is_user_logged_in()) { if(!is_user_logged_in()) {
$html="<hr><div style='text-align: center; width:100%;'><p>OR</p></div><hr>"; $html="<hr><div style='text-align: center; width:100%;'><p>OR</p></div><hr>";
$html.="<br><div style='text-align:left;width:100%;'<p><button onclick=\"window.location.href='".$this->unlock_get_login_url($redirect_url); $html.="<br><div style='text-align:left;width:100%;'<p><button onclick=\"window.location.href='".$this->unlock_get_login_url($redirect_url);
$html.="'\" type='button'>Login with Crypto Wallet</button></p></div>"; $html.="'\" type='button'>Login with Crypto Wallet</button></p></div>";
} }
return $string.$html; return $string.$html;
} }
// XXX Those 3 functions, hard-coded uri's that are dependent on a shortcode? that's sounds a bad idea, we // XXX Those 3 functions, hard-coded uri's that are dependent on a shortcode? that's sounds a bad idea, we
// should make them a configurable option // should make them a configurable option
public function add_to_register($string, $args){ public function add_to_register($string, $args){
return $this->unlock_button($string, $args, get_proto().wp_parse_url( home_url(), PHP_URL_HOST )."/register"); return $this->unlock_button($string, $args, get_proto().wp_parse_url( home_url(), PHP_URL_HOST )."/register");
} }
public function add_to_login($string, $args){ public function add_to_login($string, $args){
return $this->unlock_button($string, $args, get_proto().wp_parse_url( home_url(), PHP_URL_HOST )); return $this->unlock_button($string, $args, get_proto().wp_parse_url( home_url(), PHP_URL_HOST ));
} }
public function add_to_checkout(){ public function add_to_checkout(){
echo $this->unlock_button('', $args, get_proto().wp_parse_url( home_url(), PHP_URL_HOST )."/checkout"); echo $this->unlock_button('', $args, get_proto().wp_parse_url( home_url(), PHP_URL_HOST )."/checkout");
} }
} }
// Instance Unlock Login support class // Instance Unlock Login support class
......
...@@ -41,10 +41,10 @@ if(!class_exists('SH_VideoGallery')) { ...@@ -41,10 +41,10 @@ if(!class_exists('SH_VideoGallery')) {
// Register Query Vars // Register Query Vars
add_filter("query_vars", array($this, "query_vars")); add_filter("query_vars", array($this, "query_vars"));
//add_filter('page_template', array($this, 'sexhack_video_template')); //add_filter('page_template', array($this, 'sexhack_video_template'));
add_filter('archive_template', array($this, 'sexhack_video_template')); add_filter('archive_template', array($this, 'sexhack_video_template'));
add_action('pre_get_posts', array($this, 'fix_video_query'), 1, 1); add_action('pre_get_posts', array($this, 'fix_video_query'), 1, 1);
} }
...@@ -56,33 +56,33 @@ if(!class_exists('SH_VideoGallery')) { ...@@ -56,33 +56,33 @@ if(!class_exists('SH_VideoGallery')) {
return $vars; return $vars;
} }
public function sexhack_video_template($template) public function sexhack_video_template($template)
{ {
$template='video.php'; $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); $is_sexhack_video = get_query_var('wooprod', false);
if($is_sexhack_video ) { if($is_sexhack_video ) {
set_query_var( 'post_type', 'sexhack_video' ); set_query_var( 'post_type', 'sexhack_video' );
if ( file_exists( plugin_dir_path(__DIR__) . '/templates/'.$template)) { if ( file_exists( plugin_dir_path(__DIR__) . '/templates/'.$template)) {
return plugin_dir_path(__DIR__) . '/templates/'.$template; return plugin_dir_path(__DIR__) . '/templates/'.$template;
} }
} }
return $template; return $template;
} }
public function fix_video_query($query) public function fix_video_query($query)
{ {
if($query->get('post_type')=='sexhack_video') { if($query->get('post_type')=='sexhack_video') {
$wooprod = $query->get('wooprod', false); $wooprod = $query->get('wooprod', false);
if($wooprod) { if($wooprod) {
$query->query['post_type'] = 'sexhack_video'; $query->query['post_type'] = 'sexhack_video';
$query->set('name', esc_sql($wooprod)); $query->set('name', esc_sql($wooprod));
$query->set('post_type', 'any'); $query->set('post_type', 'any');
//$query->set('post_type', ''); //$query->set('post_type', '');
} }
} }
} }
public function getProducts($vcat=false) { public function getProducts($vcat=false) {
...@@ -93,21 +93,21 @@ if(!class_exists('SH_VideoGallery')) { ...@@ -93,21 +93,21 @@ if(!class_exists('SH_VideoGallery')) {
} }
public function get_video_thumb() public function get_video_thumb()
{ {
$DEFAULTSLUG = get_option('sexhack_gallery_slug', 'v'); $DEFAULTSLUG = get_option('sexhack_gallery_slug', 'v');
$id = get_the_ID(); $id = get_the_ID();
$prod = wc_get_product($id); $prod = wc_get_product($id);
$image = get_the_post_thumbnail($id, "medium", array("class" => "sexhack_thumbnail")); //array("class" => "alignleft sexhack_thumbnail")); $image = get_the_post_thumbnail($id, "medium", array("class" => "sexhack_thumbnail")); //array("class" => "alignleft sexhack_thumbnail"));
$hls = $prod->get_attribute("hls_public"); $hls = $prod->get_attribute("hls_public");
$hls_member = $prod->get_attribute("hls_members"); $hls_member = $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_member = $prod->get_attribute("vr_members"); $vr_member = $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");
...@@ -118,10 +118,10 @@ if(!class_exists('SH_VideoGallery')) { ...@@ -118,10 +118,10 @@ if(!class_exists('SH_VideoGallery')) {
$gif = $prod->get_attribute("gif_thumbnail"); $gif = $prod->get_attribute("gif_thumbnail");
if(!$gif) $gif = $gif_preview; if(!$gif) $gif = $gif_preview;
if($gif) $image .= "<img src='$gif' class='alignleft sexhack_thumb_hover' loading='lazy' />"; if($gif) $image .= "<img src='$gif' class='alignleft sexhack_thumb_hover' loading='lazy' />";
$html = '<li class="product type-product sexhack_thumbli">'; $html = '<li class="product type-product sexhack_thumbli">';
$vurl = str_replace("/product/", "/".$DEFAULTSLUG."/", esc_url( get_the_permalink() )); $vurl = str_replace("/product/", "/".$DEFAULTSLUG."/", esc_url( get_the_permalink() ));
$vtitle = esc_html( get_the_title() ); $vtitle = esc_html( get_the_title() );
$vtags=array(); $vtags=array();
...@@ -135,11 +135,11 @@ if(!class_exists('SH_VideoGallery')) { ...@@ -135,11 +135,11 @@ if(!class_exists('SH_VideoGallery')) {
if(($vr_premium) OR ($vr_member) OR ($vr_public) OR ($vr_preview) if(($vr_premium) OR ($vr_member) OR ($vr_public) OR ($vr_preview)
OR ((count($prod->get_downloads()) > 0) OR ((count($prod->get_downloads()) > 0)
AND (in_array("VR180", $categories) AND (in_array("VR180", $categories)
OR in_array("VR360", $categories)))) $html .= '<label class="sexhack_vtag sexhack_VR"">VR/3D</label>'; OR in_array("VR360", $categories)))) $html .= '<label class="sexhack_vtag sexhack_VR"">VR/3D</label>';
$html .= "<a href=\"$vurl\" class=\"woocommerce-LoopProduct-link woocommerce-loop-product__link\">"; $html .= "<a href=\"$vurl\" class=\"woocommerce-LoopProduct-link woocommerce-loop-product__link\">";
$html .= "<div class='sexhack_thumb_cont'>".$image."</div>"; $html .= "<div class='sexhack_thumb_cont'>".$image."</div>";
foreach($vtags as $vid => $vtag) foreach($vtags as $vid => $vtag)
{ {
$left = intval($vid)*12; $left = intval($vid)*12;
...@@ -147,11 +147,11 @@ if(!class_exists('SH_VideoGallery')) { ...@@ -147,11 +147,11 @@ if(!class_exists('SH_VideoGallery')) {
$html .= $vtag; $html .= $vtag;
} }
$html .= "<h3 class=\"sexhack_gallery_title woocommerce-loop-product__title\" alt='".$vtitle."'>".trim_text_preview($vtitle, 60, false)."</h3>"; $html .= "<h3 class=\"sexhack_gallery_title woocommerce-loop-product__title\" alt='".$vtitle."'>".trim_text_preview($vtitle, 60, false)."</h3>";
$html .= "</a></li>"; $html .= "</a></li>";
return $html; return $html;
} }
} }
$GLOBALS['sh_videogallery'] = new SH_VideoGAllery(); $GLOBALS['sh_videogallery'] = new SH_VideoGAllery();
......
...@@ -179,7 +179,7 @@ if(!class_exists('SH_GalleryWidget')) { ...@@ -179,7 +179,7 @@ if(!class_exists('SH_GalleryWidget')) {
} // Class widget ends here } // Class widget ends here
add_action( 'widgets_init', array('wp_SexHackMe\SH_GalleryWidget', 'register' )); add_action( 'widgets_init', array('wp_SexHackMe\SH_GalleryWidget', 'register' ));
} }
?> ?>
...@@ -40,61 +40,61 @@ if(!class_exists('SexhackWoocommerceProductVideos')) { ...@@ -40,61 +40,61 @@ if(!class_exists('SexhackWoocommerceProductVideos')) {
return $qvars; return $qvars;
} }
public function video_remove_default_woocommerce_image() { public function video_remove_default_woocommerce_image() {
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 ); remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );
remove_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20 ); remove_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20 );
add_action( 'woocommerce_before_single_product_summary', array($this, 'woocommerce_show_product_images_videos'), 30 ); add_action( 'woocommerce_before_single_product_summary', array($this, 'woocommerce_show_product_images_videos'), 30 );
} }
public function woocommerce_show_product_images_videos() { public function woocommerce_show_product_images_videos() {
// Get video and display // Get video and display
$prod = wc_get_product(get_the_ID()); $prod = wc_get_product(get_the_ID());
// verify GET vars
$bypass = get_query_var('sexhack_forcevideo', false);
// Possible displays
$disps = array('video', 'gif', 'image');
// By default fallback to:
$display='image';
// detect attributes
$video = $prod->get_attribute('video_preview');
$gif = $prod->get_attribute('gif_preview');
// verify GET vars if(in_array($bypass, $disps)) $display=$bypass;
$bypass = get_query_var('sexhack_forcevideo', false); else if($video) $display="video";
else if($gif) $display="gif";
// Possible displays
$disps = array('video', 'gif', 'image');
// By default fallback to:
$display='image';
// detect attributes
$video = $prod->get_attribute('video_preview');
$gif = $prod->get_attribute('gif_preview');
if(in_array($bypass, $disps)) $display=$bypass;
else if($video) $display="video";
else if($gif) $display="gif";
switch($display) { switch($display) {
case "video": case "video":
// Sanitize video URL // Sanitize video URL
$video = esc_url( $video ); $video = esc_url( $video );
// Display video // Display video
echo '<div class="images"><div class="responsive-video-wrap"><h3>Video Preview</h3>'; echo '<div class="images"><div class="responsive-video-wrap"><h3>Video Preview</h3>';
echo '<video src='."'$video'".' controls autoplay muted playsinline loop></video></div></div>'; echo '<video src='."'$video'".' controls autoplay muted playsinline loop></video></div></div>';
break; break;
case "gif": case "gif":
// sanitize URL // sanitize URL
$gif = esc_url( $gif ); $gif = esc_url( $gif );
// Display GIF // Display GIF
echo '<div class="images"><img src="'.$gif.'" /></div>'; echo '<div class="images"><img src="'.$gif.'" /></div>';
break; break;
case "image": case "image":
// No video defined so get thumbnail // No video defined so get thumbnail
wc_get_template( 'single-product/product-image.php' ); wc_get_template( 'single-product/product-image.php' );
break; break;
} }
} }
} }
...@@ -134,9 +134,9 @@ if(!class_exists('WoocommerceAccountRemoveNameSurname')) { ...@@ -134,9 +134,9 @@ if(!class_exists('WoocommerceAccountRemoveNameSurname')) {
return $required_fields; return $required_fields;
} }
} }
// Start changing the woocommerce account form // Start changing the woocommerce account form
new WoocommerceAccountRemoveNameSurname; new WoocommerceAccountRemoveNameSurname;
} }
...@@ -146,40 +146,40 @@ if(!class_exists('WoocommerceEmailCheckout')) { ...@@ -146,40 +146,40 @@ if(!class_exists('WoocommerceEmailCheckout')) {
{ {
public function __construct() public function __construct()
{ {
add_filter( 'woocommerce_checkout_fields' , array($this,'simplify_checkout_virtual') ); add_filter( 'woocommerce_checkout_fields' , array($this,'simplify_checkout_virtual') );
add_filter( 'woocommerce_login_redirect', array($this, 'fix_woocommerce_user'), 99, 2); add_filter( 'woocommerce_login_redirect', array($this, 'fix_woocommerce_user'), 99, 2);
} }
public function simplify_checkout_virtual( $fields ) { public function simplify_checkout_virtual( $fields ) {
$only_virtual = true; $only_virtual = true;
foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) { foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
// Check if there are non-virtual products // Check if there are non-virtual products
if ( ! $cart_item['data']->is_virtual() ) $only_virtual = false; if ( ! $cart_item['data']->is_virtual() ) $only_virtual = false;
} }
if( $only_virtual ) { if( $only_virtual ) {
unset($fields['billing']['billing_company']); unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']); unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']); unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_city']); unset($fields['billing']['billing_city']);
unset($fields['billing']['billing_postcode']); unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_country']); unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']); unset($fields['billing']['billing_state']);
unset($fields['billing']['billing_phone']); unset($fields['billing']['billing_phone']);
unset($fields['billing']['billing_first_name']); unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']); unset($fields['billing']['billing_last_name']);
add_filter( 'woocommerce_enable_order_notes_field', '__return_false' ); add_filter( 'woocommerce_enable_order_notes_field', '__return_false' );
} }
return $fields; return $fields;
} }
// Fix the user plan if none by add the default (usually free) one // Fix the user plan if none by add the default (usually free) one
public function fix_woocommerce_user($redirect, $user) public function fix_woocommerce_user($redirect, $user)
{ {
if(is_object($user) && is_checkout()) if(is_object($user) && is_checkout())
{ {
...@@ -303,8 +303,8 @@ if(!class_exists('SH_WooCommerce_Registration_Integration')) { ...@@ -303,8 +303,8 @@ if(!class_exists('SH_WooCommerce_Registration_Integration')) {
} }
} }
// Initilize // Initilize
new SH_WooCommerce_Registration_Integration; new SH_WooCommerce_Registration_Integration;
} }
?> ?>
...@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; ...@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
function is_valid_eth_address($addr) function is_valid_eth_address($addr)
{ {
return preg_match('/^0x[a-fA-F0-9]{40}$/', $addr); return preg_match('/^0x[a-fA-F0-9]{40}$/', $addr);
} }
......
...@@ -67,8 +67,8 @@ function starts_with ($startString, $string) ...@@ -67,8 +67,8 @@ function starts_with ($startString, $string)
function dump_rewrite( &$wp ) { function dump_rewrite( &$wp ) {
global $wp_rewrite; global $wp_rewrite;
ini_set( 'error_reporting', -1 ); ini_set( 'error_reporting', -1 );
ini_set( 'display_errors', 'On' ); ini_set( 'display_errors', 'On' );
echo '<h2>rewrite rules</h2>'; echo '<h2>rewrite rules</h2>';
echo var_export( $wp_rewrite->wp_rewrite_rules(), true ); echo var_export( $wp_rewrite->wp_rewrite_rules(), true );
...@@ -93,7 +93,7 @@ function dump_rewrite( &$wp ) { ...@@ -93,7 +93,7 @@ function dump_rewrite( &$wp ) {
} }
function do_dump_rewrite() { function do_dump_rewrite() {
add_action( 'parse_request', 'wp_SexHackMe\sarca' ); add_action( 'parse_request', 'wp_SexHackMe\sarca' );
} }
...@@ -107,7 +107,7 @@ function get_proto(){ ...@@ -107,7 +107,7 @@ function get_proto(){
function send_changepwd_mail($user_login, $baseurl=false){ function send_changepwd_mail($user_login, $baseurl=false){
global $wpdb, $wp_hasher; global $wpdb, $wp_hasher;
if(!is_object($user_login)) { if(!is_object($user_login)) {
$user_login = sanitize_text_field($user_login); $user_login = sanitize_text_field($user_login);
...@@ -124,7 +124,7 @@ function send_changepwd_mail($user_login, $baseurl=false){ ...@@ -124,7 +124,7 @@ function send_changepwd_mail($user_login, $baseurl=false){
} }
do_action('lostpassword_post'); do_action('lostpassword_post');
if ( !$user_data ) return false; if ( !$user_data ) return false;
if ( !is_object($user_data) ) return false; if ( !is_object($user_data) ) return false;
...@@ -139,8 +139,8 @@ function send_changepwd_mail($user_login, $baseurl=false){ ...@@ -139,8 +139,8 @@ function send_changepwd_mail($user_login, $baseurl=false){
else if ( is_wp_error($allow) ) else if ( is_wp_error($allow) )
return false; return false;
$key = pms_retrieve_activation_key( $user_login ); $key = pms_retrieve_activation_key( $user_login );
//$key = get_password_reset_key( $user_data ); //$key = get_password_reset_key( $user_data );
do_action( 'retrieve_password_key', $user_login, $key ); do_action( 'retrieve_password_key', $user_login, $key );
if ( empty( $wp_hasher ) ) { if ( empty( $wp_hasher ) ) {
...@@ -192,7 +192,7 @@ function send_changepwd_mail($user_login, $baseurl=false){ ...@@ -192,7 +192,7 @@ function send_changepwd_mail($user_login, $baseurl=false){
if ( $message && !wp_mail($user_email, $title, $message) ) if ( $message && !wp_mail($user_email, $title, $message) )
wp_die( __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') ); wp_die( __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function...') );
} }
function sexhack_getURL($url) function sexhack_getURL($url)
...@@ -209,12 +209,12 @@ function sexhack_getURL($url) ...@@ -209,12 +209,12 @@ function sexhack_getURL($url)
function trim_text_preview($text, $len=340, $fill=false) function trim_text_preview($text, $len=340, $fill=false)
{ {
$min="10"; $min="10";
if($len < $min) $len=$min; if($len < $min) $len=$min;
if (strlen($text) > $len) if (strlen($text) > $len)
{ {
$offset = ($len - 3) - strlen($text); $offset = ($len - 3) - strlen($text);
$text = substr($text, 0, strrpos($text, ' ', $offset)) . '...'; $text = substr($text, 0, strrpos($text, ' ', $offset)) . '...';
} }
if($fill) if($fill)
{ {
...@@ -224,7 +224,7 @@ function trim_text_preview($text, $len=340, $fill=false) ...@@ -224,7 +224,7 @@ function trim_text_preview($text, $len=340, $fill=false)
$text .= "&nbsp"; $text .= "&nbsp";
} }
} }
return $text; return $text;
} }
function html2text($html) function html2text($html)
......
...@@ -116,7 +116,7 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -116,7 +116,7 @@ if(!class_exists('SexHackMe_Plugin')) {
// Add a cron job to be executed daily // Add a cron job to be executed daily
//$this->cron_job(); //$this->cron_job();
} }
/* /*
...@@ -183,31 +183,31 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -183,31 +183,31 @@ if(!class_exists('SexHackMe_Plugin')) {
*/ */
public function add_default_settings() public function add_default_settings()
{ {
$already_installed = get_option( 'sh_already_installed' ); $already_installed = get_option( 'sh_already_installed' );
if ( !$already_installed ) if ( !$already_installed )
update_option( 'sh_already_installed', 'yes', false ); update_option( 'sh_already_installed', 'yes', false );
} }
/* /*
* Function to include the files needed * Function to include the files needed
* *
*/ */
public function include_dependencies() public function include_dependencies()
{ {
/* /*
if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/' ) ) if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/' ) )
include_once( SH_PLUGIN_DIR_PATH . 'includes/' ); include_once( SH_PLUGIN_DIR_PATH . 'includes/' );
*/ */
/* Manage Plugin Dependencies */ /* Manage Plugin Dependencies */
if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/class-tgm-plugin-activation.php' ) ) if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/class-tgm-plugin-activation.php' ) )
include_once SH_PLUGIN_DIR_PATH . 'includes/class-tgm-plugin-activation.php'; include_once SH_PLUGIN_DIR_PATH . 'includes/class-tgm-plugin-activation.php';
/* Utils */ /* Utils */
if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/functions-utils.php' ) ) if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/functions-utils.php' ) )
...@@ -237,11 +237,11 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -237,11 +237,11 @@ if(!class_exists('SexHackMe_Plugin')) {
if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/functions-hooks.php') ) if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/functions-hooks.php') )
include_once SH_PLUGIN_DIR_PATH . 'includes/functions-hooks.php'; include_once SH_PLUGIN_DIR_PATH . 'includes/functions-hooks.php';
/* Cryptocurrencies utils */ /* Cryptocurrencies utils */
if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/functions-crypto.php' ) ) if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/functions-crypto.php' ) )
include_once SH_PLUGIN_DIR_PATH . 'includes/functions-crypto.php'; include_once SH_PLUGIN_DIR_PATH . 'includes/functions-crypto.php';
/* Paid Member Subscription utils */ /* Paid Member Subscription utils */
if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/class-paid-member-subscriptions-integration.php' ) ) if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/class-paid-member-subscriptions-integration.php' ) )
include_once SH_PLUGIN_DIR_PATH . 'includes/class-paid-member-subscriptions-integration.php'; include_once SH_PLUGIN_DIR_PATH . 'includes/class-paid-member-subscriptions-integration.php';
...@@ -290,16 +290,16 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -290,16 +290,16 @@ if(!class_exists('SexHackMe_Plugin')) {
do_action( 'pms_include_files' ); do_action( 'pms_include_files' );
/* Testing code */ /* Testing code */
foreach( glob(dirname(__FILE__) . '/testing/*.php') as $class_path ) { foreach( glob(dirname(__FILE__) . '/testing/*.php') as $class_path ) {
try { try {
include_once($class_path); include_once($class_path);
} catch(\Throwable $e) { } catch(\Throwable $e) {
sexhack_log($e); sexhack_log($e);
} }
} }
} }
/** /**
...@@ -324,8 +324,8 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -324,8 +324,8 @@ if(!class_exists('SexHackMe_Plugin')) {
public function init() public function init()
{ {
// Check plugin dependencies // Check plugin dependencies
add_action( 'tgmpa_register', array($this, 'plugin_dependencies' )); add_action( 'tgmpa_register', array($this, 'plugin_dependencies' ));
// Set the main menu page // Set the main menu page
add_action('admin_menu', array('wp_SexHackMe\SH_Admin', 'menu')); add_action('admin_menu', array('wp_SexHackMe\SH_Admin', 'menu'));
...@@ -366,7 +366,7 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -366,7 +366,7 @@ if(!class_exists('SexHackMe_Plugin')) {
// Add new actions besides the activate/deactivate ones from the Plugins page // Add new actions besides the activate/deactivate ones from the Plugins page
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( $this, 'add_plugin_action_links' ) ); add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( $this, 'add_plugin_action_links' ) );
sexhack_log("SexHackMe PLUGIN Loaded!"); sexhack_log("SexHackMe PLUGIN Loaded!");
...@@ -375,27 +375,27 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -375,27 +375,27 @@ if(!class_exists('SexHackMe_Plugin')) {
// XXX There are so many dependencies to add here... // XXX There are so many dependencies to add here...
public function plugin_dependencies() public function plugin_dependencies()
{ {
$plugins = array( $plugins = array(
array( array(
'name' => 'WooCommerce', 'name' => 'WooCommerce',
'slug' => 'woocommerce', 'slug' => 'woocommerce',
'required' => false, 'required' => false,
//'is_callable' => 'wpseo_init', //'is_callable' => 'wpseo_init',
) )
); );
$config = array( $config = array(
'id' => 'sexhackme', // Unique ID for hashing notices for multiple instances of TGMPA. 'id' => 'sexhackme', // Unique ID for hashing notices for multiple instances of TGMPA.
'default_path' => '', // Default absolute path to bundled plugins. 'default_path' => '', // Default absolute path to bundled plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug. 'menu' => 'tgmpa-install-plugins', // Menu slug.
'parent_slug' => 'plugins.php', // Parent menu slug. 'parent_slug' => 'plugins.php', // Parent menu slug.
'capability' => 'manage_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used. 'capability' => 'manage_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used.
'has_notices' => true, // Show admin notices or not. 'has_notices' => true, // Show admin notices or not.
'dismissable' => true, // If false, a user cannot dismiss the nag message. 'dismissable' => true, // If false, a user cannot dismiss the nag message.
'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
'is_automatic' => false, // Automatically activate plugins after installation or not. 'is_automatic' => false, // Automatically activate plugins after installation or not.
'message' => '', // Message to output right before the plugins table. 'message' => '', // Message to output right before the plugins table.
); );
} }
public function register_flush() public function register_flush()
...@@ -508,7 +508,7 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -508,7 +508,7 @@ if(!class_exists('SexHackMe_Plugin')) {
// DEBUG REWRITE RULES // DEBUG REWRITE RULES
if( WP_DEBUG === true ){ if( WP_DEBUG === true ){
// only matched? // only matched?
//add_action("the_post", 'wp_SexHackMe\debug_rewrite_rules'); //add_action("the_post", 'wp_SexHackMe\debug_rewrite_rules');
} }
......
<?php
/**
* Copyright: 2022 (c)Franco (nextime) Lanza <franco@nexlab.it>
* License: GNU/GPL version 3.0
*
* This file is part of SexHackMe Wordpress Plugin.
*
* SexHackMe Wordpress Plugin is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* SexHackMe Wordpress Plugin is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SexHackMe Wordpress Plugin. If not, see <https://www.gnu.org/licenses/>.
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php if ( have_posts() ) : ?>
<header class="page-header">
<?php
//the_archive_title( '<h1 class="page-title">', '</h1>' );
the_archive_description( '<div class="taxonomy-description">', '</div>' ); // XXX Check it? what it does?
?>
</header><!-- .page-header -->
<?php
do_action( 'storefront_loop_before' );
//print_r($sexhack_pms->plans);
while ( have_posts() ) :
the_post();
echo do_shortcode("[sexadv adv=".get_option('sexadv_video_top')."]");
$htmltags = '<span><b>TAGS: </b></span>';
$tags = get_the_terms( get_the_ID(), 'product_tag' );
if ( ! empty( $tags ) && ! is_wp_error( $tags ) )
{
foreach($tags as $tag) {
$htmltags.="<span>#".$tag->name . '</span> ';
}
}
$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_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_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_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_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;
$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(wp_SexHackMe\user_has_premium_access()) {
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(wp_SexHackMe\user_has_member_access()) // 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(); 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(wp_SexHackMe\user_has_member_access())
{
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(wp_SexHackMe\user_has_premium_access())
{
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;
/**
* Functions hooked in to storefront_paging_nav action
*
* @hooked storefront_paging_nav - 10
*/
do_action( 'storefront_loop_after' );
else :
get_template_part( 'content', 'none' );
endif;
?>
</main><!-- #main -->
</div><!-- #primary -->
<?php
do_action( 'storefront_sidebar' );
get_footer();
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