Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include 'wp-load.php';
- $wp_version = 4.8;
- function get_credits( $wp_version, $locale = 'en_US' ) {
- $response = wp_remote_get( "http://api.wordpress.org/core/credits/1.1/?version=$wp_version&locale=$locale" );
- if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
- return false;
- }
- $results = json_decode( wp_remote_retrieve_body( $response ), true );
- return $results;
- }
- $results = get_credits( $wp_version );
- $groups = array();
- foreach ( array( 'core-developers', 'contributing-developers', 'recent-rockstars', 'props' ) as $group ) {
- if ( isset( $results['groups'][ $group ]['data'] ) ) {
- $groups[] = count( $results['groups'][ $group ]['data'] );
- }
- }
- echo 'Contributors: ' . array_sum( $groups ) . '<br />';
- $latest_release_props = $results['groups']['props']['data'];
- $props = array();
- for ( $version = 3.2; $version < $wp_version - 0.1; $version += 0.1 ) {
- $results = get_credits( number_format( $version, 1 ) );
- $props += $results['groups']['props']['data'];
- }
- $new_contributors = array_diff( $latest_release_props, $props );
- echo 'New contributors: ' . count( $new_contributors ) . '<br />';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement