PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / 2.3.2
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF v2.3.2
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
imagify / inc / main.php

main.php in Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF 2.3.2, at inc/main.php

60 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 use Imagify\Dependencies\League\Container\Container;
3 use Imagify\Plugin;
4
5 defined( 'ABSPATH' ) || exit;
6
7 if ( file_exists( IMAGIFY_PATH . 'vendor/autoload.php' ) ) {
8 require_once IMAGIFY_PATH . 'vendor/autoload.php';
9 }
10
11 require_once IMAGIFY_PATH . 'inc/Dependencies/ActionScheduler/action-scheduler.php';
12
13 /**
14 * Plugin init.
15 *
16 * @since 1.0
17 */
18 function imagify_init() {
19 // Nothing to do during autosave.
20 if ( defined( 'DOING_AUTOSAVE' ) ) {
21 return;
22 }
23
24 $providers = require_once IMAGIFY_PATH . 'config/providers.php';
25
26 $plugin = new Plugin(
27 new Container(),
28 [
29 'plugin_path' => IMAGIFY_PATH,
30 ]
31 );
32
33 $plugin->init( $providers );
34
35 // Boot the MCP adapter after providers/subscribers are wired so that
36 // ConfigSubscriber and AbilitiesSubscriber are already listening before
37 // the adapter fires `mcp_adapter_init` / `wp_abilities_api_*` actions
38 // (those fire from `rest_api_init` priority 15, well after `plugins_loaded`).
39 $can_boot_mcp_adapter =
40 class_exists( \WP\MCP\Core\McpAdapter::class )
41 && function_exists( 'wp_register_ability' )
42 && function_exists( 'wp_get_ability' )
43 && function_exists( 'wp_get_abilities' )
44 && function_exists( 'wp_register_ability_category' );
45
46 if ( $can_boot_mcp_adapter ) {
47 \WP\MCP\Core\McpAdapter::instance();
48
49 // Boot the shared MCP OAuth library (wp-media/mcp-oauth) so Claude Desktop
50 // (and any other MCP client) can authenticate against the isolated
51 // `mcp-oauth-server` it registers. The library self-wires its own
52 // WordPress hooks and is enabled by default; Imagify has no custom OAuth
53 // code. It relies on the MCP adapter, so it only boots when the adapter can.
54 if ( class_exists( \WPMedia\MCP\OAuth\Bootstrap::class ) ) {
55 \WPMedia\MCP\OAuth\Bootstrap::instance();
56 }
57 }
58 }
59 add_action( 'plugins_loaded', 'imagify_init' );
60