Released version 0.0.2

parent bf0f01e3
== Sat 16 July 2022, 11:35am ==
- Released version 0.0.1
== Mon 25 July 2022, 00:26am ==
- Released version 0.0.2
* 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.
* Support Gdrive download links through the plugin "Integrate Google Drive"
This is a very rough plan for this plugin
based on the ideas I planned for www.sexhack.me:
- Version 0.0.2:
* 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.
- Version 0.0.3:
* Integration of Ultimate Members plugin for user and model profiles
* Show thumbnail in video post list in admin
* 404 Not Found page with gallery instead of WC products
* Fix caching problems with "integrate google drive"
- Version 0.0.4:
* Upload Videos page for models
......@@ -21,6 +14,10 @@ based on the ideas I planned for www.sexhack.me:
- Version 0.0.5:
* Better Video Page
* Tag filtering/support
* Proper installation dependencies management,
- Version 0.0.9:
* Remove integrate google drive plugin support and implement internal gdrive api
- Version 0.1.0:
* Fixes of all the features on the previous versions
......
......@@ -72,10 +72,42 @@ if(!class_exists('SH_Admin')) {
{
include_once SH_PLUGIN_DIR_PATH . 'includes/admin/functions-gallery.php';
add_settings_section('sexhackme-gallery-settings', ' ','wp_SexHackMe\gallery_settings_section', 'sexhackme-gallery-settings');
register_setting('sexhackme-gallery-settings', 'sexhack_gallery_slug');
register_setting('sexhackme-gallery-settings', 'sexhack_video_page');
register_setting('sexhackme-gallery-settings', 'sexhack_gallery_page');
register_setting('sexhackme-gallery-settings', 'sexhack_video404_page');
add_action('update_option', '\wp_SexHackMe\SH_Admin::update_gallery_slug', 10, 3);
//register_setting('sexhackme-gallery-settings', 'sexhack_gallery_slug');
}
}
public static function update_gallery_slug($option, $old, $new)
{
switch($option)
{
case 'sexhack_video_page':
if(!is_int($new)) break;
$page = get_post($new);
set_option('sexhack_gallery_slug', $page->post_name);
update_option('need_rewrite_flush', 1);
break;
case 'sexhack_gallery_page':
update_option('need_rewrite_flush', 1);
break;
case 'sexhack_video404_page':
update_option('need_rewrite_flush', 1);
break;
default:
break;
}
sexhack_log("UPDATE OPTIONS: ".$option." OLD $old NEW $new");
sexhack_log(get_option('neew_rewrite_flush', 'NOT SET'));
}
public static function menu()
{
......
<?php
/**
*
* This Google Drive API handler class is a custom PHP library to handle the Google Drive API calls.
*
* @class GoogleDriveApi
* @author CodexWorld
* @link http://www.codexworld.com
* @version 1.0
*/
class GoogleDriveApi {
const OAUTH2_TOKEN_URI = 'https://oauth2.googleapis.com/token';
const DRIVE_FILE_UPLOAD_URI = 'https://www.googleapis.com/upload/drive/v3/files';
const DRIVE_FILES_URI = 'https://www.googleapis.com/drive/v3/files/';
function __construct($params = array()) {
if (count($params) > 0){
$this->initialize($params);
}
}
function initialize($params = array()) {
if (count($params) > 0){
foreach ($params as $key => $val){
if (isset($this->$key)){
$this->$key = $val;
}
}
}
}
public function GetAccessToken($client_id, $redirect_uri, $client_secret, $code) {
$curlPost = 'client_id=' . $client_id . '&redirect_uri=' . $redirect_uri . '&client_secret=' . $client_secret . '&code='. $code . '&grant_type=authorization_code';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, self::OAUTH2_TOKEN_URI);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $curlPost);
$data = json_decode(curl_exec($ch), true);
$http_code = curl_getinfo($ch,CURLINFO_HTTP_CODE);
if ($http_code != 200) {
$error_msg = 'Failed to receieve access token';
if (curl_errno($ch)) {
$error_msg = curl_error($ch);
}else{
$error_msg = !empty($data['error']['message'])?$data['error']['message']:'';
}
throw new Exception('Error '.$http_code.': '.$error_msg);
}
return $data;
}
public function DeleteFile($access_token, $file_id, $googleOauthURL = '') {
$apiURL = self::DRIVE_FILES_URI . $file_id;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: Bearer '. $access_token));
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
$data = json_decode(curl_exec($ch), true);
$http_code = curl_getinfo($ch,CURLINFO_HTTP_CODE);
if($http_code != 200 && $http_code != 204){
$error_msg = 'Failed to delete file.';
if (curl_errno($ch)) {
$error_msg = curl_error($ch);
}else{
$error_msg = !empty($data['error']['message'])?$data['error']['message']:'';
}
if($http_code == 401 && !empty($googleOauthURL)){
unset($_SESSION['google_access_token']);
$error_msg .= '<br/>Click to <a href="'.$googleOauthURL.'">authenticate with Google Drive</a>';
}
throw new Exception('Error '.$http_code.': '.$error_msg);
}else{
return true;
}
}
}
?>
......@@ -21,6 +21,10 @@
namespace wp_SexHackMe;
use \IGD\Account;
use \IGD\App;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
......@@ -36,6 +40,11 @@ if(!class_exists('SH_GDrive')) {
function get_download_url($file)
{
$active = Account::get_active_account();
if(!$active) return $file;
$account_id = $active['id'];
if(!($file && is_string($file) && strlen($file)>3)) return $file;
if ( function_exists( 'igd_fs' ) )
{
......@@ -52,7 +61,7 @@ if(!class_exists('SH_GDrive')) {
$parent=false;
$gfile=false;
$success=false;
$igd = \IGD\App::instance();
$igd = App::instance($account_id);
// Try root first
foreach($gparts as $k => $part)
{
......@@ -92,6 +101,16 @@ if(!class_exists('SH_GDrive')) {
} else {
$gdo = $igd->get_files(array('q'=> "name='{$part}"), $parent, false);
}
if(!is_array($gdo) || (count($gdo) < 1) || array_key_exists('error', $gdo))
{
if($k == 0)
{
$gdo = $igd->get_files(array('q'=> "parents='' and sharedWithMe=true and '{$part}' in name"), 'shared', true);
} else {
$gdo = $igd->get_files(array('q'=> "name='{$part}"), $parent, true);
}
}
if(!is_array($gdo) || (count($gdo) < 1) || array_key_exists('error', $gdo)) break;
$parent=false;
......
......@@ -94,25 +94,57 @@ if(!class_exists('SH_PostTypes')) {
'supports' => array('title', 'thumbnail'), //'editor','excerpt','trackbacks','custom-fields','comments','revisions','author','page-attributes'),
'taxonomies' => array(), //'category','post_tag'), // TODO Shouldn't we have a "video_type" taxonomy for VR or flat?
));
$DEFAULTSLUG = get_option('sexhack_gallery_slug', 'v');
$projects_structure = '/'.$DEFAULTSLUG.'/%wooprod%/';
$rules = $wp_rewrite->wp_rewrite_rules();
$DEFAULTSLUG = get_option('sexhack_gallery_slug', 'v');
//sexhack_log($rules);
if(!array_key_exists($DEFAULTSLUG.'/([^/]+)/?$', $rules)) {
// sexhack_log("REWRITE: rules OK: ".$DEFAULTSLUG.'/([^/]+)/?$ => '.$rules[$DEFAULTSLUG.'/([^/]+)/?$']);
//} else {
sexhack_log("REWRITE: Need to add and flush our rules!");
$wp_rewrite->add_rewrite_tag("%wooprod%", '([^/]+)', "post_type=sexhack_video&wooprod=");
$wp_rewrite->add_rewrite_tag("%videoaccess%", '([^/]+)', "videoaccess=");
$wp_rewrite->add_permastruct($DEFAULTSLUG, $projects_structure, false);
$wp_rewrite->add_permastruct($DEFAULTSLUG, $projects_structure."%videoaccess%/", false);
update_option('need_rewrite_flush', 1);
update_option('need_rewrite_flush', 1);
sexhack_log("REWRITE: Need to add and flush our rules!");
}
}
}
public static function add_rewrites()
{
global $wp_rewrite;
}
$DEFAULTSLUG = get_option('sexhack_gallery_slug', 'v');
sexhack_log("REWRITE: ADDING RULES");
//flush_rewrite_rules();
$pid = get_option('sexhack_video_page', false);
if($pid) $redir = "page_id=$pid";
else
$redir = "pagename=$DEFAULTSLUG";
add_rewrite_rule($DEFAULTSLUG.'/([^/]+)/([^/]+)/page/?([0-9]{1,})/?$',
'index.php?'.$redir.'&sh_video=$matches[1]&videoaccess=$matches[2]&paged=$matches[3]', 'top');
add_rewrite_rule($DEFAULTSLUG.'/([^/]+)/([^/]+)/?$',
'index.php?'.$redir.'&sh_video=$matches[1]&videoaccess=$matches[2]', 'top');
add_rewrite_rule($DEFAULTSLUG.'/([^/]+)/page/?([0-9]{1,})/?$',
'index.php?'.$redir.'&sh_video=$matches[1]&paged=$matches[2]', 'top');
add_rewrite_rule($DEFAULTSLUG.'/([^/]+)/?$',
'index.php?'.$redir.'&sh_video=$matches[1]','top');
$vg_id = get_option('sexhack_video404_page', false);
//if(is_int($vg_id) && $vg_id>0)
add_rewrite_rule($DEFAULTSLUG.'/?$',
'index.php?page_id='.strval($vg_id), 'top');
//update_option('need_rewrite_flush', 1);
sexhack_log($wp_rewrite->wp_rewrite_rules());
}
}
}
......
......@@ -198,6 +198,21 @@ if(!class_exists('SH_Query')) {
}
public static function get_VideoFromSlug($slug)
{
global $wpdb;
$slug = $wpdb->_real_escape($slug);
$sql = "SELECT * FROM {$wpdb->prefix}".SH_PREFIX."videos WHERE slug='".$slug."'";
$dbres = $wpdb->get_results( $sql );
if(is_array($dbres) && count($dbres) > 0)
{
return new SH_Video((array)$dbres[0]);
}
return false;
}
public static function get_Video($id, $idtype='')
{
global $wpdb;
......@@ -247,13 +262,13 @@ if(!class_exists('SH_Query')) {
$results = array();
//$sql = $wpdb->prepare("SELECT * from {$wpdb->prefix}{$prefix}videos");
$sql = "SELECT * FROM {$wpdb->prefix}".SH_PREFIX."videos";
$dbres = $wpdb->get_results( $sql );
$dbres = $wpdb->get_results( $sql, ARRAY_A );
sexhack_log($dbres);
foreach($dbres as $row)
{
$results[] = new SH_Video($row);
}
sexhack_log($results);
return $results;
......
......@@ -125,10 +125,15 @@ if(!class_exists('SH_Shortcodes')) {
$html = "<div class='sexhack_gallery'>"; //<h3>SexHack VideoGallery</h3>";
if(isset($_GET['SHDEV'])) $html .= '<h3>DEVELOPEMENT MODE</h3>';
$html .= '<ul class="products columns-4">';
$products = $sh_videogallery->getProducts();
while( $products->have_posts() ) {
$products->the_post();
$html .= $sh_videogallery->get_video_thumb();
$videos = $sh_videogallery->get_videos();
foreach($videos as $video)
{
if($video->status == 'published')
{
$post = $video->get_post();
if($post) setup_postdata($post);
$html .= $sh_videogallery->get_video_thumb($video);
}
}
wp_reset_postdata();
$html .= "</ul></div>";
......
......@@ -66,9 +66,9 @@ if(!class_exists('SH_Video')) {
'codec_public' => 'h264',
'codec_members' => 'h264',
'codec_premium' => 'h264',
'acodec_public' => 'h264',
'acodec_members' => 'h264',
'acodec_premium' => 'h264',
'acodec_public' => 'AAC',
'acodec_members' => 'AAC',
'acodec_premium' => 'AAC',
'duration_public' => false,
'duration_members' => false,
'duration_premium' => false,
......@@ -87,6 +87,18 @@ if(!class_exists('SH_Video')) {
}
public function get_title()
{
return $this->attributes['title'];
}
public function has_downloads()
{
if($this->download_public OR $this->download_members OR $this->download_premium) return true;
return false;
}
function setAttributes($attr, $post=false, $wcprod=false)
{
......
......@@ -37,11 +37,11 @@ if(!class_exists('SH_VideoGallery')) {
// TODO What an horrible and inefficient way to cache the query result.
// Think about moving it in session and with a better data structure.
$this->productlist = false;
$this->videolist = false;
// Register Query Vars
add_filter("query_vars", array($this, "query_vars"));
//add_filter('page_template', array($this, 'sexhack_video_template'));
add_filter('page_template', array($this, 'sexhack_video_template'));
add_filter('archive_template', array($this, 'sexhack_video_template'));
add_action('pre_get_posts', array($this, 'fix_video_query'), 1, 1);
......@@ -51,31 +51,32 @@ if(!class_exists('SH_VideoGallery')) {
public function query_vars($vars)
{
$vars[] = 'wooprod';
$vars[] = 'sh_video';
$vars[] = 'videoaccess';
return $vars;
}
public function sexhack_video_template($template)
{
$template='video.php';
if(isset($_GET['SHDEV'])) $template='newvideo.php';
$is_sexhack_video = get_query_var('wooprod', false);
if(isset($_GET['SHDEV'])) $templ='newvideo.php';
$is_sexhack_video = get_query_var('sh_video', false);
if($is_sexhack_video ) {
$templ='video.php';
set_query_var( 'post_type', 'sexhack_video' );
if ( file_exists( plugin_dir_path(__DIR__) . '/templates/'.$template)) {
return plugin_dir_path(__DIR__) . '/templates/'.$template;
if ( file_exists( plugin_dir_path(__DIR__) . '/templates/'.$templ)) {
return plugin_dir_path(__DIR__) . '/templates/'.$templ;
}
}
return $template;
}
return $template;
}
public function fix_video_query($query)
{
if($query->get('post_type')=='sexhack_video') {
$wooprod = $query->get('wooprod', false);
if($wooprod) {
$sh_video = $query->get('sh_video', false);
if($sh_video) {
$query->query['post_type'] = 'sexhack_video';
$query->set('name', esc_sql($wooprod));
$query->set('post_type', 'any');
......@@ -84,58 +85,65 @@ if(!class_exists('SH_VideoGallery')) {
}
}
public function getProducts($vcat=false) {
if(!$this->productlist && !$vcat) $this->productlist = SH_Query::get_Products($vcat); //$this->_getProducts($vcat);
else if($vcat) return SH_Query::get_Products($vcat); //$this->_getProducts($vcat);
public function get_videos($vcat=false) {
// XXX TODO Only published videos!
if(!$this->videolist && !$vcat) $this->videolist = sh_get_videos($vcat); //SH_Query::get_Videos($vcat); //$this->_getProducts($vcat);
else if($vcat) return sh_get_videos($vcat); //SH_Query::get_Videos($vcat); //$this->_getProducts($vcat);
return $this->productlist;
return $this->videolist;
}
public function get_video_thumb()
public function get_video_thumb($video=false)
{
$DEFAULTSLUG = get_option('sexhack_gallery_slug', 'v');
$id = get_the_ID();
$prod = wc_get_product($id);
$image = get_the_post_thumbnail($id, "medium", array("class" => "sexhack_thumbnail")); //array("class" => "alignleft sexhack_thumbnail"));
$post_id = get_the_ID();
if(!$video) $video=sh_get_video_from_post($post_id);
if(is_numeric($video->thumbnail))
{
//$image = get_post_thumbnail_id($video->thumbnail);
//$image = wp_get_attachment_link($video->thumbnail);
$image=wp_get_attachment_image($video->thumbnail, "320x160"); // XXX Seriously fixed size?
}
else
$image = $video->thumbnail;
$hls_public = $video->hls_public;
$hls_member = $video->hls_members;
$hls_premium = $video->hls_premium;
$video_preview = $video->video_preview;
$gif_preview = $video->gif_small;
sexhack_log($video);
$hls = $prod->get_attribute("hls_public");
$hls_member = $prod->get_attribute("hls_members");
$hls_premium = $prod->get_attribute("hls_premium");
$video_preview = $prod->get_attribute("video_preview");
$gif_preview = $prod->get_attribute("gif_preview");
$vr_premium = $prod->get_attribute("vr_premium");
$vr_member = $prod->get_attribute("vr_members");
$vr_public = $prod->get_attribute("vr_public");
$vr_preview = $prod->get_attribute("vr_preview");
$categories = explode(", ", html2text( wc_get_product_category_list($id)));
$categories = $video->get_categories(true);
//print_r($categories);
$gif = $prod->get_attribute("gif_thumbnail");
if(!$gif) $gif = $gif_preview;
if($gif) $image .= "<img src='$gif' class='alignleft sexhack_thumb_hover' loading='lazy' />";
$gif = $video->gif;
if(!$gif_preview) $gif_preview = $gif;
if($gif_preview) $image .= "<img src='$gif_preview' class='alignleft sexhack_thumb_hover' loading='lazy' />";
$html = '<li class="product type-product sexhack_thumbli">';
$vurl = str_replace("/product/", "/".$DEFAULTSLUG."/", esc_url( get_the_permalink() ));
$vtitle = esc_html( get_the_title() );
$vurl = site_url().esc_url( "/".$DEFAULTSLUG."/".$video->slug )."/";
if(isset($_GET['SHDEV'])) $vurl.="?SHDEV=true";
$vtitle = $video->get_title();
$vtags=array();
$downtag ='';
if((!$hls) AND (!$hls_member) AND (!$hls_premium) AND (($video_preview) OR ($vr_preview))) $vtags[] = '<label class="sexhack_vtag sexhack_preview" style="*LEFT*">preview</label>';
if(($hls) OR ($vr_public)) $vtags[] = '<label class="sexhack_vtag sexhack_public" style="*LEFT*">public</label>';
if(($hls_member) OR ($vr_member))$vtags[] = '<label class="sexhack_vtag sexhack_members" style="*LEFT*">members</label>';
if(($hls_premium) OR ($vr_premium))$vtags[] = '<label class="sexhack_vtag sexhack_premium" style="*LEFT*">premium</label>';
if(count($prod->get_downloads()) > 0) $html .= '<label class="sexhack_vtag sexhack_download"">download</label>';
if(($vr_premium) OR ($vr_member) OR ($vr_public) OR ($vr_preview)
OR ((count($prod->get_downloads()) > 0)
AND (in_array("VR180", $categories)
OR in_array("VR360", $categories)))) $html .= '<label class="sexhack_vtag sexhack_VR"">VR/3D</label>';
if((!$hls_public) AND (!$hls_member) AND (!$hls_premium) AND ($video_preview) ) $vtags[] = '<label class="sexhack_vtag sexhack_preview" style="*LEFT*">preview</label>';
if($hls_public) $vtags[] = '<label class="sexhack_vtag sexhack_public" style="*LEFT*">public</label>';
if($hls_member)$vtags[] = '<label class="sexhack_vtag sexhack_members" style="*LEFT*">members</label>';
if($hls_premium)$vtags[] = '<label class="sexhack_vtag sexhack_premium" style="*LEFT*">premium</label>';
if($video->has_downloads()) $html .= '<label class="sexhack_vtag sexhack_download"">download</label>';
if($video->video_type == 'VR') $html .= '<label class="sexhack_vtag sexhack_VR"">VR/3D</label>';
$html .= "<a href=\"$vurl\" class=\"woocommerce-LoopProduct-link woocommerce-loop-product__link\">";
$html .= "<div class='sexhack_thumb_cont'>".$image."</div>";
......
......@@ -34,7 +34,7 @@ if(!class_exists("SH_VideoProducts")) {
//add_action('sh_save_video_after_query', array($this, 'sync_product_from_video'), 1, 10);
add_filter('video_before_save', array($this, 'sync_product_from_video'));
add_action('sh_delete_video', array($this, 'delete_video_product'), 1, 10);
add_action('sh_delete_video', array($this, 'delete_video_product'), 9, 1);
}
public function delete_video_product($video)
......
......@@ -54,6 +54,7 @@ function sanitize_idtype($idt=false)
return $idt."_id";
break;
case 'id':
case 'slug':
return $idt;
break;
default:
......
......@@ -83,6 +83,11 @@ function sh_get_video_from_product($p)
return false;
}
function sh_get_video_from_slug($slug)
{
return SH_Query::get_VideoFromSlug($slug);
}
function sh_get_categories($id=false)
{
return SH_Query::get_Categories($id);
......
......@@ -463,8 +463,8 @@ if(!class_exists('SexHackMe_Plugin')) {
// Check if we need to flush rewrite rules
add_action('init', array($this, 'register_flush'), 10);
add_action('init', array($this, 'flush_rewrite'), 900);
add_action('init', array($this, 'register_flush'), 10 );
add_action('init', array($this, 'flush_rewrite'), 11);
// Enqueue scripts on the front end side. Priority 200 because of WooCommerce.
add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_front_end_scripts' ), 200 );
......@@ -477,6 +477,7 @@ if(!class_exists('SexHackMe_Plugin')) {
// Initialize Custom post_types
add_action( 'init', array( 'wp_SexHackMe\SH_PostTypes', 'init'));
add_action( 'sh_rewrite_flushed', array( 'wp_SexHackMe\SH_PostTypes', 'add_rewrites') );
// Initialize shortcodes
add_action( 'init', array( 'wp_SexHackMe\SH_Shortcodes', 'init' ) );
......@@ -531,6 +532,7 @@ if(!class_exists('SexHackMe_Plugin')) {
public function register_flush()
{
register_setting('sexhackme-settings', 'need_rewrite_flush');
register_setting('sexhackme-settings', 'rewrite_flush_done');
}
public function flush_rewrite()
......@@ -538,8 +540,10 @@ if(!class_exists('SexHackMe_Plugin')) {
if( get_option('need_rewrite_flush'))
{
sexhack_log("FLUSHING REWRITE RULES");
flush_rewrite_rules(false);
//flush_rewrite_rules(false);
flush_rewrite_rules();
update_option('need_rewrite_flush', 0);
do_action('sh_rewrite_flushed');
}
}
......@@ -644,13 +648,12 @@ if(!class_exists('SexHackMe_Plugin')) {
}
// DEBUG REWRITE RULES
//if(isset($_GET['SHDEV'])) {
if( WP_DEBUG === true ){
// only matched?
//add_action("the_post", 'wp_SexHackMe\debug_rewrite_rules');
//sexhack_log("REQUEST: ".$_SERVER['REQUEST_URI']." QUERY: ".$_SERVER['QUERY_STRING']. "POST:");
//sexhack_log($_POST);
sexhack_log("REQUEST: ".$_SERVER['REQUEST_URI']." QUERY: ".$_SERVER['QUERY_STRING']. "POST:");
sexhack_log($_POST);
}
......
......@@ -29,10 +29,50 @@ if ( ! defined( 'ABSPATH' ) ) exit;
<table class="form-table">
<tr align="top">
<td>
<label>Slug for gallery</label>
<input type="text" name="sexhack_gallery_slug" value="<?php echo get_option( 'sexhack_gallery_slug', "v" ) ?>" />
<select id="sexhack_video_page" name="sexhack_video_page" class="widefat">
<option value="-1">Choose...</option>
<?php
$opt=get_option("sexhack_video_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 Video page</p>
</td>
</tr>
<tr align="top">
<td>
<select id="sexhack_gallery_page" name="sexhack_gallery_page" class="widefat">
<option value="-1">Choose...</option>
<?php
$opt=get_option("sexhack_gallery_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 Gallery page</p>
</td>
</tr>
<tr align="top">
<td>
<select id="sexhack_video404_page" name="sexhack_video404_page" class="widefat">
<option value="-1">Choose...</option>
<?php
$opt=get_option("sexhack_video404_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 Gallery page</p>
</td>
</tr>
</table>
<?php submit_button(); ?>
</form>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment