Making WordPress.org


Ignore:
Timestamp:
12/19/2017 04:22:37 PM (7 years ago)
Author:
obenland
Message:

PLugins: Clean up formatting with phpcbf

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-internal-stats.php

    r5839 r6287  
    11<?php
    22namespace WordPressdotorg\Plugin_Directory\API\Routes;
     3
    34use WordPressdotorg\Plugin_Directory\Plugin_Directory;
    45use WordPressdotorg\Plugin_Directory\API\Base;
     
    1920    function __construct() {
    2021        register_rest_route( 'plugins/v1', '/update-stats', array(
    21             'methods'  => \WP_REST_Server::CREATABLE,
    22             'callback' => array( $this, 'bulk_update_stats' ),
     22            'methods'             => \WP_REST_Server::CREATABLE,
     23            'callback'            => array( $this, 'bulk_update_stats' ),
    2324            'permission_callback' => array( $this, 'permission_check_internal_api_bearer' ),
    2425        ) );
     
    112113    protected function sanitize_usage_numbers( $usage, $plugin ) {
    113114        $latest_version = get_post_meta( $plugin->ID, 'version', true ) ?: '0.0';
    114         $latest_branch = implode( '.', array_slice( explode('.', $latest_version ), 0, 2 ) );
     115        $latest_branch  = implode( '.', array_slice( explode( '.', $latest_version ), 0, 2 ) );
    115116
    116117        // Exclude any version strings higher than the latest plugin version (ie. 99.9)
     
    126127
    127128        // Calculate the percentage of each version branch
    128         $total = array_sum( $usage );
     129        $total  = array_sum( $usage );
    129130        $others = array();
    130131        foreach ( $usage as $version => $count ) {
     
    141142        // If there was only one version < $percent_cut_off then display it as-is
    142143        if ( count( $others ) == 1 ) {
    143             $version = array_keys( $others );
    144             $version = array_shift( $version );
     144            $version           = array_keys( $others );
     145            $version           = array_shift( $version );
    145146            $usage[ $version ] = round( $others[ $version ] / $total * 100, 2 );
    146         // Else we'll add an 'others' version.
     147            // Else we'll add an 'others' version.
    147148        } elseif ( count( $others ) > 1 ) {
    148149            $usage['other'] = round( array_sum( $others ) / $total * 100, 2 );
Note: See TracChangeset for help on using the changeset viewer.