camo-image-proxy.php 1.31 KB
Newer Older
Erick Hitter's avatar
Erick Hitter committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<?php
/**
 * Plugin Name:     Camo Image Proxy
 * Plugin URI:      https://ethitter.com/plugins/
 * Description:     Rewrite image URLs to use a Camo image proxy.
 * Author:          Erick Hitter
 * Author URI:      https://ethitter.com/
 * Text Domain:     camo-image-proxy
 * Domain Path:     /languages
 * Version:         0.1.0
 *
 * @package         Camo_Image_Proxy
 */

15 16
namespace Camo_Image_Proxy;

Erick Hitter's avatar
PHPCS  
Erick Hitter committed
17
const PLUGIN_PATH = __DIR__;
18 19 20 21 22

/**
 * Trait for singletons
 */
require_once PLUGIN_PATH . '/inc/trait-singleton.php';
Erick Hitter's avatar
Erick Hitter committed
23 24 25 26 27 28

/**
 * Plugin options
 */
require_once PLUGIN_PATH . '/inc/class-options.php';

Erick Hitter's avatar
Erick Hitter committed
29 30 31
/**
 * Options page
 */
Erick Hitter's avatar
Erick Hitter committed
32
require_once PLUGIN_PATH . '/inc/class-options-page.php';
Erick Hitter's avatar
Erick Hitter committed
33

Erick Hitter's avatar
Erick Hitter committed
34 35 36
/**
 * URL Building
 */
Erick Hitter's avatar
Erick Hitter committed
37
require_once PLUGIN_PATH . '/inc/class-url.php';
Erick Hitter's avatar
Erick Hitter committed
38 39 40 41 42 43 44 45 46 47 48

/**
 * Rewrite WordPress-generated URLs
 */
require_once PLUGIN_PATH . '/inc/class-rewrite-urls.php';

/**
 * Rewrite URLs in post content
 */
require_once PLUGIN_PATH . '/inc/class-rewrite-content.php';

Erick Hitter's avatar
Erick Hitter committed
49 50 51 52
/**
 * Assorted functions
 */
require_once PLUGIN_PATH . '/inc/functions.php';
Erick Hitter's avatar
Erick Hitter committed
53 54 55 56 57 58

/**
 * Load plugin singletons
 */
function init() {
	Options::instance();
Erick Hitter's avatar
Erick Hitter committed
59
	URL::instance();
Erick Hitter's avatar
Erick Hitter committed
60 61 62

	if ( is_admin() ) {
		Options_Page::instance();
63 64 65
	}

	if ( URL::instance()->can_rewrite() ) {
Erick Hitter's avatar
Erick Hitter committed
66 67
		Rewrite_URLs::instance();
		Rewrite_Content::instance();
Erick Hitter's avatar
Erick Hitter committed
68 69 70
	}
}
add_action( 'init', __NAMESPACE__ . '\init' );