Admin page for Video metaboxes

parent f6895523
...@@ -3,7 +3,8 @@ based on the ideas I planned for www.sexhack.me: ...@@ -3,7 +3,8 @@ based on the ideas I planned for www.sexhack.me:
- Version 0.0.2: - Version 0.0.2:
* Proper functioning Video post type page for Videos, use WC products only for downloads. * Proper functioning Video post type page for Videos (with initial rough admin editing interface).
* use WC products only for downloads and memberships.
* Database table dedicated for Video pages. * Database table dedicated for Video pages.
- Version 0.0.3: - Version 0.0.3:
...@@ -11,6 +12,8 @@ based on the ideas I planned for www.sexhack.me: ...@@ -11,6 +12,8 @@ based on the ideas I planned for www.sexhack.me:
- Version 0.0.4: - Version 0.0.4:
* Upload Videos page for models * Upload Videos page for models
* admin interface Video page editing meta-boxes rewriting
* admin page for video tags and video categories.
- Version 0.0.5: - Version 0.0.5:
* Better Video Page * Better Video Page
......
#shvtags{
float:left;
border:1px solid #ccc;
padding:5px;
font-family:Arial;
}
#shvtags > span{
cursor:pointer;
display:block;
float:left;
color:#fff;
background:#789;
padding:5px;
padding-right:25px;
margin:4px;
}
#shvtags > span:hover{
opacity:0.7;
}
#shvtags > span:after{
position:absolute;
content:"×";
border:1px solid;
padding:2px 5px;
margin-left:3px;
font-size:11px;
}
#shvtags > input{
background:#eee;
border:0;
margin:4px;
padding:7px;
width:auto;
}
...@@ -120,6 +120,10 @@ if(!class_exists('SH_Admin')) { ...@@ -120,6 +120,10 @@ if(!class_exists('SH_Admin')) {
} }
// Add Video tags and categories subpages to Video edit menu
//if(in_array('sexhack_video', get_post_types())
//{
//}
} }
} }
......
...@@ -31,18 +31,33 @@ if(!class_exists('SH_MetaBox')) { ...@@ -31,18 +31,33 @@ if(!class_exists('SH_MetaBox')) {
public static function add_video_metaboxes($post=false) public static function add_video_metaboxes($post=false)
{ {
add_meta_box( 'sh-mbox-videodescription', 'Videos', 'wp_SexHackMe\SH_MetaBox::load_metabox_video', 'sexhack_video', 'normal','default');
// Main configuration for Video pages
add_meta_box( 'sh-mbox-videodescription', 'Video details', 'wp_SexHackMe\SH_MetaBox::main_metabox_video', 'sexhack_video', 'normal','default');
// Remove Thumbnail featured image
remove_meta_box( 'postimagediv', 'sexhack_video', 'side' ); remove_meta_box( 'postimagediv', 'sexhack_video', 'side' );
add_meta_box('postimagediv', 'Video Thumbnail', 'post_thumbnail_meta_box', 'sexhack_video', 'side', 'default');
// Model selection
add_meta_box('video_model', 'Model', 'wp_SexHackMe\SH_MetaBox::model_select_meta_box', 'sexhack_video', 'side', 'default');
// Video categories
add_meta_box('video_category', 'Video categories', 'wp_SexHackMe\SH_MetaBox::video_categories_meta_box', 'sexhack_video', 'side', 'default');
// Video tags
add_meta_box('video_tags', 'Video tags', 'wp_SexHackMe\SH_MetaBox::video_tags_meta_box', 'sexhack_video', 'side', 'default');
// XXX Remove Paid Member Subscription meta boxes // XXX Remove Paid Member Subscription meta boxes
remove_meta_box( 'pms_post_content_restriction', 'sexhack_video', 'default'); remove_meta_box( 'pms_post_content_restriction', 'sexhack_video', 'default');
// XXX Remove Members plugin meta box // XXX Remove Members plugin meta box
remove_meta_box( 'members-cp', 'sexhack_video', 'default'); remove_meta_box( 'members-cp', 'sexhack_video', 'default');
// Re-add featured image thumbnail
add_meta_box('video_postimagediv', 'Video Thumbnail', 'post_thumbnail_meta_box', 'sexhack_video', 'side', 'default');
} }
public static function load_metabox_video($post) public static function main_metabox_video($post)
{ {
wp_nonce_field('video_description_nonce','sh_video_description_nonce'); wp_nonce_field('video_description_nonce','sh_video_description_nonce');
...@@ -54,6 +69,26 @@ if(!class_exists('SH_MetaBox')) { ...@@ -54,6 +69,26 @@ if(!class_exists('SH_MetaBox')) {
} }
public static function model_select_meta_box( $post, $box ) {
sh_get_template("admin/metabox_model.php");
}
public static function video_categories_meta_box( $post, $box ) {
sh_get_template("admin/metabox_videocategories.php");
}
public static function video_tags_meta_box( $post, $box ) {
$user_can_assign_terms = true; //current_user_can( $taxonomy->cap->assign_terms );
$comma = _x( ',', 'tag delimiter' );
$terms_to_edit = "prova,prova2,antani"; //get_terms_to_edit( $post->ID, $tax_name );
if ( ! is_string( $terms_to_edit ) ) {
$terms_to_edit = '';
}
sh_get_template("admin/metabox_videotags.php", array('terms_to_edit' => $terms_to_edit, "comma" => $comma, 'user_can_assign_terms' => $user_can_assign_terms));
}
public static function save_meta_box_data($post_id) public static function save_meta_box_data($post_id)
{ {
...@@ -99,18 +134,38 @@ if(!class_exists('SH_MetaBox')) { ...@@ -99,18 +134,38 @@ if(!class_exists('SH_MetaBox')) {
if(!$video) $video = new SH_Video(); if(!$video) $video = new SH_Video();
$video->post_id = $post_id; $video->post_id = $post_id;
$post = $video->get_post(); $post = $video->get_post();
// XXX TODO Sanitize inputs!
//
// Title and slug
$video->title = $post->post_title; $video->title = $post->post_title;
$video->slug = $post->post_name; $video->slug = $post->post_name;
// TODO Remove debug
sexhack_log("SAVE post object:");
sexhack_log($post); sexhack_log($post);
sexhack_log(' - $POST:');
// Sanitize user input. sexhack_log($_POST);
// Video description
$video->description = sanitize_text_field( $_POST['video_description'] ); $video->description = sanitize_text_field( $_POST['video_description'] );
sexhack_log($_POST); // Video thumbnail
// Update the meta field in the database. if(array_key_exists('video_thumbnail', $_POST) && sanitize_text_field($_POST['video_thumbnail']))
//update_post_meta( $post_id, 'video_description', $my_data ); $video->thumbnail = sanitize_text_field( $_POST['video_thumbnail'] );
else if(array_key_exists('_thumbnail_id', $_POST)
&& is_numeric($_POST['_thumbnail_id'])
&& intval($_POST['_thumbnail_id']) > 0)
{
$video->thumbnail = intval($_POST['_thumbnail_id']);
}
else
$video->thumbnail = false;
// Save the video data in the database.
sh_save_video($video); sh_save_video($video);
} }
......
...@@ -31,6 +31,7 @@ if(!class_exists('SH_PostType_Video')) { ...@@ -31,6 +31,7 @@ if(!class_exists('SH_PostType_Video')) {
public function __construct() public function __construct()
{ {
add_action('delete_post', array($this, 'delete_post'), 10, 2); add_action('delete_post', array($this, 'delete_post'), 10, 2);
add_action('transition_post_status', array($this, 'change_post_status'), 10, 3);
} }
public function delete_post($post_id, $post) public function delete_post($post_id, $post)
...@@ -41,8 +42,28 @@ if(!class_exists('SH_PostType_Video')) { ...@@ -41,8 +42,28 @@ if(!class_exists('SH_PostType_Video')) {
return; return;
sh_delete_video_from_post($post_id); sh_delete_video_from_post($post_id);
}
public function change_post_status($new, $old, $post)
{
// Only sexhack_video posts...
if(!is_object($post) || ($post->post_type!='sexhack_video'))
return;
//sexhack_log("STATUS CHANGE: post ".$post->ID." changed from $old to $new");
if($old===$new) return;
$video = sh_get_video_from_post($post);
if($video)
{
$vold = $video->status;
if($new=='publish' && $video->status == 'ready') $video->status = 'published';
else if($new!='publish' && $video->status == 'published') $video->status = 'ready';
//sexhack_log(" * video ".$video->id." is ".$video->status." (was $vold)");
if($vold!=$video->status) sh_save_video($video);
}
} }
} }
......
...@@ -92,7 +92,7 @@ if(!class_exists('SH_PostTypes')) { ...@@ -92,7 +92,7 @@ if(!class_exists('SH_PostTypes')) {
'query_var' => true, 'query_var' => true,
'has_archive' => true, 'has_archive' => true,
'supports' => array('title', 'thumbnail'), //'editor','excerpt','trackbacks','custom-fields','comments','revisions','author','page-attributes'), 'supports' => array('title', 'thumbnail'), //'editor','excerpt','trackbacks','custom-fields','comments','revisions','author','page-attributes'),
'taxonomies' => array(),//'category'), // ,'post_tag'), // TODO Shouldn't we have a "video_type" taxonomy for VR or flat? 'taxonomies' => array(), //'category','post_tag'), // TODO Shouldn't we have a "video_type" taxonomy for VR or flat?
)); ));
$DEFAULTSLUG = get_option('sexhack_gallery_slug', 'v'); $DEFAULTSLUG = get_option('sexhack_gallery_slug', 'v');
$projects_structure = '/'.$DEFAULTSLUG.'/%wooprod%/'; $projects_structure = '/'.$DEFAULTSLUG.'/%wooprod%/';
......
...@@ -29,19 +29,46 @@ if(!class_exists('SH_Query')) { ...@@ -29,19 +29,46 @@ if(!class_exists('SH_Query')) {
class SH_Query class SH_Query
{ {
public static function get_columns($table)
{
global $wpdb;
$sql = "SELECT `COLUMN_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS`
WHERE `TABLE_SCHEMA`='".DB_NAME."' AND `TABLE_NAME`='".$wpdb->_real_escape($table)."';";
$colums = array();
$res = $wpdb->get_results( $sql, ARRAY_N );
foreach($res as $k => $v)
$colums[]=$v[0];
return $colums;
}
public static function save_Video($video) public static function save_Video($video)
{ {
global $wpdb; global $wpdb;
if(is_object($video)) if(is_object($video))
{ {
$fieldsarray = $video->get_sql_array(); $fieldsarrayraw = $video->get_sql_array();
$fieldsarray = array();
$fields = ""; $fields = "";
$keys = ""; $keys = "";
$values = ""; $values = "";
$count=0; $count=0;
$tables = SH_Query::get_columns($wpdb->prefix.SH_PREFIX."videos");
//sexhack_log("TABLES");
//sexhack_log($tables);
foreach($fieldsarrayraw as $k => $v)
{
if(!in_array($k, $tables)) continue;
$fieldsarray[$k] = $v;
}
foreach($fieldsarray as $k => $v) foreach($fieldsarray as $k => $v)
{ {
if(!in_array($k, $tables)) continue;
$v = $wpdb->_real_escape($v); $v = $wpdb->_real_escape($v);
$adds = "\n"; $adds = "\n";
$fields .= $k." = '$v'"; $fields .= $k." = '$v'";
...@@ -54,7 +81,7 @@ if(!class_exists('SH_Query')) { ...@@ -54,7 +81,7 @@ if(!class_exists('SH_Query')) {
$count++; $count++;
} }
if(($video->id) && (is_long($video->id) && $video->id > 0)) if((is_long($video->id) || is_numeric($video->id)) && intval($video->id) > 0)
{ {
// Save an already existing video entry // Save an already existing video entry
$sql = "UPDATE {$wpdb->prefix}".SH_PREFIX."videos SET $sql = "UPDATE {$wpdb->prefix}".SH_PREFIX."videos SET
...@@ -75,7 +102,7 @@ if(!class_exists('SH_Query')) { ...@@ -75,7 +102,7 @@ if(!class_exists('SH_Query')) {
$video->id = $wpdb->insert_id; $video->id = $wpdb->insert_id;
} }
//sexhack_log($sql);
return $video; return $video;
} }
...@@ -143,16 +170,18 @@ if(!class_exists('SH_Query')) { ...@@ -143,16 +170,18 @@ if(!class_exists('SH_Query')) {
} }
} }
$result = array(); $results = array();
//$sql = $wpdb->prepare("SELECT * from {$wpdb->prefix}{$prefix}videos"); //$sql = $wpdb->prepare("SELECT * from {$wpdb->prefix}{$prefix}videos");
$sql = "SELECT * from {$wpdb->prefix}".SH_PREFIX."videos"; $sql = "SELECT * from {$wpdb->prefix}".SH_PREFIX."videos";
$dbres = $wpdb->get_results( $sql ); $dbres = $wpdb->get_results( $sql );
foreach($dbres as $row) foreach($dbres as $row)
{ {
$result[] = new SH_Video($row); $results[] = new SH_Video($row);
} }
return $results;
} }
......
...@@ -42,6 +42,7 @@ if(!class_exists('SH_Video')) { ...@@ -42,6 +42,7 @@ if(!class_exists('SH_Video')) {
'title' => '', 'title' => '',
'description' => '', 'description' => '',
'uploaded' => false, 'uploaded' => false,
'updated' => false,
'slug' => '', 'slug' => '',
'price' => 0, 'price' => 0,
'video_type' => 'FLAT', 'video_type' => 'FLAT',
......
<?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;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
function sh_save_video($video)
{
return SH_Query::save_Video($video);
}
function sh_delete_video($v)
{
if(is_integer($v) && (intval($v)) > 0) return SH_Query::delete_Video($v);
else if(is_object($v)) return SH_Query::delete_Video($v->id);
return false;
}
function sh_delete_video_from_post($p)
{
if(is_int($p) && $p > 0) return SH_Query::delete_Video($p, 'post');
else if(is_object($p)) return SH_Query::delete_Video($p->ID, 'post');
return false;
}
function sh_delete_video_from_product($p)
{
if(is_int($p) and $p > 0) return SH_Query::delete_Video($p, 'product');
else if(is_object($p)) return SH_Query::delete_Video($p->get_id(), 'product');
return false;
}
function sh_get_videos($vcat=false)
{
return SH_Query::get_Videos($vcat);
}
function sh_get_video($id)
{
return SH_Query::get_Video($id);
}
function sh_get_video_from_post($p)
{
if(is_int($p) && $p > 0) return SH_Query::get_Video($p, 'post');
else if(is_object($p)) return SH_Query::get_Video($p->ID, 'post');
return false;
}
function sh_get_video_from_product($p)
{
if(is_int($p) and $p > 0) return SH_Query::get_Video($p, 'product');
else if(is_object($p)) return SH_Query::get_Video($p->get_id(), 'product');
return false;
}
?>
jQuery(document).ready(function($) {
$("#sh_admin_tabs .hidden").removeClass('hidden');
$("#sh_admin_tabs").tabs({'active': 0});
// ::: TAGS BOX
$("#shvtags input").on({
focusout : function() {
var txt = this.value.replace(/[^a-z0-9\+\-\.\#]/ig,''); // allowed characters
if(txt) $("<span/>", {text:txt.toLowerCase(), insertBefore:this});
this.value = "";
},
keyup : function(ev) {
// if: comma|enter (delimit more keyCodes with | pipe)
if(/(188|13)/.test(ev.which)) $(this).focusout();
}
});
$('#shvtags').on('click', 'span', function() {
if(confirm("Remove "+ $(this).text() +"?")) $(this).remove();
});
});
...@@ -174,7 +174,8 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -174,7 +174,8 @@ if(!class_exists('SexHackMe_Plugin')) {
visible ENUM('Y', 'N') NOT NULL DEFAULT 'Y', visible ENUM('Y', 'N') NOT NULL DEFAULT 'Y',
title varchar(256) NOT NULL, title varchar(256) NOT NULL,
description varchar(1024) NOT NULL, description varchar(1024) NOT NULL,
uploaded datetime DEFAULT NULL, created datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP,
slug varchar(256) NOT NULL, slug varchar(256) NOT NULL,
price float(10) NOT NULL DEFAULT '0', price float(10) NOT NULL DEFAULT '0',
video_type ENUM('FLAT','VR') NOT NULL DEFAULT 'FLAT', video_type ENUM('FLAT','VR') NOT NULL DEFAULT 'FLAT',
...@@ -191,9 +192,15 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -191,9 +192,15 @@ if(!class_exists('SexHackMe_Plugin')) {
size_public varchar(256) DEFAULT NULL, size_public varchar(256) DEFAULT NULL,
size_members varchar(256) DEFAULT NULL, size_members varchar(256) DEFAULT NULL,
size_premium varchar(256) DEFAULT NULL, size_premium varchar(256) DEFAULT NULL,
format_public varchar(256) DEFAULT NULL, format_public varchar(256) DEFAULT 'mp4',
format_members varchar(256) DEFAULT NULL, format_members varchar(256) DEFAULT 'mp4',
format_premium varchar(256) DEFAULT NULL, format_premium varchar(256) DEFAULT 'mp4',
codec_public varchar(256) DEFAULT 'h264',
codec_members varchar(256) DEFAULT 'h264',
codec_premium varchar(256) DEFAULT 'h264',
acodec_public varchar(256) DEFAULT 'AAC',
acodec_members varchar(256) DEFAULT 'AAC',
acodec_premium varchar(256) DEFAULT 'AAC',
duration_public varchar(256) DEFAULT NULL, duration_public varchar(256) DEFAULT NULL,
duration_members varchar(256) DEFAULT NULL, duration_members varchar(256) DEFAULT NULL,
duration_premium varchar(256) DEFAULT NULL, duration_premium varchar(256) DEFAULT NULL,
...@@ -211,8 +218,8 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -211,8 +218,8 @@ if(!class_exists('SexHackMe_Plugin')) {
KEY price (price), KEY price (price),
KEY video_type (video_type), KEY video_type (video_type),
KEY product_id (product_id) KEY product_id (product_id)
) {$charset_collate}; ) {$charset_collate};
CREATE TABLE {$wpdb->prefix}{$this->prefix}video_meta ( CREATE TABLE {$wpdb->prefix}{$this->prefix}video_meta (
meta_id bigint(20) AUTO_INCREMENT NOT NULL, meta_id bigint(20) AUTO_INCREMENT NOT NULL,
video_id bigint(20) NOT NULL DEFAULT '0', video_id bigint(20) NOT NULL DEFAULT '0',
meta_key varchar(191), meta_key varchar(191),
...@@ -220,36 +227,50 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -220,36 +227,50 @@ if(!class_exists('SexHackMe_Plugin')) {
PRIMARY KEY (meta_id), PRIMARY KEY (meta_id),
KEY video_id (video_id), KEY video_id (video_id),
KEY meta_key (meta_key) KEY meta_key (meta_key)
) {$charset_collate}; ) {$charset_collate};
CREATE TABLE {$wpdb->prefix}{$this->prefix}videocategory (
id bigint(20) AUTO_INCREMENT NOT NULL,
category varchar(32) NOT NULL,
PRIMARY KEY (id),
KEY category( category)
) {$charset_collate};
CREATE TABLE {$wpdb->prefix}{$this->prefix}videotags ( CREATE TABLE {$wpdb->prefix}{$this->prefix}videotags (
id bigint(20) AUTO_INCREMENT NOT NULL, id bigint(20) AUTO_INCREMENT NOT NULL,
tag varchar(32) NOT NULL, tag varchar(32) NOT NULL,
PRIMARY KEY (id), PRIMARY KEY (id),
KEY tag (tag) KEY tag (tag)
) {$charset_collate}; ) {$charset_collate};
CREATE TABLE {$wpdb->prefix}{$this->prefix}videoguests_assoc ( CREATE TABLE {$wpdb->prefix}{$this->prefix}videoguests_assoc (
id bigint(20) AUTO_INCREMENT NOT NULL, id bigint(20) AUTO_INCREMENT NOT NULL,
user_id bigint(20) NOT NULL, user_id bigint(20) NOT NULL,
PRIMARY KEY (id), video_id bigint(20) NOT NULL,
KEY user_id (user_id) PRIMARY KEY (id),
KEY user_id (user_id),
KEY video_id (video_id)
) {$charset_collate}; ) {$charset_collate};
CREATE TABLE {$wpdb->prefix}{$this->prefix}videocategory_assoc ( CREATE TABLE {$wpdb->prefix}{$this->prefix}videocategory_assoc (
id bigint(20) AUTO_INCREMENT NOT NULL, id bigint(20) AUTO_INCREMENT NOT NULL,
user_id bigint(20) NOT NULL, cat_id bigint(20) NOT NULL,
video_id bigint(20) NOT NULL,
PRIMARY KEY (id), PRIMARY KEY (id),
KEY user_id (user_id) KEY cat_id (cat_id),
KEY video_id (video_id)
) {$charset_collate}; ) {$charset_collate};
CREATE TABLE {$wpdb->prefix}{$this->prefix}videoaccess_assoc ( CREATE TABLE {$wpdb->prefix}{$this->prefix}videoaccess_assoc (
id bigint(20) AUTO_INCREMENT NOT NULL, id bigint(20) AUTO_INCREMENT NOT NULL,
user_id bigint(20) NOT NULL, user_id bigint(20) NOT NULL,
video_id bigint(20) NOT NULL,
PRIMARY KEY (id), PRIMARY KEY (id),
KEY user_id (user_id) KEY user_id (user_id),
KEY video_id (video_id)
) {$charset_collate}; ) {$charset_collate};
CREATE TABLE {$wpdb->prefix}{$this->prefix}videotags_assoc ( CREATE TABLE {$wpdb->prefix}{$this->prefix}videotags_assoc (
id bigint(20) AUTO_INCREMENT NOT NULL, id bigint(20) AUTO_INCREMENT NOT NULL,
tag_id bigint(20) NOT NULL,
video_id bigint(20) NOT NULL, video_id bigint(20) NOT NULL,
PRIMARY KEY (id), PRIMARY KEY (id),
KEY video_id (video_id) KEY video_id (video_id),
KEY tag_id (tag_id)
) {$charset_collate};"; ) {$charset_collate};";
require_once( ABSPATH . '/wp-admin/includes/upgrade.php' ); require_once( ABSPATH . '/wp-admin/includes/upgrade.php' );
...@@ -444,8 +465,8 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -444,8 +465,8 @@ if(!class_exists('SexHackMe_Plugin')) {
// Enqueue scripts on the admin side // Enqueue scripts on the admin side
//if( is_admin() ) if( is_admin() )
// add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_admin_scripts' ) );
// Initialize Custom post_types // Initialize Custom post_types
add_action( 'init', array( 'wp_SexHackMe\SH_PostTypes', 'init') ); add_action( 'init', array( 'wp_SexHackMe\SH_PostTypes', 'init') );
...@@ -516,6 +537,16 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -516,6 +537,16 @@ if(!class_exists('SexHackMe_Plugin')) {
} }
public function enqueue_admin_scripts()
{
// Admin pages CSS
wp_enqueue_style('sexhackme_admin', SH_PLUGIN_DIR_URL.'css/sexhackme_admin.css', array(), SH_VERSION);
// Admin pages js
wp_enqueue_script('sexadmin_js', SH_PLUGIN_DIR_URL.'js/sexhackme_admin.js', array('jquery-ui-tabs'), SH_VERSION);
}
public function enqueue_front_end_scripts() public function enqueue_front_end_scripts()
{ {
// HLS Player // HLS Player
...@@ -611,8 +642,8 @@ if(!class_exists('SexHackMe_Plugin')) { ...@@ -611,8 +642,8 @@ if(!class_exists('SexHackMe_Plugin')) {
if( WP_DEBUG === true ){ if( WP_DEBUG === true ){
// only matched? // only matched?
//add_action("the_post", 'wp_SexHackMe\debug_rewrite_rules'); //add_action("the_post", 'wp_SexHackMe\debug_rewrite_rules');
//sexhack_log("REQUEST: ".$_SERVER['REQUEST_URI']." QUERY: ".$_SERVER['QUERY_STRING']. "POST:"); sexhack_log("REQUEST: ".$_SERVER['REQUEST_URI']." QUERY: ".$_SERVER['QUERY_STRING']. "POST:");
//sexhack_log($_POST); sexhack_log($_POST);
} }
......
<?php
/**
* Copyright: 2022 (c)Franco (nextime) Lanza <franco@nexlab.it>
* License: GNU/GPL version 3.0
*
* This file is part of SexHackMe Wordpress Plugin.
*
* SexHackMe Wordpress Plugin is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* SexHackMe Wordpress Plugin is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SexHackMe Wordpress Plugin. If not, see <https://www.gnu.org/licenses/>.
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
?>
<div class="wrap">
<table class="form-table">
<tr align="top">
<td>
<label>Slug for gallery</label>
<input type="text" name="vmodel" value="<?php echo get_option( 'sexhack_gallery_slug', "v" ) ?>" />
</td>
</tr>
</table>
</div>
...@@ -21,5 +21,123 @@ ...@@ -21,5 +21,123 @@
// Exit if accessed directly // Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit; if ( ! defined( 'ABSPATH' ) ) exit;
// This is a dirty trick to hide the Visibility section in the publish metabox.
echo '<style>div#visibility.misc-pub-section.misc-pub-visibility{display:none}</style>';
?> ?>
<textarea style="width:100%" id="video_description" name="video_description"><?php echo esc_attr( $video->description ); ?></textarea> <p>
<h4>Video description</h4>
<textarea style="width:100%" id="video_description" name="video_description"><?php echo esc_attr( $video->description ); ?></textarea>
</p>
<p>
<h4>Privacy:</h4>
<p>
<label> * Show video in public gallery?</label>
<input type='radio' name='video_visible' value='Y'>Yes</input>
<input type='radio' name='video_visible' value='N'>No</input>
</p>
<p>
<label> * Show video in profile gallery?</label>
<input type='radio' name='video_private' value='N'>Yes</input>
<input type='radio' name='video_private' value='Y'>No</input>
</p>
</p>
<p>
<h4>Preview</h4>
<p>
<label> * Thumbnail (URI,PATH or thumbail ID):</label>
<input type='text' nane="video_thumbnail" value='<?php echo esc_attr( $video->thumbnail ); ?>' > (Override featured image)</input>
</p>
<p>
<label> * Animated GIF (URI or PATH):</label>
<input type='text' nane="video_gif" value='<?php echo esc_attr( $video->gif ); ?>' />
</p>
<p>
<label> * Video preview/teaser (max 1 min)</label>
<input type='text' nane="video_preview" value='<?php echo esc_attr( $video->preview ); ?>' />
<p>
</p>
<p>
<h4>Virtual Reality</h4>
<p>
<label> * VR Video?:</label>
<input type='radio' name='video_type' value='VR'>Yes</input>
<input type='radio' name='video_type' value='FLAT'>No</input>
</p>
<p>
<label> * VR Projection</label>
<select name='video_vr_projection'>
<option value='VR180_LR'>Equirectangular 180 LR</option>
<option value='VR360_LR'>Equirectangular 360 LR</option>
</select>
</p>
</p>
<p>
<h4>Price:</h4>
<label>USD:</label>
<input type='text' nane="video_price" value='<?php echo esc_attr( $video->price ); ?>' />
</p>
<p>
<?php
$vaccess=array('public','members','premium');
?>
<h4>Video media files</h4>
<div id="sh_admin_tabs">
<ul class="category-tabs">
<?php
foreach($vaccess as $vt) { ?>
<li><a href="#t_<?php echo $vt; ?>"><?php echo ucfirst($vt);?></a></li>
<?php } ?>
</ul>
<br class="clear" />
<?php
foreach($vaccess as $vt) {
$vthls = 'hls_'.$vt;
$vtdown = 'download_'.$vt;
$vtsize = 'size_'.$vt;
$vtresolution = 'resolution_'.$vt;
$vtformat = 'format_'.$vt;
$vtcodec = 'codec_'.$vt;
$vtacodec = 'acodec_'.$vt;
$vtduration = 'duration_'.$vt;
?>
<div class="hidden" id="t_<?php echo $vt; ?>">
<h4> <?php echo ucfirst($vt); ?> files</h4>
<p>
<label> * Download (URI or PATH):</label>
<input type='text' nane="video_download_<?php echo $vt;?>" value='<?php echo esc_attr( $video->__get($vtdown) ); ?>' />
</p>
</p>
<label> * HLS playlist (URI or PATH):</label>
<input type='text' nane="video_hls_<?php echo $vt;?>" value='<?php echo esc_attr( $video->__get($vthls ) ); ?>' />
</p>
</p>
<label> * Duration:</label>
<input type='text' nane="video_duration_<?php echo $vt;?>" value='<?php echo esc_attr( $video->__get($vtduration ) ); ?>' />
</p>
</p>
<label> * File size:</label>
<input type='text' nane="video_size_<?php echo $vt;?>" value='<?php echo esc_attr( $video->__get($vtsize ) ); ?>' />
</p>
</p>
<label> * Resolution:</label>
<input type='text' nane="video_resolution_<?php echo $vt;?>" value='<?php echo esc_attr( $video->__get($vtresolution ) ); ?>' />
</p>
</p>
<label> * Format:</label>
<input type='text' nane="video_format_<?php echo $vt;?>" value='<?php echo esc_attr( $video->__get($vtformat ) ); ?>' />
</p>
</p>
<label> * Codec:</label>
<input type='text' nane="video_codec_<?php echo $vt;?>" value='<?php echo esc_attr( $video->__get($vtcodec ) ); ?>' />
</p>
</p>
<label> * Audio codec:</label>
<input type='text' nane="video_acodec_<?php echo $vt;?>" value='<?php echo esc_attr( $video->__get($vtacodec ) ); ?>' />
</p>
</div>
<?php } ?>
</div>
</p>
<?php
/**
* Copyright: 2022 (c)Franco (nextime) Lanza <franco@nexlab.it>
* License: GNU/GPL version 3.0
*
* This file is part of SexHackMe Wordpress Plugin.
*
* SexHackMe Wordpress Plugin is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published
* by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* SexHackMe Wordpress Plugin is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with SexHackMe Wordpress Plugin. If not, see <https://www.gnu.org/licenses/>.
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
?>
<div class="wrap">
<table class="form-table">
<tr align="top">
<td>
<label>Slug for gallery</label>
<input type="text" name="vcategory" value="<?php echo get_option( 'sexhack_gallery_slug', "v" ) ?>" />
</td>
</tr>
</table>
</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/>.
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
?>
<div id="shvtags">
<span>amateur</span>
<span>sexhackme</span>
<input type="text" value="" placeholder="Add a tag" />
</div>
<div>
<p class="howto" id="new-tag-video_tags-desc">Insert tag, confirm with enter or comma</p>
</div>
<p class="hide-if-no-js"><button type="button" class="button-link tagcloud-link" id="link-video_tags" aria-expanded="false">Choose from the most used tags</button></p>
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