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
97d18005
Commit
97d18005
authored
Jul 19, 2022
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete post actions
parent
deaa6c7b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
98 additions
and
43 deletions
+98
-43
class-post_type-video.php
includes/class-post_type-video.php
+55
-0
class-query.php
includes/class-query.php
+21
-11
functions-core.php
includes/functions-core.php
+0
-30
functions-utils.php
includes/functions-utils.php
+18
-0
sexhackme.php
sexhackme.php
+4
-2
No files found.
includes/class-post_type-video.php
0 → 100644
View file @
97d18005
<?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_PostType_Video'
))
{
class
SH_PostType_Video
{
public
function
__construct
()
{
add_action
(
'delete_post'
,
array
(
$this
,
'delete_post'
),
10
,
2
);
}
public
function
delete_post
(
$post_id
,
$post
)
{
// Make sure is the right post_type or exit
if
(
!
is_object
(
$post
)
||
(
$post
->
post_type
!=
'sexhack_video'
))
return
;
sh_delete_video_from_post
(
$post_id
);
}
}
// run
new
SH_PostType_Video
;
}
?>
includes/class-query.php
View file @
97d18005
...
...
@@ -81,25 +81,35 @@ if(!class_exists('SH_Query')) {
}
}
public
static
function
get
_Video
(
$id
,
$idtype
=
''
)
public
static
function
delete
_Video
(
$id
,
$idtype
=
''
)
{
global
$wpdb
;
if
(
!
is_integer
(
$id
))
return
;
switch
(
$idtype
)
{
case
"product"
:
case
"post"
:
$idtype
=
$idtype
.
"_id"
;
break
;
default
:
$idtype
=
"id"
;
$idtype
=
sanitize_idtype
(
$idtype
);
if
(
!
$idtype
)
return
false
;
$sql
=
"DELETE FROM
{
$wpdb
->
prefix
}
"
.
SH_PREFIX
.
"videos WHERE
{
$idtype
}
="
.
intval
(
$id
);
return
$wpdb
->
query
(
$sql
);
}
public
static
function
get_Video
(
$id
,
$idtype
=
''
)
{
global
$wpdb
;
if
(
!
is_integer
(
$id
))
return
;
$idtype
=
sanitize_idtype
(
$idtype
);
if
(
!
$idtype
)
return
false
;
// TODO sanitize query
$sql
=
"SELECT * from
{
$wpdb
->
prefix
}
"
.
SH_PREFIX
.
"videos WHERE
{
$idtype
}
="
.
intval
(
$id
);
$sql
=
"SELECT * FROM
{
$wpdb
->
prefix
}
"
.
SH_PREFIX
.
"videos WHERE
{
$idtype
}
="
.
intval
(
$id
);
$dbres
=
$wpdb
->
get_results
(
$sql
);
if
(
is_array
(
$dbres
)
&&
count
(
$dbres
)
>
0
)
{
...
...
includes/functions-core.php
View file @
97d18005
...
...
@@ -32,36 +32,6 @@ function sh_get_template($tmpl, $args=array())
return
false
;
}
function
sh_save_video
(
$video
)
{
return
SH_Query
::
save_Video
(
$video
);
}
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
;
}
function
sh_get_subscription_plans
()
{
return
pms_get_subscription_plans
();
...
...
includes/functions-utils.php
View file @
97d18005
...
...
@@ -39,6 +39,24 @@ if(!function_exists('sexhack_log')){
}
function
sanitize_idtype
(
$idt
=
false
)
{
if
((
!
$idt
)
||
(
$idt
==
''
))
$idt
=
'id'
;
switch
(
$idt
)
{
case
'post'
:
case
'product'
:
return
$idt
.
"_id"
;
break
;
case
'id'
:
return
$idt
;
break
;
default
:
return
false
;
}
}
function
debug_rewrite_rules
(
$matchonly
=
false
)
{
$matchonly
=
true
;
...
...
sexhackme.php
View file @
97d18005
...
...
@@ -375,6 +375,8 @@ if(!class_exists('SexHackMe_Plugin')) {
/* Video */
$this
->
file_include
(
'includes/class-video.php'
);
$this
->
file_include
(
'includes/functions-video.php'
);
$this
->
file_include
(
'includes/class-post_type-video.php'
);
/* Video Gallery */
$this
->
file_include
(
'includes/class-videogallery.php'
);
...
...
@@ -609,8 +611,8 @@ if(!class_exists('SexHackMe_Plugin')) {
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);
}
...
...
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