Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
W
WordPress_SexHackMe_Plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SexHackMe
WordPress_SexHackMe_Plugin
Commits
4fce81ab
Commit
4fce81ab
authored
Jul 22, 2022
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add base template for gdrive
parent
d1bb18dd
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
124 additions
and
41 deletions
+124
-41
class-integrate-google-drive.php
includes/class-integrate-google-drive.php
+47
-0
class-query.php
includes/class-query.php
+7
-1
class-video.php
includes/class-video.php
+25
-17
functions-forms-save.php
includes/functions-forms-save.php
+28
-9
sexhackme.php
sexhackme.php
+3
-0
metabox_video.php
templates/admin/metabox_video.php
+14
-14
No files found.
includes/class-integrate-google-drive.php
0 → 100644
View file @
4fce81ab
<?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
;
if
(
!
class_exists
(
'SH_GDrive'
))
{
class
SH_GDrive
{
function
__construct
()
{
add_filter
(
'sh_download_url_filter'
,
array
(
$this
,
'get_download_url'
));
{
function
get_download_url
(
$file
)
{
return
$file
;
}
}
new
SH_Gdrive
;
}
?>
includes/class-query.php
View file @
4fce81ab
...
...
@@ -51,6 +51,8 @@ if(!class_exists('SH_Query')) {
if
(
is_object
(
$video
))
{
sexhack_log
(
$video
);
$fieldsarrayraw
=
$video
->
get_sql_array
();
$fieldsarray
=
array
();
$fields
=
""
;
...
...
@@ -240,7 +242,11 @@ if(!class_exists('SH_Query')) {
if
(
$id
&&
is_numeric
(
$id
))
$sql
.=
" WHERE id='"
.
intval
(
$id
)
.
"'"
;
$dbres
=
$wpdb
->
get_results
(
$sql
);
return
$dbres
;
if
(
!
$id
)
return
$dbres
;
if
(
is_array
(
$dbres
)
&&
count
(
$dbres
)
>
0
)
return
$dbres
[
0
];
}
...
...
includes/class-video.php
View file @
4fce81ab
...
...
@@ -132,18 +132,14 @@ if(!class_exists('SH_Video')) {
{
if
(
isset
(
$this
->
attributes
[
'tags'
]))
return
$this
->
tags
;
$tags
=
sh_get_video_tags
(
$this
->
id
);
$this
->
tags
=
array
();
$this
->
tagsnames
=
array
();
$tags_indexed
=
array
();
$tagsnames
=
array
();
$this
->
attributes
[
'tags'
]
=
array
();
$this
->
attributes
[
'tagsnames'
]
=
array
();
if
(
$tags
)
{
foreach
(
$tags
as
$tag
)
{
$t
ags_indexed
[
$tag
->
id
]
=
$tag
;
$t
agsnames
[]
=
$tag
->
tag
;
$t
his
->
attributes
[
'tags'
]
[
$tag
->
id
]
=
$tag
;
$t
his
->
attributes
[
'tagsnames'
]
[]
=
$tag
->
tag
;
}
$this
->
tags
=
$tags_indexed
;
$this
->
tagsnames
=
$tagsnames
;
}
return
$this
->
tags
;
}
...
...
@@ -155,17 +151,27 @@ if(!class_exists('SH_Video')) {
return
$this
->
tagsnames
;
}
public
function
get_categories
()
public
function
add_category
(
$cat
)
{
if
(
!
is_object
(
$cat
))
return
false
;
if
(
!
isset
(
$this
->
attributes
[
'categories'
]))
$this
->
attributes
[
'categories'
]
=
array
();
$this
->
attributes
[
'categories'
][
$cat
->
id
]
=
$cat
;
return
true
;
}
public
function
get_categories
(
$usedb
=
true
)
{
if
(
isset
(
$this
->
attributes
[
'categories'
]))
return
$this
->
categories
;
$cats
=
sh_get_video_categories
(
$this
->
id
);
$this
->
categories
=
array
();
$cats_indexed
=
array
();
if
(
$cats
)
$this
->
attributes
[
'categories'
]
=
array
();
if
(
$usedb
)
{
foreach
(
$cats
as
$cat
)
$cats_indexed
[
$cat
->
id
]
=
$cat
;
$this
->
categories
=
$cats_indexed
;
$cats
=
sh_get_video_categories
(
$this
->
id
);
if
(
$cats
)
{
foreach
(
$cats
as
$cat
)
$this
->
attributes
[
'categories'
][
$cat
->
id
]
=
$cat
;
}
}
return
$this
->
categories
;
}
...
...
@@ -218,7 +224,9 @@ if(!class_exists('SH_Video')) {
$r
=
array
();
foreach
(
$this
->
attributes
as
$k
=>
$v
)
{
if
((
$v
)
&&
!
in_array
(
$k
,
array
(
'id'
,
'post'
,
'product'
,
'tags'
,
'categories'
,
'tagsnames'
))
)
$r
[
$k
]
=
$v
;
if
((
$v
!==
false
)
&&
!
in_array
(
$k
,
array
(
'id'
,
'post'
,
'product'
,
'tags'
,
'categories'
,
'tagsnames'
,
'created'
,
'updated'
,
'sells'
,
'views_public'
,
'views_members'
,
'views_premium'
))
)
$r
[
$k
]
=
$v
;
}
return
$r
;
}
...
...
includes/functions-forms-save.php
View file @
4fce81ab
...
...
@@ -86,8 +86,7 @@ function save_sexhack_video_meta_box_data( $post_id )
$video
->
model
=
intval
(
$_POST
[
'video_model'
]);
// Video description
if
(
array_key_exists
(
'video_description'
,
$_POST
)
&&
sanitize_text_field
(
$_POST
[
'video_description'
]))
$video
->
description
=
sanitize_text_field
(
$_POST
[
'video_description'
]
);
$video
->
description
=
sanitize_text_field
(
$_POST
[
'video_description'
]
);
// Video thumbnail
if
(
array_key_exists
(
'video_thumbnail'
,
$_POST
)
&&
sanitize_text_field
(
$_POST
[
'video_thumbnail'
]))
...
...
@@ -112,11 +111,12 @@ function save_sexhack_video_meta_box_data( $post_id )
// Video visible
if
(
array_key_exists
(
'video_visible'
,
$_POST
)
&&
in_array
(
$_POST
[
'video_visible'
],
array
(
'Y'
,
'N'
)))
$video
->
privat
e
=
$_POST
[
'video_visible'
];
$video
->
visibl
e
=
$_POST
[
'video_visible'
];
// Video price
if
(
array_key_exists
(
'video_price'
,
$_POST
)
&&
is_numeric
(
$_POST
[
'video_price'
])
&&
(
floatval
(
$_POST
[
'video_price'
])
>
0
))
$video
->
price
=
floatval
(
$_POST
[
'video_price'
]);
if
(
array_key_exists
(
'video_price'
,
$_POST
)
&&
is_numeric
(
$_POST
[
'video_price'
])
&&
(
floatval
(
$_POST
[
'video_price'
])
>=
0
))
$video
->
price
=
floatval
(
$_POST
[
'video_price'
]);
else
$video
->
price
=
0
;
// Video type
if
(
array_key_exists
(
'video_type'
,
$_POST
)
&&
in_array
(
$_POST
[
'video_type'
],
array
(
'VR'
,
'FLAT'
)))
...
...
@@ -128,11 +128,15 @@ function save_sexhack_video_meta_box_data( $post_id )
// Preview video
if
(
array_key_exists
(
'video_preview'
,
$_POST
)
&&
check_url_or_path
(
sanitize_text_field
(
$_POST
[
'video_preview'
])))
$video
->
preview
=
sanitize_text_field
(
$_POST
[
'video_preview'
]);
$video
->
preview
=
sanitize_text_field
(
$_POST
[
'video_preview'
]);
else
$video
->
preview
=
false
;
// Animated gif path
if
(
array_key_exists
(
'video_gif'
,
$_POST
)
&&
check_url_or_path
(
sanitize_text_field
(
$_POST
[
'video_gif'
])))
$video
->
gif
=
sanitize_text_field
(
$_POST
[
'video_gif'
]);
else
$video
->
gif
=
false
;
// Differenciated content for access levels
foreach
(
array
(
'public'
,
'members'
,
'premium'
)
as
$vt
)
...
...
@@ -143,14 +147,14 @@ function save_sexhack_video_meta_box_data( $post_id )
(
strncasecmp
(
strrev
(
sanitize_text_field
(
$_POST
[
'video_hls_'
.
$vt
])),
'8u3m'
,
4
)
===
0
))
{
$video
->
__set
(
'hls_'
.
$vt
,
sanitize_text_field
(
$_POST
[
'video_hls_'
.
$vt
]));
}
}
else
$video
->
__set
(
'hls_'
.
$vt
,
false
);
// Download
if
(
array_key_exists
(
'video_download_'
.
$vt
,
$_POST
)
&&
check_url_or_path
(
sanitize_text_field
(
$_POST
[
'video_download_'
.
$vt
])))
{
$video
->
__set
(
'download_'
.
$vt
,
sanitize_text_field
(
$_POST
[
'video_download_'
.
$vt
]));
}
}
else
$video
->
__set
(
'download_'
.
$vt
,
false
);
// Text only data
foreach
(
array
(
'size'
,
'format'
,
'codec'
,
'acodec'
,
'duration'
,
'resolution'
)
as
$key
)
...
...
@@ -159,11 +163,26 @@ function save_sexhack_video_meta_box_data( $post_id )
sanitize_text_field
(
$_POST
[
'video_'
.
$key
.
'_'
.
$vt
]))
{
$video
->
__set
(
$key
.
'_'
.
$vt
,
sanitize_text_field
(
$_POST
[
'video_'
.
$key
.
'_'
.
$vt
]));
}
}
else
$video
->
__set
(
$key
.
'_'
.
$vt
,
false
);
}
}
// Video Categories
if
(
array_key_exists
(
'vcategory'
,
$_POST
)
&&
is_array
(
$_POST
[
'vcategory'
]))
{
foreach
(
$_POST
[
'vcategory'
]
as
$cat_id
)
{
if
(
is_numeric
(
$cat_id
)
&&
intval
(
$cat_id
)
>
0
)
{
$cat
=
sh_get_categories
(
intval
(
$cat_id
));
if
(
$cat
)
$video
->
add_category
(
$cat
);
}
}
}
// Make sure the categories array is initialized
$video
->
get_categories
(
false
);
// Save the video data in the database.
sh_save_video
(
$video
);
...
...
sexhackme.php
View file @
4fce81ab
...
...
@@ -394,6 +394,9 @@ if(!class_exists('SexHackMe_Plugin')) {
/* Unlock integration class */
$this
->
file_include
(
'includes/class-unlock-support.php'
);
/* integrate google drive plugin database support */
$this
->
file_include
(
'includes/class-integrate-google-drive.php'
);
/* Video */
$this
->
file_include
(
'includes/class-video.php'
);
$this
->
file_include
(
'includes/functions-video.php'
);
...
...
templates/admin/metabox_video.php
View file @
4fce81ab
...
...
@@ -58,15 +58,15 @@ echo '<style>div#visibility.misc-pub-section.misc-pub-visibility{display:none}</
<h4>
Preview
</h4>
<p>
<label>
* Thumbnail (URI,PATH or thumbail ID):
</label>
<input
type=
'text'
na
n
e=
"video_thumbnail"
value=
'
<?php
echo
esc_attr
(
$video
->
thumbnail
);
?>
'
>
(Override featured image)
</input>
<input
type=
'text'
na
m
e=
"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'
na
n
e=
"video_gif"
value=
'
<?php
echo
esc_attr
(
$video
->
gif
);
?>
'
/>
<input
type=
'text'
na
m
e=
"video_gif"
value=
'
<?php
echo
esc_attr
(
$video
->
gif
);
?>
'
/>
</p>
<p>
<label>
* Video preview/teaser (max 1 min)
</label>
<input
type=
'text'
na
n
e=
"video_preview"
value=
'
<?php
echo
esc_attr
(
$video
->
preview
);
?>
'
/>
<input
type=
'text'
na
m
e=
"video_preview"
value=
'
<?php
echo
esc_attr
(
$video
->
preview
);
?>
'
/>
<p>
</p>
...
...
@@ -80,8 +80,8 @@ echo '<style>div#visibility.misc-pub-section.misc-pub-visibility{display:none}</
<p>
<label>
* VR Projection
</label>
<select
name=
'video_vr_projection'
>
<option
value=
'VR180_LR'
<?php
if
(
$video
->
v
ideo_v
r_projection
==
'VR180_LR'
)
echo
"selected"
;
?>
>
Equirectangular 180 LR
</option>
<option
value=
'VR360_LR'
<?php
if
(
$video
->
v
ideo_v
r_projection
==
'VR360_LR'
)
echo
"selected"
;
?>
>
Equirectangular 360 LR
</option>
<option
value=
'VR180_LR'
<?php
if
(
$video
->
vr_projection
==
'VR180_LR'
)
echo
"selected"
;
?>
>
Equirectangular 180 LR
</option>
<option
value=
'VR360_LR'
<?php
if
(
$video
->
vr_projection
==
'VR360_LR'
)
echo
"selected"
;
?>
>
Equirectangular 360 LR
</option>
</select>
<label>
(ignored for non VR videos)
</option>
</p>
...
...
@@ -89,7 +89,7 @@ echo '<style>div#visibility.misc-pub-section.misc-pub-visibility{display:none}</
<p>
<h4>
Price:
</h4>
<label>
USD:
</label>
<input
type=
'text'
na
n
e=
"video_price"
value=
'
<?php
echo
esc_attr
(
$video
->
price
);
?>
'
/>
<input
type=
'text'
na
m
e=
"video_price"
value=
'
<?php
echo
esc_attr
(
$video
->
price
);
?>
'
/>
</p>
<p>
<?php
...
...
@@ -119,35 +119,35 @@ echo '<style>div#visibility.misc-pub-section.misc-pub-visibility{display:none}</
<h4>
<?php
echo
ucfirst
(
$vt
);
?>
files
</h4>
<p>
<label>
* Download (URI or PATH):
</label>
<input
type=
'text'
na
n
e=
"video_download_
<?php
echo
$vt
;
?>
"
value=
'
<?php
echo
esc_attr
(
$video
->
__get
(
$vtdown
)
);
?>
'
/>
<input
type=
'text'
na
m
e=
"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'
na
n
e=
"video_hls_
<?php
echo
$vt
;
?>
"
value=
'
<?php
echo
esc_attr
(
$video
->
__get
(
$vthls
)
);
?>
'
/>
<input
type=
'text'
na
m
e=
"video_hls_
<?php
echo
$vt
;
?>
"
value=
'
<?php
echo
esc_attr
(
$video
->
__get
(
$vthls
)
);
?>
'
/>
</p>
</p>
<label>
* Duration:
</label>
<input
type=
'text'
na
n
e=
"video_duration_
<?php
echo
$vt
;
?>
"
value=
'
<?php
echo
esc_attr
(
$video
->
__get
(
$vtduration
)
);
?>
'
/>
<input
type=
'text'
na
m
e=
"video_duration_
<?php
echo
$vt
;
?>
"
value=
'
<?php
echo
esc_attr
(
$video
->
__get
(
$vtduration
)
);
?>
'
/>
</p>
</p>
<label>
* File size:
</label>
<input
type=
'text'
na
n
e=
"video_size_
<?php
echo
$vt
;
?>
"
value=
'
<?php
echo
esc_attr
(
$video
->
__get
(
$vtsize
)
);
?>
'
/>
<input
type=
'text'
na
m
e=
"video_size_
<?php
echo
$vt
;
?>
"
value=
'
<?php
echo
esc_attr
(
$video
->
__get
(
$vtsize
)
);
?>
'
/>
</p>
</p>
<label>
* Resolution:
</label>
<input
type=
'text'
na
n
e=
"video_resolution_
<?php
echo
$vt
;
?>
"
value=
'
<?php
echo
esc_attr
(
$video
->
__get
(
$vtresolution
)
);
?>
'
/>
<input
type=
'text'
na
m
e=
"video_resolution_
<?php
echo
$vt
;
?>
"
value=
'
<?php
echo
esc_attr
(
$video
->
__get
(
$vtresolution
)
);
?>
'
/>
</p>
</p>
<label>
* Format:
</label>
<input
type=
'text'
na
n
e=
"video_format_
<?php
echo
$vt
;
?>
"
value=
'
<?php
echo
esc_attr
(
$video
->
__get
(
$vtformat
)
);
?>
'
/>
<input
type=
'text'
na
m
e=
"video_format_
<?php
echo
$vt
;
?>
"
value=
'
<?php
echo
esc_attr
(
$video
->
__get
(
$vtformat
)
);
?>
'
/>
</p>
</p>
<label>
* Codec:
</label>
<input
type=
'text'
na
n
e=
"video_codec_
<?php
echo
$vt
;
?>
"
value=
'
<?php
echo
esc_attr
(
$video
->
__get
(
$vtcodec
)
);
?>
'
/>
<input
type=
'text'
na
m
e=
"video_codec_
<?php
echo
$vt
;
?>
"
value=
'
<?php
echo
esc_attr
(
$video
->
__get
(
$vtcodec
)
);
?>
'
/>
</p>
</p>
<label>
* Audio codec:
</label>
<input
type=
'text'
na
n
e=
"video_acodec_
<?php
echo
$vt
;
?>
"
value=
'
<?php
echo
esc_attr
(
$video
->
__get
(
$vtacodec
)
);
?>
'
/>
<input
type=
'text'
na
m
e=
"video_acodec_
<?php
echo
$vt
;
?>
"
value=
'
<?php
echo
esc_attr
(
$video
->
__get
(
$vtacodec
)
);
?>
'
/>
</p>
</div>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment