Fix indentation

parent 9a519723
......@@ -34,31 +34,31 @@ if(!class_exists('SH_Admin')) {
// Add general settings section
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') )
{
include_once SH_PLUGIN_DIR_PATH . 'includes/admin/functions-wcpms.php';
$plans = sh_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));
}
include_once SH_PLUGIN_DIR_PATH . 'includes/admin/functions-wcpms.php';
$plans = sh_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_settings_section('sexhackme-wcpms-settings', ' ', 'wp_SexHackMe\settings_wcpms_section_email', 'sexhackme-wcpms-settings-email');
register_setting('sexhackme-wcpms-settings', 'sexhack_registration_mail_endpoint');
}
}
// Add Advertising settings
if( file_exists(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_bot');
register_setting('sexhackme-advert-settings', 'sexadv_video_bot');
}
// Gallery settings
......@@ -73,31 +73,31 @@ if(!class_exists('SH_Admin')) {
public static function menu()
{
add_menu_page('SexHackMe Settings', 'SexHackMe', 'manage_options', 'sexhackme-settings',
'wp_SexHackMe\sexhackme_admin_page', SH_PLUGIN_DIR_URL .'img/admin_icon.png', 31);
add_menu_page('SexHackMe Settings', 'SexHackMe', 'manage_options', 'sexhackme-settings',
'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',
'manage_options', 'sexhackme-settings');
// TODO We don't have a main page yet, so, remove it.
remove_submenu_page( 'sexhackme-settings', 'sexhackme-settings' );
// Add page WC-PMS_Integration
if( file_exists(SH_PLUGIN_DIR_PATH . 'includes/admin/functions-wcpms.php') )
{
add_submenu_page( 'sexhackme-settings', // root slug
'WC-PMS Integration', // title
'WC-PMS Integration', // title
'manage_options', // capabilities
'pmswc-integration', // slug
'wp_SexHackMe\wcpms_adminpage'); // callback
}
// Add page WC-PMS_Integration
if( file_exists(SH_PLUGIN_DIR_PATH . 'includes/admin/functions-wcpms.php') )
{
add_submenu_page( 'sexhackme-settings', // root slug
'WC-PMS Integration', // title
'WC-PMS Integration', // title
'manage_options', // capabilities
'pmswc-integration', // slug
'wp_SexHackMe\wcpms_adminpage'); // callback
}
// 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
'Advertising', // title
'Advertising', // title
......@@ -105,7 +105,7 @@ if(!class_exists('SH_Admin')) {
'advert', // slug
'wp_SexHackMe\advert_adminpage'); // callback
}
}
// Add Gallery settings page
......
......@@ -57,7 +57,7 @@ if(!class_exists('ChaturbateLive')) {
}
}
}
}
if(!class_exists('Cam4Live')) {
......@@ -87,15 +87,15 @@ if(!class_exists('Cam4Live')) {
}
if(!class_exists('LiveCamSite')) {
class LiveCamSite
{
public static function getCamStream($site, $model)
{
if($site=='chaturbate') return ChaturbateLive::getStream($model);
else if($site=='cam4') return Cam4Live::getStream($model);
return false;
}
}
class LiveCamSite
{
public static function getCamStream($site, $model)
{
if($site=='chaturbate') return ChaturbateLive::getStream($model);
else if($site=='cam4') return Cam4Live::getStream($model);
return false;
}
}
}
......
......@@ -100,7 +100,7 @@ if(!class_exists('SH_MetaBox')) {
// Update the meta field in the database.
update_post_meta( $post_id, 'video_description', $my_data );
}
}
}
add_action('save_post', array('wp_SexHackMe\SH_MetaBox', '::save_meta_box_data' ));
......
......@@ -28,30 +28,30 @@ if(!class_exists('SH_PMS_Support')) {
class SH_PMS_Support
{
public function __construct()
{
public function __construct()
{
$this->plans = false;
}
}
private function set_pms_plans()
{
$plans = array(
'member' => array(),
private function set_pms_plans()
{
$plans = array(
'member' => array(),
'premium'=> array(),
'byid' => array()
);
$splans=pms_get_subscription_plans(true);
foreach($splans as $splan)
{
if(intval($splan->price)==0) $plans['member'][] = $splan->id;
$splans=pms_get_subscription_plans(true);
foreach($splans as $splan)
{
if(intval($splan->price)==0) $plans['member'][] = $splan->id;
else $plans['premium'][] = $splan->id;
$plans['byid'][$splan->id] = $splan;
}
$this->plans = $plans;
return $plans;
}
return $plans;
}
public function refresh_plans()
......@@ -100,15 +100,15 @@ if(!class_exists('SH_PMS_Support')) {
}
public function is_member($uid='')
{
return pms_is_member( $uid, $this->get_member_plans() );
}
public function is_member($uid='')
{
return pms_is_member( $uid, $this->get_member_plans() );
}
public function is_premium($uid='')
{
return pms_is_member( $uid, $this->get_premium_plans() );
}
public function is_premium($uid='')
{
return pms_is_member( $uid, $this->get_premium_plans() );
}
}
function instance_SH_PMS_Support() {
......@@ -116,7 +116,7 @@ if(!class_exists('SH_PMS_Support')) {
$GLOBALS['sh_pms'] = new SH_PMS_Support();
// 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('sh_pms_ready');
......@@ -133,8 +133,8 @@ if(!class_exists('SexhackPmsPasswordDataLeak')) {
{
add_filter( 'pms_recover_password_message', array($this, "change_recover_form_message") );
add_action( 'init', array($this, 'reset_password_form'), 9);
add_action( 'login_form_rp', array( $this, 'redirect_password_reset' ) );
add_action( 'login_form_resetpass', 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' ) );
}
public function change_recover_form_message($string)
......@@ -143,19 +143,19 @@ if(!class_exists('SexhackPmsPasswordDataLeak')) {
return str_replace("<br/>", "<br/>If valid, ", $string);
}
public function redirect_password_reset()
public function redirect_password_reset()
{
// XXX This should be configurable.
wp_redirect( home_url( 'password-reset' ) );
}
wp_redirect( home_url( 'password-reset' ) );
}
public function reset_password_form()
{
/*
/*
* Username or Email
*/
$error=false;
$error=false;
if( isset( $_POST['pms_username_email'] ) ) {
//Check recover password form nonce;
......@@ -189,7 +189,7 @@ if(!class_exists('SexhackPmsPasswordDataLeak')) {
}
else $error=true;
}
}
}
// Extra validation
do_action( 'pms_recover_password_form_validation' );
......@@ -208,9 +208,9 @@ if(!class_exists('SexhackPmsPasswordDataLeak')) {
}
} // isset($_POST[pms_username_email])
unset($_POST['pms_username_email']);
}
} // isset($_POST[pms_username_email])
unset($_POST['pms_username_email']);
}
}
......
......@@ -31,8 +31,8 @@ if(!class_exists('SH_PostTypes')) {
public static function init()
{
// For some pages we need to add also rewrite rules
global $wp_rewrite;
// For some pages we need to add also rewrite rules
global $wp_rewrite;
// Advertising
register_post_type('sexhackadv', array(
......@@ -57,13 +57,13 @@ if(!class_exists('SH_PostTypes')) {
// SexHack Videos
// TODO: the idea is to have custom post type for models profiles and for videos.
// Ideally /$DEFAULTSLUG/nomevideo/ finisce sul corrispettivo prodotto woocommerce,
// /$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
// 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 )
// TODO: the idea is to have custom post type for models profiles and for videos.
// Ideally /$DEFAULTSLUG/nomevideo/ finisce sul corrispettivo prodotto woocommerce,
// /$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
// 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 )
register_post_type('sexhack_video', array(
'labels' => array(
'name' => 'Videos',
......@@ -92,7 +92,7 @@ if(!class_exists('SH_PostTypes')) {
'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?
));
$DEFAULTSLUG = get_option('sexhack_gallery_slug', 'v');
$DEFAULTSLUG = get_option('sexhack_gallery_slug', 'v');
$projects_structure = '/'.$DEFAULTSLUG.'/%wooprod%/';
$rules = $wp_rewrite->wp_rewrite_rules();
if(array_key_exists($DEFAULTSLUG.'/([^/]+)/?$', $rules)) {
......@@ -111,7 +111,7 @@ if(!class_exists('SH_PostTypes')) {
}
}
}
}
?>
......@@ -29,24 +29,24 @@ if(!class_exists('SH_Shortcodes')) {
class SH_Shortcodes
{
public static function init() {
public static function init() {
$shortcodes = array(
'sexhls' => __CLASS__ . '::video_hls',
'sexvideo' => __CLASS__ . '::video_xr',
'sh_videoxr' => __CLASS__ . '::video_xr',
'sh_videohls' => __CLASS__ . '::video_hls',
'sexvideo' => __CLASS__ . '::video_xr',
'sh_videoxr' => __CLASS__ . '::video_xr',
'sh_videohls' => __CLASS__ . '::video_hls',
'xfbp' => __CLASS__ . '::xframe_bypass',
'sexhacklive' => __CLASS__ . '::sexhacklive',
'sexadv' => __CLASS__ . '::adv_shortcode',
'sexgallery' => __CLASS__ . '::videogallery_shortcode',
'sexadv' => __CLASS__ . '::adv_shortcode',
'sexgallery' => __CLASS__ . '::videogallery_shortcode',
);
foreach( $shortcodes as $shortcode_tag => $shortcode_func ) {
add_shortcode( $shortcode_tag, $shortcode_func );
}
}
}
public static function video_hls($attr, $cont)
{
......@@ -81,8 +81,8 @@ if(!class_exists('SH_Shortcodes')) {
'site' => 'chaturbate',
'model' => 'sexhackme',
), $attributes));
$ret = LiveCamSite::getCamStream($site, $model);
if($ret) return $ret;
$ret = LiveCamSite::getCamStream($site, $model);
if($ret) return $ret;
return '<p>CamStreamDL Error: wrong site option '.$site.'</p> ';
}
......@@ -117,7 +117,7 @@ if(!class_exists('SH_Shortcodes')) {
public static function videogallery_shortcode($attr, $cont)
{
global $post;
global $sh_videogallery;
global $sh_videogallery;
extract( shortcode_atts(array(
"category" => "all",
), $attr));
......@@ -135,7 +135,7 @@ if(!class_exists('SH_Shortcodes')) {
}
}
}
}
......
This diff is collapsed.
......@@ -31,14 +31,14 @@ if(!class_exists('SexhackAddUnlockLogin')) {
public function __construct()
{
add_filter("login_form_bottom", array($this, "add_to_login"), 10, 2);
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_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("unlock_authenticate_user", array($this, "fix_unlock_user"), 11, 1);
}
public function get_proto(){
return get_proto();
}
}
public function fix_unlock_user($user)
{
......@@ -47,72 +47,72 @@ if(!class_exists('SexhackAddUnlockLogin')) {
if(is_object($user) && is_valid_eth_address($user->user_login))
{
if(!($sexhack_pms->is_member($user->ID)) && !($sexhack_pms->is_premium($user->ID)))
{
$subscription_plan = $sexhack_pms->get_default_plan();
if($subscription_plan)
{
$data = array(
'user_id' => $user->ID,
'subscription_plan_id' => $subscription_plan->id,
'start_date' => date( 'Y-m-d H:i:s' ),
'expiration_date' => $subscription_plan->get_expiration_date(),
'status' => 'active',
);
$member_subscription = new \PMS_Member_Subscription();
$inserted = $member_subscription->insert( $data );
}
$subscription_plan = $sexhack_pms->get_default_plan();
if($subscription_plan)
{
$data = array(
'user_id' => $user->ID,
'subscription_plan_id' => $subscription_plan->id,
'start_date' => date( 'Y-m-d H:i:s' ),
'expiration_date' => $subscription_plan->get_expiration_date(),
'status' => 'active',
);
$member_subscription = new \PMS_Member_Subscription();
$inserted = $member_subscription->insert( $data );
}
}
}
return $user;
return $user;
}
public function unlock_get_login_url($redirect_url=false) {
$UNLOCK_BASE_URL = 'https://app.unlock-protocol.com/checkout';
$rurl=apply_filters( 'unlock_protocol_get_redirect_uri', wp_login_url());
if($redirect_url) {
$rurl=$redirect_url;
}
$login_url = add_query_arg(
array(
'client_id' => apply_filters( 'unlock_protocol_get_client_id', wp_parse_url( home_url(), PHP_URL_HOST ) ),
'redirect_uri' => $rurl,
'state' => wp_create_nonce( 'unlock_login_state' ),
),
$UNLOCK_BASE_URL
);
return apply_filters( 'unlock_protocol_get_login_url', $login_url );
}
public function unlock_button($string, $args, $redirect_url)
{
$html="";
if(!is_user_logged_in()) {
$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.="'\" type='button'>Login with Crypto Wallet</button></p></div>";
}
return $string.$html;
}
public function unlock_get_login_url($redirect_url=false) {
$UNLOCK_BASE_URL = 'https://app.unlock-protocol.com/checkout';
$rurl=apply_filters( 'unlock_protocol_get_redirect_uri', wp_login_url());
if($redirect_url) {
$rurl=$redirect_url;
}
$login_url = add_query_arg(
array(
'client_id' => apply_filters( 'unlock_protocol_get_client_id', wp_parse_url( home_url(), PHP_URL_HOST ) ),
'redirect_uri' => $rurl,
'state' => wp_create_nonce( 'unlock_login_state' ),
),
$UNLOCK_BASE_URL
);
return apply_filters( 'unlock_protocol_get_login_url', $login_url );
}
public function unlock_button($string, $args, $redirect_url)
{
$html="";
if(!is_user_logged_in()) {
$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.="'\" type='button'>Login with Crypto Wallet</button></p></div>";
}
return $string.$html;
}
// 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
public function add_to_register($string, $args){
return $this->unlock_button($string, $args, get_proto().wp_parse_url( home_url(), PHP_URL_HOST )."/register");
}
public function add_to_register($string, $args){
return $this->unlock_button($string, $args, get_proto().wp_parse_url( home_url(), PHP_URL_HOST )."/register");
}
public function add_to_login($string, $args){
return $this->unlock_button($string, $args, get_proto().wp_parse_url( home_url(), PHP_URL_HOST ));
}
public function add_to_login($string, $args){
return $this->unlock_button($string, $args, get_proto().wp_parse_url( home_url(), PHP_URL_HOST ));
}
public function add_to_checkout(){
echo $this->unlock_button('', $args, get_proto().wp_parse_url( home_url(), PHP_URL_HOST )."/checkout");
}
public function add_to_checkout(){
echo $this->unlock_button('', $args, get_proto().wp_parse_url( home_url(), PHP_URL_HOST )."/checkout");
}
}
// Instance Unlock Login support class
......
......@@ -41,10 +41,10 @@ if(!class_exists('SH_VideoGallery')) {
// Register Query Vars
add_filter("query_vars", array($this, "query_vars"));
//add_filter('page_template', array($this, 'sexhack_video_template'));
add_filter('archive_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_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')) {
return $vars;
}
public function sexhack_video_template($template)
public function sexhack_video_template($template)
{
$template='video.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' );
if ( file_exists( plugin_dir_path(__DIR__) . '/templates/'.$template)) {
return plugin_dir_path(__DIR__) . '/templates/'.$template;
}
}
return $template;
}
public function fix_video_query($query)
{
if($query->get('post_type')=='sexhack_video') {
$wooprod = $query->get('wooprod', false);
if($wooprod) {
$query->query['post_type'] = 'sexhack_video';
$query->set('name', esc_sql($wooprod));
$query->set('post_type', 'any');
//$query->set('post_type', '');
}
}
}
$is_sexhack_video = get_query_var('wooprod', false);
if($is_sexhack_video ) {
set_query_var( 'post_type', 'sexhack_video' );
if ( file_exists( plugin_dir_path(__DIR__) . '/templates/'.$template)) {
return plugin_dir_path(__DIR__) . '/templates/'.$template;
}
}
return $template;
}
public function fix_video_query($query)
{
if($query->get('post_type')=='sexhack_video') {
$wooprod = $query->get('wooprod', false);
if($wooprod) {
$query->query['post_type'] = 'sexhack_video';
$query->set('name', esc_sql($wooprod));
$query->set('post_type', 'any');
//$query->set('post_type', '');
}
}
}
public function getProducts($vcat=false) {
......@@ -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');
$id = get_the_ID();
$prod = wc_get_product($id);
$image = get_the_post_thumbnail($id, "medium", array("class" => "sexhack_thumbnail")); //array("class" => "alignleft sexhack_thumbnail"));
$id = get_the_ID();
$prod = wc_get_product($id);
$image = get_the_post_thumbnail($id, "medium", array("class" => "sexhack_thumbnail")); //array("class" => "alignleft sexhack_thumbnail"));
$hls = $prod->get_attribute("hls_public");
$hls_member = $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_premium = $prod->get_attribute("vr_premium");
$vr_member = $prod->get_attribute("vr_members");
$vr_public = $prod->get_attribute("vr_public");
$vr_preview = $prod->get_attribute("vr_preview");
......@@ -118,10 +118,10 @@ if(!class_exists('SH_VideoGallery')) {
$gif = $prod->get_attribute("gif_thumbnail");
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">';
$vurl = str_replace("/product/", "/".$DEFAULTSLUG."/", esc_url( get_the_permalink() ));
$html = '<li class="product type-product sexhack_thumbli">';
$vurl = str_replace("/product/", "/".$DEFAULTSLUG."/", esc_url( get_the_permalink() ));
$vtitle = esc_html( get_the_title() );
$vtags=array();
......@@ -135,11 +135,11 @@ if(!class_exists('SH_VideoGallery')) {
if(($vr_premium) OR ($vr_member) OR ($vr_public) OR ($vr_preview)
OR ((count($prod->get_downloads()) > 0)
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 .= "<div class='sexhack_thumb_cont'>".$image."</div>";
foreach($vtags as $vid => $vtag)
{
$left = intval($vid)*12;
......@@ -147,11 +147,11 @@ if(!class_exists('SH_VideoGallery')) {
$html .= $vtag;
}
$html .= "<h3 class=\"sexhack_gallery_title woocommerce-loop-product__title\" alt='".$vtitle."'>".trim_text_preview($vtitle, 60, false)."</h3>";
$html .= "</a></li>";
$html .= "<h3 class=\"sexhack_gallery_title woocommerce-loop-product__title\" alt='".$vtitle."'>".trim_text_preview($vtitle, 60, false)."</h3>";
$html .= "</a></li>";
return $html;
}
return $html;
}
}
$GLOBALS['sh_videogallery'] = new SH_VideoGAllery();
......
......@@ -179,7 +179,7 @@ if(!class_exists('SH_GalleryWidget')) {
} // 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')) {
return $qvars;
}
public function video_remove_default_woocommerce_image() {
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 20 );
public function video_remove_default_woocommerce_image() {
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_images', 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 );
}
}
public function woocommerce_show_product_images_videos() {
public function woocommerce_show_product_images_videos() {
// Get video and display
$prod = wc_get_product(get_the_ID());
// Get video and display
$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
$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');
if(in_array($bypass, $disps)) $display=$bypass;
else if($video) $display="video";
else if($gif) $display="gif";
if(in_array($bypass, $disps)) $display=$bypass;
else if($video) $display="video";
else if($gif) $display="gif";
switch($display) {
case "video":
// Sanitize video URL
$video = esc_url( $video );
// Display video
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>';
break;
case "gif":
// sanitize URL
$gif = esc_url( $gif );
// Display GIF
echo '<div class="images"><img src="'.$gif.'" /></div>';
break;
case "image":
switch($display) {
case "video":
// Sanitize video URL
$video = esc_url( $video );
// Display video
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>';
break;
case "gif":
// sanitize URL
$gif = esc_url( $gif );
// Display GIF
echo '<div class="images"><img src="'.$gif.'" /></div>';
break;
case "image":
// No video defined so get thumbnail
wc_get_template( 'single-product/product-image.php' );
break;
}
}
// No video defined so get thumbnail
wc_get_template( 'single-product/product-image.php' );
break;
}
}
}
......@@ -134,9 +134,9 @@ if(!class_exists('WoocommerceAccountRemoveNameSurname')) {
return $required_fields;
}
}
// Start changing the woocommerce account form
new WoocommerceAccountRemoveNameSurname;
// Start changing the woocommerce account form
new WoocommerceAccountRemoveNameSurname;
}
......@@ -146,40 +146,40 @@ if(!class_exists('WoocommerceEmailCheckout')) {
{
public function __construct()
{
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_checkout_fields' , array($this,'simplify_checkout_virtual') );
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 ) {
// Check if there are non-virtual products
if ( ! $cart_item['data']->is_virtual() ) $only_virtual = false;
}
foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
// Check if there are non-virtual products
if ( ! $cart_item['data']->is_virtual() ) $only_virtual = false;
}
if( $only_virtual ) {
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_city']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']);
unset($fields['billing']['billing_phone']);
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
add_filter( 'woocommerce_enable_order_notes_field', '__return_false' );
}
if( $only_virtual ) {
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_city']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']);
unset($fields['billing']['billing_phone']);
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
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
public function fix_woocommerce_user($redirect, $user)
{
public function fix_woocommerce_user($redirect, $user)
{
if(is_object($user) && is_checkout())
{
......@@ -303,8 +303,8 @@ if(!class_exists('SH_WooCommerce_Registration_Integration')) {
}
}
// Initilize
new SH_WooCommerce_Registration_Integration;
// Initilize
new SH_WooCommerce_Registration_Integration;
}
?>
......@@ -27,7 +27,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
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)
function dump_rewrite( &$wp ) {
global $wp_rewrite;
ini_set( 'error_reporting', -1 );
ini_set( 'display_errors', 'On' );
ini_set( 'error_reporting', -1 );
ini_set( 'display_errors', 'On' );
echo '<h2>rewrite rules</h2>';
echo var_export( $wp_rewrite->wp_rewrite_rules(), true );
......@@ -93,7 +93,7 @@ function dump_rewrite( &$wp ) {
}
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(){
function send_changepwd_mail($user_login, $baseurl=false){
global $wpdb, $wp_hasher;
if(!is_object($user_login)) {
$user_login = sanitize_text_field($user_login);
......@@ -124,7 +124,7 @@ function send_changepwd_mail($user_login, $baseurl=false){
}
do_action('lostpassword_post');
if ( !$user_data ) return false;
if ( !is_object($user_data) ) return false;
......@@ -139,8 +139,8 @@ function send_changepwd_mail($user_login, $baseurl=false){
else if ( is_wp_error($allow) )
return false;
$key = pms_retrieve_activation_key( $user_login );
//$key = get_password_reset_key( $user_data );
$key = pms_retrieve_activation_key( $user_login );
//$key = get_password_reset_key( $user_data );
do_action( 'retrieve_password_key', $user_login, $key );
if ( empty( $wp_hasher ) ) {
......@@ -192,7 +192,7 @@ function send_changepwd_mail($user_login, $baseurl=false){
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...') );
}
function sexhack_getURL($url)
......@@ -209,12 +209,12 @@ function sexhack_getURL($url)
function trim_text_preview($text, $len=340, $fill=false)
{
$min="10";
if($len < $min) $len=$min;
if (strlen($text) > $len)
{
$offset = ($len - 3) - strlen($text);
$text = substr($text, 0, strrpos($text, ' ', $offset)) . '...';
$min="10";
if($len < $min) $len=$min;
if (strlen($text) > $len)
{
$offset = ($len - 3) - strlen($text);
$text = substr($text, 0, strrpos($text, ' ', $offset)) . '...';
}
if($fill)
{
......@@ -224,7 +224,7 @@ function trim_text_preview($text, $len=340, $fill=false)
$text .= "&nbsp";
}
}
return $text;
return $text;
}
function html2text($html)
......
......@@ -116,7 +116,7 @@ if(!class_exists('SexHackMe_Plugin')) {
// Add a cron job to be executed daily
//$this->cron_job();
}
}
/*
......@@ -183,31 +183,31 @@ if(!class_exists('SexHackMe_Plugin')) {
*/
public function add_default_settings()
{
$already_installed = get_option( 'sh_already_installed' );
$already_installed = get_option( 'sh_already_installed' );
if ( !$already_installed )
update_option( 'sh_already_installed', 'yes', false );
}
}
/*
/*
* Function to include the files needed
*
*/
public function include_dependencies()
{
/*
/*
if( file_exists( 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' ) )
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 */
if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/functions-utils.php' ) )
......@@ -237,11 +237,11 @@ if(!class_exists('SexHackMe_Plugin')) {
if( file_exists( 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' ) )
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' ) )
include_once SH_PLUGIN_DIR_PATH . 'includes/class-paid-member-subscriptions-integration.php';
......@@ -290,16 +290,16 @@ if(!class_exists('SexHackMe_Plugin')) {
do_action( 'pms_include_files' );
/* Testing code */
/* Testing code */
foreach( glob(dirname(__FILE__) . '/testing/*.php') as $class_path ) {
try {
include_once($class_path);
} catch(\Throwable $e) {
sexhack_log($e);
}
}
}
}
}
/**
......@@ -324,8 +324,8 @@ if(!class_exists('SexHackMe_Plugin')) {
public function init()
{
// Check plugin dependencies
add_action( 'tgmpa_register', array($this, 'plugin_dependencies' ));
// Check plugin dependencies
add_action( 'tgmpa_register', array($this, 'plugin_dependencies' ));
// Set the main menu page
add_action('admin_menu', array('wp_SexHackMe\SH_Admin', 'menu'));
......@@ -366,7 +366,7 @@ if(!class_exists('SexHackMe_Plugin')) {
// 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' ) );
sexhack_log("SexHackMe PLUGIN Loaded!");
......@@ -375,27 +375,27 @@ if(!class_exists('SexHackMe_Plugin')) {
// XXX There are so many dependencies to add here...
public function plugin_dependencies()
{
$plugins = array(
array(
'name' => 'WooCommerce',
'slug' => 'woocommerce',
'required' => false,
//'is_callable' => 'wpseo_init',
)
);
$config = array(
'id' => 'sexhackme', // Unique ID for hashing notices for multiple instances of TGMPA.
'default_path' => '', // Default absolute path to bundled plugins.
'menu' => 'tgmpa-install-plugins', // 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.
'has_notices' => true, // Show admin notices or not.
'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.
'is_automatic' => false, // Automatically activate plugins after installation or not.
'message' => '', // Message to output right before the plugins table.
);
}
$plugins = array(
array(
'name' => 'WooCommerce',
'slug' => 'woocommerce',
'required' => false,
//'is_callable' => 'wpseo_init',
)
);
$config = array(
'id' => 'sexhackme', // Unique ID for hashing notices for multiple instances of TGMPA.
'default_path' => '', // Default absolute path to bundled plugins.
'menu' => 'tgmpa-install-plugins', // 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.
'has_notices' => true, // Show admin notices or not.
'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.
'is_automatic' => false, // Automatically activate plugins after installation or not.
'message' => '', // Message to output right before the plugins table.
);
}
public function register_flush()
......@@ -508,7 +508,7 @@ if(!class_exists('SexHackMe_Plugin')) {
// DEBUG REWRITE RULES
if( WP_DEBUG === true ){
// only matched?
//add_action("the_post", 'wp_SexHackMe\debug_rewrite_rules');
//add_action("the_post", 'wp_SexHackMe\debug_rewrite_rules');
}
......
This diff is collapsed.
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