'bbp_widget_login', 'description' => esc_html__('A simple login form with optional links to sign-up and lost password pages.', 'bbpress'), 'customize_selective_refresh' => true )); parent::__construct(false, esc_html__('(Forumax) Login Widget', 'bbpress'), $widget_ops); } /** * Register the widget * * @since 2.0.0 bbPress (r3389) */ public static function register_widget() { register_widget('BBP_Login_Widget'); } /** * Displays the output, the login form * * @since 2.0.0 bbPress (r2827) * * @param array $args Arguments * @param array $instance Instance */ public function widget($args = array(), $instance = array()) { // Get widget settings $settings = $this->parse_settings($instance); // Typical WordPress filter $settings['title'] = apply_filters('widget_title', $settings['title'], $instance, $this->id_base); // bbPress filters $settings['title'] = apply_filters('bbp_login_widget_title', $settings['title'], $instance, $this->id_base); $settings['register'] = apply_filters('bbp_login_widget_register', $settings['register'], $instance, $this->id_base); $settings['lostpass'] = apply_filters('bbp_login_widget_lostpass', $settings['lostpass'], $instance, $this->id_base); echo $args['before_widget']; if (!empty($settings['title'])) { echo $args['before_title'] . $settings['title'] . $args['after_title']; } if (!is_user_logged_in()): ?>
id="rememberme" />

parse_settings($instance); ?>

'', 'register' => '', 'lostpass' => '' ), 'login_widget_settings'); } } /** * bbPress Views Widget * * Adds a widget which displays the view list * * @since 2.0.0 bbPress (r3020) */ class BBP_Views_Widget extends WP_Widget { /** * bbPress View Widget * * Registers the view widget * * @since 2.0.0 bbPress (r3020) */ public function __construct() { $widget_ops = apply_filters('bbp_views_widget_options', array( 'classname' => 'widget_display_views', 'description' => esc_html__('A list of registered optional topic views.', 'bbpress'), 'customize_selective_refresh' => true )); parent::__construct(false, esc_html__('(Forumax) Topic Views List', 'bbpress'), $widget_ops); } /** * Register the widget * * @since 2.0.0 bbPress (r3389) */ public static function register_widget() { register_widget('BBP_Views_Widget'); } /** * Displays the output, the view list * * @since 2.0.0 bbPress (r3020) * * @param array $args Arguments * @param array $instance Instance */ public function widget($args = array(), $instance = array()) { // Only output widget contents if views exist if (!bbp_get_views()) { return; } // Get widget settings $settings = $this->parse_settings($instance); // Typical WordPress filter $settings['title'] = apply_filters('widget_title', $settings['title'], $instance, $this->id_base); // bbPress filter $settings['title'] = apply_filters('bbp_view_widget_title', $settings['title'], $instance, $this->id_base); // Start an output buffer ob_start(); echo $args['before_widget']; if (!empty($settings['title'])) { echo $args['before_title'] . $settings['title'] . $args['after_title']; } ?> parse_settings($instance); ?>

'' ), 'view_widget_settings'); } } /** * bbPress Search Widget * * Adds a widget which displays the forum search form * * @since 2.3.0 bbPress (r4579) */ class BBP_Search_Widget extends WP_Widget { /** * bbPress Search Widget * * Registers the search widget * * @since 2.3.0 bbPress (r4579) */ public function __construct() { $widget_ops = apply_filters('bbp_search_widget_options', array( 'classname' => 'widget_display_search', 'description' => esc_html__('The bbPress forum search form.', 'bbpress'), 'customize_selective_refresh' => true )); parent::__construct(false, esc_html__('(Forumax) Forum Search Form', 'bbpress'), $widget_ops); } /** * Register the widget * * @since 2.3.0 bbPress (r4579) */ public static function register_widget() { register_widget('BBP_Search_Widget'); } /** * Displays the output, the search form * * @since 2.3.0 bbPress (r4579) */ public function widget($args, $instance) { // Bail if search is disabled if (!bbp_allow_search()) { return; } // Get widget settings $settings = $this->parse_settings($instance); // Typical WordPress filter $settings['title'] = apply_filters('widget_title', $settings['title'], $instance, $this->id_base); // bbPress filter $settings['title'] = apply_filters('bbp_search_widget_title', $settings['title'], $instance, $this->id_base); echo $args['before_widget']; if (!empty($settings['title'])) { echo $args['before_title'] . $settings['title'] . $args['after_title']; } bbp_get_template_part('form', 'search'); echo $args['after_widget']; } /** * Update the widget options * * @since 2.3.0 bbPress (r4579) * * @param array $new_instance The new instance options * @param array $old_instance The old instance options */ public function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); return $instance; } /** * Output the search widget options form * * @since 2.3.0 bbPress (r4579) * * @param $instance Instance */ public function form($instance) { // Get widget settings $settings = $this->parse_settings($instance); ?>

esc_html__('Search Forums', 'bbpress') ), 'search_widget_settings'); } } /** * bbPress Forum Widget * * Adds a widget which displays the forum list * * @since 2.0.0 bbPress (r2653) */ class BBP_Forums_Widget extends WP_Widget { /** * bbPress Forum Widget * * Registers the forum widget * * @since 2.0.0 bbPress (r2653) */ public function __construct() { $widget_ops = apply_filters('bbp_forums_widget_options', array( 'classname' => 'widget_display_forums', 'description' => esc_html__('A list of forums with an option to set the parent.', 'bbpress'), 'customize_selective_refresh' => true )); parent::__construct(false, esc_html__('(Forumax) Forums List', 'bbpress'), $widget_ops); } /** * Register the widget * * @since 2.0.0 bbPress (r3389) */ public static function register_widget() { register_widget('BBP_Forums_Widget'); } /** * Displays the output, the forum list * * @since 2.0.0 bbPress (r2653) * * @param array $args Arguments * @param array $instance Instance */ public function widget($args, $instance) { // Get widget settings $settings = $this->parse_settings($instance); // Typical WordPress filter $settings['title'] = apply_filters('widget_title', $settings['title'], $instance, $this->id_base); // bbPress filter $settings['title'] = apply_filters('bbp_forum_widget_title', $settings['title'], $instance, $this->id_base); // Note: private and hidden forums will be excluded via the // bbp_pre_get_posts_normalize_forum_visibility action and function. $widget_query = new WP_Query(array( // What and how 'post_type' => bbp_get_forum_post_type(), 'post_status' => bbp_get_public_status_id(), 'post_parent' => $settings['parent_forum'], 'posts_per_page' => (int) get_option('_bbp_forums_per_page', 50), // Order 'orderby' => 'menu_order title', 'order' => 'ASC', // Performance 'ignore_sticky_posts' => true, 'no_found_rows' => true, 'update_post_term_cache' => false, 'update_post_meta_cache' => false )); // Bail if no posts if (!$widget_query->have_posts()) { return; } echo $args['before_widget']; if (!empty($settings['title'])) { echo $args['before_title'] . $settings['title'] . $args['after_title']; } ?> parse_settings($instance); ?>


esc_html__('Forums', 'bbpress'), 'parent_forum' => 0 ), 'forum_widget_settings'); } } /** * bbPress Topic Widget * * Adds a widget which displays the topic list * * @since 2.0.0 bbPress (r2653) */ class BBP_Topics_Widget extends WP_Widget { /** * bbPress Topic Widget * * Registers the topic widget * * @since 2.0.0 bbPress (r2653) */ public function __construct() { $widget_ops = apply_filters('bbp_topics_widget_options', array( 'classname' => 'widget_display_topics', 'description' => esc_html__('A list of recent topics, sorted by: newness, popularity, or recent replies.', 'bbpress'), 'customize_selective_refresh' => true )); parent::__construct(false, esc_html__('(Forumax) Recent Topics', 'bbpress'), $widget_ops); } /** * Register the widget * * @since 2.0.0 bbPress (r3389) */ public static function register_widget() { register_widget('BBP_Topics_Widget'); } /** * Displays the output, the topic list * * @since 2.0.0 bbPress (r2653) * * @param array $args * @param array $instance */ public function widget($args = array(), $instance = array()) { // Get widget settings $settings = $this->parse_settings($instance); // Typical WordPress filter $settings['title'] = apply_filters('widget_title', $settings['title'], $instance, $this->id_base); // bbPress filter $settings['title'] = apply_filters('bbp_topic_widget_title', $settings['title'], $instance, $this->id_base); // How do we want to order our results? switch ($settings['order_by']) { // Order by most recent replies case 'freshness': $topics_query = array( // What and how 'post_type' => bbp_get_topic_post_type(), 'post_status' => bbp_get_public_topic_statuses(), 'post_parent' => $settings['parent_forum'], 'posts_per_page' => (int) $settings['max_shown'], 'meta_query' => array( array( 'key' => '_bbp_last_active_time', 'type' => 'DATETIME' ) ), // Ordering 'orderby' => 'meta_value', 'order' => 'DESC', // Performance 'ignore_sticky_posts' => true, 'no_found_rows' => true, 'update_post_term_cache' => false, 'update_post_meta_cache' => false ); break; // Order by total number of replies case 'popular': $topics_query = array( // What and how 'post_type' => bbp_get_topic_post_type(), 'post_status' => bbp_get_public_topic_statuses(), 'post_parent' => $settings['parent_forum'], 'posts_per_page' => (int) $settings['max_shown'], 'meta_query' => array( array( 'key' => '_bbp_reply_count', 'type' => 'NUMERIC' ) ), // Ordering 'orderby' => 'meta_value_num', 'order' => 'DESC', // Performance 'ignore_sticky_posts' => true, 'no_found_rows' => true, 'update_post_term_cache' => false, 'update_post_meta_cache' => false ); break; // Order by which topic was created most recently case 'newness': default: $topics_query = array( // What and how 'post_type' => bbp_get_topic_post_type(), 'post_status' => bbp_get_public_topic_statuses(), 'post_parent' => $settings['parent_forum'], 'posts_per_page' => (int) $settings['max_shown'], // Ordering 'orderby' => 'date', 'order' => 'DESC', // Performance 'ignore_sticky_posts' => true, 'no_found_rows' => true, 'update_post_term_cache' => false, 'update_post_meta_cache' => false ); break; } // Note: private and hidden forums will be excluded via the // bbp_pre_get_posts_normalize_forum_visibility action and function. $widget_query = new WP_Query($topics_query); // Bail if no topics are found if (!$widget_query->have_posts()) { return; } // Start an output buffer ob_start(); echo $args['before_widget']; if (!empty($settings['title'])) { echo $args['before_title'] . $settings['title'] . $args['after_title']; } ?> parse_settings($instance); ?>


esc_html__('Recent Topics', 'bbpress'), 'max_shown' => 5, 'show_date' => false, 'show_user' => false, 'parent_forum' => 'any', 'order_by' => false ), 'topic_widget_settings'); } } /** * bbPress Statistics Widget * * Adds a widget which displays the forum statistics * * @since 2.3.0 bbPress (r4509) */ class BBP_Stats_Widget extends WP_Widget { /** * bbPress Statistics Widget * * Registers the statistics widget * * @since 2.3.0 bbPress (r4509) */ public function __construct() { $widget_ops = apply_filters('bbp_stats_widget_options', array( 'classname' => 'widget_display_stats', 'description' => esc_html__('Some statistics from your forum.', 'bbpress'), 'customize_selective_refresh' => true )); parent::__construct(false, esc_html__('(Forumax) Statistics', 'bbpress'), $widget_ops); } /** * Register the widget * * @since 2.3.0 bbPress (r4509) */ public static function register_widget() { register_widget('BBP_Stats_Widget'); } /** * Displays the output, the statistics * * @since 2.3.0 bbPress (r4509) * * @param array $args Arguments * @param array $instance Instance */ public function widget($args = array(), $instance = array()) { // Get widget settings $settings = $this->parse_settings($instance); // Typical WordPress filter $settings['title'] = apply_filters('widget_title', $settings['title'], $instance, $this->id_base); // bbPress widget title filter $settings['title'] = apply_filters('bbp_stats_widget_title', $settings['title'], $instance, $this->id_base); echo $args['before_widget']; if (!empty($settings['title'])) { echo $args['before_title'] . $settings['title'] . $args['after_title']; } bbp_get_template_part('content', 'statistics'); echo $args['after_widget']; } /** * Update the statistics widget options * * @since 2.3.0 bbPress (r4509) * * @param array $new_instance The new instance options * @param array $old_instance The old instance options * * @return array */ public function update($new_instance, $old_instance) { $instance = $old_instance; $instance['title'] = strip_tags($new_instance['title']); return $instance; } /** * Output the statistics widget options form * * @since 2.3.0 bbPress (r4509) * * @param $instance * * @return string|void */ public function form($instance) { // Get widget settings $settings = $this->parse_settings($instance); ?>

esc_html__('Forum Statistics', 'bbpress') ), 'stats_widget_settings'); } } /** * bbPress Replies Widget * * Adds a widget which displays the replies list * * @since 2.0.0 bbPress (r2653) */ class BBP_Replies_Widget extends WP_Widget { /** * bbPress Replies Widget * * Registers the replies widget * * @since 2.0.0 bbPress (r2653) */ public function __construct() { $widget_ops = apply_filters('bbp_replies_widget_options', array( 'classname' => 'widget_display_replies', 'description' => esc_html__('A list of the most recent replies.', 'bbpress'), 'customize_selective_refresh' => true )); parent::__construct(false, esc_html__('(Forumax) Recent Replies', 'bbpress'), $widget_ops); } /** * Register the widget * * @since 2.0.0 bbPress (r3389) */ public static function register_widget() { register_widget('BBP_Replies_Widget'); } /** * Displays the output, the replies list * * @since 2.0.0 bbPress (r2653) * * @param array $args * @param array $instance */ public function widget($args, $instance) { // Get widget settings $settings = $this->parse_settings($instance); // Typical WordPress filter $settings['title'] = apply_filters('widget_title', $settings['title'], $instance, $this->id_base); // bbPress filter $settings['title'] = apply_filters('bbp_replies_widget_title', $settings['title'], $instance, $this->id_base); // Note: private and hidden forums will be excluded via the // bbp_pre_get_posts_normalize_forum_visibility action and function. $widget_query = new WP_Query(array( // What and when 'post_type' => bbp_get_reply_post_type(), 'post_status' => bbp_get_public_reply_statuses(), 'posts_per_page' => (int) $settings['max_shown'], // Performance 'ignore_sticky_posts' => true, 'no_found_rows' => true, 'update_post_term_cache' => false, 'update_post_meta_cache' => false )); // Bail if no replies if (!$widget_query->have_posts()) { return; } // Start an output buffer ob_start(); echo $args['before_widget']; if (!empty($settings['title'])) { echo $args['before_title'] . $settings['title'] . $args['after_title']; } ?> parse_settings($instance); ?>

esc_html__('Recent Replies', 'bbpress'), 'max_shown' => 5, 'show_date' => false, 'show_user' => false ), 'replies_widget_settings'); } }