| @@ -55,39 +55,27 @@ | ||
| 55 | 55 | <?php |
| 56 | 56 | $sitemap_files = $sitemap_generator->get_sitemap_files(); |
| 57 | 57 | $sitemap_count = count($sitemap_files); |
| 58 | 58 | |
| 59 | - // Check news/video sitemap status | |
| 59 | + // Check news/video sitemap status. | |
| 60 | + // | |
| 61 | + // Read through get_sitemap_document() — the same accessor the | |
| 62 | + // served route uses — so these tiles always describe the document | |
| 63 | + // crawlers actually receive. Reading the transient and the | |
| 64 | + // physical file in a different order than the serving code is | |
| 65 | + // what made the dashboard report a URL count no crawler ever saw. | |
| 60 | 66 | $news_sm_enabled = !empty($news_settings['enabled']); |
| 61 | 67 | $video_sm_enabled = !empty($video_settings['enabled']); |
| 62 | - $news_sm_exists = false !== get_transient('metasync_vsm_' . md5('news-sitemap.xml')) | |
| 63 | - || file_exists(ABSPATH . 'news-sitemap.xml'); | |
| 64 | - $video_sm_exists = false !== get_transient('metasync_vsm_' . md5('video-sitemap.xml')) | |
| 65 | - || file_exists(ABSPATH . 'video-sitemap.xml'); | |
| 68 | + $news_xml = $sitemap_generator->get_sitemap_document('news-sitemap.xml'); | |
| 69 | + $video_xml = $sitemap_generator->get_sitemap_document('video-sitemap.xml'); | |
| 70 | + $news_sm_exists = false !== $news_xml; | |
| 71 | + $video_sm_exists = false !== $video_xml; | |
| 66 | 72 | $extra_sitemap_count = ($news_sm_exists ? 1 : 0) + ($video_sm_exists ? 1 : 0); |
| 67 | 73 | $total_sitemap_count = $sitemap_count + $extra_sitemap_count; |
| 68 | 74 | |
| 69 | 75 | // Count URLs in news/video sitemaps for total |
| 70 | - $news_url_count = 0; | |
| 71 | - $video_url_count = 0; | |
| 72 | - if ($news_sm_exists) { | |
| 73 | - $news_xml = get_transient('metasync_vsm_' . md5('news-sitemap.xml')); | |
| 74 | - if (!$news_xml && file_exists(ABSPATH . 'news-sitemap.xml')) { | |
| 75 | - $news_xml = file_get_contents(ABSPATH . 'news-sitemap.xml'); | |
| 76 | - } | |
| 77 | - if ($news_xml) { | |
| 78 | - $news_url_count = substr_count($news_xml, '<url>'); | |
| 79 | - } | |
| 80 | - } | |
| 81 | - if ($video_sm_exists) { | |
| 82 | - $video_xml = get_transient('metasync_vsm_' . md5('video-sitemap.xml')); | |
| 83 | - if (!$video_xml && file_exists(ABSPATH . 'video-sitemap.xml')) { | |
| 84 | - $video_xml = file_get_contents(ABSPATH . 'video-sitemap.xml'); | |
| 85 | - } | |
| 86 | - if ($video_xml) { | |
| 87 | - $video_url_count = substr_count($video_xml, '<url>'); | |
| 88 | - } | |
| 89 | - } | |
| 76 | + $news_url_count = $news_sm_exists ? substr_count($news_xml, '<url>') : 0; | |
| 77 | + $video_url_count = $video_sm_exists ? substr_count($video_xml, '<url>') : 0; | |
| 90 | 78 | $total_url_count = $url_count + $news_url_count + $video_url_count; |
| 91 | 79 | $any_sitemap_exists = $sitemap_exists || $news_sm_exists || $video_sm_exists; |
| 92 | 80 | ?> |
| 93 | 81 | |
| @@ -450,9 +438,9 @@ | ||
| 450 | 438 | <td><?php echo number_format($urls_in_file); ?></td> |
| 451 | 439 | <td> |
| 452 | 440 | <?php |
| 453 | 441 | if ($last_generated) { |
| 454 | - echo esc_html(date('M j, Y g:i A', strtotime($last_generated))); | |
| 442 | + echo esc_html(gmdate('M j, Y g:i A', strtotime($last_generated))); | |
| 455 | 443 | } else { |
| 456 | 444 | echo '—'; |
| 457 | 445 | } |
| 458 | 446 | ?> |
| @@ -481,9 +469,9 @@ | ||
| 481 | 469 | <div class="sitemap-filename">news-sitemap.xml</div> |
| 482 | 470 | <div class="sitemap-url-range"><?php esc_html_e('Google News Sitemap', 'metasync'); ?></div> |
| 483 | 471 | </td> |
| 484 | 472 | <td><?php echo $news_sm_exists ? $news_url_count : '<em style="color:var(--dashboard-text-secondary);">Not generated</em>'; ?></td> |
| 485 | - <td><?php echo ($news_sm_exists && $last_generated) ? esc_html(date('M j, Y g:i A', strtotime($last_generated))) : '—'; ?></td> | |
| 473 | + <td><?php echo ($news_sm_exists && $last_generated) ? esc_html(gmdate('M j, Y g:i A', strtotime($last_generated))) : '—'; ?></td> | |
| 486 | 474 | <td> |
| 487 | 475 | <?php if ($news_sm_exists): ?> |
| 488 | 476 | <a href="<?php echo esc_url(home_url('/news-sitemap.xml')); ?>" target="_blank" class="button-view"> |
| 489 | 477 | <span class="dashicons dashicons-external"></span> |
| @@ -509,9 +497,9 @@ | ||
| 509 | 497 | <div class="sitemap-filename">video-sitemap.xml</div> |
| 510 | 498 | <div class="sitemap-url-range"><?php esc_html_e('Video Sitemap', 'metasync'); ?></div> |
| 511 | 499 | </td> |
| 512 | 500 | <td><?php echo $video_sm_exists ? $video_url_count : '<em style="color:var(--dashboard-text-secondary);">Not generated</em>'; ?></td> |
| 513 | - <td><?php echo ($video_sm_exists && $last_generated) ? esc_html(date('M j, Y g:i A', strtotime($last_generated))) : '—'; ?></td> | |
| 501 | + <td><?php echo ($video_sm_exists && $last_generated) ? esc_html(gmdate('M j, Y g:i A', strtotime($last_generated))) : '—'; ?></td> | |
| 514 | 502 | <td> |
| 515 | 503 | <?php if ($video_sm_exists): ?> |
| 516 | 504 | <a href="<?php echo esc_url(home_url('/video-sitemap.xml')); ?>" target="_blank" class="button-view"> |
| 517 | 505 | <span class="dashicons dashicons-external"></span> |
| @@ -580,10 +568,11 @@ | ||
| 580 | 568 | <?php |
| 581 | 569 | require_once plugin_dir_path(dirname(__FILE__)) . 'sitemap/class-metasync-sitemap-news.php'; |
| 582 | 570 | $news_checker = new Metasync_Sitemap_News(); |
| 583 | 571 | $news_conflicts = $news_checker->get_conflict_notices(); |
| 584 | - $news_has_content = false !== get_transient('metasync_vsm_' . md5('news-sitemap.xml')) | |
| 585 | - || file_exists(ABSPATH . 'news-sitemap.xml'); | |
| 572 | + // Reuse the accessor-derived value computed for the status tiles so | |
| 573 | + // this panel cannot disagree with them, or with the served document. | |
| 574 | + $news_has_content = $news_sm_exists; | |
| 586 | 575 | $news_conflict_name = $news_checker->get_conflict_plugin_name(); |
| 587 | 576 | $mss_brand = Metasync::get_effective_plugin_name(); |
| 588 | 577 | |
| 589 | 578 | # Flag a generated-but-empty news sitemap. $news_url_count is already |
| @@ -597,8 +586,9 @@ | ||
| 597 | 586 | |
| 598 | 587 | <?php if (!empty($news_conflict_name)): ?> |
| 599 | 588 | <div class="metasync-sitemap-conflict-note" style="display:flex; gap:7px; align-items:center; margin:0 0 16px; padding:8px 12px; border-radius:7px; background:rgba(245,158,11,0.08); border:1px solid rgba(245,158,11,0.28); font-size:12px; line-height:1.5; color:var(--dashboard-text-secondary,#6b7280);"> |
| 600 | 589 | <span style="font-size:13px; line-height:1;">⚠️</span> |
| 590 | + <?php /* translators: %s: plugin brand name. */ ?> | |
| 601 | 591 | <span><strong style="color:#8a5a00;"><?php echo esc_html($news_conflict_name); ?></strong> <?php printf(esc_html__('is also active — its news sitemap settings may conflict with %s\'s.', 'metasync'), esc_html($mss_brand)); ?></span> |
| 602 | 592 | </div> |
| 603 | 593 | <?php endif; ?> |
| 604 | 594 | |
| @@ -779,8 +769,9 @@ | ||
| 779 | 769 | <td> |
| 780 | 770 | <?php |
| 781 | 771 | $tax_scrollable = count($tax_terms) > 10; |
| 782 | 772 | if ($tax_scrollable) : ?> |
| 773 | + <?php /* translators: %s: taxonomy name. */ ?> | |
| 783 | 774 | <input type="text" class="metasync-checkbox-search" placeholder="<?php echo esc_attr(sprintf(__('Filter %s...', 'metasync'), strtolower($tax->label))); ?>"> |
| 784 | 775 | <?php endif; ?> |
| 785 | 776 | <div class="metasync-checkbox-list <?php echo $tax_scrollable ? 'metasync-checkbox-scroll' : ''; ?>"> |
| 786 | 777 | <?php foreach ($tax_terms as $term) : ?> |
| @@ -839,10 +830,11 @@ | ||
| 839 | 830 | <?php |
| 840 | 831 | require_once plugin_dir_path(dirname(__FILE__)) . 'sitemap/class-metasync-sitemap-video.php'; |
| 841 | 832 | $video_checker = new Metasync_Sitemap_Video(); |
| 842 | 833 | $video_conflicts = $video_checker->get_conflict_notices(); |
| 843 | - $video_has_content = false !== get_transient('metasync_vsm_' . md5('video-sitemap.xml')) | |
| 844 | - || file_exists(ABSPATH . 'video-sitemap.xml'); | |
| 834 | + // Reuse the accessor-derived value computed for the status tiles so | |
| 835 | + // this panel cannot disagree with them, or with the served document. | |
| 836 | + $video_has_content = $video_sm_exists; | |
| 845 | 837 | $video_conflict_name = $video_checker->get_conflict_plugin_name(); |
| 846 | 838 | $mss_brand = Metasync::get_effective_plugin_name(); |
| 847 | 839 | |
| 848 | 840 | # Why videos were left out. Recorded by generate_video_sitemap() so the |
| @@ -897,8 +889,9 @@ | ||
| 897 | 889 | |
| 898 | 890 | <?php if (!empty($video_conflict_name)): ?> |
| 899 | 891 | <div class="metasync-sitemap-conflict-note" style="display:flex; gap:7px; align-items:center; margin:0 0 16px; padding:8px 12px; border-radius:7px; background:rgba(245,158,11,0.08); border:1px solid rgba(245,158,11,0.28); font-size:12px; line-height:1.5; color:var(--dashboard-text-secondary,#6b7280);"> |
| 900 | 892 | <span style="font-size:13px; line-height:1;">⚠️</span> |
| 893 | + <?php /* translators: %s: plugin brand name. */ ?> | |
| 901 | 894 | <span><strong style="color:#8a5a00;"><?php echo esc_html($video_conflict_name); ?></strong> <?php printf(esc_html__('is also active — its video sitemap settings may conflict with %s\'s.', 'metasync'), esc_html($mss_brand)); ?></span> |
| 902 | 895 | </div> |
| 903 | 896 | <?php endif; ?> |
| 904 | 897 | |
| @@ -1126,8 +1119,9 @@ | ||
| 1126 | 1119 | <td> |
| 1127 | 1120 | <?php |
| 1128 | 1121 | $vtax_scrollable = count($tax_terms) > 10; |
| 1129 | 1122 | if ($vtax_scrollable) : ?> |
| 1123 | + <?php /* translators: %s: taxonomy name. */ ?> | |
| 1130 | 1124 | <input type="text" class="metasync-checkbox-search" placeholder="<?php echo esc_attr(sprintf(__('Filter %s...', 'metasync'), strtolower($tax->label))); ?>"> |
| 1131 | 1125 | <?php endif; ?> |
| 1132 | 1126 | <div class="metasync-checkbox-list <?php echo $vtax_scrollable ? 'metasync-checkbox-scroll' : ''; ?>"> |
| 1133 | 1127 | <?php foreach ($tax_terms as $term) : ?> |