bp( $srcset_values, $extensions ) {
if ( ! $srcset_values ) {
return false;
}
if ( ! is_array( $srcset_values ) ) {
$srcset_values = explode( ',', $srcset_values );
}
$has_webp = false;
foreach ( $srcset_values as $i => $srcset_value ) {
$srcset_value = preg_split( '/\s+/', trim( $srcset_value ) );
if ( count( $srcset_value ) > 2 ) {
// Not a good idea to have space characters in file name.
$descriptor = array_pop( $srcset_value );
$srcset_value = [
'url' => implode( ' ', $srcset_value ),
'descriptor' => $descriptor,
];
} else {
$srcset_value = [
'url' => $srcset_value[0],
'descriptor' => ! empty( $srcset_value[1] ) ? $srcset_value[1] : '1x',
];
}
$url_webp = $this->url_to_webp( $srcset_value['url'], $extensions );
if ( ! $url_webp ) {
$srcset_values[ $i ] = implode( ' ', $srcset_value );
continue;
}
$srcset_values[ $i ] = $url_webp . ' ' . $srcset_value['descriptor'];
$has_webp = true;
}
if ( ! $has_webp ) {
return false;
}
return implode( ',', $srcset_values );
}
/**
* Get a list of URL/path associations.
* URLs are schema-less, starting by a double slash.
*
* @since 3.4
*
* @return array A list of URLs as keys and paths as values.
*/
private function get_url_to_path_associations() {
static $list;
if ( isset( $list ) ) {
return $list;
}
$content_url = preg_replace( '@^https?:@', '', content_url( '/' ) );
$content_dir = trailingslashit( rocket_get_constant( 'WP_CONTENT_DIR' ) );
$list = [ $content_url => $content_dir ];
$upload = wp_upload_dir();
$upload_dir = trailingslashit( $upload['basedir'] );
if ( strpos( $upload_dir, $content_dir ) === false ) {
$upload_url = preg_replace( '@^https?:@', '', trailingslashit( $upload['baseurl'] ) );
$list[ $upload_url ] = $upload_dir;
}
/**
* Filter the list of URL/path associations.
* The URLs with the most levels must come first.
*
* @since 3.4
*
* @param array $list The list of URL/path associations. URLs are schema-less, starting by a double slash.
*/
$list = apply_filters( 'rocket_url_to_path_associations', $list );
$list = array_filter(
$list,
function ( $path, $url ) {
return $path && $url && is_string( $path ) && is_string( $url );
},
ARRAY_FILTER_USE_BOTH
);
if ( $list ) {
$list = array_unique( $list );
}
return $list;
}
/**
* Get a list of plugins that serve webp images on frontend.
* If the CDN is used, this won't list plugins that use a technique not compatible with CDN.
*
* @since 3.4
*
* @return array The WebP plugin names.
*/
private function get_plugins_serving_webp() {
$webp_plugins = $this->get_webp_plugins();
if ( ! $webp_plugins ) {
// Somebody probably messed up.
return [];
}
$checks = [];
$is_using_cdn = $this->is_using_cdn();
foreach ( $webp_plugins as $plugin ) {
if ( $is_using_cdn && $plugin->is_serving_webp_compatible_with_cdn() ) {
$checks[ $plugin->get_id() ] = $plugin->get_name();
} elseif ( ! $is_using_cdn && $plugin->is_serving_webp() ) {
$checks[ $plugin->get_id() ] = $plugin->get_name();
}
}
return $checks;
}
/**
* Change Youtube thumbnail extension.
*
* @param string $extension extension from the thumbnail.
*
* @return string
*/
public function change_youtube_thumbnail( $extension ) {
if ( ! $this->options_data->get( 'cache_webp', 0 ) ) {
return $extension;
}
return 'webp';
}
}
Fatal error: Uncaught TypeError: Argument 1 passed to WP_Rocket\Event_Management\Event_Manager::add_subscriber() must implement interface WP_Rocket\Event_Management\Subscriber_Interface, string given, called in /home/merciket/public_html/wp-content/plugins/wp-rocket/inc/Plugin.php on line 155 and defined in /home/merciket/public_html/wp-content/plugins/wp-rocket/inc/classes/event-management/class-event-manager.php:33
Stack trace:
#0 /home/merciket/public_html/wp-content/plugins/wp-rocket/inc/Plugin.php(155): WP_Rocket\Event_Management\Event_Manager->add_subscriber('WP_Rocket\\Addon...')
#1 /home/merciket/public_html/wp-content/plugins/wp-rocket/inc/main.php(42): WP_Rocket\Plugin->load()
#2 /home/merciket/public_html/wp-includes/class-wp-hook.php(324): rocket_init('')
#3 /home/merciket/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#4 /home/merciket/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#5 /home/merciket/public_html/wp-settings.php(506): do_action('plugins_l in /home/merciket/public_html/wp-content/plugins/wp-rocket/inc/classes/event-management/class-event-manager.php on line 33