XFrameBypass, Cam4 and Chaturbate support rewritten

parent c97547f3
<?php
/**
* Copyright: 2022 (c)Franco (nextime) Lanza <franco@nexlab.it>
* License: GNU/GPL version 3.0
*
* This file is part of SexHackMe Wordpress Plugin.
*
* SexHackMe Wordpress Plugin is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* SexHackMe Wordpress Plugin is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SexHackMe Wordpress Plugin. If not, see <https://www.gnu.org/licenses/>.
*/
namespace wp_SexHackMe;
if(!class_exists('XFrameByPass')) {
class XFrameByPass
{
public function __construct()
{
sexhack_log('XFrameByPass() Instanced');
add_shortcode( 'xfbp', array( $this, 'xfbp_shortcode_fn' ));
}
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'
);
?>
...@@ -21,16 +21,14 @@ ...@@ -21,16 +21,14 @@
namespace wp_SexHackMe; namespace wp_SexHackMe;
if(!class_exists('Cam4ChaturbateLive')) { // Exit if accessed directly
class Cam4ChaturbateLive if ( ! defined( 'ABSPATH' ) ) exit;
{
public function __construct()
{
add_shortcode( 'sexhacklive', array( $this, 'sexhack_live' ));
sexhack_log('Cam4ChaturbateLive() Instanced');
}
public function parse_chaturbate($html) if(!class_exists('ChaturbateLive')) {
class ChaturbateLive
{
public static function parseSite($html)
{ {
$dom = new DOMDocument; $dom = new DOMDocument;
@$dom->loadHTML($html); @$dom->loadHTML($html);
...@@ -48,8 +46,24 @@ if(!class_exists('Cam4ChaturbateLive')) { ...@@ -48,8 +46,24 @@ if(!class_exists('Cam4ChaturbateLive')) {
return FALSE; return FALSE;
} }
public static function getStream($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> '.sh_hls_player($vurl);
}
}
}
public function parse_cam4($html) if(!class_exists('Cam4Live')) {
class Cam4Live
{
public static function parseSite($html)
{ {
$dom = new DOMDocument; $dom = new DOMDocument;
@$dom->loadHTML($html); @$dom->loadHTML($html);
...@@ -59,51 +73,33 @@ if(!class_exists('Cam4ChaturbateLive')) { ...@@ -59,51 +73,33 @@ if(!class_exists('Cam4ChaturbateLive')) {
return FALSE; return FALSE;
} }
public static function getStream($model)
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)); $vurl = false; //$this->parse_cam4(sexhack_getURL('https://www.cam4.com/'.$model));
if(!$vurl) { if(!$vurl) {
return '<p>Cam4 '.$model."'s cam is OFFLINE</p>"; return '<p>Cam4 '.$model."'s cam is OFFLINE</p>";
} }
return '<a href="https://chaturbate.com/'.$model.'/" target="_blank" >Cam4 '.$model.":</a> ".SexhackHlsPlayer::addPlayer($vurl); return '<a href="https://chaturbate.com/'.$model.'/" target="_blank" >Cam4 '.$model.":</a> ".sh_hls_player($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> '; }
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;
} }
} }
}
}
$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'
);
?> ?>
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
namespace wp_SexHackMe; namespace wp_SexHackMe;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
class SexHackPMSHelper class SexHackPMSHelper
{ {
......
...@@ -21,6 +21,10 @@ ...@@ -21,6 +21,10 @@
namespace wp_SexHackMe; namespace wp_SexHackMe;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
if(!class_exists('SH_Shortcodes')) { if(!class_exists('SH_Shortcodes')) {
class SH_Shortcodes class SH_Shortcodes
{ {
...@@ -32,6 +36,8 @@ if(!class_exists('SH_Shortcodes')) { ...@@ -32,6 +36,8 @@ if(!class_exists('SH_Shortcodes')) {
'sexvideo' => __CLASS__ . '::video_xr', 'sexvideo' => __CLASS__ . '::video_xr',
'sh_videoxr' => __CLASS__ . '::video_xr', 'sh_videoxr' => __CLASS__ . '::video_xr',
'sh_videohls' => __CLASS__ . '::video_hls', 'sh_videohls' => __CLASS__ . '::video_hls',
'xfbp' => __CLASS__ . '::xframe_bypass',
'sexhacklive' => __CLASS__ . '::sexhacklive',
); );
foreach( $shortcodes as $shortcode_tag => $shortcode_func ) { foreach( $shortcodes as $shortcode_tag => $shortcode_func ) {
...@@ -58,6 +64,26 @@ if(!class_exists('SH_Shortcodes')) { ...@@ -58,6 +64,26 @@ if(!class_exists('SH_Shortcodes')) {
return "<div class='sexvideo_videojs'>" . sh_xr_player($url, $posters) . "</div>"; return "<div class='sexvideo_videojs'>" . sh_xr_player($url, $posters) . "</div>";
} }
public static function xframe_bypass($attr, $cont)
{
extract( shortcode_atts(array(
'url' => 'https://www.sexhack.me',
), $attr));
return '<iframe is="x-frame-bypass" src="'.$url.'"></iframe>';
}
public static function sexhacklive($attr, $cont)
{
extract( shortcode_atts(array(
'site' => 'chaturbate',
'model' => 'sexhackme',
), $attributes));
$ret = LiveCamSite::getCamStream($site, $model);
if($ret) return $ret;
return '<p>CamStreamDL Error: wrong site option '.$site.'</p> ';
}
} }
} }
......
...@@ -32,6 +32,10 @@ ...@@ -32,6 +32,10 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/ */
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! class_exists( 'TGM_Plugin_Activation' ) ) { if ( ! class_exists( 'TGM_Plugin_Activation' ) ) {
/** /**
......
...@@ -21,6 +21,10 @@ ...@@ -21,6 +21,10 @@
namespace wp_SexHackMe; namespace wp_SexHackMe;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
if(!class_exists('SH_VideoPlayer')) { if(!class_exists('SH_VideoPlayer')) {
class SH_VideoPlayer class SH_VideoPlayer
{ {
......
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
namespace wp_SexHackMe; namespace wp_SexHackMe;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
function is_valid_eth_address($addr) function is_valid_eth_address($addr)
{ {
......
...@@ -21,6 +21,8 @@ ...@@ -21,6 +21,8 @@
namespace wp_SexHackMe; namespace wp_SexHackMe;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
if(!function_exists('sexhack_log')){ if(!function_exists('sexhack_log')){
......
...@@ -207,24 +207,27 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -207,24 +207,27 @@ if(!class_exists('SexHackMe_Plugin')) {
/* Manage Plugin Dependencies */ /* Manage Plugin Dependencies */
if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/class-tgm-plugin-activation.php' ) ) if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/class-tgm-plugin-activation.php' ) )
include_once( SH_PLUGIN_DIR_PATH . 'includes/class-tgm-plugin-activation.php' ); include_once SH_PLUGIN_DIR_PATH . 'includes/class-tgm-plugin-activation.php';
/* Utils */ /* Utils */
if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/functions-utils.php' ) ) if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/functions-utils.php' ) )
include_once( SH_PLUGIN_DIR_PATH . 'includes/functions-utils.php' ); include_once SH_PLUGIN_DIR_PATH . 'includes/functions-utils.php';
/* Cryptocurrencies utils */ /* Cryptocurrencies utils */
if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/functions-crypto.php' ) ) if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/functions-crypto.php' ) )
include_once( SH_PLUGIN_DIR_PATH . 'includes/functions-crypto.php' ); include_once SH_PLUGIN_DIR_PATH . 'includes/functions-crypto.php';
/* Paid Member Subscription utils */ /* Paid Member Subscription utils */
if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/class-paid-member-subscriptions-integration.php' ) ) if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/class-paid-member-subscriptions-integration.php' ) )
include_once( SH_PLUGIN_DIR_PATH . 'includes/class-paid-member-subscriptions-integration.php' ); include_once SH_PLUGIN_DIR_PATH . 'includes/class-paid-member-subscriptions-integration.php';
/* Video Players */ /* Video Players */
if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/class-video-players.php' ) ) if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/class-video-players.php' ) )
include_once( SH_PLUGIN_DIR_PATH . 'includes/class-video-players.php' ); include_once SH_PLUGIN_DIR_PATH . 'includes/class-video-players.php';
/* Cam4 and Chaturbate support */
if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/class-livecam-site-support.php') )
include_once SH_PLUGIN_DIR_PATH . 'includes/class-livecam-site-support.php';
/* Shortcodes */ /* Shortcodes */
if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/class-shortcodes.php' ) ) if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/class-shortcodes.php' ) )
......
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