Changeset 14153
- Timestamp:
- 10/29/2024 03:18:40 AM (7 months ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin.php
r14152 r14153 165 165 krsort( $result['ratings'] ); 166 166 167 // Determine the last_updated date. 168 $last_updated = $post->last_updated ?: $post->post_modified_gmt; // Prefer the post_meta unless not set. 169 if ( '0000-00-00 00:00:00' === $last_updated ) { 170 $last_updated = $post->post_date_gmt; 171 } 172 167 173 $result['num_ratings'] = array_sum( $result['ratings'] ); 168 174 $result['support_url'] = 'https://wordpress.org/support/plugin/' . urlencode( $plugin_slug ) . '/'; … … 171 177 $result['active_installs'] = intval( get_post_meta( $post_id, 'active_installs', true ) ); 172 178 $result['downloaded'] = intval( get_post_meta( $post_id, 'downloads', true ) ); 173 $result['last_updated'] = gmdate( 'Y-m-d g:ia \G\M\T', strtotime( $ post->post_modified_gmt) );179 $result['last_updated'] = gmdate( 'Y-m-d g:ia \G\M\T', strtotime( $last_updated ) ); 174 180 $result['added'] = gmdate( 'Y-m-d', strtotime( $post->post_date_gmt ) ); 175 181 $result['homepage'] = get_post_meta( $post_id, 'header_plugin_uri', true ); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-meta.php
r13751 r14153 61 61 <li> 62 62 <?php 63 $modified_time = get_post_modified_time(); 63 $last_updated = get_post_meta( $post->ID, 'last_updated', true ); 64 // Fallback to modified timestamp if meta unavailable. 65 $last_updated = $last_updated ? strtotime( $last_updated ) : get_post_modified_time( 'U', true ); 64 66 65 67 // Fallback for approved plugins that are not published yet. 66 if ( $modified_time< 0 ) {67 $ modified_time = get_post_time();68 if ( ! $last_updated || $last_updated < 0 ) { 69 $last_updated = get_post_time( 'U', true ); 68 70 } 69 71 … … 72 74 __( 'Last updated %s', 'wporg-plugins' ), 73 75 /* translators: %s: time since the last update */ 74 '<strong>' . wp_kses( sprintf( __( '%s ago', 'wporg-plugins' ), '<span>' . human_time_diff( $ modified_time) . '</span>' ), array( 'span' => true ) ) . '</strong>'76 '<strong>' . wp_kses( sprintf( __( '%s ago', 'wporg-plugins' ), '<span>' . human_time_diff( $last_updated ) . '</span>' ), array( 'span' => true ) ) . '</strong>' 75 77 ); 76 78 ?>
Note: See TracChangeset
for help on using the changeset viewer.