Skip to:
Content

BuddyPress.org

Changeset 10441


Ignore:
Timestamp:
01/07/2016 04:26:05 PM (11 years ago)
Author:
boonebgorges
Message:

Improved coding standards in BP_Groups_Widget.

Props sbrajesh.
See #6721.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-widgets.php

    r10440 r10441  
    2727         * Working as a group, we get things done better.
    2828         */
    29         function __construct() {
     29        public function __construct() {
    3030                $widget_ops = array(
    3131                        'description' => __( 'A dynamic list of recently active, popular, and newest groups', 'buddypress' ),
     
    3434                parent::__construct( false, _x( '(BuddyPress) Groups', 'widget name', 'buddypress' ), $widget_ops );
    3535
    36                 if ( is_active_widget( false, false, $this->id_base ) && !is_admin() && !is_network_admin() ) {
     36                if ( is_active_widget( false, false, $this->id_base ) && ! is_admin() && ! is_network_admin() ) {
    3737                        $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
    3838                        wp_enqueue_script( 'groups_widget_groups_list-js', buddypress()->plugin_url . "bp-groups/js/widget-groups{$min}.js", array( 'jquery' ), bp_get_version() );
     
    4646         * @param array $instance Widget instance data.
    4747         */
    48         function widget( $args, $instance ) {
     48        public function widget( $args, $instance ) {
    4949
    5050                /**
     
    5959                extract( $args );
    6060
    61                 if ( empty( $instance['group_default'] ) )
     61                if ( empty( $instance['group_default'] ) ) {
    6262                        $instance['group_default'] = 'popular';
    63 
    64                 if ( empty( $instance['title'] ) )
     63                }
     64
     65                if ( empty( $instance['title'] ) ) {
    6566                        $instance['title'] = __( 'Groups', 'buddypress' );
     67                }
    6668
    6769                /**
     
    8890                echo $before_widget;
    8991
    90                 $title = !empty( $instance['link_title'] ) ? '<a href="' . bp_get_groups_directory_permalink() . '">' . $title . '</a>' : $title;
     92                $title = ! empty( $instance['link_title'] ) ? '<a href="' . bp_get_groups_directory_permalink() . '">' . $title . '</a>' : $title;
    9193
    9294                echo $before_title . $title . $after_title;
     
    124126                                                                <span class="activity">
    125127                                                                <?php
    126                                                                         if ( 'newest' == $instance['group_default'] )
     128                                                                        if ( 'newest' == $instance['group_default'] ) {
    127129                                                                                printf( __( 'created %s', 'buddypress' ), bp_get_group_date_created() );
    128                                                                         if ( 'active' == $instance['group_default'] )
     130                                                                        } elseif ( 'active' == $instance['group_default'] ) {
    129131                                                                                printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() );
    130                                                                         elseif ( 'popular' == $instance['group_default'] )
     132                                                                        } elseif ( 'popular' == $instance['group_default'] ) {
    131133                                                                                bp_group_member_count();
     134                                                                        }
    132135                                                                ?>
    133136                                                                </span>
     
    160163         * @return array
    161164         */
    162         function update( $new_instance, $old_instance ) {
     165        public function update( $new_instance, $old_instance ) {
    163166                $instance = $old_instance;
    164167
     
    166169                $instance['max_groups']    = strip_tags( $new_instance['max_groups'] );
    167170                $instance['group_default'] = strip_tags( $new_instance['group_default'] );
    168                 $instance['link_title']    = (bool)$new_instance['link_title'];
     171                $instance['link_title']    = (bool) $new_instance['link_title'];
    169172
    170173                return $instance;
     
    177180         * @return mixed
    178181         */
    179         function form( $instance ) {
     182        public function form( $instance ) {
    180183                $defaults = array(
    181184                        'title'         => __( 'Groups', 'buddypress' ),
     
    189192                $max_groups    = strip_tags( $instance['max_groups'] );
    190193                $group_default = strip_tags( $instance['group_default'] );
    191                 $link_title    = (bool)$instance['link_title'];
     194                $link_title    = (bool) $instance['link_title'];
    192195                ?>
    193196
     
    212215function groups_ajax_widget_groups_list() {
    213216
    214         check_ajax_referer('groups_widget_groups_list');
     217        check_ajax_referer( 'groups_widget_groups_list' );
    215218
    216219        switch ( $_POST['filter'] ) {
     
    267270        <?php else: ?>
    268271
    269                 <?php echo "-1[[SPLIT]]<li>" . __("No groups matched the current filter.", 'buddypress'); ?>
     272                <?php echo "-1[[SPLIT]]<li>" . __( "No groups matched the current filter.", 'buddypress' ); ?>
    270273
    271274        <?php endif;
Note: See TracChangeset for help on using the changeset viewer.