Changeset 4420
- Timestamp:
- 11/25/2016 06:55:10 AM (8 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 2 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r4419 r4420 41 41 add_filter( 'single_term_title', array( $this, 'filter_single_term_title' ) ); 42 42 add_filter( 'the_content', array( $this, 'filter_rel_nofollow' ) ); 43 44 // Cron tasks. 45 add_action( 'admin_init', array( $this, 'register_cron_tasks' ) ); 46 add_action( 'plugin_directory_meta_sync', array( __NAMESPACE__ . '\Jobs\Meta_Sync', 'cron_trigger' ) ); 43 47 44 48 // oEmbed whitlisting. … … 328 332 329 333 /** 334 * Queue all of our cron tasks. 335 */ 336 function register_cron_tasks() { 337 if ( ! wp_next_scheduled ( 'plugin_directory_meta_sync' ) ) { 338 wp_schedule_event( time(), 'hourly', 'plugin_directory_meta_sync' ); 339 } 340 } 341 342 /** 330 343 * Register the Shortcodes used within the content. 331 344 */ … … 951 964 public function filter_shim_postmeta( $value, $object_id, $meta_key ) { 952 965 switch ( $meta_key ) { 953 case 'downloads':954 $post = get_post( $object_id );955 $count = Template::get_downloads_count( $post );956 $value = array( $count );957 break;958 959 case 'rating':960 $post = get_post( $object_id );961 // The WordPress.org global ratings functions962 if ( ! method_exists( '\WPORG_Ratings', 'get_avg_rating' ) ) {963 break;964 }965 966 $rating = \WPORG_Ratings::get_avg_rating( 'plugin', $post->post_name );967 $value = array( $rating );968 break;969 970 case 'ratings':971 $post = get_post( $object_id );972 if ( ! method_exists( '\WPORG_Ratings', 'get_rating_counts' ) ) {973 break;974 }975 976 $ratings = \WPORG_Ratings::get_rating_counts( 'plugin', $post->post_name );977 $value = array( $ratings );978 break;979 980 966 case 'tested': 981 967 // For the tested field, we bump up the minor release to the latest compatible minor release.
Note: See TracChangeset
for help on using the changeset viewer.