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
7414e5c6
Commit
7414e5c6
authored
Jun 15, 2022
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix rewrite
parent
cf8c843f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
6 deletions
+23
-6
sexhack_gallery.php
classes/sexhack_gallery.php
+21
-4
genutils.php
helpers/genutils.php
+1
-0
sexhackme.php
sexhackme.php
+1
-2
.video.php.swp
template/.video.php.swp
+0
-0
No files found.
classes/sexhack_gallery.php
View file @
7414e5c6
...
@@ -23,6 +23,14 @@ if(!class_exists('SexHackVideoGallery')) {
...
@@ -23,6 +23,14 @@ if(!class_exists('SexHackVideoGallery')) {
}
}
public
function
check_rewrite
(
$rules
)
{
// TODO Check if our rules are present and call flush if not
sexhack_log
(
$rules
);
return
$rules
;
}
public
function
add_css
()
public
function
add_css
()
{
{
wp_enqueue_style
(
'sexhackme_gallery'
,
plugin_dir_url
(
__DIR__
)
.
'css/sexhackme_gallery.css'
);
wp_enqueue_style
(
'sexhackme_gallery'
,
plugin_dir_url
(
__DIR__
)
.
'css/sexhackme_gallery.css'
);
...
@@ -96,9 +104,18 @@ if(!class_exists('SexHackVideoGallery')) {
...
@@ -96,9 +104,18 @@ if(!class_exists('SexHackVideoGallery')) {
));
));
$projects_structure
=
'/v/%wooprod%/'
;
$projects_structure
=
'/v/%wooprod%/'
;
$rules
=
$wp_rewrite
->
wp_rewrite_rules
();
// XXX This is HORRIBLE. Using a Try/Catch to test an array key is stupid. But apparently php is also
// stupid and array_key_exists() doesn't work.
try
{
sexhack_log
(
"REWRITE: rules OK: "
.
'v/([^/]+)/?$ => '
.
$rules
[
'v/([^/]+)/?$'
]);
}
catch
(
Exception
$e
)
{
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
(
"%wooprod%"
,
'([^/]+)'
,
"post_type=sexhack_video&wooprod="
);
$wp_rewrite
->
add_permastruct
(
'v'
,
$projects_structure
,
false
);
$wp_rewrite
->
add_permastruct
(
'v'
,
$projects_structure
,
false
);
//$projects_structure = '/v/%sexhackmodel%/%sexhackvideo%/'; // are we really using /v/ also for this? how we get 2 tags?
$wp_rewrite
->
flush_rules
();
}
}
}
...
...
helpers/genutils.php
View file @
7414e5c6
...
@@ -4,6 +4,7 @@ namespace wp_SexHackMe;
...
@@ -4,6 +4,7 @@ namespace wp_SexHackMe;
function
debug_rewrite_rules
(
$matchonly
=
false
)
function
debug_rewrite_rules
(
$matchonly
=
false
)
{
{
$matchonly
=
true
;
global
$wp_rewrite
,
$wp
,
$template
;
global
$wp_rewrite
,
$wp
,
$template
;
$i
=
1
;
$i
=
1
;
if
(
!
empty
(
$wp_rewrite
->
rules
))
{
if
(
!
empty
(
$wp_rewrite
->
rules
))
{
...
...
sexhackme.php
View file @
7414e5c6
...
@@ -207,8 +207,7 @@ if(!class_exists('SexHackMe')) {
...
@@ -207,8 +207,7 @@ if(!class_exists('SexHackMe')) {
// DEBUG REWRITE RULES
// DEBUG REWRITE RULES
if
(
WP_DEBUG
===
true
){
if
(
WP_DEBUG
===
true
){
// only matched?
// only matched?
$matched
=
true
;
add_action
(
"the_post"
,
'wp_SexHackMe\debug_rewrite_rules'
);
add_action
(
"the_post"
,
'wp_SexHackMe\debug_rewrite_rules'
,
$matched
);
}
}
...
...
template/.video.php.swp
deleted
100644 → 0
View file @
cf8c843f
File deleted
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