|
1 | 1 | <?php |
| 2 | + |
2 | 3 | /** |
3 | 4 | * Template for displaying a list of links with their associated posts. |
4 | 5 | * This template is reused for both "Recent Link Checks" and "Latest Links" sections. |
|
12 | 13 | * @param string $iawmlf_no_links_message Message to display when no links are available. |
13 | 14 | */ |
14 | 15 |
|
| 16 | +use Internet_Archive\Wayback_Machine_Link_Fixer\Link\Link; |
| 17 | + |
15 | 18 | defined( 'ABSPATH' ) || exit; |
16 | 19 |
|
17 | 20 | ?> |
|
77 | 80 | </span> |
78 | 81 | <?php endif; ?> |
79 | 82 | </div> |
| 83 | + |
80 | 84 | </div> |
81 | | - <?php if ( ! empty( $iawmlf_posts ) ) : ?> |
| 85 | + |
| 86 | + <div class="iawmlf_dashboard-link-check-details"> |
82 | 87 | <div class="iawmlf_dashboard-link-check-posts"> |
83 | 88 | <div class="iawmlf_dashboard-link-check-details"> |
84 | 89 | <div class="iawmlf_dashboard-link-check-details-item"> |
|
87 | 92 | <?php esc_html_e( 'View Full Report', 'internet-archive-wayback-machine-link-fixer' ); ?> |
88 | 93 | </a> |
89 | 94 | </div> |
90 | | - </div> |
91 | | - <span class="iawmlf_dashboard-link-check-posts-label"> |
92 | | - <?php |
93 | | - printf( |
94 | | - /* translators: %d: number of posts */ |
95 | | - esc_html( _n( 'Found in %d post:', 'Found in %d posts:', count( $iawmlf_posts ), 'internet-archive-wayback-machine-link-fixer' ) ), |
96 | | - count( $iawmlf_posts ) |
97 | | - ); |
98 | | - ?> |
99 | | - </span> |
100 | | - <div class="iawmlf_dashboard-link-check-posts-list"> |
101 | | - <?php |
102 | | - $iawmlf_displayed_posts = array_slice( $iawmlf_posts, 0, 12 ); // Show max 12 posts now |
103 | | - foreach ( $iawmlf_displayed_posts as $iawmlf_displayed_post ) : |
104 | | - ?> |
105 | | - <a href="<?php echo esc_url( get_edit_post_link( $iawmlf_displayed_post->ID ) ); ?>" class="iawmlf_dashboard-link-check-post"> |
106 | | - <?php echo esc_html( '' !== $iawmlf_displayed_post->post_title ? $iawmlf_displayed_post->post_title : __( '(No title)', 'internet-archive-wayback-machine-link-fixer' ) ); ?> |
107 | | - </a> |
108 | | - <?php endforeach; ?> |
109 | | - <?php if ( count( $iawmlf_posts ) > 12 ) : ?> |
110 | | - <span class="iawmlf_dashboard-link-check-posts-more"> |
| 95 | + <div class="iawmlf_dashboard-link-check-stats"> |
| 96 | + <!-- Current Status Section --> |
| 97 | + <div class="iawmlf_link-status-section"> |
111 | 98 | <?php |
112 | 99 | printf( |
113 | | - /* translators: %d: number of additional posts */ |
114 | | - esc_html__( '... and %d more', 'internet-archive-wayback-machine-link-fixer' ), |
115 | | - count( $iawmlf_posts ) - 12 |
| 100 | + '<strong>%s</strong>: %s', |
| 101 | + esc_html__( 'Current Status', 'internet-archive-wayback-machine-link-fixer' ), |
| 102 | + wp_kses_post( ( new Internet_Archive\Wayback_Machine_Link_Fixer\Util\Link_Summary_Factory( $iawmlf_link ) )->get_summary() ) |
116 | 103 | ); |
117 | 104 | ?> |
118 | | - </span> |
119 | | - <?php endif; ?> |
| 105 | + </div> |
| 106 | + |
| 107 | + <!-- Full URL Section --> |
| 108 | + <div class="iawmlf_link-url-section"> |
| 109 | + <p> |
| 110 | + <strong><?php esc_html_e( 'Full URL', 'internet-archive-wayback-machine-link-fixer' ); ?></strong>: |
| 111 | + <a href="<?php echo esc_url( $iawmlf_link->get_href() ); ?>" target="_blank" rel="noopener noreferrer"> |
| 112 | + <?php echo esc_html( $iawmlf_link->get_href() ); ?> |
| 113 | + </a> |
| 114 | + </p> |
| 115 | + </div> |
| 116 | + |
| 117 | + <!-- Archive Status Section --> |
| 118 | + <div class="iawmlf_link-archive-section"> |
| 119 | + <?php if ( $iawmlf_link->is_excluded() ) : ?> |
| 120 | + <p class="iawmlf_link_archived_url"> |
| 121 | + <strong><?php esc_html_e( 'Archive Status', 'internet-archive-wayback-machine-link-fixer' ); ?></strong>: |
| 122 | + <?php esc_html_e( 'EXCLUDED', 'internet-archive-wayback-machine-link-fixer' ); ?> |
| 123 | + </p> |
| 124 | + <?php else : ?> |
| 125 | + <p class="iawmlf_link_archived_url"> |
| 126 | + <strong><?php esc_html_e( 'Archive Status', 'internet-archive-wayback-machine-link-fixer' ); ?></strong>: |
| 127 | + <?php |
| 128 | + if ( ! $iawmlf_link->is_processed() ) { |
| 129 | + $iawmlf_archive_process = $iawmlf_link->get_archive_process(); |
| 130 | + if ( \Internet_Archive\Wayback_Machine_Link_Fixer\Link\Link::PROCESS_NEW === $iawmlf_archive_process ) { |
| 131 | + esc_html_e( 'NEW - This link has been queued and will be processed by the Internet Archive as soon as possible', 'internet-archive-wayback-machine-link-fixer' ); |
| 132 | + } else { |
| 133 | + esc_html_e( 'PENDING – Queued for submission to the Internet Archive. Processing time varies based on queue size.', 'internet-archive-wayback-machine-link-fixer' ); |
| 134 | + } |
| 135 | + } elseif ( '' !== $iawmlf_link->get_archived_href() ) { |
| 136 | + esc_html_e( 'HAS ARCHIVE - A snapshot of this link is available on the Internet Archive', 'internet-archive-wayback-machine-link-fixer' ); |
| 137 | + } else { |
| 138 | + esc_html_e( 'NO ARCHIVE - Unable to create or find a snapshot. This can happen if the URL is blocked by robots.txt, requires authentication, or is no longer accessible', 'internet-archive-wayback-machine-link-fixer' ); |
| 139 | + } |
| 140 | + ?> |
| 141 | + </p> |
| 142 | + <?php endif; ?> |
| 143 | + </div> |
| 144 | + |
| 145 | + <!-- Archived URL Section --> |
| 146 | + <?php if ( ! $iawmlf_link->is_excluded() && '' !== $iawmlf_link->get_archived_href() ) : ?> |
| 147 | + <div class="iawmlf_link-archived-url-section"> |
| 148 | + <p class="iawmlf_link_archived_url"> |
| 149 | + <strong><?php esc_html_e( 'Archived URL', 'internet-archive-wayback-machine-link-fixer' ); ?></strong>: |
| 150 | + <a href="<?php echo esc_url( $iawmlf_link->get_archived_href() ); ?>" target="_blank"> |
| 151 | + <?php echo esc_html( $iawmlf_link->get_archived_href() ); ?> |
| 152 | + </a> |
| 153 | + </p> |
| 154 | + </div> |
| 155 | + <?php endif; ?> |
| 156 | + </div> |
120 | 157 | </div> |
| 158 | + <?php if ( ! empty( $iawmlf_posts ) ) : ?> |
| 159 | + <span class="iawmlf_dashboard-link-check-posts-label"> |
| 160 | + <?php |
| 161 | + printf( |
| 162 | + /* translators: %d: number of posts */ |
| 163 | + esc_html( _n( 'Found in %d post:', 'Found in %d posts:', count( $iawmlf_posts ), 'internet-archive-wayback-machine-link-fixer' ) ), |
| 164 | + count( $iawmlf_posts ) |
| 165 | + ); |
| 166 | + ?> |
| 167 | + </span> |
| 168 | + <div class="iawmlf_dashboard-link-check-posts-list"> |
| 169 | + <?php |
| 170 | + $iawmlf_displayed_posts = array_slice( $iawmlf_posts, 0, 12 ); // Show max 12 posts now |
| 171 | + foreach ( $iawmlf_displayed_posts as $iawmlf_displayed_post ) : |
| 172 | + ?> |
| 173 | + <a href="<?php echo esc_url( get_edit_post_link( $iawmlf_displayed_post->ID ) ); ?>" class="iawmlf_dashboard-link-check-post"> |
| 174 | + <?php echo esc_html( '' !== $iawmlf_displayed_post->post_title ? $iawmlf_displayed_post->post_title : __( '(No title)', 'internet-archive-wayback-machine-link-fixer' ) ); ?> |
| 175 | + </a> |
| 176 | + <?php endforeach; ?> |
| 177 | + <?php if ( count( $iawmlf_posts ) > 12 ) : ?> |
| 178 | + <span class="iawmlf_dashboard-link-check-posts-more"> |
| 179 | + <?php |
| 180 | + printf( |
| 181 | + /* translators: %d: number of additional posts */ |
| 182 | + esc_html__( '... and %d more', 'internet-archive-wayback-machine-link-fixer' ), |
| 183 | + count( $iawmlf_posts ) - 12 |
| 184 | + ); |
| 185 | + ?> |
| 186 | + </span> |
| 187 | + <?php endif; ?> |
| 188 | + </div> |
| 189 | + <?php else : ?> |
| 190 | + <p class="iawmlf_dashboard-link-check-no-posts"> |
| 191 | + <?php esc_html_e( 'No posts found with this link.', 'internet-archive-wayback-machine-link-fixer' ); ?> |
| 192 | + </p> |
| 193 | + <?php endif; ?> |
121 | 194 | </div> |
122 | | - <?php endif; ?> |
| 195 | + </div> |
123 | 196 | </div> |
124 | 197 | <?php endforeach; ?> |
125 | 198 | <?php else : ?> |
|
0 commit comments