Changeset 4622 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin.php
- Timestamp:
- 01/10/2017 10:13:25 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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();
Note: See TracChangeset
for help on using the changeset viewer.