Making WordPress.org


Ignore:
Timestamp:
12/19/2017 04:22:37 PM (9 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/bin/quick-stats.php

    r6261 r6287  
    2020$_SERVER['REQUEST_URI'] = parse_url( $opts['url'], PHP_URL_PATH );
    2121
    22 include rtrim( $opts['abspath'], '/' ) . '/wp-load.php';
     22require rtrim( $opts['abspath'], '/' ) . '/wp-load.php';
    2323
    2424if ( ! class_exists( '\WordPressdotorg\Plugin_Directory\Plugin_Directory' ) ) {
     
    2626        if ( defined( 'WPORG_PLUGIN_DIRECTORY_BLOGID' ) ) {
    2727                fwrite( STDERR, "Run the following command instead:\n" );
    28                 fwrite( STDERR, "\tphp " . implode( ' ', $argv ) . " --url " . get_site_url( WPORG_PLUGIN_DIRECTORY_BLOGID, '/' ) . "\n" );
     28                fwrite( STDERR, "\tphp " . implode( ' ', $argv ) . ' --url ' . get_site_url( WPORG_PLUGIN_DIRECTORY_BLOGID, '/' ) . "\n" );
    2929        }
    3030        die();
     
    3838function display_top_table( $stats, $n = 20 ) {
    3939
    40         $top = array_slice( $stats, 0, $n );
     40        $top  = array_slice( $stats, 0, $n );
    4141        $tail = array_slice( $stats, $n );
    4242
    4343        foreach ( $top as $row ) {
    44                 #$vals = array_values( (array) $row );
     44                // $vals = array_values( (array) $row );
    4545                echo $row[0] . "\t\t\t" . number_format( $row[1] ) . "\n";
    4646        }
    4747
    48         echo "Top $n Total: " . number_format( array_reduce( $top, __NAMESPACE__.'\callback_sum' ) ) . "\n";
     48        echo "Top $n Total: " . number_format( array_reduce( $top, __NAMESPACE__ . '\callback_sum' ) ) . "\n";
    4949
    5050        $tail_n = count( $tail );
    51         echo "Other $tail_n: " . number_format( array_reduce( $tail, __NAMESPACE__.'\callback_sum' ) ) . "\n";
     51        echo "Other $tail_n: " . number_format( array_reduce( $tail, __NAMESPACE__ . '\callback_sum' ) ) . "\n";
    5252
    5353}
    5454
    55 function tested_to_summary($pfx_where = '1=1') {
     55function tested_to_summary( $pfx_where = '1=1' ) {
    5656        global $wpdb;
    5757
     
    6161}
    6262
    63 $where = $wpdb->prepare( "post_status = %s", 'publish' );
     63$where = $wpdb->prepare( 'post_status = %s', 'publish' );
    6464
    65 if ( !empty( $opts['age'] ) && strtotime( $opts['age'] ) > 0 )
    66         $where .= $wpdb->prepare( " AND post_modified >= %s", strftime( '%Y-%m-%d',     strtotime( $opts['age'] ) ) );
     65if ( ! empty( $opts['age'] ) && strtotime( $opts['age'] ) > 0 ) {
     66        $where .= $wpdb->prepare( ' AND post_modified >= %s', strftime( '%Y-%m-%d', strtotime( $opts['age'] ) ) );
     67}
    6768
    68 //TODO: add some more reports, and a CLI argument for choosing them
     69// TODO: add some more reports, and a CLI argument for choosing them
    6970display_top_table( tested_to_summary( $where ) );
Note: See TracChangeset for help on using the changeset viewer.