r happened during gathering of the URLs to preload:', 'The following errors happened during gathering of the URLs to preload:', count( $errors['errors'] ), 'rocket' ) . '
'; foreach ( $errors['errors'] as $error ) { $message .= '' . $error . '
'; } } } \rocket_notice_html( [ 'status' => $status, 'message' => $message, 'dismissible' => 'notice-preload-running', 'action' => 'stop_preload', ] ); } /** * This notice is displayed after the sitemap preload is complete * * @since 3.2 * @author Remy Perona */ public function notice_preload_complete() { if ( ! current_user_can( 'rocket_preload_cache' ) ) { return; } $screen = get_current_screen(); if ( 'settings_page_wprocket' !== $screen->id ) { return; } $result = get_transient( 'rocket_preload_complete' ); if ( false === $result ) { return; } $result_timestamp = get_transient( 'rocket_preload_complete_time' ); if ( false === $result_timestamp ) { return; } delete_transient( 'rocket_preload_complete' ); delete_transient( 'rocket_preload_errors' ); delete_transient( 'rocket_preload_complete_time' ); // translators: %d is the number of pages preloaded. $notice_message = sprintf( __( 'Preload complete: %d pages have been cached.', 'rocket' ), $result ); $notice_message .= ' (' . $result_timestamp . ') '; \rocket_notice_html( [ 'message' => $notice_message, ] ); } /** * Stops currently running preload from the notice action button * * @since 3.2 * @author Remy Perona */ public function do_admin_post_stop_preload() { if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( sanitize_key( $_GET['_wpnonce'] ), 'rocket_stop_preload' ) ) { wp_nonce_ays( '' ); } if ( ! current_user_can( 'rocket_preload_cache' ) ) { wp_safe_redirect( wp_get_referer() ); die(); } $this->homepage_preloader->cancel_preload(); wp_safe_redirect( wp_get_referer() ); die(); } }