webp cache after Imagify network option has been modified. * * @since 3.4 * @access public * @author Grégory Viguier * * @param string $option Name of the network option. * @param mixed $value Current value of the network option. * @param mixed $old_value Old value of the network option. * @param int $network_id ID of the network. */ public function sync_on_network_option_update( $option, $value, $old_value, $network_id ) { if ( get_current_network_id() === $network_id ) { $this->sync_on_option_update( $old_value, $value ); } } /** * Store the Imagify network option value before it is deleted. * * @since 3.4 * @access public * @author Grégory Viguier * * @param string $option Option name. * @param int $network_id ID of the network. */ public function store_option_value_before_network_delete( $option, $network_id ) { if ( get_current_network_id() === $network_id ) { $this->tmp_is_serving_webp = $this->is_serving_webp(); } } /** * Maybe activate webp cache after Imagify network option has been deleted. * * @since 3.4 * @access public * @author Grégory Viguier * * @param string $option Name of the network option. * @param int $network_id ID of the network. */ public function sync_on_network_option_delete( $option, $network_id ) { if ( get_current_network_id() === $network_id && false !== $this->tmp_is_serving_webp ) { $this->trigger_webp_change(); } } /** * Maybe deactivate webp cache after Imagify option has been successfully added. * * @since 3.4 * @access public * @author Grégory Viguier * * @param string $option Name of the option to add. * @param mixed $value Value of the option. */ public function sync_on_option_add( $option, $value ) { if ( ! empty( $value['display_webp'] ) ) { $this->trigger_webp_change(); } } /** * This function is used to synchronize the option update for Imagify plugin. * It checks for the existence of certain keys in the old and new values of the options. * Depending on the version of Imagify, the keys may differ. * For Imagify version 2.2 and above, the keys are 'display_nextgen' and 'display_nextgen_method'. * For Imagify version 2.1 and below, the keys are 'display_webp' and 'display_webp_method'. * The function then checks if the old and new values of the display and method options have changed. * If they have, it triggers a webp change. * * @param mixed $old_value The old option value. * @param mixed $value The new option value. * @since 3.4 * @access public * @author Grégory Viguier */ public function sync_on_option_update( $old_value, $value ) { // Determine the key for the display option in the old and new values. $old_display_key = array_key_exists( 'display_nextgen', $old_value ) ? 'display_nextgen' : 'display_webp'; $display_key = array_key_exists( 'display_nextgen', $value ) ? 'display_nextgen' : 'display_webp'; // Get the old and new values of the display option. $old_display = ! empty( $old_value[ $old_display_key ] ); $display = ! empty( $value[ $display_key ] ); // Determine the key for the method option in the old and new values. $old_method_key = array_key_exists( 'display_nextgen_method', $old_value ) ? 'display_nextgen_method' : 'display_webp_method'; $method_key = array_key_exists( 'display_nextgen_method', $value ) ? 'display_nextgen_method' : 'display_webp_method'; // If the old value of the method option is not set, set it to the corresponding display option. if ( ! isset( $old_value[ $old_method_key ] ) ) { $old_value[ $old_method_key ] = $old_value[ $old_display_key . '_method' ] ?? ''; } // If the new value of the method option is not set, set it to the corresponding display option. if ( ! isset( $value[ $method_key ] ) ) { $value[ $method_key ] = $value[ $display_key . '_method' ] ?? ''; } // If the old and new values of the display or method options have changed, trigger a webp change. if ( $old_display !== $display || $old_value[ $old_method_key ] !== $value[ $method_key ] ) { $this->trigger_webp_change(); } } /** * Store the Imagify option value before it is deleted. * * @since 3.4 * @access public * @author Grégory Viguier * * @param string $option Name of the option to delete. */ public function store_option_value_before_delete( $option ) { if ( $this->get_option_name_to_serve_webp() === $option ) { $this->tmp_is_serving_webp = $this->is_serving_webp(); } } /** * Maybe activate webp cache after Imagify option has been deleted. * * @since 3.4 * @access public * @author Grégory Viguier * * @param string $option Name of the deleted option. */ public function sync_on_option_delete( $option ) { if ( false !== $this->tmp_is_serving_webp ) { $this->trigger_webp_change(); } } /** ----------------------------------------------------------------------------------------- */ /** PUBLIC TOOLS ============================================================================ */ /** ----------------------------------------------------------------------------------------- */ /** * Get the plugin name. * * @since 3.4 * @access public * @author Grégory Viguier * * @return string */ public function get_name() { return 'Imagify'; } /** * Get the plugin identifier. * * @since 3.4 * @access public * @author Grégory Viguier * * @return string */ public function get_id() { return 'imagify'; } /** * Tell if the plugin converts images to webp. * * @since 3.4 * @access public * @author Grégory Viguier * * @return bool */ public function is_converting_to_webp() { if ( ! function_exists( 'get_imagify_option' ) ) { // No Imagify, no webp. return false; } return ( defined( 'IMAGIFY_VERSION' ) && version_compare( IMAGIFY_VERSION, '2.2', '>=' ) ) || get_imagify_option( 'convert_to_webp' ); } /** * Tell if the plugin serves webp images on frontend. * * @since 3.4 * @access public * @author Grégory Viguier * * @return bool */ public function is_serving_webp() { if ( ! function_exists( 'get_imagify_option' ) ) { // No Imagify, no webp. return false; } return get_imagify_option( 'display_webp' ) || get_imagify_option( 'display_nextgen' ); } /** * Tell if the plugin uses a CDN-compatible technique to serve webp images on frontend. * * @since 3.4 * @access public * @author Grégory Viguier * * @return bool */ public function is_serving_webp_compatible_with_cdn() { if ( ! $this->is_serving_webp() ) { return false; } return 'rewrite' !== get_imagify_option( 'display_webp_method' ) || 'rewrite' !== get_imagify_option( 'display_nextgen_method' ); } /** * Get the plugin basename. * * @since 3.4 * @access public * @author Grégory Viguier * * @return bool */ public function get_basename() { if ( empty( $this->plugin_basename ) ) { $this->plugin_basename = rocket_has_constant( 'IMAGIFY_FILE' ) ? plugin_basename( rocket_get_constant( 'IMAGIFY_FILE' ) ) : 'imagify/imagify.php'; } return $this->plugin_basename; } /** ----------------------------------------------------------------------------------------- */ /** PRIVATE TOOLS =========================================================================== */ /** ----------------------------------------------------------------------------------------- */ /** * Get the name of the Imagify’s "serve webp" option. * * @since 3.4 * @access private * @author Grégory Viguier * * @return string */ private function get_option_name_to_serve_webp() { if ( ! empty( $this->plugin_option_name_to_serve_webp ) ) { return $this->plugin_option_name_to_serve_webp; } $default = 'imagify_settings'; if ( ! class_exists( '\Imagify_Options' ) || ! method_exists( '\Imagify_Options', 'get_instance' ) ) { $this->plugin_option_name_to_serve_webp = $default; return $this->plugin_option_name_to_serve_webp; } $instance = \Imagify_Options::get_instance(); if ( ! method_exists( $instance, 'get_option_name' ) ) { $this->plugin_option_name_to_serve_webp = $default; return $this->plugin_option_name_to_serve_webp; } $this->plugin_option_name_to_serve_webp = $instance->get_option_name(); return $this->plugin_option_name_to_serve_webp; } /** * Tell if Imagify is active for network. * * @since 3.4 * @access private * @author Grégory Viguier * * @return bool */ private function is_active_for_network() { static $is; if ( isset( $is ) ) { return $is; } if ( function_exists( 'imagify_is_active_for_network' ) ) { $is = imagify_is_active_for_network(); return $is; } if ( ! is_multisite() ) { $is = false; return $is; } if ( ! function_exists( 'is_plugin_active_for_network' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $is = is_plugin_active_for_network( $this->get_basename() ); return $is; } }
Fatal error: Uncaught TypeError: WP_Rocket\Event_Management\Event_Manager::add_subscriber(): Argument #1 ($subscriber) must be of type WP_Rocket\Event_Management\Subscriber_Interface, string given, called in /htdocs/top-x-porn.com/wp-content/plugins/wp-rocket/inc/Plugin.php on line 168 and defined in /htdocs/top-x-porn.com/wp-content/plugins/wp-rocket/inc/classes/event-management/class-event-manager.php:33 Stack trace: #0 /htdocs/top-x-porn.com/wp-content/plugins/wp-rocket/inc/Plugin.php(168): WP_Rocket\Event_Management\Event_Manager->add_subscriber('WP_Rocket\\Subsc...') #1 /htdocs/top-x-porn.com/wp-content/plugins/wp-rocket/inc/main.php(47): WP_Rocket\Plugin->load() #2 /htdocs/top-x-porn.com/wp-includes/class-wp-hook.php(324): rocket_init('') #3 /htdocs/top-x-porn.com/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #4 /htdocs/top-x-porn.com/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #5 /htdocs/top-x-porn.com/wp-settings.php(555): do_action('plugins_loaded') #6 /htdocs/top-x-porn.com/wp-config.php(106): require_once('/htdocs/top-x-p...') #7 /htdocs/top-x-porn.com/wp-load.php(50): require_once('/htdocs/top-x-p...') #8 /htdocs/top-x-porn.com/wp-blog-header.php(13): require_once('/htdocs/top-x-p...') #9 /htdocs/top-x-porn.com/index.php(17): require('/htdocs/top-x-p...') #10 {main} thrown in /htdocs/top-x-porn.com/wp-content/plugins/wp-rocket/inc/classes/event-management/class-event-manager.php on line 33