$checks[ $plugin->get_id() ] = $plugin->get_name();
} elseif ( ! $is_using_cdn && $plugin->is_serving_webp() ) {
$checks[ $plugin->get_id() ] = $plugin->get_name();
}
}
return $checks;
}
/**
* Get a list of active plugins that convert and/or serve webp images.
*
* @since 3.4
* @access private
* @author Grégory Viguier
*
* @return array An array of Webp_Interface objects.
*/
private function get_webp_plugins() {
/**
* Add Webp plugins.
*
* @since 3.4
* @author Grégory Viguier
*
* @param array $webp_plugins An array of Webp_Interface objects.
*/
$webp_plugins = (array) apply_filters( 'rocket_webp_plugins', [] );
if ( ! $webp_plugins ) {
// Somebody probably messed up.
return [];
}
foreach ( $webp_plugins as $i => $plugin ) {
if ( ! is_a( $plugin, '\WP_Rocket\Subscriber\Third_Party\Plugins\Images\Webp\Webp_Interface' ) ) {
unset( $webp_plugins[ $i ] );
continue;
}
if ( ! $this->is_plugin_active( $plugin->get_basename() ) ) {
unset( $webp_plugins[ $i ] );
continue;
}
}
return $webp_plugins;
}
/**
* Tell if a plugin is active.
*
* @since 3.4
* @access public
* @see \plugin_basename()
* @author Grégory Viguier
*
* @param string $plugin_basename A plugin basename.
* @return bool
*/
private function is_plugin_active( $plugin_basename ) {
if ( \doing_action( 'deactivate_' . $plugin_basename ) ) {
return false;
}
if ( \doing_action( 'activate_' . $plugin_basename ) ) {
return true;
}
return \rocket_is_plugin_active( $plugin_basename );
}
/**
* Tell if WP Rocket uses a CDN for images.
*
* @since 3.4
* @access private
* @author Grégory Viguier
*
* @return bool
*/
private function is_using_cdn() {
// Don't use `$this->options_data->get( 'cdn' )` here, we need an up-to-date value when the CDN option changes.
$use = get_rocket_option( 'cdn' ) && $this->cdn_subscriber->get_cdn_hosts( [], [ 'all', 'images' ] );
/**
* Filter whether WP Rocket is using a CDN for webp images.
*
* @since 3.4
* @author Grégory Viguier
*
* @param bool $use True if WP Rocket is using a CDN for webp images. False otherwise.
*/
return (bool) apply_filters( 'rocket_webp_is_using_cdn', $use );
}
}
Fatal error: Uncaught Error: Call to a member function withArgument() on null in /home/payon/public_html/wp-content/plugins/wp-rocket/inc/classes/ServiceProvider/class-common-subscribers.php:73
Stack trace:
#0 /home/payon/public_html/wp-content/plugins/wp-rocket/vendor/league/container/src/ServiceProvider/ServiceProviderAggregate.php(84): WP_Rocket\ServiceProvider\Common_Subscribers->register()
#1 /home/payon/public_html/wp-content/plugins/wp-rocket/vendor/league/container/src/Container.php(88): League\Container\ServiceProvider\ServiceProviderAggregate->register('cdn_subscriber')
#2 /home/payon/public_html/wp-content/plugins/wp-rocket/inc/classes/class-plugin.php(186): League\Container\Container->get('cdn_subscriber')
#3 /home/payon/public_html/wp-content/plugins/wp-rocket/inc/main.php(40): WP_Rocket\Plugin->load()
#4 /home/payon/public_html/wp-includes/class-wp-hook.php(308): rocket_init('')
#5 /home/payon/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
#6 /home/payon/public_html/wp-in in /home/payon/public_html/wp-content/plugins/wp-rocket/inc/classes/ServiceProvider/class-common-subscribers.php on line 73