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
fd4dd83d
Commit
fd4dd83d
authored
Aug 06, 2024
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PPV and discount for premium members on PPVs
parent
b5c7d0aa
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
296 additions
and
142 deletions
+296
-142
functions-wcpms.php
includes/admin/functions-wcpms.php
+7
-0
class-admin.php
includes/class-admin.php
+1
-0
class-video.php
includes/class-video.php
+1
-0
class-videogallery.php
includes/class-videogallery.php
+5
-1
class-woocommerce-support.php
includes/class-woocommerce-support.php
+242
-138
functions-forms-save.php
includes/functions-forms-save.php
+6
-0
sexhackme.php
sexhackme.php
+3
-1
metabox_video.php
templates/admin/metabox_video.php
+6
-0
wcpms.php
templates/admin/wcpms.php
+12
-0
new_video.php
templates/new_video.php
+7
-0
video.php
templates/video.php
+6
-2
No files found.
includes/admin/functions-wcpms.php
View file @
fd4dd83d
...
...
@@ -30,11 +30,18 @@ function wcpms_adminpage()
sh_get_template
(
'admin/wcpms.php'
);
}
function
settings_wcpms_section
()
{
echo
"<h2>SexHackMe PMS - WooCommerce integration Settings</h2>"
;
}
function
settings_wcpms_section_premium_discount
()
{
echo
"<h2>Premium users discount on Videos</h2>"
;
}
function
settings_wcpms_section_email
()
{
echo
"<h2>WooCommerce Checkout Email endpoint</h2>"
;
...
...
includes/class-admin.php
View file @
fd4dd83d
...
...
@@ -61,6 +61,7 @@ if(!class_exists('SH_Admin')) {
add_settings_section
(
'sexhackme-wcpms-settings'
,
' '
,
'wp_SexHackMe\settings_wcpms_section_prodcat'
,
'sexhackme-wcpms-settings-prodcat'
);
register_setting
(
'sexhackme-wcpms-settings'
,
'sexhack_wcpms-prodcat'
);
register_setting
(
'sexhackme-wcpms-settings'
,
'sexhack_wcpms-prodvisible'
);
register_setting
(
'sexhackme-wcpms-settings'
,
'sexhack_wcpms_premium_discount'
);
}
...
...
includes/class-video.php
View file @
fd4dd83d
...
...
@@ -51,6 +51,7 @@ if(!class_exists('SH_Video')) {
'hls_public'
=>
false
,
'hls_members'
=>
false
,
'hls_premium'
=>
false
,
'premium_is_ppv'
=>
'N'
,
'thumbnail'
=>
false
,
'gif'
=>
false
,
'gif_small'
=>
false
,
...
...
includes/class-videogallery.php
View file @
fd4dd83d
...
...
@@ -116,6 +116,7 @@ if(!class_exists('SH_VideoGallery')) {
$hls_premium
=
$video
->
hls_premium
;
$video_preview
=
$video
->
preview
;
$gif_preview
=
$video
->
gif_small
;
$premium_is_ppv
=
$video
->
premium_is_ppv
;
//sexhack_log($video);
...
...
@@ -140,7 +141,10 @@ if(!class_exists('SH_VideoGallery')) {
if
(
$hls_public
)
$vtags
[]
=
'<label class="sexhack_vtag sexhack_public" style="*LEFT*">public</label>'
;
elseif
(
$video_preview
)
$vtags
[]
=
'<label class="sexhack_vtag sexhack_preview" style="*LEFT*">preview</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
(
$hls_premium
)
{
if
(
$video
->
ppv_is_ppv
)
$vtags
[]
=
'<label class="sexhack_vtag sexhack_premium" style="*LEFT*">PPV</label>'
;
else
$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>'
;
...
...
includes/class-woocommerce-support.php
View file @
fd4dd83d
This diff is collapsed.
Click to expand it.
includes/functions-forms-save.php
View file @
fd4dd83d
...
...
@@ -135,6 +135,11 @@ function save_sexhack_video_forms( $post_id)
if
(
array_key_exists
(
'video_private'
,
$_POST
)
&&
in_array
(
$_POST
[
'video_private'
],
array
(
'Y'
,
'N'
)))
$video
->
private
=
$_POST
[
'video_private'
];
// Premium Video is PPV?
if
(
array_key_exists
(
'premium_is_ppv'
,
$_POST
)
&&
in_array
(
$_POST
[
'premium_is_ppv'
],
array
(
'Y'
,
'N'
)))
$video
->
premium_is_ppv
=
$_POST
[
'premium_is_ppv'
];
// Video visible
if
(
array_key_exists
(
'video_visible'
,
$_POST
)
&&
in_array
(
$_POST
[
'video_visible'
],
array
(
'Y'
,
'N'
)))
$video
->
visible
=
$_POST
[
'video_visible'
];
...
...
@@ -148,6 +153,7 @@ function save_sexhack_video_forms( $post_id)
if
(
array_key_exists
(
'video_type'
,
$_POST
)
&&
in_array
(
$_POST
[
'video_type'
],
array
(
'VR'
,
'FLAT'
)))
$video
->
video_type
=
$_POST
[
'video_type'
];
// VR Projection
if
(
array_key_exists
(
'video_vr_projection'
,
$_POST
)
&&
in_array
(
$_POST
[
'video_vr_projection'
],
array
(
'VR180_LR'
,
'VR360_LR'
)))
$video
->
vr_projection
=
$_POST
[
'video_vr_projection'
];
...
...
sexhackme.php
View file @
fd4dd83d
...
...
@@ -47,7 +47,7 @@ if(!class_exists('SexHackMe_Plugin')) {
public
function
__construct
()
{
define
(
'SH_VERSION'
,
'0.0.
2
'
);
define
(
'SH_VERSION'
,
'0.0.
3
'
);
define
(
'SH_PLUGIN_DIR_PATH'
,
plugin_dir_path
(
__FILE__
)
);
define
(
'SH_PLUGIN_DIR_URL'
,
plugin_dir_url
(
__FILE__
)
);
define
(
'SH_PLUGIN_BASENAME'
,
plugin_basename
(
__FILE__
)
);
...
...
@@ -190,6 +190,7 @@ if(!class_exists('SexHackMe_Plugin')) {
download_public varchar(1024) DEFAULT NULL,
download_members varchar(1024) DEFAULT NULL,
download_premium varchar(1024) DEFAULT NULL,
premium_is_ppv ENUM('Y', 'N') NOT NULL DEFAULT 'N',
size_public varchar(256) DEFAULT NULL,
size_members varchar(256) DEFAULT NULL,
size_premium varchar(256) DEFAULT NULL,
...
...
@@ -218,6 +219,7 @@ if(!class_exists('SexHackMe_Plugin')) {
KEY post_id (post_id),
KEY slug (slug),
KEY price (price),
KEY premium_is_ppv (premium_is_ppc),
KEY video_type (video_type),
KEY product_id (product_id)
)
{
$charset_collate
}
;
...
...
templates/admin/metabox_video.php
View file @
fd4dd83d
...
...
@@ -108,6 +108,12 @@ if($video->product_id > 0)
<label>
USD:
</label>
<input
type=
'text'
name=
"video_price"
value=
'
<?php
echo
esc_attr
(
$video
->
price
);
?>
'
/>
</p>
<p>
<h4>
is premium a PPV?
</h4>
<input
type=
'radio'
name=
'premium_is_ppv'
value=
'Y'
<?php
if
(
$video
->
premium_is_ppv
==
'Y'
)
echo
"checked"
;
?>
>
Yes
</input>
<input
type=
'radio'
name=
'premium_is_ppv'
value=
'N'
<?php
if
(
$video
->
premium_is_ppv
==
'N'
)
echo
"checked"
;
?>
>
No
</input>
</p>
<p>
<?php
$vaccess
=
array
(
'public'
,
'members'
,
'premium'
);
...
...
templates/admin/wcpms.php
View file @
fd4dd83d
...
...
@@ -62,6 +62,18 @@ $plans = wp_SexHackMe\sh_get_subscription_plans();
}
?>
</table>
<table
class=
"form-table"
>
<tr
align=
"top"
>
<td>
<label><b>
Premium member discount on PPVs
</b></label><br>
<input
type=
'number'
name=
'sexhack_wcpms_premium_discount'
value=
"
<?php
echo
get_option
(
'sexhack_wcpms_premium_discount'
,
'0'
);
?>
"
/>
<p
class=
"description"
>
insert a percentage of discount all premium members will have on PPV videos
</p>
</td>
</tr>
</table>
<?php
do_settings_sections
(
'sexhackme-wcpms-settings-email'
);
?>
<table
class=
"form-table"
>
<tr
align=
"top"
>
...
...
templates/new_video.php
View file @
fd4dd83d
...
...
@@ -120,6 +120,13 @@ foreach(array('public','members','premium') as $level) { ?>
<input
type=
'radio'
name=
'video_isdownload_
<?php
echo
$level
;
?>
'
value=
'N'
<?php
if
(
!
$video
->
has_downloads
(
$level
))
echo
"checked"
;
?>
>
No
</input>
</p>
<?php
if
(
$level
==
'premium'
)
{
?>
<p>
<label>
Is premium video a PPV?
</label>
<input
type=
'radio'
name=
'premium_is_ppv'
value=
'Y'
<?php
if
(
$video
->
premium_is_ppv
==
'Y'
)
echo
"checked"
;
?>
>
Yes
</input>
<input
type=
'radio'
name=
'premium_is_ppv'
value=
'N'
<?php
if
(
$video
->
premium_is_ppv
==
'N'
)
echo
"checked"
;
?>
>
No
</input>
</p>
<p>
<label>
Create Members video HLS from this video?
</label>
<input
type=
'radio'
name=
'video_createMembers_
<?php
echo
$level
;
?>
'
value=
'Y'
>
Yes
</input>
...
...
templates/video.php
View file @
fd4dd83d
...
...
@@ -84,6 +84,7 @@ get_header(); ?>
$video_preview
=
$video
->
preview
;
$gif_preview
=
$video
->
gif_small
;
$gif
=
$video
->
gif
;
$premium_is_ppv
=
$video
->
premium_is_ppv
;
$categories
=
$video
->
get_categories
(
true
);
...
...
@@ -116,7 +117,7 @@ get_header(); ?>
else
{
if
(
user_has_premium_access
()
||
$video
->
user_bought_video
())
{
if
(
$hls_premium
)
$tab
=
'subscribers'
;
if
(
$hls_premium
&&
((
!
$premium_is_ppv
)
||
$video
->
user_bought_video
()
)
)
$tab
=
'subscribers'
;
elseif
(
$hls_members
)
$tab
=
'members'
;
else
$tab
=
'public'
;
}
...
...
@@ -162,7 +163,7 @@ get_header(); ?>
break
;
case
"subscribers"
:
if
(
user_has_premium_access
(
)
||
$video
->
user_bought_video
())
if
(
(
user_has_premium_access
()
&&
!
$premium_is_ppv
)
||
$video
->
user_bought_video
())
{
if
(
$filterurl
&&
$hls_premium
&&
$video
->
video_type
==
"VR"
)
echo
do_shortcode
(
"[sexvideo url=
\"
"
.
wp_nonce_url
(
$filterurl
.
$sh_video
.
"/premium/"
.
basename
(
$hls_premium
),
'shm_premium_video-'
.
$video
->
id
)
.
"
\"
posters=
\"
"
.
$thumb
.
"
\"
]"
);
...
...
@@ -252,6 +253,9 @@ get_header(); ?>
</div>
<?php
}
?>
<?php
if
(
!
$video
->
user_bought_video
()
&&
$hls_premium
&&
$premium_is_ppv
)
{
?>
<h3><a
href=
"
<?php
echo
get_permalink
(
$video
->
product_id
);
?>
"
>
Buy unlimited full access to this video
</a></h3>
<?php
}
?>
<?php
if
(
$video
->
has_downloads
())
{
?>
<h3><a
href=
"
<?php
echo
get_permalink
(
$video
->
product_id
);
?>
"
>
Download the full lenght hi-res version of this video
</a></h3>
...
...
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