Changeset 2705 for trunk/bp-core/bp-core-widgets.php
- Timestamp:
- 02/12/2010 02:37:31 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-widgets.php
r2695 r2705 3 3 /* Register widgets for the core component */ 4 4 function bp_core_register_widgets() { 5 add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Welcome_Widget");') );6 5 add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Members_Widget");') ); 7 6 add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Whos_Online_Widget");') ); … … 9 8 } 10 9 add_action( 'bp_register_widgets', 'bp_core_register_widgets' ); 11 12 /*** WELCOME WIDGET *****************/13 14 class BP_Core_Welcome_Widget extends WP_Widget {15 function bp_core_welcome_widget() {16 parent::WP_Widget( false, $name = __( 'Welcome', 'buddypress' ) );17 }18 19 function widget($args, $instance) {20 extract( $args );21 ?>22 <?php echo $before_widget; ?>23 <?php echo $before_title24 . $instance['title']25 . $after_title; ?>26 27 <?php if ( $instance['title'] ) : ?><h3><?php echo attribute_escape( stripslashes( $instance['title'] ) ) ?></h3><?php endif; ?>28 <?php if ( $instance['text'] ) : ?><p><?php echo apply_filters( 'bp_core_welcome_widget_text', $instance['text'] ) ?></p><?php endif; ?>29 30 <?php if ( !is_user_logged_in() ) { ?>31 <div class="create-account"><div class="visit generic-button"><a href="<?php bp_signup_page() ?>" title="<?php _e('Create Account', 'buddypress') ?>"><?php _e('Create Account', 'buddypress') ?></a></div></div>32 <?php } ?>33 34 <?php echo $after_widget; ?>35 <?php36 }37 38 function update( $new_instance, $old_instance ) {39 $instance = $old_instance;40 $instance['title'] = strip_tags( $new_instance['title'] );41 $instance['text'] = strip_tags( wp_filter_post_kses( $new_instance['text'] ) );42 43 return $instance;44 }45 46 function form( $instance ) {47 $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'text' => '' ) );48 $title = strip_tags( $instance['title'] );49 $text = strip_tags( $instance['text'] );50 ?>51 <p><label for="bp-widget-welcome-title"><?php _e('Title:', 'buddypress'); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo attribute_escape( stripslashes( $title ) ); ?>" /></label></p>52 <p>53 <label for="bp-widget-welcome-text"><?php _e( 'Welcome Text:' , 'buddypress'); ?>54 <textarea id="<?php echo $this->get_field_id( 'text' ); ?>" name="<?php echo $this->get_field_name( 'text' ); ?>" class="widefat" style="height: 100px"><?php echo attribute_escape( stripslashes( $text ) ); ?></textarea>55 </label>56 </p>57 <?php58 }59 }60 add_filter( 'bp_core_welcome_widget_text', 'attribute_escape' );61 add_filter( 'bp_core_welcome_widget_text', 'wptexturize' );62 add_filter( 'bp_core_welcome_widget_text', 'convert_smilies' );63 add_filter( 'bp_core_welcome_widget_text', 'convert_chars' );64 add_filter( 'bp_core_welcome_widget_text', 'stripslashes' );65 add_filter( 'bp_core_welcome_widget_text', 'wpautop' );66 add_filter( 'bp_core_welcome_widget_text', 'force_balance_tags' );67 68 10 69 11 /*** MEMBERS WIDGET *****************/
Note: See TracChangeset
for help on using the changeset viewer.