- Timestamp:
- 05/17/2023 11:14:06 AM (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/classes/class-bp-messages-sitewide-notices-widget.php
r13108 r13481 6 6 * @subpackage MessagesClasses 7 7 * @since 1.9.0 8 * @deprecated 12.0.0 8 9 */ 9 10 … … 11 12 defined( 'ABSPATH' ) || exit; 12 13 14 _deprecated_file( basename( __FILE__ ), '12.0.0', '', __( 'BuddyPress does not include Legacy Widgets anymore, you can restore it using the BP Classic plugin', 'buddypress' ) ); 15 13 16 /** 14 17 * A widget that displays sitewide notices. 15 18 * 16 19 * @since 1.9.0 20 * @deprecated 12.0.0 17 21 */ 18 22 class BP_Messages_Sitewide_Notices_Widget extends WP_Widget { … … 23 27 * @since 1.9.0 24 28 * @since 9.0.0 Adds the `show_instance_in_rest` property to Widget options. 29 * @deprecated 12.0.0 25 30 */ 26 31 public function __construct() { 27 parent::__construct( 28 'bp_messages_sitewide_notices_widget', 29 __( '(BuddyPress) Sitewide Notices', 'buddypress' ), 30 array( 31 'classname' => 'widget_bp_core_sitewide_messages buddypress widget', 32 'description' => __( 'Display Sitewide Notices posted by the site administrator', 'buddypress' ), 33 'customize_selective_refresh' => true, 34 'show_instance_in_rest' => true, 35 ) 36 ); 32 _deprecated_function( __METHOD__, '12.0.0' ); 37 33 } 38 34 39 35 /** 40 36 * Render the widget. 37 * 38 * @deprecated 12.0.0 41 39 * 42 40 * @see WP_Widget::widget() for a description of parameters. … … 46 44 */ 47 45 public function widget( $args, $instance ) { 48 49 if ( ! is_user_logged_in() ) { 50 return; 51 } 52 53 // Don't display the widget if there are no Notices to show. 54 $notices = BP_Messages_Notice::get_active(); 55 if ( empty( $notices ) ) { 56 return; 57 } 58 59 extract( $args ); 60 61 $title = ! empty( $instance['title'] ) ? $instance['title'] : ''; 62 63 /** 64 * Filters the title of the Messages widget. 65 * 66 * @since 1.9.0 67 * @since 2.3.0 Added 'instance' and 'id_base' to arguments passed to filter. 68 * 69 * @param string $title The widget title. 70 * @param array $instance The settings for the particular instance of the widget. 71 * @param string $id_base Root ID for all widgets of this type. 72 */ 73 $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); 74 75 echo $before_widget; 76 echo $before_title . $title . $after_title; ?> 77 78 <div class="bp-site-wide-message"> 79 <?php bp_message_get_notices(); ?> 80 </div> 81 82 <?php 83 84 echo $after_widget; 46 _deprecated_function( __METHOD__, '12.0.0' ); 85 47 } 86 48 87 49 /** 88 50 * Process the saved settings for the widget. 51 * 52 * @deprecated 12.0.0 89 53 * 90 54 * @see WP_Widget::update() for a description of parameters and … … 96 60 */ 97 61 public function update( $new_instance, $old_instance ) { 98 $instance = $old_instance; 99 $instance['title'] = strip_tags( $new_instance['title'] ); 100 return $instance; 62 _deprecated_function( __METHOD__, '12.0.0' ); 101 63 } 102 64 103 65 /** 104 66 * Render the settings form for Appearance > Widgets. 67 * 68 * @deprecated 12.0.0 105 69 * 106 70 * @see WP_Widget::form() for a description of parameters. … … 109 73 */ 110 74 public function form( $instance ) { 111 $instance = bp_parse_args( 112 (array) $instance, 113 array( 114 'title' => '', 115 ) 116 ); 117 118 $title = strip_tags( $instance['title'] ); ?> 119 120 <p> 121 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'buddypress' ); ?></label> 122 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /> 123 </p> 124 125 <?php 75 _deprecated_function( __METHOD__, '12.0.0' ); 126 76 } 127 77 }
Note: See TracChangeset
for help on using the changeset viewer.