ata Localize script data. * * @return array */ public function add_localize_script_data( $data ): array { if ( ! is_array( $data ) ) { $data = (array) $data; } if ( ! $this->is_enabled() ) { return $data; } $transient = get_transient( 'rocket_rucss_processing' ); if ( false === $transient ) { return $data; } $data['notice_end_time'] = $transient; return $data; } /** * Disables combine CSS if RUCSS is enabled when updating to 3.11 * * @since 3.11 * * @param string $old_version Previous plugin version. * * @return void */ public function set_option_on_update( $old_version ) { if ( version_compare( $old_version, '3.11', '>=' ) ) { return; } $options = get_option( 'wp_rocket_settings', [] ); if ( 'local' === wp_get_environment_type() ) { $options['optimize_css_delivery'] = 1; $options['remove_unused_css'] = 1; $options['async_css'] = 1; } update_option( 'wp_rocket_settings', $options ); } /** * Updates safelist items for new SaaS compatibility * * @since 3.11.0.2 * * @param string $old_version Previous plugin version. * * @return void */ public function update_safelist_items( $old_version ) { if ( version_compare( $old_version, '3.11.0.2', '>=' ) ) { return; } $options = get_option( 'wp_rocket_settings', [] ); if ( empty( $options['remove_unused_css_safelist'] ) ) { return; } foreach ( $options['remove_unused_css_safelist'] as $key => $value ) { if ( str_contains( $value, '.css' ) ) { continue; } if ( str_starts_with( $value, '(' ) ) { continue; } $options['remove_unused_css_safelist'][ $key ] = '(.*)' . $value; } update_option( 'wp_rocket_settings', $options ); } /** * Display a notification on wrong license. * * @return void */ public function display_wrong_license_notice() { if ( ! $this->can_display_notice( false ) ) { return; } $main_message = __( "We couldn't generate the used CSS because you're using a nulled version of WP Rocket. You need an active license to use the Remove Unused CSS feature and further improve your website's performance.", 'rocket' ); $cta_message = sprintf( // translators: %1$s = promo percentage. __( 'Click here to get a WP Rocket single license at %1$s off!', 'rocket' ), '10%%' ); $message = sprintf( // translators: %1$s = plugin name, %2$s = opening anchor tag, %3$s = closing anchor tag. "%1\$s:

$main_message

%2\$s$cta_message%3\$s", 'WP Rocket', '', '' ); rocket_notice_html( [ 'status' => 'error', 'dismissible' => '', 'message' => $message, 'id' => 'rocket-notice-rucss-wrong-licence', ] ); } /** * Display an error notice when the connection to the server fails * * @return void */ public function display_saas_error_notice() { if ( ! $this->has_saas_error_notice() ) { $boxes = get_user_meta( get_current_user_id(), 'rocket_boxes', true ); if ( in_array( 'rucss_saas_error_notice', (array) $boxes, true ) ) { unset( $boxes['rucss_saas_error_notice'] ); update_user_meta( get_current_user_id(), 'rocket_boxes', $boxes ); } return; } if ( ! $this->can_display_notice() ) { return; } $boxes = get_user_meta( get_current_user_id(), 'rocket_boxes', true ); if ( in_array( 'rucss_error_notice', (array) $boxes, true ) ) { return; } $firewall_beacon = $this->beacon->get_suggest( 'rucss_firewall_ips' ); $main_message = sprintf( // translators: %1$s = open tag, %2$s = closing tag. __( 'It seems a security plugin or the server\'s firewall prevents WP Rocket from accessing the Remove Unused CSS generator. IPs listed %1$shere in our documentation%2$s should be added to your allowlists:', 'rocket' ), '', '' ); $security_message = __( '- In the security plugin, if you are using one', 'rocket' ); $firewall_message = __( "- In the server's firewall. Your host can help you with this", 'rocket' ); $message = "WP Rocket: $main_message"; rocket_notice_html( [ 'status' => 'error', 'message' => $message, 'dismissible' => '', 'id' => 'rocket-notice-rucss-error-http', 'dismiss_button' => 'rucss_error_notice', 'dismiss_button_class' => 'button-primary', ] ); } /** * Is the error notice present. * * @return bool */ public function has_saas_error_notice() { return (bool) get_transient( 'wp_rocket_rucss_errors_count' ); } /** * Display a notice on table missing. * * @return void */ public function display_no_table_notice() { if ( ! $this->can_display_notice() ) { return; } if ( $this->used_css->exists() ) { return; } // translators: %1$s = plugin name, %2$s = table name, %3$s = open tag, %4$s = closing tag. $main_message = esc_html__( '%1$s: Could not create the %2$s table in the database which is necessary for the Remove Unused CSS feature to work. Please reach out to %3$sour support%4$s.', 'rocket' ); $message = sprintf( // translators: %1$s = plugin name, %2$s = table name, %3$s = open tag, %4$s = closing tag. $main_message, 'WP Rocket', $this->used_css->get_name(), '', '' ); rocket_notice_html( [ 'status' => 'error', 'dismissible' => '', 'message' => $message, 'id' => 'rocket-notice-rucss-missing-table', ] ); } /** * Get support URL. * * @return string */ protected function get_support_url() { return rocket_get_external_url( 'support', [ 'utm_source' => 'wp_plugin', 'utm_medium' => 'wp_rocket', ] ); } }
Fatal error: Uncaught TypeError: Argument 1 passed to WP_Rocket\Engine\Optimization\RUCSS\Admin\OptionSubscriber::__construct() must be an instance of WP_Rocket\Engine\Optimization\RUCSS\Admin\Settings, string given in /home/merciket/public_html/wp-content/plugins/wp-rocket/inc/Engine/Optimization/RUCSS/Admin/OptionSubscriber.php:22 Stack trace: #0 [internal function]: WP_Rocket\Engine\Optimization\RUCSS\Admin\OptionSubscriber->__construct('WP_Rocket\\Engin...') #1 /home/merciket/public_html/wp-content/plugins/wp-rocket/inc/Dependencies/League/Container/Definition/Definition.php(256): ReflectionClass->newInstanceArgs(Array) #2 /home/merciket/public_html/wp-content/plugins/wp-rocket/inc/Dependencies/League/Container/Definition/Definition.php(212): WP_Rocket\Dependencies\League\Container\Definition\Definition->resolveClass('WP_Rocket\\Engin...') #3 /home/merciket/public_html/wp-content/plugins/wp-rocket/inc/Dependencies/League/Container/Definition/DefinitionAggregate.php(94): WP_Rocket\Dependencies\League\Container\Definiti in /home/merciket/public_html/wp-content/plugins/wp-rocket/inc/Engine/Optimization/RUCSS/Admin/OptionSubscriber.php on line 22