Skip to:
Content

bbPress.org

Changeset 2802


Ignore:
Timestamp:
01/13/2011 11:47:27 PM (14 years ago)
Author:
johnjamesjacoby
Message:

Clean up index.php. Number format friendliness. Add some comments. Fixes #1370 props JohnConners

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bb-admin/index.php

    r2535 r2802  
    11<?php
     2
     3// Get started
    24require_once('admin.php');
    35require_once( BB_PATH . BB_INC . 'functions.bb-statistics.php' );
    46
    5 $rn_forums = get_total_forums();
    6 $rn_forums = sprintf(__ngettext('<span>%d</span> forum', '<span>%d</span> forums', $rn_forums), number_format( $rn_forums ) );
     7// Get counts and format numbers
     8$rn_forums             = number_format( get_total_forums() );
     9$rn_forums             = sprintf(__ngettext('<span>%s</span> forum', '<span>%s</span> forums', $rn_forums), $rn_forums );
    710
    8 $rn_topics = get_total_topics();
    9 $rn_topics = sprintf(__ngettext('<span>%d</span> topic', '<span>%d</span> topics', $rn_topics), number_format( $rn_topics ) );
     11$rn_topics             = number_format( get_total_topics() );
     12$rn_topics             = sprintf(__ngettext('<span>%s</span> topic', '<span>%s</span> topics', $rn_topics), $rn_topics );
    1013
    11 $rn_posts = get_total_posts();
    12 $rn_posts = sprintf(__ngettext('<span>%d</span> post', '<span>%d</span> posts', $rn_posts), number_format( $rn_posts ) );
     14$rn_posts              = number_format( get_total_posts() );
     15$rn_posts              = sprintf(__ngettext('<span>%s</span> post', '<span>%s</span> posts', $rn_posts), $rn_posts );
    1316
    14 $rn_users = bb_get_total_users();
    15 $rn_users = sprintf(__ngettext('<span>%d</span> user', '<span>%d</span> users', $rn_users), number_format( $rn_users ) );
     17$rn_users              = number_format( bb_get_total_users() );
     18$rn_users              = sprintf(__ngettext('<span>%s</span> user', '<span>%s</span> users', $rn_users), $rn_users );
    1619
    17 $rn_topic_tags = bb_get_total_topic_tags();
    18 $rn_topic_tags = sprintf(__ngettext('<span>%d</span> tag', '<span>%d</span> tags', $rn_topic_tags), number_format( $rn_topic_tags ) );
     20$rn_topic_tags         = number_format( bb_get_total_topic_tags() );
     21$rn_topic_tags         = sprintf(__ngettext('<span>%s</span> tag', '<span>%s</span> tags', $rn_topic_tags), $rn_topic_tags );
    1922
    20 $rn_topics_average = get_topics_per_day();
    21 $rn_topics_average = sprintf(__ngettext('<span>%d</span> topic', '<span>%d</span> topics', $rn_topics_average), number_format( $rn_topics_average ) );
     23$rn_topics_average     = number_format( get_topics_per_day() );
     24$rn_topics_average     = sprintf(__ngettext('<span>%s</span> topic', '<span>%s</span> topics', $rn_topics_average), $rn_topics_average );
    2225
    23 $rn_posts_average = get_posts_per_day();
    24 $rn_posts_average = sprintf(__ngettext('<span>%d</span> post', '<span>%d</span> posts', $rn_posts_average), number_format( $rn_posts_average ) );
     26$rn_posts_average      = number_format( get_posts_per_day() );
     27$rn_posts_average      = sprintf(__ngettext('<span>%s</span> post', '<span>%s</span> posts', $rn_posts_average), $rn_posts_average );
    2528
    26 $rn_users_average = get_registrations_per_day();
    27 $rn_users_average = sprintf(__ngettext('<span>%d</span> user', '<span>%d</span> users', $rn_users_average), number_format( $rn_users_average ) );
     29$rn_users_average      = number_format( get_registrations_per_day() );
     30$rn_users_average      = sprintf(__ngettext('<span>%s</span> user', '<span>%s</span> users', $rn_users_average), $rn_users_average );
    2831
    29 $rn_topic_tags_average = bb_get_topic_tags_per_day();
    30 $rn_topic_tags_average = sprintf(__ngettext('<span>%d</span> tag', '<span>%d</span> tags', $rn_topic_tags_average), number_format( $rn_topic_tags_average ) );
     32$rn_topic_tags_average = number_format( bb_get_topic_tags_per_day() );
     33$rn_topic_tags_average = sprintf(__ngettext('<span>%s</span> tag', '<span>%s</span> tags', $rn_topic_tags_average), $rn_topic_tags_average );
    3134
     35// Filter the numbers
    3236$rn = apply_filters( 'bb_admin_right_now', array(
    3337    'forums'     => array( $rn_forums, '-' ),
     
    4044$bb_admin_body_class = ' bb-admin-dashboard';
    4145
    42 bb_get_admin_header();
    43 ?>
     46bb_get_admin_header(); ?>
    4447
    4548<div class="wrap">
    4649    <h2><?php _e('Dashboard'); ?></h2>
     50
    4751    <?php do_action( 'bb_admin_notices' ); ?>
    4852
     
    5761                    </tr>
    5862                </thead>
    59 <?php
    60 if ( !empty( $rn ) && is_array( $rn ) ) {
    61 ?>
     63
     64<?php if ( !empty( $rn ) && is_array( $rn ) ) { ?>
     65
    6266                <tbody>
    63 <?php
    64     foreach ( $rn as $rn_row ) {
    65 ?>
     67
     68    <?php foreach ( $rn as $rn_row ) { ?>
     69
    6670                    <tr>
    6771                        <td><?php echo $rn_row[0]; ?></td>
    6872                        <td><?php echo $rn_row[1]; ?></td>
    6973                    </tr>
    70 <?php
    71     }
    72 ?>
     74    <?php } ?>
     75
    7376                </tbody>
    74 <?php
    75 }
    76 ?>
     77
     78<?php } ?>
     79
    7780            </table>
    7881        </div>
Note: See TracChangeset for help on using the changeset viewer.