Commit 04f20145 authored by Erick Hitter's avatar Erick Hitter

Prepare for content rewrites

parent d62b3234
......@@ -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' );
<?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;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment