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

Prepare for content rewrites

parent d62b3234
No related branches found
No related tags found
3 merge requests!6add linting,!5WIP: Add JUnit reporting,!4WIP: Initial release
This commit is part of merge request !4. Comments created here will be created in the context of that merge request.
......@@ -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;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment