Changeset 4622
- Timestamp:
- 01/10/2017 10:13:25 PM (8 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-internal-stats.php
r3354 r4622 109 109 */ 110 110 protected function sanitize_usage_numbers( $usage, $plugin ) { 111 $latest_version = get_post_meta( $plugin->ID, 'version', true ) ;111 $latest_version = get_post_meta( $plugin->ID, 'version', true ) ?: '0.0'; 112 112 $latest_branch = implode( '.', array_slice( explode('.', $latest_version ), 0, 2 ) ); 113 113 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin.php
r4560 r4622 60 60 $result['name'] = $post->post_title; 61 61 $result['slug'] = $post->post_name; 62 $result['version'] = get_post_meta( $post_id, 'version', true ) ;62 $result['version'] = get_post_meta( $post_id, 'version', true ) ?: '0.0'; 63 63 64 64 $author = get_user_by( 'id', $post->post_author ); … … 92 92 } 93 93 94 $result['requires'] = get_post_meta( $post_id, 'requires', true ) ;95 $result['tested'] = get_post_meta( $post_id, 'tested', true ) ;94 $result['requires'] = get_post_meta( $post_id, 'requires', true ) ?: false; 95 $result['tested'] = get_post_meta( $post_id, 'tested', true ) ?: false; 96 96 $result['compatibility'] = array(); 97 $result['rating'] = get_post_meta( $post_id, 'rating', true) * 20; // Stored as 0.0 ~ 5.0, API outputs as 0..10097 $result['rating'] = ( get_post_meta( $post_id, 'rating', true ) ?: 0 ) * 20; // Stored as 0.0 ~ 5.0, API outputs as 0..100 98 98 $result['ratings'] = array_map( 'intval', (array) get_post_meta( $post_id, 'ratings', true ) ); 99 99 $result['num_ratings'] = array_sum( $result['ratings'] ); 100 $result['support_threads'] = get_post_meta( $post_id, 'support_threads', true ) ?: 0;101 $result['support_threads_resolved'] = get_post_meta( $post_id, 'support_threads_resolved', true ) ?: 0;102 $result['active_installs'] = (int)get_post_meta( $post_id, 'active_installs', true);100 $result['support_threads'] = intval( get_post_meta( $post_id, 'support_threads', true ) ); 101 $result['support_threads_resolved'] = intval( get_post_meta( $post_id, 'support_threads_resolved', true ) ); 102 $result['active_installs'] = intval( get_post_meta( $post_id, 'active_installs', true ) ); 103 103 $result['downloaded'] = intval( get_post_meta( $post_id, 'downloads', true ) ); 104 104 $result['last_updated'] = gmdate( 'Y-m-d g:ia \G\M\T', strtotime( $post->post_modified_gmt ) ); … … 124 124 125 125 $result['screenshots'] = array(); 126 $descriptions = get_post_meta( $post->ID, 'screenshots', true ) ;126 $descriptions = get_post_meta( $post->ID, 'screenshots', true ) ?: array(); 127 127 $screen_shots = get_post_meta( $post->ID, 'assets_screenshots', true ) ?: array(); 128 128 … … 151 151 } 152 152 153 $result['stable_tag'] = get_post_meta( $post_id, 'stable_tag', true ) ;153 $result['stable_tag'] = get_post_meta( $post_id, 'stable_tag', true ) ?: 'trunk'; 154 154 155 155 $result['versions'] = array(); … … 163 163 } 164 164 165 $result['donate_link'] = get_post_meta( $post_id, 'donate_link', true ) ;165 $result['donate_link'] = get_post_meta( $post_id, 'donate_link', true ) ?: false; 166 166 167 167 $result['banners'] = array(); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-i18n.php
r4475 r4622 347 347 $slug = $post->post_name; 348 348 349 $post->stable_tag = get_post_meta( $post->ID, 'stable_tag', true ) ;349 $post->stable_tag = get_post_meta( $post->ID, 'stable_tag', true ) ?: 'trunk'; 350 350 351 351 if ( empty( $slug ) ) { -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
r4514 r4622 20 20 public static function active_installs( $full = true, $post = null ) { 21 21 $post = get_post( $post ); 22 $count = get_post_meta( $post->ID, 'active_installs', true ) ;22 $count = get_post_meta( $post->ID, 'active_installs', true ) ?: 0; 23 23 24 24 if ( $count <= 10 ) { … … 131 131 } 132 132 133 $raw_sections = get_post_meta( $plugin->ID, 'sections', true ) ;133 $raw_sections = get_post_meta( $plugin->ID, 'sections', true ) ?: array(); 134 134 $raw_sections = array_unique( array_merge( $raw_sections, $default_sections ) ); 135 135 … … 216 216 public static function get_plugin_icon( $post = null, $output = 'raw' ) { 217 217 $plugin = get_post( $post ); 218 $raw_icons = get_post_meta( $plugin->ID, 'assets_icons', true ) ;218 $raw_icons = get_post_meta( $plugin->ID, 'assets_icons', true ) ?: array(); 219 219 220 220 $icon = $icon_2x = $svg = $generated = false; … … 295 295 296 296 $banner = $banner_2x = false; 297 $raw_banners = get_post_meta( $plugin->ID, 'assets_banners', true ) ;297 $raw_banners = get_post_meta( $plugin->ID, 'assets_banners', true ) ?: array(); 298 298 299 299 // Split in rtl and non-rtl banners. … … 449 449 450 450 if ( 'latest' == $version || 'latest-stable' == $version ) { 451 $version = get_post_meta( $post->ID, 'stable_tag', true ) ;451 $version = get_post_meta( $post->ID, 'stable_tag', true ) ?: 'trunk'; 452 452 } 453 453 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php
r4620 r4622 187 187 update_post_meta( $plugin->ID, 'assets_banners_color', wp_slash( $banner_average_color ) ); 188 188 189 $current_stable_tag = get_post_meta( $plugin->ID, 'stable_tag', true ) ;189 $current_stable_tag = get_post_meta( $plugin->ID, 'stable_tag', true ) ?: 'trunk'; 190 190 191 191 $this->rebuild_invalidate_zips( $plugin_slug, $stable_tag, $current_stable_tag, $svn_changed_tags ); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/shortcodes/class-screenshots.php
r4505 r4622 18 18 19 19 // All indexed from 1. 20 $descriptions = get_post_meta( $plugin->ID, 'screenshots', true ) ;21 $screen_shots = get_post_meta( $plugin->ID, 'assets_screenshots', true ) ;20 $descriptions = get_post_meta( $plugin->ID, 'screenshots', true ) ?: array(); 21 $screen_shots = get_post_meta( $plugin->ID, 'assets_screenshots', true ) ?: array();; 22 22 23 23 if ( empty( $screen_shots ) ) { -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-ratings.php
r3935 r4622 30 30 31 31 $post = get_post(); 32 $rating = get_post_meta( $post->ID, 'rating', true ) ;32 $rating = get_post_meta( $post->ID, 'rating', true ) ?: 0; 33 33 $ratings = get_post_meta( $post->ID, 'ratings', true ) ?: array(); 34 34 $num_ratings = array_sum( $ratings );
Note: See TracChangeset
for help on using the changeset viewer.