Skip to content
Snippets Groups Projects
Commit 04f20145 authored by Erick Hitter's avatar Erick Hitter
Browse files

Prepare for content rewrites

parent d62b3234
Branches
No related tags found
3 merge requests!6add linting,!5WIP: Add JUnit reporting,!4WIP: Initial release
...@@ -56,11 +56,14 @@ require_once PLUGIN_PATH . '/inc/functions.php'; ...@@ -56,11 +56,14 @@ require_once PLUGIN_PATH . '/inc/functions.php';
*/ */
function init() { function init() {
Options::instance(); Options::instance();
URL::instance();
// Don't rewrite in the admin!
if ( is_admin() ) { if ( is_admin() ) {
Options_Page::instance(); Options_Page::instance();
} else {
Rewrite_URLs::instance();
Rewrite_Content::instance();
} }
Rewrite_URLs::instance();
} }
add_action( 'init', __NAMESPACE__ . '\init' ); add_action( 'init', __NAMESPACE__ . '\init' );
<?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;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment