Changeset 10441
- Timestamp:
- 01/07/2016 04:26:05 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-widgets.php
r10440 r10441 27 27 * Working as a group, we get things done better. 28 28 */ 29 function __construct() {29 public function __construct() { 30 30 $widget_ops = array( 31 31 'description' => __( 'A dynamic list of recently active, popular, and newest groups', 'buddypress' ), … … 34 34 parent::__construct( false, _x( '(BuddyPress) Groups', 'widget name', 'buddypress' ), $widget_ops ); 35 35 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() ) { 37 37 $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; 38 38 wp_enqueue_script( 'groups_widget_groups_list-js', buddypress()->plugin_url . "bp-groups/js/widget-groups{$min}.js", array( 'jquery' ), bp_get_version() ); … … 46 46 * @param array $instance Widget instance data. 47 47 */ 48 function widget( $args, $instance ) {48 public function widget( $args, $instance ) { 49 49 50 50 /** … … 59 59 extract( $args ); 60 60 61 if ( empty( $instance['group_default'] ) ) 61 if ( empty( $instance['group_default'] ) ) { 62 62 $instance['group_default'] = 'popular'; 63 64 if ( empty( $instance['title'] ) ) 63 } 64 65 if ( empty( $instance['title'] ) ) { 65 66 $instance['title'] = __( 'Groups', 'buddypress' ); 67 } 66 68 67 69 /** … … 88 90 echo $before_widget; 89 91 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; 91 93 92 94 echo $before_title . $title . $after_title; … … 124 126 <span class="activity"> 125 127 <?php 126 if ( 'newest' == $instance['group_default'] ) 128 if ( 'newest' == $instance['group_default'] ) { 127 129 printf( __( 'created %s', 'buddypress' ), bp_get_group_date_created() ); 128 if ( 'active' == $instance['group_default'] )130 } elseif ( 'active' == $instance['group_default'] ) { 129 131 printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() ); 130 elseif ( 'popular' == $instance['group_default'] )132 } elseif ( 'popular' == $instance['group_default'] ) { 131 133 bp_group_member_count(); 134 } 132 135 ?> 133 136 </span> … … 160 163 * @return array 161 164 */ 162 function update( $new_instance, $old_instance ) {165 public function update( $new_instance, $old_instance ) { 163 166 $instance = $old_instance; 164 167 … … 166 169 $instance['max_groups'] = strip_tags( $new_instance['max_groups'] ); 167 170 $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']; 169 172 170 173 return $instance; … … 177 180 * @return mixed 178 181 */ 179 function form( $instance ) {182 public function form( $instance ) { 180 183 $defaults = array( 181 184 'title' => __( 'Groups', 'buddypress' ), … … 189 192 $max_groups = strip_tags( $instance['max_groups'] ); 190 193 $group_default = strip_tags( $instance['group_default'] ); 191 $link_title = (bool) $instance['link_title'];194 $link_title = (bool) $instance['link_title']; 192 195 ?> 193 196 … … 212 215 function groups_ajax_widget_groups_list() { 213 216 214 check_ajax_referer( 'groups_widget_groups_list');217 check_ajax_referer( 'groups_widget_groups_list' ); 215 218 216 219 switch ( $_POST['filter'] ) { … … 267 270 <?php else: ?> 268 271 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' ); ?> 270 273 271 274 <?php endif;
Note: See TracChangeset
for help on using the changeset viewer.