Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Photon-Plugin
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jan Grewe
Photon-Plugin
Commits
5914f569
Commit
5914f569
authored
13 years ago
by
Jeff Stieler
Browse files
Options
Downloads
Patches
Plain Diff
Add XMLRPC request value CDN rewriting.
parent
fe7a194e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
cdn-rewrite.php
+9
-3
9 additions, 3 deletions
cdn-rewrite.php
with
9 additions
and
3 deletions
cdn-rewrite.php
+
9
−
3
View file @
5914f569
...
@@ -50,7 +50,8 @@ class CDN_Rewrite {
...
@@ -50,7 +50,8 @@ class CDN_Rewrite {
}
}
if
(
'/'
!=
$this
->
cdn_root_url
)
{
if
(
'/'
!=
$this
->
cdn_root_url
)
{
add_action
(
'template_redirect'
,
array
(
$this
,
'start_buffer'
),
1
);
$action
=
(
defined
(
'XMLRPC_REQUEST'
)
&&
XMLRPC_REQUEST
)
?
'xmlrpc_call'
:
'template_redirect'
;
add_action
(
$action
,
array
(
$this
,
'start_buffer'
),
1
);
}
}
}
}
...
@@ -130,9 +131,14 @@ class CDN_Rewrite {
...
@@ -130,9 +131,14 @@ class CDN_Rewrite {
* @return string
* @return string
*/
*/
public
function
filter_urls
(
$content
)
{
public
function
filter_urls
(
$content
)
{
$root_url
=
$this
->
get_site_root_url
();
$regex
=
'#(?<=[(\"\'])'
.
quotemeta
(
$root_url
)
.
'(?:(/[^\"\')]+\.('
.
join
(
'|'
,
array
(
$this
->
file_extensions
,
$this
->
css_file_extensions
,
$this
->
js_file_extensions
))
.
')))#'
;
$root_url
=
$this
->
get_site_root_url
();
$xml_begin
=
$xml_end
=
''
;
if
(
defined
(
'XMLRPC_REQUEST'
)
&&
XMLRPC_REQUEST
)
{
$xml_begin
=
'>'
;
$xml_end
=
'<'
;
}
$regex
=
'#(?<=[(\"\''
.
$xml_begin
.
'])'
.
quotemeta
(
$root_url
)
.
'(?:(/[^\"\''
.
$xml_end
.
')]+\.('
.
join
(
'|'
,
array
(
$this
->
file_extensions
,
$this
->
css_file_extensions
,
$this
->
js_file_extensions
))
.
')))#'
;
$content
=
preg_replace_callback
(
$regex
,
array
(
$this
,
'url_rewrite'
),
$content
);
$content
=
preg_replace_callback
(
$regex
,
array
(
$this
,
'url_rewrite'
),
$content
);
return
$content
;
return
$content
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment