@@ -84,7 +84,7 @@ public function render_page() {
8484 $ is_pro = $ license_context ['is_pro ' ];
8585 $ license_key = (string ) get_option ( 'edacp_license_key ' , '' );
8686 $ is_connected = $ license_context ['is_connected ' ];
87- $ next_collection = $ this ->get_next_collection_date ();
87+ $ next_send_date = $ this ->get_next_send_estimate_date ();
8888 $ scans_stats = new Scans_Stats ();
8989 $ summary = $ scans_stats ->summary ();
9090 $ preview_data = is_array ( $ summary ) ? $ this ->get_preview_data ( $ summary , $ is_pro ) : [];
@@ -97,7 +97,6 @@ public function render_page() {
9797 );
9898
9999 $ dashboard_url = edac_link_wrapper ( 'https://my.equalizedigital.com/ ' , 'accessibility-reports ' , 'account ' , false );
100- $ email_reports_url = edac_link_wrapper ( 'https://my.equalizedigital.com/email-reports ' , 'accessibility-reports ' , 'email-reports ' , false );
101100 $ signup_url = edac_link_wrapper ( 'https://my.equalizedigital.com/sign-up/ ' , 'accessibility-reports ' , 'signup ' , false );
102101 $ privacy_url = edac_link_wrapper ( 'https://equalizedigital.com/privacy-policy/ ' , 'accessibility-reports ' , 'privacy ' , false );
103102 $ data_processing_url = edac_link_wrapper ( 'https://equalizedigital.com/data-terms/ ' , 'accessibility-reports ' , 'dpa ' , false );
@@ -215,14 +214,11 @@ public function render_page() {
215214 </div>
216215 <p><?php esc_html_e ( 'You’ll receive weekly accessibility reports for this site. ' , 'accessibility-checker ' ); ?> </p>
217216 <p class="edac-reports-card__meta">
218- <?php if ( $ next_collection ) : ?>
217+ <?php if ( $ next_send_date ) : ?>
219218 <?php /* translators: %s: next report date. */ ?>
220- <span><?php printf ( esc_html__ ( 'Next report: %s ' , 'accessibility-checker ' ), esc_html ( wp_date ( get_option ( 'date_format ' ), strtotime ( $ next_collection ) ) ) ); ?> </span>
219+ <span><?php printf ( esc_html__ ( 'Next report: %s ' , 'accessibility-checker ' ), esc_html ( mysql2date ( get_option ( 'date_format ' ), $ next_send_date ) ) ); ?> </span>
221220 <?php endif ; ?>
222221 </p>
223- <p>
224- <a class="button button-primary edac-reports-page__button" href="<?php echo esc_url ( $ email_reports_url ); ?> " target="_blank" rel="noopener noreferrer"><?php esc_html_e ( 'Manage Recipients in Dashboard ' , 'accessibility-checker ' ); ?> </a>
225- </p>
226222 </div>
227223
228224 <div class="edac-reports-card">
@@ -323,42 +319,48 @@ private function get_license_context(): array {
323319 /**
324320 * Resolve effective license context from current status values.
325321 *
326- * @param bool $has_pro_plugin Whether the Pro plugin is installed.
327- * @param string $pro_status Current Pro license status.
328- * @param string $free_status Current free license status.
329- * @param string $site_id Current connected site ID.
322+ * @param bool $has_pro_plugin Whether the Pro plugin is installed.
323+ * @param string $pro_status Current Pro license status.
324+ * @param string $free_status Current free license status.
325+ * @param string $site_id Current connected site ID.
326+ * @param bool $fallback_active Whether a fallback from Pro to Free is currently active.
330327 * @return array{has_pro_plugin:bool,is_pro:bool,status:string,is_connected:bool}
331328 */
332- private static function resolve_license_context ( bool $ has_pro_plugin , string $ pro_status , string $ free_status , string $ site_id ): array {
333- $ is_pro = $ has_pro_plugin && 'valid ' === $ pro_status ;
329+ private static function resolve_license_context ( bool $ has_pro_plugin , string $ pro_status , string $ free_status , string $ site_id, bool $ fallback_active = false ): array {
330+ $ is_pro = $ has_pro_plugin && 'valid ' === $ pro_status && ! $ fallback_active ;
334331 $ status = $ is_pro ? $ pro_status : $ free_status ;
335332 $ is_connected = 'valid ' === $ status && '' !== $ site_id ;
336333
337334
338335 return [
339- 'has_pro_plugin ' => $ has_pro_plugin ,
340- 'is_pro ' => $ is_pro ,
341- 'status ' => $ status ,
342- 'is_connected ' => $ is_connected ,
336+ 'has_pro_plugin ' => $ has_pro_plugin ,
337+ 'is_pro ' => $ is_pro ,
338+ 'status ' => $ status ,
339+ 'is_connected ' => $ is_connected ,
340+ 'fallback_active ' => $ fallback_active ,
343341 ];
344342 }
345343
346344 /**
347- * Get the next report collection date for display.
348- *
349- * Prefers the schedule returned by the connector service and falls back to a
350- * local estimate when no remote schedule has been stored yet.
345+ * Gets the next estimated send date, assuming each send will be on
346+ * Mondays.
351347 *
352348 * @return string
353349 */
354- private function get_next_collection_date (): string {
355- $ next_collection = (string ) get_option ( 'edac_next_collection ' , '' );
356- if ( '' !== $ next_collection ) {
357- return $ next_collection ;
358- }
350+ private function get_next_send_estimate_date (): string {
351+ try {
352+ // If today is Monday, use today. Otherwise, use next Monday.
353+ $ today = new \DateTime ( 'now ' , wp_timezone () );
359354
360- $ next_monday = new \DateTime ( 'next monday ' , wp_timezone () );
361- return $ next_monday ->format ( 'Y-m-d ' );
355+ if ( '1 ' === $ today ->format ( 'N ' ) ) {
356+ return $ today ->format ( 'Y-m-d ' );
357+ }
358+
359+ $ next_monday = new \DateTime ( 'next monday ' , wp_timezone () );
360+ return $ next_monday ->format ( 'Y-m-d ' );
361+ } catch ( \Exception $ exception ) {
362+ return '' ;
363+ }
362364 }
363365
364366 /**
0 commit comments