' . sprintf( // translators: %1$s WP Rocket plugin name; %2$s = file name. __( '%1$s has not been deactivated due to missing writing permissions. Make %2$s writeable and retry deactivation, or force deactivation now:', 'rocket' ), WP_ROCKET_PLUGIN_NAME, 'wp-config.php' ) . '
' . sprintf( // translators: %1$s WP Rocket plugin name; %2$s = file name. __( '%1$s has not been deactivated due to missing writing permissions. Make %2$s writeable and retry deactivation, or force deactivation now:', 'rocket' ), WP_ROCKET_PLUGIN_NAME, '.htaccess' ) . '
' . sprintf( __( '%s: The following plugins are not compatible with this plugin and may cause unexpected results:', 'rocket' ), WP_ROCKET_PLUGIN_NAME ) . '
' . __( 'Don’t worry, WP Rocket’s page caching and settings will still function correctly.', 'rocket' ) . '' . __( 'For optimal performance, adding the following lines into your .htaccess is recommended (not required):', 'rocket' ) . '' . esc_textarea( get_rocket_htaccess_marker() ) . '</textarea>
provided by rocket_notice_html(). '%1$s%2$s
%s
%1$s
%2$s %4$s', // Closing
provided by rocket_notice_html(). '%s
'; rocket_notice_html( [ 'message' => $thankyou_message, ] ); delete_transient( 'rocket_analytics_optin' ); } add_action( 'admin_notices', 'rocket_analytics_optin_thankyou_notice' ); /** * Displays a notice after clearing the cache * * @since 2.11 * @author Remy Perona */ function rocket_clear_cache_notice() { $cleared_cache = get_transient( 'rocket_clear_cache' ); if ( ! $cleared_cache ) { return; } delete_transient( 'rocket_clear_cache' ); $notice = ''; switch ( $cleared_cache ) { case 'all': if ( current_user_can( 'rocket_purge_cache' ) ) { // translators: %s = plugin name. $notice = sprintf( __( '%s: Cache cleared.', 'rocket' ), '' . WP_ROCKET_PLUGIN_NAME . '' ); $notice .= ' (' . date_i18n( get_option( 'date_format' ) ) . ' @ ' . date_i18n( get_option( 'time_format' ) ) . ') '; } break; case 'post': if ( current_user_can( 'rocket_purge_posts' ) ) { // translators: %s = plugin name. $notice = sprintf( __( '%s: Post cache cleared.', 'rocket' ), '' . WP_ROCKET_PLUGIN_NAME . '' ); $notice .= ' (' . date_i18n( get_option( 'date_format' ) ) . ' @ ' . date_i18n( get_option( 'time_format' ) ) . ') '; } break; case 'term': if ( current_user_can( 'rocket_purge_terms' ) ) { // translators: %s = plugin name. $notice = sprintf( __( '%s: Term cache cleared.', 'rocket' ), '' . WP_ROCKET_PLUGIN_NAME . '' ); $notice .= ' (' . date_i18n( get_option( 'date_format' ) ) . ' @ ' . date_i18n( get_option( 'time_format' ) ) . ') '; } break; case 'user': if ( current_user_can( 'rocket_purge_users' ) ) { // translators: %s = plugin name). $notice = sprintf( __( '%s: User cache cleared.', 'rocket' ), '' . WP_ROCKET_PLUGIN_NAME . '' ); $notice .= ' (' . date_i18n( get_option( 'date_format' ) ) . ' @ ' . date_i18n( get_option( 'time_format' ) ) . ') '; } break; default: break; } if ( empty( $notice ) ) { return; } rocket_notice_html( [ 'message' => $notice, ] ); } add_action( 'admin_notices', 'rocket_clear_cache_notice' ); /** * Outputs notice HTML * * @since 2.11 * @author Remy Perona * * @param array $args An array of arguments used to determine the notice output. * @return void */ function rocket_notice_html( $args ) { $defaults = [ 'status' => 'success', 'dismissible' => 'is-dismissible', 'message' => '', 'action' => '', 'dismiss_button' => false, 'dismiss_button_message' => __( 'Dismiss this notice', 'rocket' ), 'readonly_content' => '', 'id' => '', ]; $args = wp_parse_args( $args, $defaults ); switch ( $args['action'] ) { case 'clear_cache': $args['action'] = '' . __( 'Clear cache', 'rocket' ) . ''; break; case 'clear_used_css': $params = [ 'action' => 'rocket_clear_usedcss', ]; if ( ! empty( $_SERVER['REQUEST_URI'] ) ) { $referer_url = filter_var( wp_unslash( $_SERVER['REQUEST_URI'] ), FILTER_SANITIZE_URL ); $params['_wp_http_referer'] = rawurlencode( $referer_url ); } $args['action'] = '' . __( 'Clear Used CSS', 'rocket' ) . ''; break; case 'stop_preload': $args['action'] = '' . __( 'Stop Preload', 'rocket' ) . ''; break; case 'switch_to_rucss': $params = [ 'action' => 'switch_to_rucss', ]; $args['action'] = '' . __( 'Turn on Remove Unused CSS', 'rocket' ) . ''; break; case 'enable_separate_mobile_cache': $params = [ 'action' => 'rocket_enable_separate_mobile_cache', ]; $args['action'] = '' . __( 'Enable “Separate Cache Files for Mobile Devices” now', 'rocket' ) . ''; break; case 'force_deactivation': /** * Allow a "force deactivation" link to be printed, use at your own risks * * @since 2.0.0 * * @param bool $permit_force_deactivation true will print the link. */ $permit_force_deactivation = apply_filters( 'rocket_permit_force_deactivation', true ); // We add a link to permit "force deactivation", use at your own risks. if ( $permit_force_deactivation ) { global $status, $page, $s; $plugin_file = 'wp-rocket/wp-rocket.php'; $rocket_nonce = wp_create_nonce( 'force_deactivation' ); $args['action'] = '' . __( 'Force deactivation ', 'rocket' ) . ''; } break; } /** * Notice arguments. * * @param array $args arguments from the notice. * @return array */ $filtered_args = apply_filters( 'rocket_notice_args', $args ); if ( is_array( $filtered_args ) ) { $args = wp_parse_args( $filtered_args, $defaults ); } $notice_id = ''; if ( ! empty( $args['id'] ) ) { $notice_id = ' id="' . esc_attr( $args['id'] ) . '"'; } ?>
</textarea>
' . $file . '