# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: \includes\common
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
|
|
|
|
| 64 | 64 | * @uses get_template_part() To get the login/logged in form |
| 65 | 65 | */ |
| 66 | 66 | public function widget( $args, $instance ) { |
| 67 | | |
| | 67 | |
| | 68 | // Get widget settings |
| | 69 | $settings = $this->parse_settings( $instance ); |
| | 70 | |
| 68 | 71 | // Typical WordPress filter |
| 69 | | $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); |
| | 72 | $settings['title'] = apply_filters( 'widget_title', $settings['title'], $instance, $this->id_base ); |
| 70 | 73 | |
| 71 | 74 | // bbPress filters |
| 72 | | $title = apply_filters( 'bbp_login_widget_title', $instance['title'], $instance, $this->id_base ); |
| 73 | | $register = apply_filters( 'bbp_login_widget_register', $instance['register'], $instance, $this->id_base ); |
| 74 | | $lostpass = apply_filters( 'bbp_login_widget_lostpass', $instance['lostpass'], $instance, $this->id_base ); |
| | 75 | $settings['title'] = apply_filters( 'bbp_login_widget_title', $settings['title'], $instance, $this->id_base ); |
| | 76 | $settings['register'] = apply_filters( 'bbp_login_widget_register', $settings['register'], $instance, $this->id_base ); |
| | 77 | $settings['lostpass'] = apply_filters( 'bbp_login_widget_lostpass', $settings['lostpass'], $instance, $this->id_base ); |
| 75 | 78 | |
| 76 | 79 | echo $args['before_widget']; |
| 77 | 80 | |
| 78 | | if ( !empty( $title ) ) |
| 79 | | echo $args['before_title'] . $title . $args['after_title']; |
| | 81 | if ( !empty( $settings['title'] ) ) |
| | 82 | echo $args['before_title'] . $settings['title'] . $args['after_title']; |
| 80 | 83 | |
| 81 | 84 | if ( !is_user_logged_in() ) : ?> |
| 82 | 85 | |
| … |
… |
|
| 109 | 112 | |
| 110 | 113 | </div> |
| 111 | 114 | |
| 112 | | <?php if ( !empty( $register ) || !empty( $lostpass ) ) : ?> |
| | 115 | <?php if ( !empty( $settings['register'] ) || !empty( $settings['lostpass'] ) ) : ?> |
| 113 | 116 | |
| 114 | 117 | <div class="bbp-login-links"> |
| 115 | 118 | |
| 116 | | <?php if ( !empty( $register ) ) : ?> |
| | 119 | <?php if ( !empty( $settings['register'] ) ) : ?> |
| 117 | 120 | |
| 118 | | <a href="<?php echo esc_url( $register ); ?>" title="<?php esc_attr_e( 'Register', 'bbpress' ); ?>" class="bbp-register-link"><?php _e( 'Register', 'bbpress' ); ?></a> |
| | 121 | <a href="<?php echo esc_url( $settings['register'] ); ?>" title="<?php esc_attr_e( 'Register', 'bbpress' ); ?>" class="bbp-register-link"><?php _e( 'Register', 'bbpress' ); ?></a> |
| 119 | 122 | |
| 120 | 123 | <?php endif; ?> |
| 121 | 124 | |
| 122 | | <?php if ( !empty( $lostpass ) ) : ?> |
| | 125 | <?php if ( !empty( $settings['lostpass'] ) ) : ?> |
| 123 | 126 | |
| 124 | | <a href="<?php echo esc_url( $lostpass ); ?>" title="<?php esc_attr_e( 'Lost Password', 'bbpress' ); ?>" class="bbp-lostpass-link"><?php _e( 'Lost Password', 'bbpress' ); ?></a> |
| | 127 | <a href="<?php echo esc_url( $settings['lostpass'] ); ?>" title="<?php esc_attr_e( 'Lost Password', 'bbpress' ); ?>" class="bbp-lostpass-link"><?php _e( 'Lost Password', 'bbpress' ); ?></a> |
| 125 | 128 | |
| 126 | 129 | <?php endif; ?> |
| 127 | 130 | |
| … |
… |
|
| 174 | 177 | */ |
| 175 | 178 | public function form( $instance ) { |
| 176 | 179 | |
| 177 | | // Form values |
| 178 | | $title = !empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; |
| 179 | | $register = !empty( $instance['register'] ) ? esc_attr( $instance['register'] ) : ''; |
| 180 | | $lostpass = !empty( $instance['lostpass'] ) ? esc_attr( $instance['lostpass'] ) : ''; |
| 181 | | |
| | 180 | // Get widget settings |
| | 181 | $settings = $this->parse_settings( $instance ); |
| | 182 | |
| 182 | 183 | ?> |
| 183 | 184 | |
| 184 | 185 | <p> |
| 185 | 186 | <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?> |
| 186 | | <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></label> |
| | 187 | <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( $settings['title'] ); ?>" /></label> |
| 187 | 188 | </p> |
| 188 | 189 | |
| 189 | 190 | <p> |
| 190 | 191 | <label for="<?php echo $this->get_field_id( 'register' ); ?>"><?php _e( 'Register URI:', 'bbpress' ); ?> |
| 191 | | <input class="widefat" id="<?php echo $this->get_field_id( 'register' ); ?>" name="<?php echo $this->get_field_name( 'register' ); ?>" type="text" value="<?php echo $register; ?>" /></label> |
| | 192 | <input class="widefat" id="<?php echo $this->get_field_id( 'register' ); ?>" name="<?php echo $this->get_field_name( 'register' ); ?>" type="text" value="<?php echo esc_url( $settings['register'] ); ?>" /></label> |
| 192 | 193 | </p> |
| 193 | 194 | |
| 194 | 195 | <p> |
| 195 | 196 | <label for="<?php echo $this->get_field_id( 'lostpass' ); ?>"><?php _e( 'Lost Password URI:', 'bbpress' ); ?> |
| 196 | | <input class="widefat" id="<?php echo $this->get_field_id( 'lostpass' ); ?>" name="<?php echo $this->get_field_name( 'lostpass' ); ?>" type="text" value="<?php echo $lostpass; ?>" /></label> |
| | 197 | <input class="widefat" id="<?php echo $this->get_field_id( 'lostpass' ); ?>" name="<?php echo $this->get_field_name( 'lostpass' ); ?>" type="text" value="<?php echo esc_url( $settings['lostpass'] ); ?>" /></label> |
| 197 | 198 | </p> |
| 198 | 199 | |
| 199 | 200 | <?php |
| 200 | 201 | } |
| | 202 | |
| | 203 | /** |
| | 204 | * Merge the widget settings into defaults array. |
| | 205 | * |
| | 206 | * @since bbPress (rX) |
| | 207 | * |
| | 208 | * @param $instance Instance |
| | 209 | * @uses bbp_parse_args() To merge widget settings into defaults |
| | 210 | */ |
| | 211 | public function parse_settings( $instance = array() ) { |
| | 212 | |
| | 213 | // Default settings |
| | 214 | $defaults = array( |
| | 215 | 'title' => '', |
| | 216 | 'register' => '', |
| | 217 | 'lostpass' => '' |
| | 218 | ); |
| | 219 | |
| | 220 | // Allow to change the widget default settings |
| | 221 | $defaults = apply_filters( 'bbp_login_widget_default_settings', $defaults ); |
| | 222 | |
| | 223 | return bbp_parse_args( $instance , $defaults , 'login_widget_settings' ); |
| | 224 | } |
| 201 | 225 | } |
| 202 | 226 | |
| 203 | 227 | /** |
| … |
… |
|
| 258 | 282 | // Only output widget contents if views exist |
| 259 | 283 | if ( bbp_get_views() ) : |
| 260 | 284 | |
| 261 | | // Typical WordPress filter |
| 262 | | $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); |
| | 285 | // Get widget settings |
| | 286 | $settings = $this->parse_settings( $instance ); |
| | 287 | |
| | 288 | // Typical WordPress filter |
| | 289 | $settings['title'] = apply_filters( 'widget_title', $settings['title'], $instance, $this->id_base ); |
| 263 | 290 | |
| 264 | | // bbPress filter |
| 265 | | $title = apply_filters( 'bbp_view_widget_title', $instance['title'], $instance, $this->id_base ); |
| | 291 | // bbPress filter |
| | 292 | $settings['title'] = apply_filters( 'bbp_view_widget_title', $settings['title'], $instance, $this->id_base ); |
| 266 | 293 | |
| 267 | 294 | echo $args['before_widget']; |
| 268 | | echo $args['before_title'] . $title . $args['after_title']; ?> |
| | 295 | |
| | 296 | if ( !empty( $settings['title'] ) ) |
| | 297 | echo $args['before_title'] . $settings['title'] . $args['after_title']; ?> |
| 269 | 298 | |
| 270 | 299 | <ul> |
| 271 | 300 | |
| … |
… |
|
| 307 | 336 | * @uses BBP_Views_Widget::get_field_name() To output the field name |
| 308 | 337 | */ |
| 309 | 338 | public function form( $instance ) { |
| 310 | | $title = !empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; ?> |
| | 339 | |
| | 340 | // Get widget settings |
| | 341 | $settings = $this->parse_settings( $instance ); |
| | 342 | |
| | 343 | ?> |
| 311 | 344 | |
| 312 | 345 | <p> |
| 313 | 346 | <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?> |
| 314 | | <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /> |
| | 347 | <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( $settings['title'] ); ?>" /> |
| 315 | 348 | </label> |
| 316 | 349 | </p> |
| 317 | 350 | |
| 318 | 351 | <?php |
| 319 | 352 | } |
| | 353 | |
| | 354 | /** |
| | 355 | * Merge the widget settings into defaults array. |
| | 356 | * |
| | 357 | * @since bbPress (rX) |
| | 358 | * |
| | 359 | * @param $instance Instance |
| | 360 | * @uses bbp_parse_args() To merge widget settings into defaults |
| | 361 | */ |
| | 362 | public function parse_settings( $instance = array() ) { |
| | 363 | |
| | 364 | // Default settings |
| | 365 | $defaults = array( 'title' => '' ); |
| | 366 | |
| | 367 | // Allow to change the widget default settings |
| | 368 | $defaults = apply_filters( 'bbp_view_widget_default_settings', $defaults ); |
| | 369 | |
| | 370 | return bbp_parse_args( $instance , $defaults , 'view_widget_settings' ); |
| | 371 | } |
| 320 | 372 | } |
| 321 | 373 | |
| 322 | 374 | /** |
| … |
… |
|
| 370 | 422 | */ |
| 371 | 423 | public function widget( $args, $instance ) { |
| 372 | 424 | |
| 373 | | // Typical WordPress filter |
| 374 | | $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); |
| | 425 | // Get widget settings |
| | 426 | $settings = $this->parse_settings( $instance ); |
| 375 | 427 | |
| 376 | | // bbPress filter |
| 377 | | $title = apply_filters( 'bbp_search_widget_title', $instance['title'], $instance, $this->id_base ); |
| | 428 | // Typical WordPress filter |
| | 429 | $settings['title'] = apply_filters( 'widget_title', $settings['title'], $instance, $this->id_base ); |
| 378 | 430 | |
| | 431 | // bbPress filter |
| | 432 | $settings['title'] = apply_filters( 'bbp_search_widget_title', $settings['title'], $instance, $this->id_base ); |
| | 433 | |
| 379 | 434 | echo $args['before_widget']; |
| 380 | | echo $args['before_title'] . $title . $args['after_title']; |
| | 435 | |
| | 436 | if ( !empty( $settings['title'] ) ) |
| | 437 | echo $args['before_title'] . $settings['title'] . $args['after_title']; |
| 381 | 438 | |
| 382 | 439 | bbp_get_template_part( 'form', 'search' ); |
| 383 | 440 | |
| … |
… |
|
| 409 | 466 | * @uses BBP_Search_Widget::get_field_name() To output the field name |
| 410 | 467 | */ |
| 411 | 468 | public function form( $instance ) { |
| 412 | | $title = !empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; ?> |
| | 469 | |
| | 470 | // Get widget settings |
| | 471 | $settings = $this->parse_settings( $instance ); |
| | 472 | |
| | 473 | ?> |
| 413 | 474 | |
| 414 | 475 | <p> |
| 415 | 476 | <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?> |
| 416 | | <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /> |
| | 477 | <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( $settings['title'] ); ?>" /> |
| 417 | 478 | </label> |
| 418 | 479 | </p> |
| 419 | 480 | |
| 420 | 481 | <?php |
| 421 | 482 | } |
| | 483 | |
| | 484 | /** |
| | 485 | * Merge the widget settings into defaults array. |
| | 486 | * |
| | 487 | * @since bbPress (rX) |
| | 488 | * |
| | 489 | * @param $instance Instance |
| | 490 | * @uses bbp_parse_args() To merge widget settings into defaults |
| | 491 | */ |
| | 492 | public function parse_settings( $instance = array() ) { |
| | 493 | |
| | 494 | // Default settings |
| | 495 | $defaults = array( 'title' => '' ); |
| | 496 | |
| | 497 | // Allow to change the widget default settings |
| | 498 | $defaults = apply_filters( 'bbp_search_widget_default_settings', $defaults ); |
| | 499 | |
| | 500 | return bbp_parse_args( $instance , $defaults , 'search_widget_settings' ); |
| | 501 | } |
| 422 | 502 | } |
| 423 | 503 | |
| 424 | 504 | /** |
| … |
… |
|
| 482 | 562 | */ |
| 483 | 563 | public function widget( $args, $instance ) { |
| 484 | 564 | |
| 485 | | // Typical WordPress filter |
| 486 | | $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); |
| | 565 | // Get widget settings |
| | 566 | $settings = $this->parse_settings( $instance ); |
| 487 | 567 | |
| 488 | | // bbPress filter |
| 489 | | $title = apply_filters( 'bbp_forum_widget_title', $instance['title'], $instance, $this->id_base ); |
| 490 | | $parent_forum = !empty( $instance['parent_forum'] ) ? $instance['parent_forum'] : '0'; |
| | 568 | // Typical WordPress filter |
| | 569 | $settings['title'] = apply_filters( 'widget_title', $settings['title'], $instance, $this->id_base ); |
| 491 | 570 | |
| | 571 | // bbPress filter |
| | 572 | $settings['title'] = apply_filters( 'bbp_forum_widget_title', $settings['title'], $instance, $this->id_base ); |
| | 573 | |
| 492 | 574 | // Note: private and hidden forums will be excluded via the |
| 493 | 575 | // bbp_pre_get_posts_exclude_forums filter and function. |
| 494 | 576 | $widget_query = new WP_Query( array( |
| 495 | | 'post_parent' => $parent_forum, |
| | 577 | 'post_parent' => $settings['parent_forum'], |
| 496 | 578 | 'post_type' => bbp_get_forum_post_type(), |
| 497 | 579 | 'posts_per_page' => get_option( '_bbp_forums_per_page', 50 ), |
| 498 | 580 | 'orderby' => 'menu_order', |
| … |
… |
|
| 502 | 584 | if ( $widget_query->have_posts() ) : |
| 503 | 585 | |
| 504 | 586 | echo $args['before_widget']; |
| 505 | | echo $args['before_title'] . $title . $args['after_title']; ?> |
| | 587 | |
| | 588 | if ( !empty( $settings['title'] ) ) |
| | 589 | echo $args['before_title'] . $settings['title'] . $args['after_title']; ?> |
| 506 | 590 | |
| 507 | 591 | <ul> |
| 508 | 592 | |
| … |
… |
|
| 553 | 637 | * @uses BBP_Forums_Widget::get_field_name() To output the field name |
| 554 | 638 | */ |
| 555 | 639 | public function form( $instance ) { |
| 556 | | $title = !empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; |
| 557 | | $parent_forum = !empty( $instance['parent_forum'] ) ? esc_attr( $instance['parent_forum'] ) : '0'; ?> |
| | 640 | |
| | 641 | // Get widget settings |
| | 642 | $settings = $this->parse_settings( $instance ); |
| | 643 | |
| | 644 | ?> |
| 558 | 645 | |
| 559 | 646 | <p> |
| 560 | 647 | <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?> |
| 561 | | <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /> |
| | 648 | <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( $settings['title'] ); ?>" /> |
| 562 | 649 | </label> |
| 563 | 650 | </p> |
| 564 | 651 | |
| 565 | 652 | <p> |
| 566 | 653 | <label for="<?php echo $this->get_field_id( 'parent_forum' ); ?>"><?php _e( 'Parent Forum ID:', 'bbpress' ); ?> |
| 567 | | <input class="widefat" id="<?php echo $this->get_field_id( 'parent_forum' ); ?>" name="<?php echo $this->get_field_name( 'parent_forum' ); ?>" type="text" value="<?php echo $parent_forum; ?>" /> |
| | 654 | <input class="widefat" id="<?php echo $this->get_field_id( 'parent_forum' ); ?>" name="<?php echo $this->get_field_name( 'parent_forum' ); ?>" type="text" value="<?php echo esc_attr( $settings['parent_forum'] ); ?>" /> |
| 568 | 655 | </label> |
| 569 | 656 | |
| 570 | 657 | <br /> |
| … |
… |
|
| 574 | 661 | |
| 575 | 662 | <?php |
| 576 | 663 | } |
| | 664 | |
| | 665 | /** |
| | 666 | * Merge the widget settings into defaults array. |
| | 667 | * |
| | 668 | * @since bbPress (rX) |
| | 669 | * |
| | 670 | * @param $instance Instance |
| | 671 | * @uses bbp_parse_args() To merge widget settings into defaults |
| | 672 | */ |
| | 673 | public function parse_settings( $instance = array() ) { |
| | 674 | |
| | 675 | // Default settings |
| | 676 | $defaults = array( 'title' => '', 'parent_forum' => 0 ); |
| | 677 | |
| | 678 | // Allow to change the widget default settings |
| | 679 | $defaults = apply_filters( 'bbp_forum_widget_default_settings', $defaults ); |
| | 680 | |
| | 681 | return bbp_parse_args( $instance , $defaults , 'forum_widget_settings' ); |
| | 682 | } |
| 577 | 683 | } |
| 578 | 684 | |
| 579 | 685 | /** |
| … |
… |
|
| 633 | 739 | */ |
| 634 | 740 | public function widget( $args, $instance ) { |
| 635 | 741 | |
| | 742 | // Get widget settings |
| | 743 | $settings = $this->parse_settings( $instance ); |
| | 744 | |
| 636 | 745 | // Typical WordPress filter |
| 637 | | $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); |
| | 746 | $settings['title'] = apply_filters( 'widget_title', $settings['title'], $instance, $this->id_base ); |
| 638 | 747 | |
| 639 | 748 | // bbPress filter |
| 640 | | $title = apply_filters( 'bbp_topic_widget_title', $instance['title'], $instance, $this->id_base ); |
| 641 | | $max_shown = !empty( $instance['max_shown'] ) ? (int) $instance['max_shown'] : 5; |
| 642 | | $show_date = !empty( $instance['show_date'] ) ? 'on' : false; |
| 643 | | $show_user = !empty( $instance['show_user'] ) ? 'on' : false; |
| 644 | | $parent_forum = !empty( $instance['parent_forum'] ) ? $instance['parent_forum'] : 'any'; |
| 645 | | $order_by = !empty( $instance['order_by'] ) ? $instance['order_by'] : false; |
| | 749 | $settings['title'] = apply_filters( 'bbp_topic_widget_title', $settings['title'], $instance, $this->id_base ); |
| 646 | 750 | |
| 647 | 751 | // How do we want to order our results? |
| 648 | | switch ( $order_by ) { |
| | 752 | switch ( $settings['order_by'] ) { |
| 649 | 753 | |
| 650 | 754 | // Order by most recent replies |
| 651 | 755 | case 'freshness' : |
| 652 | 756 | $topics_query = array( |
| 653 | | 'author' => 0, |
| 654 | 757 | 'post_type' => bbp_get_topic_post_type(), |
| 655 | | 'post_parent' => $parent_forum, |
| 656 | | 'posts_per_page' => $max_shown, |
| 657 | | 'post_status' => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ), |
| 658 | | 'show_stickes' => false, |
| | 758 | 'post_parent' => $settings['parent_forum'], |
| | 759 | 'posts_per_page' => (int) $settings['max_shown'], |
| | 760 | 'post_status' => array( bbp_get_public_status_id(), bbp_get_closed_status_id() ), |
| | 761 | 'show_stickies' => false, |
| 659 | 762 | 'meta_key' => '_bbp_last_active_time', |
| 660 | 763 | 'orderby' => 'meta_value', |
| 661 | 764 | 'order' => 'DESC', |
| 662 | | 'meta_query' => array( bbp_exclude_forum_ids( 'meta_query' ) ) |
| 663 | 765 | ); |
| 664 | 766 | break; |
| 665 | 767 | |
| 666 | 768 | // Order by total number of replies |
| 667 | 769 | case 'popular' : |
| 668 | 770 | $topics_query = array( |
| 669 | | 'author' => 0, |
| 670 | 771 | 'post_type' => bbp_get_topic_post_type(), |
| 671 | | 'post_parent' => $parent_forum, |
| 672 | | 'posts_per_page' => $max_shown, |
| 673 | | 'post_status' => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ), |
| 674 | | 'show_stickes' => false, |
| | 772 | 'post_parent' => $settings['parent_forum'], |
| | 773 | 'posts_per_page' => (int) $settings['max_shown'], |
| | 774 | 'post_status' => array( bbp_get_public_status_id(), bbp_get_closed_status_id() ), |
| | 775 | 'show_stickies' => false, |
| 675 | 776 | 'meta_key' => '_bbp_reply_count', |
| 676 | 777 | 'orderby' => 'meta_value', |
| 677 | | 'order' => 'DESC', |
| 678 | | 'meta_query' => array( bbp_exclude_forum_ids( 'meta_query' ) ) |
| | 778 | 'order' => 'DESC' |
| 679 | 779 | ); |
| 680 | 780 | break; |
| 681 | 781 | |
| … |
… |
|
| 683 | 783 | case 'newness' : |
| 684 | 784 | default : |
| 685 | 785 | $topics_query = array( |
| 686 | | 'author' => 0, |
| 687 | 786 | 'post_type' => bbp_get_topic_post_type(), |
| 688 | | 'post_parent' => $parent_forum, |
| 689 | | 'posts_per_page' => $max_shown, |
| 690 | | 'post_status' => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ), |
| 691 | | 'show_stickes' => false, |
| 692 | | 'order' => 'DESC', |
| 693 | | 'meta_query' => array( bbp_exclude_forum_ids( 'meta_query' ) ) |
| | 787 | 'post_parent' => $settings['parent_forum'], |
| | 788 | 'posts_per_page' => (int) $settings['max_shown'], |
| | 789 | 'post_status' => array( bbp_get_public_status_id(), bbp_get_closed_status_id() ), |
| | 790 | 'show_stickies' => false, |
| | 791 | 'order' => 'DESC' |
| 694 | 792 | ); |
| 695 | 793 | break; |
| 696 | 794 | } |
| … |
… |
|
| 698 | 796 | // Note: private and hidden forums will be excluded via the |
| 699 | 797 | // bbp_pre_get_posts_exclude_forums filter and function. |
| 700 | 798 | $widget_query = new WP_Query( $topics_query ); |
| 701 | | |
| | 799 | |
| 702 | 800 | // Topics exist |
| 703 | 801 | if ( $widget_query->have_posts() ) : |
| 704 | 802 | |
| 705 | 803 | echo $args['before_widget']; |
| 706 | | echo $args['before_title'] . $title . $args['after_title']; ?> |
| | 804 | |
| | 805 | if ( !empty( $settings['title'] ) ) |
| | 806 | echo $args['before_title'] . $settings['title'] . $args['after_title']; ?> |
| 707 | 807 | |
| 708 | 808 | <ul> |
| 709 | 809 | |
| … |
… |
|
| 714 | 814 | $author_link = bbp_get_topic_author_link( array( 'post_id' => $topic_id, 'type' => 'both', 'size' => 14 ) ); ?> |
| 715 | 815 | |
| 716 | 816 | <li> |
| 717 | | <a class="bbp-forum-title" href="<?php bbp_topic_permalink( $topic_id ); ?>" title="<?php bbp_topic_title( $topic_id ); ?>"><?php bbp_topic_title( $topic_id ); ?></a> |
| | 817 | <a class="bbp-forum-title" href="<?php echo esc_url( bbp_get_topic_permalink( $topic_id ) ); ?>" title="<?php echo esc_attr( bbp_get_topic_title( $topic_id ) ); ?>"><?php bbp_topic_title( $topic_id ); ?></a> |
| 718 | 818 | |
| 719 | | <?php if ( 'on' == $show_user ) : ?> |
| | 819 | <?php if ( 'on' == $settings['show_user'] ) : ?> |
| 720 | 820 | |
| 721 | 821 | <?php printf( _x( 'by %1$s', 'widgets', 'bbpress' ), '<span class="topic-author">' . $author_link . '</span>' ); ?> |
| 722 | 822 | |
| 723 | 823 | <?php endif; ?> |
| 724 | 824 | |
| 725 | | <?php if ( 'on' == $show_date ) : ?> |
| | 825 | <?php if ( 'on' == $settings['show_date'] ) : ?> |
| 726 | 826 | |
| 727 | 827 | <div><?php bbp_topic_last_active_time( $topic_id ); ?></div> |
| 728 | 828 | |
| … |
… |
|
| 750 | 850 | * @param array $new_instance The new instance options |
| 751 | 851 | * @param array $old_instance The old instance options |
| 752 | 852 | */ |
| 753 | | public function update( $new_instance, $old_instance ) { |
| 754 | | $instance = $old_instance; |
| 755 | | $instance['title'] = strip_tags( $new_instance['title'] ); |
| 756 | | $instance['max_shown'] = strip_tags( $new_instance['max_shown'] ); |
| 757 | | $instance['show_date'] = strip_tags( $new_instance['show_date'] ); |
| 758 | | $instance['show_user'] = strip_tags( $new_instance['show_user'] ); |
| 759 | | $instance['order_by'] = strip_tags( $new_instance['order_by'] ); |
| | 853 | public function update( $new_instance, $old_instance ) { |
| | 854 | $instance = $old_instance; |
| | 855 | |
| | 856 | foreach( array( 'title', 'parent_forum', 'show_date', 'show_user', 'order_by' ) as $key ) |
| | 857 | $instance[$key] = strip_tags( $new_instance[$key] ); |
| 760 | 858 | |
| | 859 | // Force to any |
| | 860 | if ( !empty( $instance['parent_forum'] ) && !is_numeric( $instance['parent_forum'] ) ) |
| | 861 | $instance['parent_forum'] = 'any'; |
| | 862 | |
| | 863 | $instance['max_shown'] = (int) $new_instance['max_shown']; |
| | 864 | |
| 761 | 865 | return $instance; |
| 762 | 866 | } |
| 763 | 867 | |
| … |
… |
|
| 770 | 874 | * @uses BBP_Topics_Widget::get_field_id() To output the field id |
| 771 | 875 | * @uses BBP_Topics_Widget::get_field_name() To output the field name |
| 772 | 876 | */ |
| 773 | | public function form( $instance ) { |
| 774 | | $title = !empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; |
| 775 | | $max_shown = !empty( $instance['max_shown'] ) ? esc_attr( $instance['max_shown'] ) : ''; |
| 776 | | $show_date = !empty( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : ''; |
| 777 | | $show_user = !empty( $instance['show_user'] ) ? esc_attr( $instance['show_user'] ) : ''; |
| 778 | | $order_by = !empty( $instance['order_by'] ) ? esc_attr( $instance['order_by'] ) : ''; ?> |
| | 877 | public function form( $instance ) { |
| | 878 | |
| | 879 | // Get widget settings |
| | 880 | $settings = $this->parse_settings( $instance ); |
| | 881 | |
| | 882 | // Escape all settings values |
| | 883 | $settings = array_map( 'esc_attr' , $settings ); |
| | 884 | |
| | 885 | ?> |
| 779 | 886 | |
| 780 | | <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></label></p> |
| 781 | | <p><label for="<?php echo $this->get_field_id( 'max_shown' ); ?>"><?php _e( 'Maximum topics to show:', 'bbpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_shown' ); ?>" name="<?php echo $this->get_field_name( 'max_shown' ); ?>" type="text" value="<?php echo $max_shown; ?>" /></label></p> |
| 782 | | <p><label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Show post date:', 'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" <?php checked( 'on', $show_date ); ?> /></label></p> |
| 783 | | <p><label for="<?php echo $this->get_field_id( 'show_user' ); ?>"><?php _e( 'Show topic author:', 'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_user' ); ?>" name="<?php echo $this->get_field_name( 'show_user' ); ?>" <?php checked( 'on', $show_user ); ?> /></label></p> |
| | 887 | <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $settings['title']; ?>" /></label></p> |
| | 888 | <p><label for="<?php echo $this->get_field_id( 'max_shown' ); ?>"><?php _e( 'Maximum topics to show:', 'bbpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_shown' ); ?>" name="<?php echo $this->get_field_name( 'max_shown' ); ?>" type="text" value="<?php echo $settings['max_shown']; ?>" /></label></p> |
| 784 | 889 | |
| 785 | 890 | <p> |
| | 891 | <label for="<?php echo $this->get_field_id( 'parent_forum' ); ?>"><?php _e( 'Parent Forum ID:', 'bbpress' ); ?> |
| | 892 | <input class="widefat" id="<?php echo $this->get_field_id( 'parent_forum' ); ?>" name="<?php echo $this->get_field_name( 'parent_forum' ); ?>" type="text" value="<?php echo $settings['parent_forum']; ?>" /> |
| | 893 | </label> |
| | 894 | |
| | 895 | <br /> |
| | 896 | |
| | 897 | <small><?php _e( '"0" to show only root - "any" to show all', 'bbpress' ); ?></small> |
| | 898 | </p> |
| | 899 | |
| | 900 | <p><label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Show post date:', 'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" <?php checked( 'on', $settings['show_date'] ); ?> /></label></p> |
| | 901 | <p><label for="<?php echo $this->get_field_id( 'show_user' ); ?>"><?php _e( 'Show topic author:', 'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_user' ); ?>" name="<?php echo $this->get_field_name( 'show_user' ); ?>" <?php checked( 'on', $settings['show_user'] ); ?> /></label></p> |
| | 902 | |
| | 903 | <p> |
| 786 | 904 | <label for="<?php echo $this->get_field_id( 'order_by' ); ?>"><?php _e( 'Order By:', 'bbpress' ); ?></label> |
| 787 | 905 | <select name="<?php echo $this->get_field_name( 'order_by' ); ?>" id="<?php echo $this->get_field_name( 'order_by' ); ?>"> |
| 788 | | <option <?php selected( $order_by, 'newness' ); ?> value="newness"><?php _e( 'Newest Topics', 'bbpress' ); ?></option> |
| 789 | | <option <?php selected( $order_by, 'popular' ); ?> value="popular"><?php _e( 'Popular Topics', 'bbpress' ); ?></option> |
| 790 | | <option <?php selected( $order_by, 'freshness' ); ?> value="freshness"><?php _e( 'Topics With Recent Replies', 'bbpress' ); ?></option> |
| | 906 | <option <?php selected( $settings['order_by'], 'newness' ); ?> value="newness"><?php _e( 'Newest Topics', 'bbpress' ); ?></option> |
| | 907 | <option <?php selected( $settings['order_by'], 'popular' ); ?> value="popular"><?php _e( 'Popular Topics', 'bbpress' ); ?></option> |
| | 908 | <option <?php selected( $settings['order_by'], 'freshness' ); ?> value="freshness"><?php _e( 'Topics With Recent Replies', 'bbpress' ); ?></option> |
| 791 | 909 | </select> |
| 792 | 910 | </p> |
| 793 | 911 | |
| 794 | 912 | <?php |
| 795 | 913 | } |
| | 914 | |
| | 915 | /** |
| | 916 | * Merge the widget settings into defaults array. |
| | 917 | * |
| | 918 | * @since bbPress (rX) |
| | 919 | * |
| | 920 | * @param $instance Instance |
| | 921 | * @uses bbp_parse_args) To merge widget options into defaults |
| | 922 | */ |
| | 923 | public function parse_settings( $instance = '' ) { |
| | 924 | |
| | 925 | // Default settings |
| | 926 | $defaults = array( |
| | 927 | 'title' => '', |
| | 928 | 'max_shown' => 5, |
| | 929 | 'show_date' => false, |
| | 930 | 'show_user' => false, |
| | 931 | 'parent_forum' => 'any', |
| | 932 | 'order_by' => false |
| | 933 | ); |
| | 934 | |
| | 935 | // Allow to change the widget default settings |
| | 936 | $defaults = apply_filters( 'bbp_topic_widget_default_settings' , $defaults ); |
| | 937 | |
| | 938 | return bbp_parse_args( $instance , $defaults , 'topic_widget_settings' ); |
| | 939 | } |
| 796 | 940 | } |
| 797 | 941 | |
| 798 | 942 | /** |
| … |
… |
|
| 848 | 992 | * @uses bbp_get_template_part() To get the content-forum-statistics template |
| 849 | 993 | */ |
| 850 | 994 | public function widget( $args, $instance ) { |
| | 995 | |
| | 996 | // Get widget settings |
| | 997 | $settings = $this->parse_settings( $instance ); |
| | 998 | |
| | 999 | // Typical WordPress filter |
| | 1000 | $settings['title'] = apply_filters( 'widget_title', $settings['title'], $instance, $this->id_base ); |
| 851 | 1001 | |
| 852 | | $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); |
| 853 | | $title = apply_filters( 'bbp_stats_widget_title', $instance['title'], $instance, $this->id_base ); |
| | 1002 | // bbPress widget title filter |
| | 1003 | $settings['title'] = apply_filters( 'bbp_stats_widget_title', $settings['title'], $instance, $this->id_base ); |
| 854 | 1004 | |
| 855 | 1005 | echo $args['before_widget']; |
| 856 | | echo $args['before_title'] . $title . $args['after_title']; |
| | 1006 | |
| | 1007 | if ( !empty( $settings['title'] ) ) |
| | 1008 | echo $args['before_title'] . $settings['title'] . $args['after_title']; |
| 857 | 1009 | |
| 858 | 1010 | bbp_get_template_part( 'content', 'statistics' ); |
| 859 | 1011 | |
| … |
… |
|
| 887 | 1039 | * @return string|void |
| 888 | 1040 | */ |
| 889 | 1041 | public function form( $instance ) { |
| 890 | | $title = !empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; ?> |
| | 1042 | |
| | 1043 | // Get widget settings |
| | 1044 | $settings = $this->parse_settings( $instance ); ?> |
| 891 | 1045 | |
| 892 | 1046 | <p> |
| 893 | 1047 | <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?> |
| 894 | | <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" |
| 895 | | name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>"/> |
| | 1048 | <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( $settings['title'] ); ?>"/> |
| 896 | 1049 | </label> |
| 897 | 1050 | </p> |
| 898 | 1051 | |
| 899 | 1052 | <?php |
| 900 | 1053 | } |
| | 1054 | |
| | 1055 | /** |
| | 1056 | * Merge the widget settings into defaults array. |
| | 1057 | * |
| | 1058 | * @since bbPress (rX) |
| | 1059 | * |
| | 1060 | * @param $instance Instance |
| | 1061 | * @uses bbp_parse_args() To merge widget settings into defaults |
| | 1062 | */ |
| | 1063 | public function parse_settings( $instance = array() ) { |
| | 1064 | |
| | 1065 | // Default settings |
| | 1066 | $defaults = array( 'title' => '' ); |
| | 1067 | |
| | 1068 | // Allow to change the widget default settings |
| | 1069 | $defaults = apply_filters( 'bbp_stats_widget_default_settings' , $defaults ); |
| | 1070 | |
| | 1071 | return bbp_parse_args( $instance , $defaults , 'stats_widget_settings' ); |
| | 1072 | |
| | 1073 | } |
| 901 | 1074 | } |
| 902 | 1075 | |
| 903 | 1076 | /** |
| … |
… |
|
| 959 | 1132 | * @uses get_the_time() To get the time of the reply |
| 960 | 1133 | */ |
| 961 | 1134 | public function widget( $args, $instance ) { |
| 962 | | |
| | 1135 | |
| | 1136 | // Get widget settings |
| | 1137 | $settings = $this->parse_settings( $instance ); |
| | 1138 | |
| 963 | 1139 | // Typical WordPress filter |
| 964 | | $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); |
| | 1140 | $settings['title'] = apply_filters( 'widget_title', $settings['title'], $instance, $this->id_base ); |
| 965 | 1141 | |
| 966 | 1142 | // bbPress filter |
| 967 | | $title = apply_filters( 'bbp_replies_widget_title', $instance['title'], $instance, $this->id_base ); |
| 968 | | $max_shown = !empty( $instance['max_shown'] ) ? $instance['max_shown'] : '5'; |
| 969 | | $show_date = !empty( $instance['show_date'] ) ? 'on' : false; |
| 970 | | $show_user = !empty( $instance['show_user'] ) ? 'on' : false; |
| 971 | | $post_types = !empty( $instance['post_type'] ) ? array( bbp_get_topic_post_type(), bbp_get_reply_post_type() ) : bbp_get_reply_post_type(); |
| | 1143 | $settings['title'] = apply_filters( 'bbp_replies_widget_title', $settings['title'], $instance, $this->id_base ); |
| 972 | 1144 | |
| 973 | 1145 | // Note: private and hidden forums will be excluded via the |
| 974 | 1146 | // bbp_pre_get_posts_exclude_forums filter and function. |
| 975 | 1147 | $widget_query = new WP_Query( array( |
| 976 | | 'post_type' => $post_types, |
| 977 | | 'post_status' => join( ',', array( bbp_get_public_status_id(), bbp_get_closed_status_id() ) ), |
| 978 | | 'posts_per_page' => $max_shown, |
| 979 | | 'meta_query' => array( bbp_exclude_forum_ids( 'meta_query' ) ) |
| | 1148 | 'post_type' => bbp_get_reply_post_type(), |
| | 1149 | 'post_status' => array( bbp_get_public_status_id(), bbp_get_closed_status_id() ), |
| | 1150 | 'posts_per_page' => (int) $settings['max_shown'] |
| 980 | 1151 | ) ); |
| 981 | 1152 | |
| 982 | 1153 | // Get replies and display them |
| 983 | 1154 | if ( $widget_query->have_posts() ) : |
| 984 | 1155 | |
| 985 | 1156 | echo $args['before_widget']; |
| 986 | | echo $args['before_title'] . $title . $args['after_title']; ?> |
| | 1157 | |
| | 1158 | if ( !empty( $settings['title'] ) ) |
| | 1159 | echo $args['before_title'] . $settings['title'] . $args['after_title']; ?> |
| 987 | 1160 | |
| 988 | 1161 | <ul> |
| 989 | 1162 | |
| … |
… |
|
| 995 | 1168 | |
| 996 | 1169 | $reply_id = bbp_get_reply_id( $widget_query->post->ID ); |
| 997 | 1170 | $author_link = bbp_get_reply_author_link( array( 'post_id' => $reply_id, 'type' => 'both', 'size' => 14 ) ); |
| 998 | | $reply_link = '<a class="bbp-reply-topic-title" href="' . esc_url( bbp_get_reply_url( $reply_id ) ) . '" title="' . bbp_get_reply_excerpt( $reply_id, 50 ) . '">' . bbp_get_reply_topic_title( $reply_id ) . '</a>'; |
| | 1171 | $reply_link = '<a class="bbp-reply-topic-title" href="' . esc_url( bbp_get_reply_url( $reply_id ) ) . '" title="' . esc_attr( bbp_get_reply_excerpt( $reply_id, 50 ) ) . '">' . bbp_get_reply_topic_title( $reply_id ) . '</a>'; |
| 999 | 1172 | |
| 1000 | 1173 | // Reply author, link, and timestamp |
| 1001 | | if ( ( 'on' == $show_date ) && ( 'on' == $show_user ) ) : |
| | 1174 | if ( ( 'on' == $settings['show_date'] ) && ( 'on' == $settings['show_user'] ) ) : |
| 1002 | 1175 | |
| 1003 | 1176 | // translators: 1: reply author, 2: reply link, 3: reply timestamp |
| 1004 | 1177 | printf( _x( '%1$s on %2$s %3$s', 'widgets', 'bbpress' ), $author_link, $reply_link, '<div>' . bbp_get_time_since( get_the_time( 'U' ) ) . '</div>' ); |
| 1005 | 1178 | |
| 1006 | 1179 | // Reply link and timestamp |
| 1007 | | elseif ( $show_date == 'on' ) : |
| | 1180 | elseif ( $settings['show_date'] == 'on' ) : |
| 1008 | 1181 | |
| 1009 | 1182 | // translators: 1: reply link, 2: reply timestamp |
| 1010 | 1183 | printf( _x( '%1$s %2$s', 'widgets', 'bbpress' ), $reply_link, '<div>' . bbp_get_time_since( get_the_time( 'U' ) ) . '</div>' ); |
| 1011 | 1184 | |
| 1012 | 1185 | // Reply author and title |
| 1013 | | elseif ( $show_user == 'on' ) : |
| | 1186 | elseif ( $settings['show_user'] == 'on' ) : |
| 1014 | 1187 | |
| 1015 | 1188 | // translators: 1: reply author, 2: reply link |
| 1016 | 1189 | printf( _x( '%1$s on %2$s', 'widgets', 'bbpress' ), $author_link, $reply_link ); |
| … |
… |
|
| 1048 | 1221 | * @param array $old_instance The old instance options |
| 1049 | 1222 | */ |
| 1050 | 1223 | public function update( $new_instance, $old_instance ) { |
| 1051 | | $instance = $old_instance; |
| 1052 | | $instance['title'] = strip_tags( $new_instance['title'] ); |
| 1053 | | $instance['max_shown'] = strip_tags( $new_instance['max_shown'] ); |
| 1054 | | $instance['show_date'] = strip_tags( $new_instance['show_date'] ); |
| 1055 | | $instance['show_user'] = strip_tags( $new_instance['show_user'] ); |
| | 1224 | $instance = $old_instance; |
| | 1225 | |
| | 1226 | foreach( array( 'title', 'show_date', 'show_user' ) as $key ) |
| | 1227 | $instance[$key] = strip_tags( $new_instance[$key] ); |
| | 1228 | |
| | 1229 | $instance['max_shown'] = (int) $new_instance['max_shown']; |
| 1056 | 1230 | |
| 1057 | 1231 | return $instance; |
| 1058 | 1232 | } |
| … |
… |
|
| 1067 | 1241 | * @uses BBP_Replies_Widget::get_field_name() To output the field name |
| 1068 | 1242 | */ |
| 1069 | 1243 | public function form( $instance ) { |
| 1070 | | $title = !empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; |
| 1071 | | $max_shown = !empty( $instance['max_shown'] ) ? esc_attr( $instance['max_shown'] ) : ''; |
| 1072 | | $show_date = !empty( $instance['show_date'] ) ? esc_attr( $instance['show_date'] ) : ''; |
| 1073 | | $show_user = !empty( $instance['show_user'] ) ? esc_attr( $instance['show_user'] ) : ''; ?> |
| | 1244 | |
| | 1245 | // Get widget settings |
| | 1246 | $settings = $this->parse_settings( $instance ); ?> |
| 1074 | 1247 | |
| 1075 | | <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /></label></p> |
| 1076 | | <p><label for="<?php echo $this->get_field_id( 'max_shown' ); ?>"><?php _e( 'Maximum replies to show:', 'bbpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_shown' ); ?>" name="<?php echo $this->get_field_name( 'max_shown' ); ?>" type="text" value="<?php echo $max_shown; ?>" /></label></p> |
| 1077 | | <p><label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Show post date:', 'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" <?php checked( 'on', $show_date ); ?> /></label></p> |
| 1078 | | <p><label for="<?php echo $this->get_field_id( 'show_user' ); ?>"><?php _e( 'Show reply author:', 'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_user' ); ?>" name="<?php echo $this->get_field_name( 'show_user' ); ?>" <?php checked( 'on', $show_user ); ?> /></label></p> |
| | 1248 | <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?> <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( $settings['title'] ); ?>" /></label></p> |
| | 1249 | <p><label for="<?php echo $this->get_field_id( 'max_shown' ); ?>"><?php _e( 'Maximum replies to show:', 'bbpress' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'max_shown' ); ?>" name="<?php echo $this->get_field_name( 'max_shown' ); ?>" type="text" value="<?php echo esc_attr( $settings['max_shown'] ); ?>" /></label></p> |
| | 1250 | <p><label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php _e( 'Show post date:', 'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_date' ); ?>" name="<?php echo $this->get_field_name( 'show_date' ); ?>" <?php checked( 'on', esc_attr( $settings['show_date'] ) ); ?> /></label></p> |
| | 1251 | <p><label for="<?php echo $this->get_field_id( 'show_user' ); ?>"><?php _e( 'Show reply author:', 'bbpress' ); ?> <input type="checkbox" id="<?php echo $this->get_field_id( 'show_user' ); ?>" name="<?php echo $this->get_field_name( 'show_user' ); ?>" <?php checked( 'on', esc_attr( $settings['show_user'] ) ); ?> /></label></p> |
| 1079 | 1252 | |
| 1080 | 1253 | <?php |
| 1081 | 1254 | } |
| | 1255 | |
| | 1256 | /** |
| | 1257 | * Merge the widget settings into defaults array. |
| | 1258 | * |
| | 1259 | * @since bbPress (rX) |
| | 1260 | * |
| | 1261 | * @param $instance Instance |
| | 1262 | * @uses bbp_parse_args() To merge widget settings into defaults |
| | 1263 | */ |
| | 1264 | public function parse_settings( $instance = array() ) { |
| | 1265 | |
| | 1266 | // Default settings |
| | 1267 | $defaults = array( |
| | 1268 | 'title' => '', |
| | 1269 | 'max_shown' => 5, |
| | 1270 | 'show_date' => false, |
| | 1271 | 'show_user' => false |
| | 1272 | ); |
| | 1273 | |
| | 1274 | // Allow to change the widget default settings |
| | 1275 | $defaults = apply_filters( 'bbp_replies_widget_default_settings', $defaults ); |
| | 1276 | |
| | 1277 | return bbp_parse_args( $instance , $defaults , 'replies_widget_settings' ); |
| | 1278 | } |
| | 1279 | No newline at end of file |
| 1082 | 1280 | } |