Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
WP Plugins
camo-image-proxy
Commits
04f20145
Commit
04f20145
authored
Feb 18, 2018
by
Erick Hitter
Browse files
Prepare for content rewrites
parent
d62b3234
Changes
2
Hide whitespace changes
Inline
Side-by-side
camo-image-proxy.php
View file @
04f20145
...
...
@@ -56,11 +56,14 @@ require_once PLUGIN_PATH . '/inc/functions.php';
*/
function
init
()
{
Options
::
instance
();
URL
::
instance
();
// Don't rewrite in the admin!
if
(
is_admin
()
)
{
Options_Page
::
instance
();
}
else
{
Rewrite_URLs
::
instance
();
Rewrite_Content
::
instance
();
}
Rewrite_URLs
::
instance
();
}
add_action
(
'init'
,
__NAMESPACE__
.
'\init'
);
inc/class-rewrite-content.php
View file @
04f20145
<?php
/**
* Rewrite images in content
*
* @package Camo_Image_Proxy
*/
namespace
Camo_Image_Proxy
;
/**
* Class Rewrite_Content
*/
class
Rewrite_Content
{
use
Singleton
;
/**
* Filter priority
*
* @var int
*/
private
$priority
;
/**
* Hooks
*/
public
function
setup
()
{
$priority
=
apply_filters
(
'camo_image_proxy_rewrite_content_priority'
,
PHP_INT_MAX
-
1
);
$this
->
priority
=
absint
(
$priority
);
add_filter
(
'the_content'
,
[
$this
,
'filter_the_content'
],
$this
->
priority
);
}
/**
* Rewrite image URLs in content
*
* @param string $content Post content.
* @return string
*/
public
function
filter_the_content
(
string
$content
)
:
string
{
// TODO: only deal with image srcs, use DOM Document.
return
$content
;
}
}
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