format( 'w' ) - $start + 7 ) % 7; $week = $now->modify( "-{$back} days" )->getTimestamp(); $waiting = Print_Queue::waiting( 0 ); return array( 'week' => count( Design_Store::orders_where( array( 'date_created' => '>=' . $week ) ) ), 'files' => $waiting['files'], 'orders' => $waiting['total'], ); } /** * The widget's content. * * @param array $numbers numbers(). * @param bool|null $pro_active Whether Pro is active; Settings::pro_active() when null. */ public static function html( array $numbers, ?bool $pro_active = null ): string { $pro_active = $pro_active ?? Settings::pro_active(); $html = sprintf( '
%1$s %3$s
', esc_html( __( 'PrintBlob Pro add-on', 'printblob' ) . ': ' . Pro::prices_text() . '.' ), esc_url( Pro::checkout_url( 'dashboard' ) ), esc_html( Pro::offer_text() ) ); } $links[] = '' . esc_html__( 'Dismiss', 'printblob' ) . ''; return $html . '' . implode( ' ยท ', $links ) . '
'; } public static function render(): void { echo wp_kses_post( self::html( self::numbers() ) ); } public static function dismiss(): void { Admin_Menu::guard( 'printblob_dismiss_dashboard' ); update_user_meta( get_current_user_id(), self::DISMISSED, 1 ); wp_safe_redirect( admin_url() ); exit; } }