Moved video players and relative shortcodes

parent b364ecb3
<?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('SexhackVideoJSPlayer')) {
class SexhackVideoJSPlayer
{
public function __construct()
{
sexhack_log('SexhackVideoJSPlayer() Instanced');
add_shortcode("sexvideo", array( $this, "sexvideo_shortcode"));
}
public function addPlayer($vurl, $posters="", $projection="180_LR")
{
$uid = uniqid('sexvideo_');
//$uid = "antani";
$html = "<video id='$uid' class='video-js vjs-default-skin vjs-2-1 vjs-big-play-centered' style='width: 100%; height: 100%;' controls poster='$posters'>\n";
//$html.= '<script src="https://s3.deovr.com/version/1/js/bundle.js" async></script>';
//$html .= "<deo-video id='$uid'>\n";
//$html .= ' <source src="'.$vurl.'" quality="1080p" type="application/x-mpegURL">'."\n";
$html .= '</video>'."\n";
//$html .= "</deo-video>\n";
$html .= "<script language='javascript'>\n";
$html .= "$(window).on('load', function() {\n";
//$html .= " videojs.log.level('debug');\n";
$html .= " var player = videojs('$uid', {\n";
$html .= " html5: {\n";
$html .= " vhs: {\n";
$html .= " overrideNative: !videojs.browser.IS_SAFARI\n";
$html .= " },\n";
$html .= " nativeAudioTracks: false,\n";
$html .= " nativeVideoTracks: false\n";
$html .= " }});\n";
$html .= " player.src({ src: '$vurl', type: 'application/x-mpegURL'});\n";
//if($_GET['antani']) {
$html .= " player.xr();";
//} else {
// $html .= " player.mediainfo = player.mediainfo || {};\n";
// $html .= " player.mediainfo.projection = '$projection';\n";
// $html .= " player.vr({projection: '$projection', debug: false, forceCardboard: true});\n";
//}
//$html .= " player.xr();";
$html .= '});'."\n";
$html .= "</script>";
return $html;
}
public function sexvideo_shortcode($attr, $cont)
{
extract( shortcode_atts(array(
"url" => '',
"posters" => '',
), $attr));
return "<div class='sexvideo_videojs'>" . $this->addPlayer($url, $posters) . "</div>";
}
}
}
$SEXHACK_SECTION = array(
'class' => 'SexhackVideoJSPlayer',
'description' => 'Add VideoJS Video Player',
'name' => 'sexhackme_videojs_player'
);
?>
...@@ -182,9 +182,9 @@ if(!class_exists('SexHackVideoGallery')) { ...@@ -182,9 +182,9 @@ if(!class_exists('SexHackVideoGallery')) {
$is_sexhack_video = get_query_var('wooprod', false); $is_sexhack_video = get_query_var('wooprod', false);
if($is_sexhack_video ) { if($is_sexhack_video ) {
set_query_var( 'post_type', 'sexhack_video' ); set_query_var( 'post_type', 'sexhack_video' );
if ( file_exists( plugin_dir_path(__DIR__) . '/template/'.$template)) { if ( file_exists( plugin_dir_path(__DIR__) . '/templates/'.$template)) {
sexhack_log("NEW TEMPLATE!: ".plugin_dir_path(__DIR__) . '/template/'.$template); sexhack_log("NEW TEMPLATE!: ".plugin_dir_path(__DIR__) . '/templates/'.$template);
return plugin_dir_path(__DIR__) . '/template/'.$template; return plugin_dir_path(__DIR__) . '/templates/'.$template;
} }
} }
return $template; return $template;
......
...@@ -21,54 +21,46 @@ ...@@ -21,54 +21,46 @@
namespace wp_SexHackMe; namespace wp_SexHackMe;
if(!class_exists('SexhackHlsPlayer')) { if(!class_exists('SH_Shortcodes')) {
class SexhackHlsPlayer class SH_Shortcodes
{ {
public function __construct()
{ public static function init() {
sexhack_log('SexhackHlsPlayer() Instanced');
add_shortcode("sexhls", array( $this, "sexhls_shortcode")); $shortcodes = array(
'sexhls' => __CLASS__ . '::video_hls',
'sexvideo' => __CLASS__ . '::video_xr',
'sh_videoxr' => __CLASS__ . '::video_xr',
'sh_videohls' => __CLASS__ . '::video_hls',
);
foreach( $shortcodes as $shortcode_tag => $shortcode_func ) {
add_shortcode( $shortcode_tag, $shortcode_func );
} }
}
public function addPlayer($vurl, $posters="") public static function video_hls($attr, $cont)
{ {
$uid = uniqid('sexhls_'); extract( shortcode_atts(array(
$html = '<video id="'.$uid.'" style="width: 100%; height: 100%;" controls poster="'.$posters.'"></video>'."\n"; "url" => '',
$html .= '<script language="javascript">'."\n"; "posters" => '',
$html .= '$(window).on(\'load\', function() {'."\n"; ), $attr));
$html .= ' SexHLSPlayer(\''.$vurl.'\', \''.$uid.'\');'."\n"; return "<div class='sexhls_video'>" . sh_hls_player($url, $posters) . "</div>";
$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) public static function video_xr($attr, $cont)
{ {
extract( shortcode_atts(array( extract( shortcode_atts(array(
"url" => '', "url" => '',
"posters" => '', "posters" => '',
), $attr)); ), $attr));
return "<div class='sexhls_video'>" . $this->addPlayer($url, $posters) . "</div>"; return "<div class='sexvideo_videojs'>" . sh_xr_player($url, $posters) . "</div>";
} }
} }
} }
$SEXHACK_SECTION = array(
'class' => 'SexhackHlsPlayer',
'description' => 'Add HLS Video Player for progressive and live streaming support',
'name' => 'sexhackme_hls_player'
);
?> ?>
<?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('SH_VideoPlayer')) {
class SH_VideoPlayer
{
public static function addPlayer($player_type='hls', $vurl='', $posters="", $projection='180_LR')
{
$html = false;
switch($player_type)
{
case 'hls':
$html = sh_get_template("videoplayer/hls.php", array('vurl' => $vurl, 'posters' => $posters ));
sexhack_log($html);
break;
case 'xr':
$html = sh_get_template("videoplayer/xr.php", array('vurl' => $vurl, 'posters' => $posters, 'projection' => $projection));
break;
}
return $html;
}
}
}
?>
...@@ -37,6 +37,27 @@ if(!function_exists('sexhack_log')){ ...@@ -37,6 +37,27 @@ if(!function_exists('sexhack_log')){
} }
function sh_get_template($tmpl, $args=array())
{
foreach($args as $var => $data) $$var = $data;
if(file_exists(SH_PLUGIN_DIR_PATH . 'templates/' . $tmpl))
return include_once SH_PLUGIN_DIR_PATH . 'templates/' . $tmpl;
return false;
}
function sh_hls_player($video_url, $posters='')
{
echo SH_VideoPlayer::addPlayer('hls', $video_url, $posters);
}
function sh_xr_player($video_url, $posters='', $projection='180_LR')
{
echo SH_VideoPlayer::addPlayer('xr', $video_url, $posters, $projection);
}
function debug_rewrite_rules($matchonly=false) function debug_rewrite_rules($matchonly=false)
{ {
$matchonly=true; $matchonly=true;
...@@ -261,4 +282,10 @@ function html2text($html) ...@@ -261,4 +282,10 @@ function html2text($html)
return $plaintext; return $plaintext;
} }
function checkbox($res)
{
if($res=="1") return "checked";
}
?> ?>
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* Plugin Name: SexHackMe * Plugin Name: SexHackMe
* Plugin URI: https://www.sexhack.me/SexHackMe_Wordpress * Plugin URI: https://www.sexhack.me/SexHackMe_Wordpress
* Description: Cumulative plugin for https://www.sexhack.me modifications to wordpress, woocommerce and storefront theme * Description: Cumulative plugin for https://www.sexhack.me modifications to wordpress, woocommerce and storefront theme
* Version: 0.1 * Version: 0.0.1
* Author: Franco Lanza * Author: Franco Lanza
* *
* ---------------------- * ----------------------
...@@ -221,6 +221,20 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -221,6 +221,20 @@ if(!class_exists('SexHackMe_Plugin')) {
if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/functions-paid-member-subscriptions-integration.php' ) ) if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/functions-paid-member-subscriptions-integration.php' ) )
include_once( SH_PLUGIN_DIR_PATH . 'includes/functions-paid-member-subscriptions-integration.php' ); include_once( SH_PLUGIN_DIR_PATH . 'includes/functions-paid-member-subscriptions-integration.php' );
/* Video Players */
if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/class-video-players.php' ) )
include_once( SH_PLUGIN_DIR_PATH . 'includes/class-video-players.php' );
/* Shortcodes */
if( file_exists( SH_PLUGIN_DIR_PATH . 'includes/class-shortcodes.php' ) )
include_once SH_PLUGIN_DIR_PATH . 'includes/class-shortcodes.php';
/* Hook to include needed files */
do_action( 'pms_include_files' );
/* Testing code */ /* Testing code */
foreach( glob(dirname(__FILE__) . '/testing/*.php') as $class_path ) { foreach( glob(dirname(__FILE__) . '/testing/*.php') as $class_path ) {
...@@ -231,8 +245,6 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -231,8 +245,6 @@ if(!class_exists('SexHackMe_Plugin')) {
} }
} }
} }
...@@ -280,11 +292,11 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -280,11 +292,11 @@ if(!class_exists('SexHackMe_Plugin')) {
// add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) ); // add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
// Initialize shortcodes // Initialize shortcodes
//add_action( 'init', array( 'PMS_Shortcodes', 'init' ) ); add_action( 'init', array( 'wp_SexHackMe\SH_Shortcodes', 'init' ) );
//add_action( 'init', array( $this, 'init_dependencies' ), 1 ); //add_action( 'init', array( $this, 'init_dependencies' ), 1 );
//Show row meta on the plugin screen (used to add links like Documentation, Support etc.). //Show row meta on the plugin screen (used to add links like Documentation, Support etc.).
//add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 ); add_filter( 'plugin_row_meta', array( $this, 'plugin_row_meta' ), 10, 2 );
// Hook to be executed on a specific interval, by the cron job (wp_schedule_event); used to check if a subscription has expired // Hook to be executed on a specific interval, by the cron job (wp_schedule_event); used to check if a subscription has expired
//add_action('pms_check_subscription_status','pms_member_check_expired_subscriptions'); //add_action('pms_check_subscription_status','pms_member_check_expired_subscriptions');
...@@ -293,7 +305,7 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -293,7 +305,7 @@ if(!class_exists('SexHackMe_Plugin')) {
//add_action('pms_remove_activation_key','pms_remove_expired_activation_key'); //add_action('pms_remove_activation_key','pms_remove_expired_activation_key');
// Add new actions besides the activate/deactivate ones from the Plugins page // Add new actions besides the activate/deactivate ones from the Plugins page
//add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( $this, 'add_plugin_action_links' ) ); add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( $this, 'add_plugin_action_links' ) );
sexhack_log("SexHackMe PLUGIN Loaded!"); sexhack_log("SexHackMe PLUGIN Loaded!");
...@@ -304,6 +316,7 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -304,6 +316,7 @@ if(!class_exists('SexHackMe_Plugin')) {
} }
// XXX There are so many dependencies to add here...
public function plugin_dependencies() public function plugin_dependencies()
{ {
$plugins = array( $plugins = array(
...@@ -348,35 +361,87 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -348,35 +361,87 @@ if(!class_exists('SexHackMe_Plugin')) {
public function enqueue_front_end_scripts() public function enqueue_front_end_scripts()
{ {
// HLS Player // HLS Player
wp_enqueue_script('sexhls_baseplayer', SH_PLUGIN_DIR_URL.'js/hls.js'); wp_enqueue_script('sexhls_baseplayer', SH_PLUGIN_DIR_URL.'js/hls.js', array(), SH_VERSION);
wp_enqueue_script('sexhls_player_controls', SH_PLUGIN_DIR_URL.'js/sexhls.js'); wp_enqueue_script('sexhls_player_controls', SH_PLUGIN_DIR_URL.'js/sexhls.js', array('sexhls_baseplayer'), SH_VERSION);
wp_enqueue_script('sexhls_mousetrap', SH_PLUGIN_DIR_URL.'js/mousetrap.min.js'); wp_enqueue_script('sexhls_mousetrap', SH_PLUGIN_DIR_URL.'js/mousetrap.min.js', array('sexhls_baseplayer'), SH_VERSION);
// VideoJS Player (for 3D) // VideoJS Player (for 3D)
wp_enqueue_script('sexvideo_baseplayer', SH_PLUGIN_DIR_URL.'js/video.min.js'); wp_enqueue_script('sexvideo_baseplayer', SH_PLUGIN_DIR_URL.'js/video.min.js', array(), SH_VERSION);
wp_enqueue_script('sexvideo_xrplayer', SH_PLUGIN_DIR_URL.'js/videojs-xr.min.js'); wp_enqueue_script('sexvideo_xrplayer', SH_PLUGIN_DIR_URL.'js/videojs-xr.min.js', array('sexvideo_baseplayer'), SH_VERSION);
wp_enqueue_style ('videojs', SH_PLUGIN_DIR_URL.'css/video-js.min.css'); wp_enqueue_style ('videojs', SH_PLUGIN_DIR_URL.'css/video-js.min.css', array(), SH_VERSION);
wp_enqueue_style ('sexhack_videojs', SH_PLUGIN_DIR_URL.'css/sexhackme_videojs.css'); wp_enqueue_style ('sexhack_videojs', SH_PLUGIN_DIR_URL.'css/sexhackme_videojs.css', array(), SH_VERSION);
wp_enqueue_style ('videojs-xr', SH_PLUGIN_DIR_URL.'css/videojs-xr.css'); wp_enqueue_style ('videojs-xr', SH_PLUGIN_DIR_URL.'css/videojs-xr.css', array('videojs'), SH_VERSION);
// Sexhack Video Gallery // Sexhack Video Gallery
wp_enqueue_style ('sexhackme_gallery', SH_PLUGIN_DIR_URL.'css/sexhackme_gallery.css'); wp_enqueue_style ('sexhackme_gallery', SH_PLUGIN_DIR_URL.'css/sexhackme_gallery.css', array(), SH_VERSION);
// Sexhack Fix Header // Sexhack Fix Header
wp_enqueue_style ('sexhackme_header', SH_PLUGIN_DIR_URL.'css/sexhackme_header.css'); wp_enqueue_style ('sexhackme_header', SH_PLUGIN_DIR_URL.'css/sexhackme_header.css', array(), SH_VERSION);
// Fix Woocommerce Checkout // Fix Woocommerce Checkout
wp_enqueue_style ('sexhackme_checkout', SH_PLUGIN_DIR_URL.'css/sexhackme_checkout.css'); wp_enqueue_style ('sexhackme_checkout', SH_PLUGIN_DIR_URL.'css/sexhackme_checkout.css', array(), SH_VERSION);
// XFrame Bypass // XFrame Bypass
wp_enqueue_script('xfbp_poly', SH_PLUGIN_DIR_URL.'js/custom-elements-builtin.js'); wp_enqueue_script('xfbp_poly', SH_PLUGIN_DIR_URL.'js/custom-elements-builtin.js', array(), SH_VERSION);
wp_enqueue_script('xfbp_js', SH_PLUGIN_DIR_URL.'js/x-frame-bypass.js'); wp_enqueue_script('xfbp_js', SH_PLUGIN_DIR_URL.'js/x-frame-bypass.js', array(), SH_VERSION);
}
/**
* Show row meta on the plugin screen. (Used to add links like Documentation, Support etc.)
*
* @param mixed $links Plugin Row Meta
* @param mixed $file Plugin Base file
* @return array
*
*/
public static function plugin_row_meta( $links, $file ) {
if ( $file == SH_PLUGIN_BASENAME ) {
$row_meta = array(
'get_support' => '<a href="' . esc_url(
apply_filters( 'sh_docs_url', 'https://git.nexlab.net/SexHackMe/sexhackme/issues' )
) . '" title="' . esc_attr( 'Get Support' ) . '" target="_blank">Get Support</a>',
);
return array_merge( $links, $row_meta );
}
return (array) $links;
}
public function add_plugin_action_links( $links ) {
if ( current_user_can( 'manage_options' ) ) {
$links[] = '<span class="delete"><a href="' . wp_nonce_url(
add_query_arg( array( 'page' => 'sh-uninstall-page' ) ,
admin_url( 'admin.php' )
),
'sh_uninstall_page_nonce' ) . '">Uninstall</a></span>';
$settings_url = sprintf( '<a href="%1$s">%2$s</a>',
menu_page_url( 'sh-settings-page', false ),
esc_html( 'Settings' )
);
$docs_url = sprintf( '<a href="%1$s" target="_blank">%2$s</a>',
esc_url( 'https://www.sexhack.me/SexHackMe_Wordpress' ),
esc_html('Docs' )
);
array_unshift( $links, $settings_url, $docs_url );
}
return $links;
} }
/* FROM HERE IS THE DEPRECATED PART */ /* FROM HERE IS THE DEPRECATED PART */
public function deprecated() public function deprecated()
...@@ -385,7 +450,6 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -385,7 +450,6 @@ if(!class_exists('SexHackMe_Plugin')) {
$SECTIONS = array(); $SECTIONS = array();
foreach( glob(dirname(__FILE__) . '/deprecated/*.php') as $class_path ) { foreach( glob(dirname(__FILE__) . '/deprecated/*.php') as $class_path ) {
sexhack_log($class_path);
$SEXHACK_SECTION = false; $SEXHACK_SECTION = false;
try { try {
include_once($class_path); include_once($class_path);
...@@ -397,28 +461,16 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -397,28 +461,16 @@ if(!class_exists('SexHackMe_Plugin')) {
$this->SECTIONS = $SECTIONS; $this->SECTIONS = $SECTIONS;
$this->instances = array(); $this->instances = array();
foreach($SECTIONS as $section) { foreach($SECTIONS as $section) {
sexhack_log("Loading ".$section['name']);
$this->instance_subclass($section);
}
}
public function instance_subclass($section)
{
$class = "wp_SexHackMe\\".$section['class']; $class = "wp_SexHackMe\\".$section['class'];
//sexhack_log($class);
$this->instances[$section['name']] = new $class(); $this->instances[$section['name']] = new $class();
} }
public function settings_section() {
echo "<h3>Enable following functionalities:</h3>";
}
public function checkbox($res)
{
if($res=="1") return "checked";
} }
/* public function settings_section() {
* echo "<h3>Enable following functionalities:</h3>";
* }
*/
public function initialize_plugin() public function initialize_plugin()
{ {
...@@ -443,10 +495,11 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -443,10 +495,11 @@ if(!class_exists('SexHackMe_Plugin')) {
public function admin_menu() public function admin_menu()
{ {
add_menu_page('SexHackMe Settings', 'SexHackMe', 'manage_options', 'sexhackme-settings', add_menu_page('SexHackMe Settings', 'SexHackMe', 'manage_options', 'sexhackme-settings',
array($this, 'admin_page'), plugin_dir_url(__FILE__) .'/img/admin_icon.png', 31); array($this, 'admin_page'), SH_PLUGIN_DIR_PATH .'img/admin_icon.png', 31);
add_submenu_page( 'sexhackme-settings', 'SexHackMe Settings', 'Modules', add_submenu_page( 'sexhackme-settings', 'SexHackMe Settings', 'Modules',
'manage_options', 'sexhackme-settings'); 'manage_options', 'sexhackme-settings');
foreach($this->SECTIONS as $section) { foreach($this->SECTIONS as $section) {
if(get_option( $section['name'])=="1") if(get_option( $section['name'])=="1")
{ {
...@@ -469,70 +522,10 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -469,70 +522,10 @@ if(!class_exists('SexHackMe_Plugin')) {
public function admin_page() public function admin_page()
{ {
?> if(file_exists( SH_PLUGIN_DIR_PATH . 'templates/admin/sexhackme.php'))
<div class="wrap"> include_once( SH_PLUGIN_DIR_PATH . 'templates/admin/sexhackme.php');
<h2>SexHackMe Plugin Settings</h2>
<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']))
{
$reqps = array();
if(is_string($section['require-page']))
{
$reqtitle="Select the base plugin module page";
$reqpages=get_posts(array('post_type' => $section['require-page'], 'parent' => 0));
$reqps[] = array('title' => $reqtitle, 'pages' => $reqpages, 'option' => $section['name']."-page");
} elseif(is_array($section['require-page'])) {
$i=0;
foreach($section['require-page'] as $rpage) {
if(array_key_exists('post_type', $rpage)) {
$reqpsa = array('title' => 'Select Page', 'option' => $section['name']."-page$i",
'pages' => get_posts(array('post_type' => $rpage['post_type'], 'parent' => 0)));
if(array_key_exists('option', $rpage)) $reqpsa['option'] = $rpage['option'];
if(array_key_exists('title', $rpage)) $reqpsa['title'] = $rpage['title'];
$reqps[] = $reqpsa;
}
$i++;
}
} else {
$reqtitle="Select the base plugin module page";
$reqpages=get_pages();
$reqps[] = array('title' => $reqtitle, 'pages' => $reqpages, 'option' => $section['name']."-page");
}
foreach($reqps as $reqarr) {
?>
<select id="<?php echo $reqarr['option'];?>" name="<?php echo $reqarr['option']; ?>" class="widefat">
<option value="-1"><?php esc_html_e( 'Choose...', 'paid-member-subscriptions' ) ?></option>
<?php
$opt=get_option($reqarr['option']);
foreach( $reqarr['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"><?php echo $reqarr['title']; ?></p>
<?php } ?>
<?php } ?>
</td>
</tr>
<?php } ?>
</table>
<?php submit_button(); ?>
</form>
</div>
<?php
} }
} }
// Let's run the plugin! // Let's run the plugin!
......
<?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/>.
*/
?>
<div class="wrap">
<h2>SexHackMe Plugin Settings</h2>
<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 wp_SexHackMe\checkbox(get_option( $section['name'] )); ?>/>
<br>
<?php
if(array_key_exists('require-page', $section) && ($section['require-page']))
{
$reqps = array();
if(is_string($section['require-page']))
{
$reqtitle="Select the base plugin module page";
$reqpages=get_posts(array('post_type' => $section['require-page'], 'parent' => 0));
$reqps[] = array('title' => $reqtitle, 'pages' => $reqpages, 'option' => $section['name']."-page");
} elseif(is_array($section['require-page'])) {
$i=0;
foreach($section['require-page'] as $rpage) {
if(array_key_exists('post_type', $rpage)) {
$reqpsa = array('title' => 'Select Page', 'option' => $section['name']."-page$i",
'pages' => get_posts(array('post_type' => $rpage['post_type'], 'parent' => 0)));
if(array_key_exists('option', $rpage)) $reqpsa['option'] = $rpage['option'];
if(array_key_exists('title', $rpage)) $reqpsa['title'] = $rpage['title'];
$reqps[] = $reqpsa;
}
$i++;
}
} else {
$reqtitle="Select the base plugin module page";
$reqpages=get_pages();
$reqps[] = array('title' => $reqtitle, 'pages' => $reqpages, 'option' => $section['name']."-page");
}
foreach($reqps as $reqarr) {
?>
<select id="<?php echo $reqarr['option'];?>" name="<?php echo $reqarr['option']; ?>" class="widefat">
<option value="-1"><?php esc_html_e( 'Choose...', 'paid-member-subscriptions' ) ?></option>
<?php
$opt=get_option($reqarr['option']);
foreach( $reqarr['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"><?php echo $reqarr['title']; ?></p>
<?php } ?>
<?php } ?>
</td>
</tr>
<?php } ?>
</table>
<?php submit_button(); ?>
</form>
</div>
<?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/>.
*/
$uid = uniqid('sexhls_');
?>
<video id="<?php echo $uid; ?>" style="width: 100%; height: 100%;" controls poster="<?php echo $posters; ?>"></video>
<script language="javascript">
$(window).on('load', function() {
SexHLSPlayer('<?php echo $vurl; ?>', '<?php echo $uid; ?>');
$('#<?php echo $uid; ?>').on('click', function(){this.paused?this.play():this.pause();});
Mousetrap(document.getElementById('<?php echo $uid; ?>')).bind('space', function(e, combo) { SexHLSplayPause('<?php echo $uid; ?>'); });
Mousetrap(document.getElementById('<?php echo $uid; ?>')).bind('up', function(e, combo) { SexHLSvolumeUp('<?php echo $uid; ?>'); });
Mousetrap(document.getElementById('<?php echo $uid; ?>')).bind('down', function(e, combo) { SexHLSvolumeDown('<?php echo $uid; ?>'); });
Mousetrap(document.getElementById('<?php echo $uid; ?>')).bind('right', function(e, combo) { SexHLSseekRight('<?php echo $uid; ?>'); });
Mousetrap(document.getElementById('<?php echo $uid; ?>')).bind('left', function(e, combo) { SexHLSseekLeft('<?php echo $uid; ?>'); });
Mousetrap(document.getElementById('<?php echo $uid; ?>')).bind('f', function(e, combo) { SexHLSvidFullscreen('<?php echo $uid; ?>'); });
});
</script>
<?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/>.
*/
$uid = uniqid('sexvideo_');
?>
<video id='<?php echo $uid; ?>' class='video-js vjs-default-skin vjs-2-1 vjs-big-play-centered' style='width: 100%; height: 100%;' controls poster='<?php echo $posters; ?>'>
</video>
<script language='javascript'>
$(window).on('load', function() {
var player = videojs('<?php echo $uid; ?>', {
html5: {
vhs: {
overrideNative: !videojs.browser.IS_SAFARI
},
nativeAudioTracks: false,
nativeVideoTracks: false
}});
player.src({ src: '<?php echo $vurl; ?>', type: 'application/x-mpegURL'});
player.xr();
});
</script>
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