getContainer()->get( 'options' ); // Busting Factory. $this->getContainer()->add( 'busting_factory', 'WP_Rocket\Addon\Busting\BustingFactory' ) ->withArgument( rocket_get_constant( 'WP_ROCKET_CACHE_BUSTING_PATH' ) ) ->withArgument( rocket_get_constant( 'WP_ROCKET_CACHE_BUSTING_URL' ) ); // Facebook Tracking Subscriber. $this->getContainer()->share( 'facebook_tracking', 'WP_Rocket\Addon\FacebookTracking\Subscriber' ) ->withArgument( $this->getContainer()->get( 'busting_factory' ) ) ->withArgument( $options ); // Google Tracking Subscriber. $this->getContainer()->share( 'google_tracking', 'WP_Rocket\Addon\GoogleTracking\Subscriber' ) ->withArgument( $this->getContainer()->get( 'busting_factory' ) ) ->withArgument( $options ); // Sucuri Addon. $this->getContainer()->share( 'sucuri_subscriber', 'WP_Rocket\Subscriber\Third_Party\Plugins\Security\Sucuri_Subscriber' ) ->withArgument( $options ); // Cloudflare Addon. $this->addon_cloudflare( $options ); } /** * Adds Cloudflare Addon into the Container when the addon is enabled. * * @since 3.5 * * @param Options_Data $options Instance of options. */ protected function addon_cloudflare( Options_Data $options ) { // If the addon is not enabled, delete the transient and bail out. Don't load the addon. if ( ! (bool) $options->get( 'do_cloudflare', false ) ) { delete_transient( 'rocket_cloudflare_is_api_keys_valid' ); return; } $this->provides[] = 'cloudflare_subscriber'; $this->getContainer()->add( 'cloudflare_api', 'WPMedia\Cloudflare\APIClient' ) ->withArgument( rocket_get_constant( 'WP_ROCKET_VERSION' ) ); $this->getContainer()->add( 'cloudflare', 'WPMedia\Cloudflare\Cloudflare' ) ->withArgument( $options ) ->withArgument( $this->getContainer()->get( 'cloudflare_api' ) ); $this->getContainer()->share( 'cloudflare_subscriber', 'WPMedia\Cloudflare\Subscriber' ) ->withArgument( $this->getContainer()->get( 'cloudflare' ) ) ->withArgument( $options ) ->withArgument( $this->getContainer()->get( 'options_api' ) ); } }