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
c9995f8b
Commit
c9995f8b
authored
Jul 14, 2022
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move sh_ function to a separate file
parent
7ac1cb62
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
114 additions
and
79 deletions
+114
-79
functions-core.php
includes/functions-core.php
+109
-0
functions-utils.php
includes/functions-utils.php
+0
-79
sexhackme.php
sexhackme.php
+5
-0
No files found.
includes/functions-core.php
0 → 100644
View file @
c9995f8b
<?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_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_disclaimer
()
{
echo
sh_get_template
(
"blocks/disclaimer.php"
);
}
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
sh_fix_user_with_no_plan
(
$userid
)
{
global
$sexhack_pms
;
if
(
!
(
$sexhack_pms
->
is_member
(
$user
->
ID
))
&&
!
(
$sexhack_pms
->
is_premium
(
$user
->
ID
)))
{
$subscription_plan
=
$sexhack_pms
->
get_default_plan
();
if
(
$subscription_plan
)
{
$data
=
array
(
'user_id'
=>
$userid
,
'subscription_plan_id'
=>
$subscription_plan
->
id
,
'start_date'
=>
date
(
'Y-m-d H:i:s'
),
'expiration_date'
=>
$subscription_plan
->
get_expiration_date
(),
'status'
=>
'active'
,
);
$member_subscription
=
new
\PMS_Member_Subscription
();
$inserted
=
$member_subscription
->
insert
(
$data
);
}
}
}
function
user_has_premium_access
(
$uid
=
''
)
{
global
$sexhack_pms
;
return
$sexhack_pms
->
is_premium
(
$uid
)
AND
is_user_logged_in
();
}
function
user_is_premium
(
$uid
=
''
)
{
global
$sexhack_pms
;
return
$sexhack_pms
->
is_premium
(
$uid
);
}
function
user_has_member_access
(
$uid
=
''
)
{
global
$sexhack_pms
;
if
(
$uid
)
return
$sexhack_pms
->
is_member
(
$uid
)
OR
$sexhack_pms
->
is_premium
(
$uid
);
return
is_user_logged_in
();
}
function
user_is_member
(
$uid
=
''
)
{
global
$sexhack_pms
;
return
$sexhack_pms
->
is_member
(
$uid
);
}
?>
includes/functions-utils.php
View file @
c9995f8b
...
@@ -39,55 +39,6 @@ if(!function_exists('sexhack_log')){
...
@@ -39,55 +39,6 @@ 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_disclaimer
()
{
echo
sh_get_template
(
"blocks/disclaimer.php"
);
}
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
sh_fix_user_with_no_plan
(
$userid
)
{
global
$sexhack_pms
;
if
(
!
(
$sexhack_pms
->
is_member
(
$user
->
ID
))
&&
!
(
$sexhack_pms
->
is_premium
(
$user
->
ID
)))
{
$subscription_plan
=
$sexhack_pms
->
get_default_plan
();
if
(
$subscription_plan
)
{
$data
=
array
(
'user_id'
=>
$userid
,
'subscription_plan_id'
=>
$subscription_plan
->
id
,
'start_date'
=>
date
(
'Y-m-d H:i:s'
),
'expiration_date'
=>
$subscription_plan
->
get_expiration_date
(),
'status'
=>
'active'
,
);
$member_subscription
=
new
\PMS_Member_Subscription
();
$inserted
=
$member_subscription
->
insert
(
$data
);
}
}
}
function
debug_rewrite_rules
(
$matchonly
=
false
)
function
debug_rewrite_rules
(
$matchonly
=
false
)
{
{
$matchonly
=
true
;
$matchonly
=
true
;
...
@@ -155,36 +106,6 @@ function get_proto(){
...
@@ -155,36 +106,6 @@ function get_proto(){
}
}
function
user_has_premium_access
(
$uid
=
''
)
{
global
$sexhack_pms
;
return
$sexhack_pms
->
is_premium
(
$uid
)
AND
is_user_logged_in
();
}
function
user_is_premium
(
$uid
=
''
)
{
global
$sexhack_pms
;
return
$sexhack_pms
->
is_premium
(
$uid
);
}
function
user_has_member_access
(
$uid
=
''
)
{
global
$sexhack_pms
;
if
(
$uid
)
return
$sexhack_pms
->
is_member
(
$uid
)
OR
$sexhack_pms
->
is_premium
(
$uid
);
return
is_user_logged_in
();
}
function
user_is_member
(
$uid
=
''
)
{
global
$sexhack_pms
;
return
$sexhack_pms
->
is_member
(
$uid
);
}
function
send_changepwd_mail
(
$user_login
,
$baseurl
=
false
){
function
send_changepwd_mail
(
$user_login
,
$baseurl
=
false
){
global
$wpdb
,
$wp_hasher
;
global
$wpdb
,
$wp_hasher
;
...
...
sexhackme.php
View file @
c9995f8b
...
@@ -213,6 +213,11 @@ if(!class_exists('SexHackMe_Plugin')) {
...
@@ -213,6 +213,11 @@ if(!class_exists('SexHackMe_Plugin')) {
if
(
file_exists
(
SH_PLUGIN_DIR_PATH
.
'includes/functions-utils.php'
)
)
if
(
file_exists
(
SH_PLUGIN_DIR_PATH
.
'includes/functions-utils.php'
)
)
include_once
SH_PLUGIN_DIR_PATH
.
'includes/functions-utils.php'
;
include_once
SH_PLUGIN_DIR_PATH
.
'includes/functions-utils.php'
;
/* Core functions */
if
(
file_exists
(
SH_PLUGIN_DIR_PATH
.
'includes/functions-core.php'
)
)
include_once
SH_PLUGIN_DIR_PATH
.
'includes/functions-core.php'
;
/* Cryptocurrencies utils */
/* Cryptocurrencies utils */
if
(
file_exists
(
SH_PLUGIN_DIR_PATH
.
'includes/functions-crypto.php'
)
)
if
(
file_exists
(
SH_PLUGIN_DIR_PATH
.
'includes/functions-crypto.php'
)
)
include_once
SH_PLUGIN_DIR_PATH
.
'includes/functions-crypto.php'
;
include_once
SH_PLUGIN_DIR_PATH
.
'includes/functions-crypto.php'
;
...
...
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