Initial commit

parents
<?php
namespace wp_SexHackMe;
if(!class_exists('SexhackHlsPlayer')) {
class SexhackHlsPlayer
{
public function __construct()
{
sexhack_log('SexhackHlsPlayer() Instanced');
add_action('wp_enqueue_scripts', array( $this, 'add_js' ));
add_shortcode("sexhls", array( $this, "sexhls_shortcode"));
}
public function add_js()
{
wp_enqueue_script('sexhls_baseplayer', plugin_dir_url(__DIR__).'js/hls.js');
wp_enqueue_script('sexhls_player_controls', plugin_dir_url(__DIR__).'js/sexhls.js');
wp_enqueue_script('sexhls_mousetrap', plugin_dir_url(__DIR__).'js/mousetrap.min.js');
}
public function addPlayer($vurl, $posters="")
{
$uid = uniqid('sexhls_');
$html = '<video id="'.$uid.'" style="width: 100%; height: 100%;" controls poster="'.$posters.'"></video>'."\n";
$html .= '<script language="javascript">'."\n";
$html .= '$(window).on(\'load\', function() {'."\n";
$html .= ' SexHLSPlayer(\''.$vurl.'\', \''.$uid.'\');'."\n";
$html .= ' $(\'#'.$uid.'\').on(\'click\', function(){this.paused?this.play():this.pause();});'."\n";
$html .= ' Mousetrap(document.getElementById(\''.$uid.'\')).bind(\'space\', function(e, combo) { SexHLSplayPause(\''.$uid.'\'); });'."\n";
$html .= ' Mousetrap(document.getElementById(\''.$uid.'\')).bind(\'up\', function(e, combo) { SexHLSvolumeUp(\''.$uid.'\'); });'."\n";
$html .= ' Mousetrap(document.getElementById(\''.$uid.'\')).bind(\'down\', function(e, combo) { SexHLSvolumeDown(\''.$uid.'\'); });'."\n";
$html .= ' Mousetrap(document.getElementById(\''.$uid.'\')).bind(\'right\', function(e, combo) { SexHLSseekRight(\''.$uid.'\'); });'."\n";
$html .= ' Mousetrap(document.getElementById(\''.$uid.'\')).bind(\'left\', function(e, combo) { SexHLSseekLeft(\''.$uid.'\'); });'."\n";
$html .= ' Mousetrap(document.getElementById(\''.$uid.'\')).bind(\'f\', function(e, combo) { SexHLSvidFullscreen(\''.$uid.'\'); });'."\n";
$html .= '});'."\n";
$html .= '</script>'."\n";
return $html;
}
public function sexhls_shortcode($attr, $cont)
{
extract( shortcode_atts(array(
"url" => '',
"posters" => '',
), $attr));
return "<div class='sexhls_video'>" . $this->addPlayer($url, $posters) . "</div>";
}
}
}
$SEXHACK_SECTION = array(
'class' => 'SexhackHlsPlayer',
'description' => 'Add HLS Video Player for progressive and live streaming support',
'name' => 'sexhackme_hls_player'
);
?>
<?php
namespace wp_SexHackMe;
if(!class_exists('SexhackAddUnlockLogin')) {
class 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);
sexhack_log('SexhackAddUnlockLogin() Instanced');
}
public function get_proto(){
if(is_ssl()) {
return 'https://';
} else {
return 'http://';
}
}
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 add_to_register($string, $args){
return $this->unlock_button($string, $args, $this->get_proto().wp_parse_url( home_url(), PHP_URL_HOST )."/register");
}
public function add_to_login($string, $args){
return $this->unlock_button($string, $args, $this->get_proto().wp_parse_url( home_url(), PHP_URL_HOST ));
}
public function add_to_checkout(){
echo $this->unlock_button('', $args, $this->get_proto().wp_parse_url( home_url(), PHP_URL_HOST )."/checkout");
}
}
}
$SEXHACK_SECTION = array(
'class' => 'SexhackAddUnlockLogin',
'description' => 'Integrate Unlock login in PMS login and registration page, as well as woocommerce checkout page',
'name' => 'sexhackme_addunlockbutton'
);
?>
<?php
namespace wp_SexHackMe;
if(!class_exists('Cam4ChaturbateLive')) {
class Cam4ChaturbateLive
{
public function __construct()
{
add_shortcode( 'sexhacklive', array( $this, 'sexhack_live' ));
sexhack_log('Cam4ChaturbateLive() Instanced');
}
public function parse_chaturbate($html)
{
$dom = new DOMDocument;
@$dom->loadHTML($html);
foreach ($dom->getElementsByTagName('script') as $node) {
preg_match( '/initialRoomDossier\s*=\s*(["\'])(?P<value>(?:(?!\1).)+)\1/', $node->textContent, $res);
if(count($res) > 2)
{
$j = json_decode(str_replace("\u0022", '"', str_replace("\u005C", "\\", $res[2])));
if(property_exists($j, 'hls_source'))
{
return $j->{'hls_source'};
}
}
}
return FALSE;
}
public function parse_cam4($html)
{
$dom = new DOMDocument;
@$dom->loadHTML($html);
foreach ( $dom->getElementsByTagName('video') as $node) {
return $node->getAttribute('src');
}
return FALSE;
}
public function sexhacklive_getChaturbate($model)
{
$vurl = false; //$this->parse_chaturbate(sexhack_getURL('https://chaturbate.com/'.$model.'/'));
if(!$vurl) {
return '<p>Chaturbate '.$model."'s cam is OFFLINE</p>";
}
return '<a href="https://chaturbate.com/'.$model.'/" target="_black" >Chaturbate '.$model.':</a> '.SexhackHlsPlayer::addPlayer($vurl);
}
public function sexhacklive_getCam4($model)
{
$vurl = false; //$this->parse_cam4(sexhack_getURL('https://www.cam4.com/'.$model));
if(!$vurl) {
return '<p>Cam4 '.$model."'s cam is OFFLINE</p>";
}
return '<a href="https://chaturbate.com/'.$model.'/" target="_blank" >Cam4 '.$model.":</a> ".SexhackHlsPlayer::addPlayer($vurl);
}
public function sexhack_live($attributes, $content)
{
extract( shortcode_atts(array(
'site' => 'chaturbate',
'model' => 'sexhackme',
), $attributes));
if($site=='chaturbate') {
return $this->sexhacklive_getChaturbate($model);
} else if($site=='cam4') {
return $this->sexhacklive_getCam4($model);
}
return '<p>CamStreamDL Error: wrong site option '.$site.'</p> ';
}
}
}
$SEXHACK_SECTION = array(
'class' => 'Cam4ChaturbateLive',
'description' => 'Add shortcodes for retrieve cam4 and/or chaturbate live streaming (it needs HLS player active!!) Shortcuts: [sexhacklive site="chaturbate|cam4" model="modelname"] ',
'name' => 'sexhackme_cam4chaturbate_live'
);
?>
<?php
namespace wp_SexHackMe;
if(!class_exists('SexhackPmsPasswordDataLeak')) {
class SexhackPmsPasswordDataLeak
{
public function __construct()
{
sexhack_log('SexhackPmsPasswordDataLeak() Instanced');
add_filter( 'pms_recover_password_message', array($this, "change_recover_form_message") );
add_action( 'init', array($this, 'reset_password_form'), 9);
}
public function change_recover_form_message($string)
{
return str_replace("<br/>", "<br/>If valid, ", $string);
}
public function reset_password_form()
{
/*
* Username or Email
*/
$error=false;
if( isset( $_POST['pms_username_email'] ) ) {
//Check recover password form nonce;
if( !isset( $_POST['pmstkn'] ) || ( !wp_verify_nonce( sanitize_text_field( $_POST['pmstkn'] ), 'pms_recover_password_form_nonce') ) )
return;
if( is_email( $_POST['pms_username_email'] ) )
$username_email = sanitize_email( $_POST['pms_username_email'] );
else
$username_email = sanitize_text_field( $_POST['pms_username_email'] );
if( empty( $username_email ) )
pms_errors()->add( 'pms_username_email', __( 'Please enter a username or email address.', 'paid-member-subscriptions' ) );
else {
$user = '';
// verify if it's a username and a valid one
if ( !is_email($username_email) ) {
if ( username_exists($username_email) ) {
$user = get_user_by('login',$username_email);
}
else $error=true; //pms_errors()->add('pms_username_email',__( 'The entered username doesn\'t exist. Please try again.', 'paid-member-subscriptions'));
}
//verify if it's a valid email
if ( is_email( $username_email ) ){
if ( email_exists($username_email) ) {
$user = get_user_by('email', $username_email);
}
else $error=true; //pms_errors()->add('pms_username_email',__( 'The entered email wasn\'t found in our database. Please try again.', 'paid-member-subscriptions'));
}
}
// Extra validation
do_action( 'pms_recover_password_form_validation' );
//If entered username or email is valid (no errors), email the password reset confirmation link
if ( count( pms_errors()->get_error_codes() ) == 0 && !$error) {
if (is_object($user)) { //user data is set
$requestedUserID = $user->ID;
$requestedUserLogin = $user->user_login;
$requestedUserEmail = $user->user_email;
//search if there is already an activation key present, if not create one
$key = pms_retrieve_activation_key( $requestedUserLogin );
//Confirmation link email content
$recoveruserMailMessage1 = sprintf(__('Someone has just requested a password reset for the following account: <b>%1$s</b><br/><br/>If this was a mistake, just ignore this email and nothing will happen.<br/>To reset your password, visit the following link: %2$s', 'paid-member-subscriptions'), $username_email, '<a href="' . esc_url(add_query_arg(array('loginName' => urlencode( $requestedUserLogin ), 'key' => $key), pms_get_current_page_url())) . '">' . esc_url(add_query_arg(array('loginName' => urlencode( $requestedUserLogin ), 'key' => $key), pms_get_current_page_url())) . '</a>');
$recoveruserMailMessage1 = apply_filters('pms_recover_password_message_content_sent_to_user1', $recoveruserMailMessage1, $requestedUserID, $requestedUserLogin, $requestedUserEmail);
//Confirmation link email title
$recoveruserMailMessageTitle1 = sprintf(__('Password Reset from "%s"', 'paid-member-subscriptions'), $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES));
$recoveruserMailMessageTitle1 = apply_filters('pms_recover_password_message_title_sent_to_user1', $recoveruserMailMessageTitle1, $requestedUserLogin);
//we add this filter to enable html encoding
add_filter('wp_mail_content_type', function () { return 'text/html'; } );
// Temporary change the from name and from email
add_filter( 'wp_mail_from_name', array( 'PMS_Emails', 'pms_email_website_name' ), 20, 1 );
add_filter( 'wp_mail_from', array( 'PMS_Emails', 'pms_email_website_email' ), 20, 1 );
//send mail to the user notifying him of the reset request
if (trim($recoveruserMailMessageTitle1) != '') {
$sent = wp_mail($requestedUserEmail, $recoveruserMailMessageTitle1, $recoveruserMailMessage1);
if ($sent === false)
pms_errors()->add('pms_username_email',__( 'There was an error while trying to send the activation link.', 'paid-member-subscriptions'));
}
// Reset the from name and email
remove_filter( 'wp_mail_from_name', array( 'PMS_Emails', 'pms_email_website_name' ), 20 );
remove_filter( 'wp_mail_from', array( 'PMS_Emails', 'pms_email_website_email' ), 20 );
// add option to store all user $id => $key and timestamp values that reset their passwords every 24 hours
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();
update_option( 'pms_recover_password_activation_keys', $activation_keys );
if( $sent === true )
do_action( 'pms_password_reset_email_sent', $user, $key );
}
}
} // isset($_POST[pms_username_email])
unset($_POST['pms_username_email']);
}
}
}
$SEXHACK_SECTION = array('class' => 'SexhackPmsPasswordDataLeak', 'description' => 'Fix Pay Member Subscription password-reset data leak', 'name' => 'sexhackme_pms_resetfix');
?>
<?php
namespace wp_SexHackMe;
if(!class_exists('PmsWoocommerceRegistrationIntegration')) {
class PmsWoocommerceRegistrationIntegration
{
public function __construct()
{
sexhack_log('PmsWoocommerceRegistrationIntegration() Instanced');
// Register new endpoint (URL) for My Account page
add_action( 'init', array($this, 'add_subscriptions_endpoint') );
// Add new QUERY vars
add_filter( 'query_vars', array($this, 'subscriptions_query_vars'), 0 );
// Insert the new endpoint into the My Account menu
add_filter( 'woocommerce_account_menu_items', array($this, 'add_subscriptions_link_my_account') );
/* 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') );
/* 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,
// don't be a dick. Don't do it on every fucking page.
// if you look hard enought like really really hard...
// you find a dick pretty much
// everywhere
// if you look hard
// enought
// like really
// really hard
// you find a dick
// pretty much
// everywhere
add_action( 'init', array($this, 'gen_random_pwd'));
// Sending email with link to set user password
add_action("pms_register_form_after_create_user", array($this, "send_register_email_reset_password") );
}
// Register new endpoint (URL) for My Account page
// Note: Re-save Permalinks or it will give 404 error
function add_subscriptions_endpoint()
{
add_rewrite_endpoint( 'subscriptions', EP_ROOT | EP_PAGES );
}
// Add new QUERY vars
public function subscriptions_query_vars( $vars )
{
$vars[] = 'subscriptions';
return $vars;
}
// Insert the new endpoint into the My Account menu
public function add_subscriptions_link_my_account( $items )
{
$items['subscriptions'] = 'Subscriptions';
return $items;
}
// Add content to the new tab
public function subscriptions_content()
{
echo '<h3>Subscriptions</h3>';
echo do_shortcode( '[pms-account show_tabs="no"]' );
echo "<h3>Payment History:</h3>";
echo do_shortcode( '[pms-payment-history]');
}
public function send_register_email_reset_password($user_data)
{
send_changepwd_mail($user_data["user_login"]);
}
// XXX 8==D
public function gen_random_pwd()
{
$pwd = wp_generate_password();
$_POST['pass1'] = $pwd;
$_POST['pass2'] = $pwd;
}
}
}
$SEXHACK_SECTION = array(
'class' => 'PmsWoocommerceRegistrationIntegration',
'description' => 'Integrate woocommerce account page and sexhack modified registration form on pms to send password change link by email',
'name' => 'sexhackme_pmswooregistration',
'slugs' => array('account', 'register', 'login', 'password-reset')
);
?>
<?php
namespace wp_SexHackMe;
if(!class_exists('SexHackVideoGallery')) {
class SexHackVideoGallery
{
public function __construct()
{
$this->productlist = false;
// Register Query Vars
add_filter("query_vars", array($this, "query_vars"));
add_action('wp_enqueue_scripts', array( $this, 'add_css' ), 200);
add_shortcode("sexgallery", array($this, "sexgallery_shortcode"));
add_action('init', array($this, "register_sexhack_video_post_type"));
//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);
sexhack_log('SexHackVideoGallery() Instanced');
}
public function add_css()
{
wp_enqueue_style ('sexhackme_gallery', plugin_dir_url(__DIR__).'css/sexhackme_gallery.css');
}
public function query_vars($vars)
{
$vars[] = 'wooprod';
return $vars;
}
public function sexhack_video_template($template)
{
$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__) . '/template/video.php')) {
sexhack_log("NEW TEMPLATE!: ".plugin_dir_path(__DIR__) . '/template/video.php');
return plugin_dir_path(__DIR__) . '/template/video.php';
}
}
return $template;
}
public function fix_video_query($query)
{
if($query->get('post_type')=='sexhack_video') {
$wooprod = $query->get('wooprod', false);
if($wooprod) {
sexhack_log($_SERVER['REQUEST_URI']." BEFORE ".print_r($query, true));
$query->query['post_type'] = 'sexhack_video';
$query->set('name', $wooprod);
$query->set('post_type', 'any');
//$query->set('post_type', '');
sexhack_log("AFTER ".print_r($query, true));
}
}
}
// sets custom post type
// TODO: the idea is to have custom post type for models profiles and for videos.
// Ideally /v/nomevideo/ finisce sul corrispettivo prodotto woocommerce,
// /v/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 )
public function register_sexhack_video_post_type()
{
global $wp_rewrite;
sexhack_log("REGISTER SEXHACK_VIDEO ");
register_post_type('sexhack_video', array(
'label' => 'Sexhack.me Video','description' => '',
'public' => true,
'show_ui' => true,
'show_in_menu' => false, // Visibility in admin menu.
'capability_type' => 'post',
'hierarchical' => false,
'publicly_queryable' => true,
'rewrite' => false,
'query_var' => true,
'has_archive' => true,
'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes'),
'taxonomies' => array('category','post_tag'),
// there are a lot more available arguments, but the above is plenty for now
));
$projects_structure = '/v/%wooprod%/';
$wp_rewrite->add_rewrite_tag("%wooprod%", '([^/]+)', "post_type=sexhack_video&wooprod=");
$wp_rewrite->add_permastruct('v', $projects_structure, false);
//$projects_structure = '/v/%sexhackmodel%/%sexhackvideo%/'; // are we really using /v/ also for this? how we get 2 tags?
}
public function getProducts() {
if(!$this->productlist)
$this->productlist = $this->_getProducts();
return $this->productlist;
}
// TODO: add pagination support
public function _getProducts()
{
$products = new \WP_Query( array(
/*
* We're limiting the results to 100 products, change this as you
* see fit. -1 is for unlimted but could introduce performance issues.
*/
'posts_per_page' => 100,
'post_type' => 'product',
'post_status' => 'publish',
'product_cat' => 'Videos',
'order' => 'ASC',
'orderby' => 'title',
'tax_query' => array( array(
'taxonomy' => 'product_visibility',
'terms' => array( 'exclude-from-catalog' ),
'field' => 'name',
'operator' => 'NOT IN',
) ),
//'meta_query' => array( array(
// 'value' => 'hls_public',
// 'compare' => 'like'
//) ),
) );
//sexhack_log(var_dump($products));
return $products;
}
public function sexgallery_shortcode($attr, $cont)
{
global $post;
extract( shortcode_atts(array(
"category" => "free",
), $attr));
$html = "<div class='sexhack_gallery'>"; //<h3>SexHack VideoGallery</h3>";
$html .= '<ul class="products columns-4">';
$products = $this->getProducts();
while( $products->have_posts() ) {
$products->the_post();
$html .= $this->get_video_thumb();
}
wp_reset_postdata();
$html .= "</ul></div>";
return $html;
}
public function get_video_thumb()
{
$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"));
$gif = $prod->get_attribute("gif_preview");
if($gif) $image .= "<img src='$gif' class='alignleft sexhack_thumb_hover' />";
$html = '<li class="product type-product sexhack_thumbli">';
$vurl = str_replace("/product/", "/v/", esc_url( get_the_permalink() ));
$vtitle = esc_html( get_the_title() );
$html .= "<a href=\"$vurl\" class=\"woocommerce-LoopProduct-link woocommerce-loop-product__link\">";
$html .= "<div class='sexhack_thumb_cont'>".$image."</div>";
// XXX Add the "hover" text preview, in "alt"?
$html .= "<h2 class=\"woocommerce-loop-product__title\" alt='".$vtitle."'>".trim_text_preview($vtitle, 120)."</h2>";
$html .= "</a></li>";
return $html;
}
}
}
$SEXHACK_SECTION = array(
'class' => 'SexHackVideoGallery',
'description' => 'Create Video galleries for Sexhack Video products',
'require-page' => true,
'name' => 'sexhackme_videogallery'
);
?>
<?php
namespace wp_SexHackMe;
if(!class_exists('StorefrontMoveHeaderCart')) {
class StorefrontMoveHeaderCart
{
public function __construct()
{
sexhack_log('StorefrontMoveHeaderCart() Instanced');
add_action( 'init', array($this, 'remove_header_cart' ));
add_filter('storefront_credit_link', false);
add_action('wp_enqueue_scripts', array( $this, 'add_css' ), 200);
add_action( 'storefront_header', array($this, 'add_header_cart'), 40);
}
public function add_css()
{
wp_enqueue_style ('sexhackme_header', plugin_dir_url(__DIR__).'css/sexhackme_header.css');
}
public function remove_header_cart()
{
remove_action( 'storefront_header', 'storefront_header_cart', 60 );
remove_action( 'storefront_header', 'storefront_product_search', 40);
}
public function add_header_cart()
{
storefront_header_cart();
}
}
}
$SEXHACK_SECTION = array(
'class' => 'StorefrontMoveHeaderCart',
'description' => 'Move storefront header cart and remove find products and credits',
'name' => 'sexhackme_sf_headercart'
);
?>
<?php
namespace wp_SexHackMe;
if(!class_exists('TemplateClass')) {
class TemplateClass
{
public function __construct()
{
sexhack_log('TemplateClass() Instanced');
}
}
}
$SEXHACK_SECTION = array(
'class' => 'TemplateClass',
'description' => 'Describe me',
'name' => 'sexhackme_template_name'
);
?>
<?php
namespace wp_SexHackMe;
if(!class_exists('WoocommerceEmailCheckout')) {
class WoocommerceEmailCheckout
{
public function __construct()
{
sexhack_log('WoocommerceEmailCheckout() Instanced');
add_filter( 'woocommerce_checkout_fields' , array($this,'simplify_checkout_virtual') );
}
public function simplify_checkout_virtual( $fields ) {
$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;
}
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;
}
}
}
$SEXHACK_SECTION = array(
'class' => 'WoocommerceEmailCheckout',
'description' => 'Reduce new user form on woocommerce checkout to email only for virtual/downloadable products',
'name' => 'sexhackme_woovirtcheckout'
);
?>
<?php
namespace wp_SexHackMe;
if(!class_exists('SexhackWoocommerceProductVideos')) {
class SexhackWoocommerceProductVideos
{
public function __construct()
{
sexhack_log('SexhackWoocommerceProductVideos() Instanced');
add_action( 'woocommerce_before_single_product', array($this, 'video_remove_default_woocommerce_image' ));
add_filter( 'query_vars', array($this, 'themeslug_query_vars' ));
}
public function themeslug_query_vars( $qvars ) {
$qvars[] = 'sexhack_forcevideo';
return $qvars;
}
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() {
// 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');
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":
// No video defined so get thumbnail
wc_get_template( 'single-product/product-image.php' );
break;
}
}
}
}
$SEXHACK_SECTION = array('class' => 'SexhackWoocommerceProductVideos', 'description' => 'Video in Products for woocommerce', 'name' => 'sexhackme_video');
?>
<?php
namespace wp_SexHackMe;
if(!class_exists('WoocommerceAccountRemoveNameSurname')) {
class WoocommerceAccountRemoveNameSurname
{
public function __construct()
{
add_filter('woocommerce_save_account_details_required_fields', array($this, 'ts_hide_first_last_name'));
add_action( 'woocommerce_edit_account_form_start', array($this, 'add_username_to_edit_account_form'));
add_action('wp_enqueue_scripts', array( $this, 'add_css' ), 200);
sexhack_log('WoocommerceAccountRemoveNameSurname() Instanced');
}
public function add_css()
{
wp_enqueue_style ('sexhackme_checkout', plugin_dir_url(__DIR__).'css/sexhackme_checkout.css');
}
// Add the custom field "username"
public function add_username_to_edit_account_form()
{
$user = wp_get_current_user();
?>
<p class="woocommerce-form-row woocommerce-form-row--wide form-row form-row-wide">
<label for="username"><?php _e( 'Username', 'woocommerce' ); ?> (Cannot be changed!) </label>
<input type="text" class="woocommerce-Input woocommerce-Input--text input-text" name="username" id="username"
value="<?php echo esc_attr( $user->user_login ); ?>" disabled />
</p>
<?php
}
public function ts_hide_first_last_name($required_fields)
{
unset($required_fields["account_first_name"]);
unset($required_fields["account_last_name"]);
unset($required_fields["account_display_name"]);
return $required_fields;
}
}
}
$SEXHACK_SECTION = array(
'class' => 'WoocommerceAccountRemoveNameSurname',
'description' => 'Remove Name and Surname fields from the woocommerce account details page',
'name' => 'sexhackme_woonamesurname'
);
?>
<?php
namespace wp_SexHackMe;
if(!class_exists('XFrameByPass')) {
class XFrameByPass
{
public function __construct()
{
sexhack_log('XFrameByPass() Instanced');
add_shortcode( 'xfbp', array( $this, 'xfbp_shortcode_fn' ));
add_action('wp_enqueue_scripts', array( $this, 'xfbp_js' ));
}
public function xfbp_js()
{
wp_enqueue_script('xfbp_poly', plugin_dir_url(__DIR__).'js/custom-elements-builtin.js');
wp_enqueue_script('xfbp_js', plugin_dir_url(__DIR__).'js/x-frame-bypass.js');
}
public function xfbp_shortcode_fn($attributes, $content)
{
extract( shortcode_atts(array(
'url' => 'https://www.sexhack.me',
), $attributes));
return '<iframe is="x-frame-bypass" src="'.$url.'"></iframe>';
}
}
}
$SEXHACK_SECTION = array(
'class' => 'XFrameByPass',
'description' => 'Bypass iframe limitation with x-frame-bypass',
'name' => 'sexhackme_xframebypass'
);
?>
.woocommerce-EditAccountForm .woocommerce-form-row--first {
display: none;
}
.woocommerce-EditAccountForm .woocommerce-form-row--last {
display: none;
}
.woocommerce-EditAccountForm
.woocommerce-form-row--last + div + p {
display: none;
}
/*.col-full{ */
/* max-width:66%; */
/* margin-left: 0;
margin-right: 0;
padding: 0; */
/*}*/
.sexhack_gallery_thumbnail {
padding: 10px 10px 10px 10px;
}
@media screen and (max-width: 767px) {
.sexhack_gallery_thumbnail {
width:90%;
display: block;
}
.sexhack_gallery_row {
display: block;
}
ul.products li.sexhack_thumbli img.sexhack_thumbnail {
width:90%;
}
.sexhack_thumb_cont .sexhack_thumb_hover {
width: 90%;
}
}
@media screen and (min-width: 768px) {
.site-main ul.products.columns-4 li.sexhack_thumbli {
width: 21%;
/* This to solve the different title lenght, combine with right trim and popup full title maybe,
and maybe not here but adding another container.
I should also re-check the sexhack class naming...
//height: 200px;
//overflow: hidden;
*/
}
.sexhack_gallery_row {
display: table-row;
}
.sexhack_gallery_container {
align: left;
align-content: top;
align-items:top;
//border: 2px solid red;
display: table;
}
.sexhack_thumb_cont .sexhack_thumb_hover {
object-fit: contain;
}
}
.sexhack_thumb_cont {
position: relative;
max-width: 100%;
display: block;
}
.sexhack_thumb_cont .sexhack_thumb_hover {
position: absolute;
top: 0;
right: 0;
left: 0;
bottom: 0;
opacity: 0;
transition: opacity .2s;
}
.sexhack_thumb_cont:hover .sexhack_thumb_hover {
opacity: 1;
}
@media screen and (min-width: 768px) {
.storefront-breadcrumb {
padding: 0.5em 0em;
margin: 0 0 0.7em;
}
.main-navigation ul.menu>li>a, .main-navigation ul.nav-menu>li>a {
padding: 0.4em 0.5em;
}
.site-header {
padding-top: 0.3em;
}
.woocommerce-active .site-header .main-navigation {
width: 100%;
}
a:focus, button:focus, .button.alt:focus {
outline-color: transparent;
}
/* a:focus, button:focus, .button.alt:focus
* , input:focus,
* textarea:focus,
* input[type="button"]:focus,
* input[type="reset"]:focus,
* input[type="submit"]:focus,
* input[type="email"]:focus,
* input[type="tel"]:focus,
* input[type="url"]:focus,
* input[type="password"]:focus,
* input[type="search"]:focus {
outline-color: transparent;
} */
}
This diff is collapsed.
This diff is collapsed.
<?php
namespace wp_SexHackMe;
function debug_rewrite_rules($matchonly=false)
{
global $wp_rewrite, $wp, $template;
$i=1;
if (!empty($wp_rewrite->rules)) {
foreach($wp_rewrite->rules as $name => $value) {
if($name==$wp->matched_rule) {
sexhack_log("MATCHED REWRITE RULE $i!!! NAME: ".$name." , VALUE: ".$value." , REQUEST: ".$wp->request." , MATCHED: ".$wp->matched_query." , TEMPLATE:".$template);
} else {
if(!$matchonly)
sexhack_log("REWRITE $i: $name -> $value ");
}
$i++;
}
}
}
function starts_with ($startString, $string)
{
$len = strlen($startString);
return (substr($string, 0, $len) === $startString);
}
function dump_rewrite( &$wp ) {
global $wp_rewrite;
ini_set( 'error_reporting', -1 );
ini_set( 'display_errors', 'On' );
echo '<h2>rewrite rules</h2>';
echo var_export( $wp_rewrite->wp_rewrite_rules(), true );
echo '<h2>permalink structure</h2>';
echo var_export( $wp_rewrite->permalink_structure, true );
echo '<h2>page permastruct</h2>';
echo var_export( $wp_rewrite->get_page_permastruct(), true );
echo '<h2>matched rule and query</h2>';
echo var_export( $wp->matched_rule, true );
echo '<h2>matched query</h2>';
echo var_export( $wp->matched_query, true );
echo '<h2>request</h2>';
echo var_export( $wp->request, true );
global $wp_the_query;
echo '<h2>the query</h2>';
echo var_export( $wp_the_query, true );
}
function do_dump_rewrite() {
add_action( 'parse_request', 'wp_SexHackMe\sarca' );
}
?>
<?php
namespace wp_SexHackMe;
class SexHackPMSHelper
{
public function __construct()
{
$this->plans = $this->get_pms_plantype();
}
public function get_pms_plantype()
{
$plans = array(
'member' => array(),
'premium'=> array()
);
$splans=pms_get_subscription_plans(true);
foreach($splans as $splan)
{
if(intval($splan->price)==0) $plans['member'][] = $splan->id;
else $plans['premium'][] = $splan->id;
}
return $plans;
}
public function is_member($uid='')
{
return pms_is_member( $uid, $this->plans['member'] );
}
public function is_premium($uid='')
{
return pms_is_member( $uid, $this->plans['premium'] );
}
}
function instancePMSHelper() {
$GLOBALS['sexhack_pms'] = new SexHackPMSHelper();
}
add_action('wp', 'wp_SexHackMe\instancePMSHelper');
?>
<?php
namespace wp_SexHackMe;
function send_changepwd_mail($user_login){
global $wpdb, $wp_hasher;
$user_login = sanitize_text_field($user_login);
if ( empty( $user_login) ) {
return false;
} else if ( strpos( $user_login, '@' ) ) {
$user_data = get_user_by( 'email', trim( $user_login ) );
if ( empty( $user_data ) )
return false;
} else {
$login = trim($user_login);
$user_data = get_user_by('login', $login);
}
do_action('lostpassword_post');
if ( !$user_data ) return false;
// redefining user_login ensures we return the right case in the email
$user_login = $user_data->user_login;
$user_email = $user_data->user_email;
do_action('retreive_password', $user_login); // Misspelled and deprecated
do_action('retrieve_password', $user_login);
$allow = apply_filters('allow_password_reset', true, $user_data->ID);
if ( ! $allow )
return false;
else if ( is_wp_error($allow) )
return false;
$key = get_password_reset_key( $user_data );
do_action( 'retrieve_password_key', $user_login, $key );
if ( empty( $wp_hasher ) ) {
require_once ABSPATH . 'wp-includes/class-phpass.php';
$wp_hasher = new PasswordHash( 8, true );
}
$hashed = $wp_hasher->HashPassword( $key );
$wpdb->update( $wpdb->users, array( 'user_activation_key' => time().":".$hashed ), array( 'user_login' => $user_login ) );
$message = __('Someone requested that the password be reset for the following account:') . "\r\n\r\n";
$message .= network_home_url( '/' ) . "\r\n\r\n";
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
$message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "\r\n\r\n";
$message .= __('To reset your password, visit the following address:') . "\r\n\r\n";
$message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n";
if ( is_multisite() )
$blogname = $GLOBALS['current_site']->site_name;
else
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
$title = sprintf( __('[%s] Password Reset'), $blogname );
$title = apply_filters('retrieve_password_title', $title);
$message = apply_filters('retrieve_password_message', $message, $key);
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...') );
}
?>
<?php
namespace wp_SexHackMe;
function sexhack_getURL($url)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch,CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$out = curl_exec($ch);
curl_close($ch);
return $out;
}
function trim_text_preview($text, $len=340)
{
$min="10";
if($len < $min) $len=$min;
if (strlen($text) > $len)
{
$offset = ($len - 3) - strlen($text);
$text = substr($text, 0, strrpos($text, ' ', $offset)) . '...';
}
return $text;
}
?>
!function(P,H,k){"use strict";if(1==P.importNode.length&&!H.get("ungap-li")){var D="extends";try{var e={extends:"li"},t=HTMLLIElement,n=function(){return Reflect.construct(t,[],n)};if(n.prototype=k.create(t.prototype),H.define("ungap-li",n,e),!/is="ungap-li"/.test((new n).outerHTML))throw e}catch(e){!function(){var l="attributeChangedCallback",n="connectedCallback",r="disconnectedCallback",e=Element.prototype,i=k.assign,t=k.create,o=k.defineProperties,a=k.getOwnPropertyDescriptor,s=k.setPrototypeOf,u=H.define,c=H.get,f=H.upgrade,p=H.whenDefined,v=t(null),d=new WeakMap,g={childList:!0,subtree:!0};Reflect.ownKeys(self).filter(function(e){return"string"==typeof e&&/^HTML(?!Element)/.test(e)}).forEach(function(e){function t(){}var n=self[e];s(t,n),(t.prototype=n.prototype).constructor=t,(n={})[e]={value:t},o(self,n)}),new MutationObserver(m).observe(P,g),O(Document.prototype,"importNode"),O(Node.prototype,"cloneNode"),o(H,{define:{value:function(e,t,n){if(e=e.toLowerCase(),n&&D in n){v[e]=i({},n,{Class:t});for(var e=n[D]+'[is="'+e+'"]',r=P.querySelectorAll(e),o=0,a=r.length;o<a;o++)A(r[o])}else u.apply(H,arguments)}},get:{value:function(e){return e in v?v[e].Class:c.call(H,e)}},upgrade:{value:function(e){var t=L(e);!t||e instanceof t.Class?f.call(H,e):N(e,t)}},whenDefined:{value:function(e){return e in v?Promise.resolve():p.call(H,e)}}});var h=P.createElement;o(P,{createElement:{value:function(e,t){e=h.call(P,e);return t&&"is"in t&&(e.setAttribute("is",t.is),H.upgrade(e)),e}}});var b=a(e,"attachShadow").value,y=a(e,"innerHTML");function m(e){for(var t=0,n=e.length;t<n;t++){for(var r=e[t],o=r.addedNodes,a=r.removedNodes,i=0,l=o.length;i<l;i++)A(o[i]);for(i=0,l=a.length;i<l;i++)C(a[i])}}function w(e){for(var t=0,n=e.length;t<n;t++){var r=e[t],o=r.attributeName,a=r.oldValue,i=r.target,r=i.getAttribute(o);l in i&&(a!=r||null!=r)&&i[l](o,a,i.getAttribute(o),null)}}function C(e){var t;1===e.nodeType&&((t=L(e))&&e instanceof t.Class&&r in e&&d.get(e)!==r&&(d.set(e,r),Promise.resolve(e).then(T)),E(e,C))}function L(e){e=e.getAttribute("is");return e&&(e=e.toLowerCase())in v?v[e]:null}function M(e){e[n]()}function T(e){e[r]()}function N(e,t){var t=t.Class,n=t.observedAttributes||[];if(s(e,t.prototype),n.length){new MutationObserver(w).observe(e,{attributes:!0,attributeFilter:n,attributeOldValue:!0});for(var r=[],o=0,a=n.length;o<a;o++)r.push({attributeName:n[o],oldValue:null,target:e});w(r)}}function A(e){var t;1===e.nodeType&&((t=L(e))&&(e instanceof t.Class||N(e,t),n in e&&e.isConnected&&d.get(e)!==n&&(d.set(e,n),Promise.resolve(e).then(M))),E(e,A))}function E(e,t){for(var n=e.content,r=(n&&11==n.nodeType?n:e).querySelectorAll("[is]"),o=0,a=r.length;o<a;o++)t(r[o])}function O(e,t){var n=e[t],r={};r[t]={value:function(){var e=n.apply(this,arguments);switch(e.nodeType){case 1:case 11:E(e,A)}return e}},o(e,r)}o(e,{attachShadow:{value:function(){var e=b.apply(this,arguments);return new MutationObserver(m).observe(e,g),e}},innerHTML:{get:y.get,set:function(e){y.set.call(this,e),/\bis=("|')?[a-z0-9_-]+\1/i.test(e)&&E(this,A)}}})}()}}}(document,customElements,Object);
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
/* mousetrap v1.6.5 craig.is/killing/mice */
(function(q,u,c){function v(a,b,g){a.addEventListener?a.addEventListener(b,g,!1):a.attachEvent("on"+b,g)}function z(a){if("keypress"==a.type){var b=String.fromCharCode(a.which);a.shiftKey||(b=b.toLowerCase());return b}return n[a.which]?n[a.which]:r[a.which]?r[a.which]:String.fromCharCode(a.which).toLowerCase()}function F(a){var b=[];a.shiftKey&&b.push("shift");a.altKey&&b.push("alt");a.ctrlKey&&b.push("ctrl");a.metaKey&&b.push("meta");return b}function w(a){return"shift"==a||"ctrl"==a||"alt"==a||
"meta"==a}function A(a,b){var g,d=[];var e=a;"+"===e?e=["+"]:(e=e.replace(/\+{2}/g,"+plus"),e=e.split("+"));for(g=0;g<e.length;++g){var m=e[g];B[m]&&(m=B[m]);b&&"keypress"!=b&&C[m]&&(m=C[m],d.push("shift"));w(m)&&d.push(m)}e=m;g=b;if(!g){if(!p){p={};for(var c in n)95<c&&112>c||n.hasOwnProperty(c)&&(p[n[c]]=c)}g=p[e]?"keydown":"keypress"}"keypress"==g&&d.length&&(g="keydown");return{key:m,modifiers:d,action:g}}function D(a,b){return null===a||a===u?!1:a===b?!0:D(a.parentNode,b)}function d(a){function b(a){a=
a||{};var b=!1,l;for(l in p)a[l]?b=!0:p[l]=0;b||(x=!1)}function g(a,b,t,f,g,d){var l,E=[],h=t.type;if(!k._callbacks[a])return[];"keyup"==h&&w(a)&&(b=[a]);for(l=0;l<k._callbacks[a].length;++l){var c=k._callbacks[a][l];if((f||!c.seq||p[c.seq]==c.level)&&h==c.action){var e;(e="keypress"==h&&!t.metaKey&&!t.ctrlKey)||(e=c.modifiers,e=b.sort().join(",")===e.sort().join(","));e&&(e=f&&c.seq==f&&c.level==d,(!f&&c.combo==g||e)&&k._callbacks[a].splice(l,1),E.push(c))}}return E}function c(a,b,c,f){k.stopCallback(b,
b.target||b.srcElement,c,f)||!1!==a(b,c)||(b.preventDefault?b.preventDefault():b.returnValue=!1,b.stopPropagation?b.stopPropagation():b.cancelBubble=!0)}function e(a){"number"!==typeof a.which&&(a.which=a.keyCode);var b=z(a);b&&("keyup"==a.type&&y===b?y=!1:k.handleKey(b,F(a),a))}function m(a,g,t,f){function h(c){return function(){x=c;++p[a];clearTimeout(q);q=setTimeout(b,1E3)}}function l(g){c(t,g,a);"keyup"!==f&&(y=z(g));setTimeout(b,10)}for(var d=p[a]=0;d<g.length;++d){var e=d+1===g.length?l:h(f||
A(g[d+1]).action);n(g[d],e,f,a,d)}}function n(a,b,c,f,d){k._directMap[a+":"+c]=b;a=a.replace(/\s+/g," ");var e=a.split(" ");1<e.length?m(a,e,b,c):(c=A(a,c),k._callbacks[c.key]=k._callbacks[c.key]||[],g(c.key,c.modifiers,{type:c.action},f,a,d),k._callbacks[c.key][f?"unshift":"push"]({callback:b,modifiers:c.modifiers,action:c.action,seq:f,level:d,combo:a}))}var k=this;a=a||u;if(!(k instanceof d))return new d(a);k.target=a;k._callbacks={};k._directMap={};var p={},q,y=!1,r=!1,x=!1;k._handleKey=function(a,
d,e){var f=g(a,d,e),h;d={};var k=0,l=!1;for(h=0;h<f.length;++h)f[h].seq&&(k=Math.max(k,f[h].level));for(h=0;h<f.length;++h)f[h].seq?f[h].level==k&&(l=!0,d[f[h].seq]=1,c(f[h].callback,e,f[h].combo,f[h].seq)):l||c(f[h].callback,e,f[h].combo);f="keypress"==e.type&&r;e.type!=x||w(a)||f||b(d);r=l&&"keydown"==e.type};k._bindMultiple=function(a,b,c){for(var d=0;d<a.length;++d)n(a[d],b,c)};v(a,"keypress",e);v(a,"keydown",e);v(a,"keyup",e)}if(q){var n={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",
18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},r={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},C={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},B={option:"alt",command:"meta","return":"enter",
escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},p;for(c=1;20>c;++c)n[111+c]="f"+c;for(c=0;9>=c;++c)n[c+96]=c.toString();d.prototype.bind=function(a,b,c){a=a instanceof Array?a:[a];this._bindMultiple.call(this,a,b,c);return this};d.prototype.unbind=function(a,b){return this.bind.call(this,a,function(){},b)};d.prototype.trigger=function(a,b){if(this._directMap[a+":"+b])this._directMap[a+":"+b]({},a);return this};d.prototype.reset=function(){this._callbacks={};
this._directMap={};return this};d.prototype.stopCallback=function(a,b){if(-1<(" "+b.className+" ").indexOf(" mousetrap ")||D(b,this.target))return!1;if("composedPath"in a&&"function"===typeof a.composedPath){var c=a.composedPath()[0];c!==a.target&&(b=c)}return"INPUT"==b.tagName||"SELECT"==b.tagName||"TEXTAREA"==b.tagName||b.isContentEditable};d.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)};d.addKeycodes=function(a){for(var b in a)a.hasOwnProperty(b)&&(n[b]=a[b]);p=null};
d.init=function(){var a=d(u),b;for(b in a)"_"!==b.charAt(0)&&(d[b]=function(b){return function(){return a[b].apply(a,arguments)}}(b))};d.init();q.Mousetrap=d;"undefined"!==typeof module&&module.exports&&(module.exports=d);"function"===typeof define&&define.amd&&define(function(){return d})}})("undefined"!==typeof window?window:null,"undefined"!==typeof window?document:null);
//var vtag = document.getElementById('vtag');
function SexHLSPlayer(url, vuid){
var vtag = document.getElementById(vuid);
if(Hls.isSupported()) {
vtag.volume = 0.3;
var hls = new Hls({autoStartLoad:false});
var m3u8Url = decodeURIComponent(url)
hls.loadSource(m3u8Url);
hls.attachMedia(vtag);
hls.on(Hls.Events.MANIFEST_PARSED,function() {
hls.autoLevelEnabled = true;
//hls.loadLevel = 4;
hls.startLoad();
//vtag.play(); // XXX Autoplay doesn't work apparently atm
});
//document.title = url
}
else if (vtag.canPlayType('application/vnd.apple.mpegurl')) {
vtag.src = url;
// XXX Autoplay doesn't work apparently atm
//vtag.addEventListener('canplay',function() {
// vtag.play();
//});
vtag.volume = 0.3;
//document.title = url;
}
}
function SexHLSplayPause(vuid) {
vtag = document.getElementById(vuid);
vtag.paused?vtag.play():vtag.pause();
}
function SexHLSvolumeUp(vuid) {
vtag = document.getElementById(vuid);
if(vtag.volume <= 0.9) vtag.volume+=0.1;
}
function SexHLSvolumeDown(vuid) {
vtag = document.getElementById(vuid);
if(vtag.volume >= 0.1) vtag.volume-=0.1;
}
function SexHLSseekRight(vuid) {
vtag = document.getElementById(vuid);
vtag.currentTime+=5;
}
function SexHLSseekLeft(vuid) {
vtag = document.getElementById(vuid);
vtag.currentTime-=5;
}
function SexHLSvidFullscreen(vuid) {
vtag = document.getElementById(vuid);
if (vtag.requestFullscreen) {
vtag.requestFullscreen();
} else if (vtag.mozRequestFullScreen) {
vtag.mozRequestFullScreen();
} else if (vtag.webkitRequestFullscreen) {
vtag.webkitRequestFullscreen();
}
}
//playM3u8(window.location.href.split("#")[1])
/*
$(window).on('load', function () {
$('#vtag').on('click', function(){this.paused?this.play():this.pause();});
Mousetrap.bind('space', SexHLSplayPause);
Mousetrap.bind('up', SexHLSvolumeUp);
Mousetrap.bind('down', SexHLSvolumeDown);
Mousetrap.bind('right', SexHLSseekRight);
Mousetrap.bind('left', SexHLSseekLeft);
Mousetrap.bind('f', SexHLSvidFullscreen);
});
*/
This source diff could not be displayed because it is too large. You can view the blob instead.
customElements.define('x-frame-bypass', class extends HTMLIFrameElement {
constructor () {
super()
}
connectedCallback () {
this.load(this.src)
this.src = ''
this.sandbox = '' + this.sandbox || 'allow-forms allow-modals allow-pointer-lock allow-popups allow-popups-to-escape-sandbox allow-presentation allow-same-origin allow-scripts allow-top-navigation-by-user-activation' // all except allow-top-navigation
}
load (url, options) {
if (!url || !url.startsWith('http'))
throw new Error(`X-Frame-Bypass src ${url} does not start with http(s)://`)
console.log('X-Frame-Bypass loading:', url)
this.srcdoc = `<html>
<head>
<style>
.loader {
position: absolute;
top: calc(50% - 25px);
left: calc(50% - 25px);
width: 50px;
height: 50px;
background-color: #333;
border-radius: 50%;
animation: loader 1s infinite ease-in-out;
}
@keyframes loader {
0% {
transform: scale(0);
}
100% {
transform: scale(1);
opacity: 0;
}
}
</style>
</head>
<body>
<div class="loader"></div>
</body>
</html>`
this.fetchProxy(url, options, 0).then(res => res.text()).then(data => {
if (data)
this.srcdoc = data.replace(/<head([^>]*)>/i, `<head$1>
<base href="${url}">
<script>
// X-Frame-Bypass navigation event handlers
document.addEventListener('click', e => {
if (frameElement && document.activeElement && document.activeElement.href) {
e.preventDefault()
frameElement.load(document.activeElement.href)
}
})
document.addEventListener('submit', e => {
if (frameElement && document.activeElement && document.activeElement.form && document.activeElement.form.action) {
e.preventDefault()
if (document.activeElement.form.method === 'post')
frameElement.load(document.activeElement.form.action, {method: 'post', body: new FormData(document.activeElement.form)})
else
frameElement.load(document.activeElement.form.action + '?' + new URLSearchParams(new FormData(document.activeElement.form)))
}
})
</script>`)
}).catch(e => console.error('Cannot load X-Frame-Bypass:', e))
}
fetchProxy (url, options, i) {
const proxy = [
'https://cors.io/?',
'https://jsonp.afeld.me/?url=',
'https://cors-anywhere.herokuapp.com/'
]
return fetch(proxy[i] + url, options).then(res => {
if (!res.ok)
throw new Error(`${res.status} ${res.statusText}`);
return res
}).catch(error => {
if (i === proxy.length - 1)
throw error
return this.fetchProxy(url, options, i + 1)
})
}
}, {extends: 'iframe'})
\ No newline at end of file
<?php
/**
* Plugin Name: SexHackMe
* Plugin URI: https://www.sexhack.me/SexHackMe_Wordpress
* Description: Cumulative plugin for https://www.sexhack.me modifications to wordpress, woocommerce and storefront theme
* Version: 0.1
* Author: Franco Lanza
*/
/**
* include all files from folder sites
* Array for every classfile, format: array('description' => "<text>", 'name' => "<text>", "class" => "<classname>");
* it MUST be present on every subclass!!!
*/
namespace wp_SexHackMe;
// XXX TODO: should we run only if woocommerce is installed?
// look at https://woocommerce.com/document/create-a-plugin/#section-1
$SEXHACK_SECTIONS = array();
$SEXHACK_ERRORS = array();
$GLOBAL_NOSLUGS=array(
'wp-cron.php',
'wp-content',
'xmlrpc.php'
);
if(!function_exists('sexhack_log')){
function sexhack_log( $message ) {
if( WP_DEBUG === true ){
if( is_array( $message ) || is_object( $message ) ){
error_log( "SexHackMe: ".print_r( $message, true ) );
} else {
error_log( "SexHackMe: ".$message );
}
}
}
}
$FIRST_SLUG = "/";
$slug = explode("/", $_SERVER['REQUEST_URI']);
if(count($slug) > 1) {
$FIRST_SLUG=explode("?", $slug[1])[0];
$FIRST_SLUG=explode("#", $FIRST_SLUG)[0];
}
sexhack_log("FIRST_SLUG:".$FIRST_SLUG." REQUEST:".$_SERVER['REQUEST_URI']." QUERY:".$_SERVER['QUERY_STRING'] );
foreach( glob(dirname(__FILE__) . '/helpers/*.php') as $helper_path ) {
sexhack_log('Loading '.$helper_path);
require_once($helper_path);
}
if(!class_exists('SexHackMe')) {
foreach( glob(dirname(__FILE__) . '/classes/*.php') as $class_path ) {
$SEXHACK_SECTION = false;
try {
include_once($class_path);
} catch(\Throwable $e) {
sexhack_log($e);
}
//sexhack_log("Class_path:" . $class_path);
//sexhack_log("Section:" . $SEXHACK_SECTION["name"]);
if(is_array($SEXHACK_SECTION)) { $SEXHACK_SECTIONS[] = $SEXHACK_SECTION; }
else { $SEXHACK_ERRORS[] = basename("/classes/".$class_path); }
}
class SexHackMe
{
public function __construct($SECTIONS)
{
global $FIRST_SLUG;
//$FIRST_SLUG = \wp_SexHackMe\$FIRST_SLUG;
sexhack_log("SexHackMe Instanciated");
$this->SECTIONS = $SECTIONS;
$this->instances = array();
add_action('admin_menu', array($this, 'admin_menu'));
add_action('admin_init', array($this, 'initialize_plugin'));
foreach($this->SECTIONS as $section) {
if(get_option( $section['name'])=="1")
{
if (array_key_exists('noslugs', $section) && in_array($FIRST_SLUG, $section['noslugs'])) {
sexhack_log("NOSLUGS for ".$section['name']);
continue;
}
else {
if (array_key_exists('slugs', $section)) {
if(in_array($FIRST_SLUG, $section['slugs'])) {
sexhack_log("SLUGS for ".$section['name']);
$this->instance_subclass($section);
}
}
else {
$this->instance_subclass($section);
}
}
}
}
}
public function instance_subclass($section)
{
$class = "wp_SexHackMe\\".$section['class'];
//sexhack_log($class);
$this->instances[$section['name']] = new $class();
}
public function settings_section() {
echo "<h3>Enable following functionalities:</h3>";
}
public function settings_field($name)
{
echo $name;
}
public function checkbox($res)
{
if($res=="1") return "checked";
}
public function initialize_plugin()
{
add_settings_section('sexhackme-settings', ' ', array($this, 'settings_section'), 'sexhackme-settings');
foreach($this->SECTIONS as $section) {
add_settings_field($section['name'], $section['name'], $section['name'],
array($this, 'settings_field'), 'sexhackme-settings', 'sexhackme-settings', $section['name'] );
register_setting('sexhackme-settings', $section['name']);
if(array_key_exists('require-page', $section) && ($section['require-page']))
{
register_setting('sexhackme-settings', $section['name']."-page");
}
}
}
public function admin_menu()
{
add_menu_page('SexHackMe Settings', 'SexHackMe', 'manage_options', 'sexhackme-settings',
array($this, 'admin_page'), plugin_dir_url(__FILE__) .'/img/admin_icon.png');
}
public function admin_page()
{
global $SEXHACK_ERRORS;
?>
<div class="wrap">
<h2>SexHackMe Plugin Settings</h2>
<?php if(!empty($SEXHACK_ERRORS)) {
foreach($SEXHACK_ERRORS as $serr) { ?><h3 style="color: red;">Error loading <?php echo $serr ?>!</h3><?php }} ?>
<form method="post" action="/wp-admin/options.php">
<?php settings_fields( 'sexhackme-settings' ); ?>
<?php do_settings_sections( 'sexhackme-settings' ); ?>
<table class="form-table">
<?php foreach($this->SECTIONS as $section) { ?>
<tr align="top">
<th scope="row"><?php echo $section['description'];?></th>
<td>
<input type="checkbox" name="<?php echo $section['name'];?>" value="1" <?php echo $this->checkbox(get_option( $section['name'] )); ?>/>
<br>
<?php if(array_key_exists('require-page', $section) && ($section['require-page']))
{ ?>
<select id="<?php echo $section['name'];?>-page" name="<?php echo $section['name'];?>-page" class="widefat">
<option value="-1"><?php esc_html_e( 'Choose...', 'paid-member-subscriptions' ) ?></option>
<?php
$opt=get_option( $section['name']."-page");
foreach( get_pages() as $page ) {
echo '<option value="' . esc_attr( $page->ID ) . '"';
if ($opt == $page->ID) { echo "selected";}
echo '>' . esc_html( $page->post_title ) . ' ( ID: ' . esc_attr( $page->ID ) . ')' . '</option>';
} ?>
</select>
<p class="description">Select the base plugin module page</p>
<?php } ?>
</td>
</tr>
<?php } ?>
</table>
<?php submit_button(); ?>
</form>
</div>
<?php
}
}
function sexhackme_plugin_run($SECTIONS, $SLUG)
{
sexhack_log("Running SexHackMe Plugins (".$SLUG.")");
$SexHackMe = new SexHackMe($SECTIONS);
}
if(!in_array($FIRST_SLUG, $GLOBAL_NOSLUGS)) sexhackme_plugin_run($SEXHACK_SECTIONS, $FIRST_SLUG);
else sexhack_log("NOSLUGS DETECTED: NOT RUNNING( ".$FIRST_SLUG." - ".$_SERVER['REQUEST_URI'].$_SERVER['QUERY_STRING'].")");
}
// DEBUG REWRITE RULES
if( WP_DEBUG === true ){
// only matched?
$matched = true;
add_action("the_post", 'wp_SexHackMe\debug_rewrite_rules', $matched);
}
?>
<?php
/**
* The template for displaying archive pages.
*
* Learn more: https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package storefront
*/
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();
$prod = wc_get_product(get_the_ID());
$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");
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_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 (($hls) OR ($hls_member) OR ($hls_premium) OR ($video_preview)) : ?>
<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());
if($sexhack_pms->is_premium())
{
if($hls_premium) echo do_shortcode( "[sexhls url=\"".$hls_premium."\" posters=\"".$thumb."\"]" );
else if($hls_member) echo do_shortcode( "[sexhls url=\"".$hls_member."\" posters=\"".$thumb."\"]" );
else if($hls) echo do_shortcode( "[sexhls url=\"".$hls."\" posters=\"".$thumb."\"]" );
else if($video_preview) echo '<video src='."'$video_preview'".' controls autoplay muted playsinline loop poster="'.$thumb.'"></video>';
else echo "Error fetching the video..."; // This should never happen
}
elseif($sexhack_pms->is_member())
{
if($hls_member) echo do_shortcode( "[sexhls url=\"".$hls_member."\" posters=\"".$thumb."\"]" );
else if($hls) echo do_shortcode( "[sexhls url=\"".$hls."\" posters=\"".$thumb."\"]" );
else if($video_preview) echo '<video src='."'$video_preview'".' controls autoplay muted playsinline loop poster="'.$thumb.'"></video>';
if($hls_premium) echo "Premium versions for subscribers available..";
}
else
{
if($hls) echo do_shortcode( "[sexhls url=\"".$hls."\" posters=\"".$thumb."\"]" );
else if($video_preview) echo '<video src='."'$video_preview'".' controls autoplay muted playsinline loop poster="'.$thumb.'"></video>';
if($hls_premium) echo "Premium version for subscribers available...";
if($hls_member) echo "Members version available...";
}
?>
</article>
<?php
else :
get_template_part( 'content', get_post_format() ); // get_post_format() return empty for us
endif;
?>
<h3><a href="<?php echo get_the_permalink(); ?>">Download the full lenght hi-res version of this video</a><h3>
<?php
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