Changeset 6506
- Timestamp:
- 06/09/2017 04:45:11 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/common/widgets.php
r6384 r6506 37 37 $widget_ops = apply_filters( 'bbp_login_widget_options', array( 38 38 'classname' => 'bbp_widget_login', 39 'description' => __( 'A simple login form with optional links to sign-up and lost password pages.', 'bbpress' )39 'description' => esc_html__( 'A simple login form with optional links to sign-up and lost password pages.', 'bbpress' ) 40 40 ) ); 41 41 42 parent::__construct( false, __( '(bbPress) Login Widget', 'bbpress' ), $widget_ops );42 parent::__construct( false, esc_html__( '(bbPress) Login Widget', 'bbpress' ), $widget_ops ); 43 43 } 44 44 … … 87 87 <form method="post" action="<?php bbp_wp_login_action( array( 'context' => 'login_post' ) ); ?>" class="bbp-login-form"> 88 88 <fieldset> 89 <legend><?php _e( 'Log In', 'bbpress' ); ?></legend>89 <legend><?php esc_html_e( 'Log In', 'bbpress' ); ?></legend> 90 90 91 91 <div class="bbp-username"> 92 <label for="user_login"><?php _e( 'Username', 'bbpress' ); ?>: </label>92 <label for="user_login"><?php esc_html_e( 'Username', 'bbpress' ); ?>: </label> 93 93 <input type="text" name="log" value="<?php bbp_sanitize_val( 'user_login', 'text' ); ?>" size="20" id="user_login" /> 94 94 </div> 95 95 96 96 <div class="bbp-password"> 97 <label for="user_pass"><?php _e( 'Password', 'bbpress' ); ?>: </label>97 <label for="user_pass"><?php esc_html_e( 'Password', 'bbpress' ); ?>: </label> 98 98 <input type="password" name="pwd" value="<?php bbp_sanitize_val( 'user_pass', 'password' ); ?>" size="20" id="user_pass" autocomplete="off" /> 99 99 </div> … … 101 101 <div class="bbp-remember-me"> 102 102 <input type="checkbox" name="rememberme" value="forever" <?php checked( bbp_get_sanitize_val( 'rememberme', 'checkbox' ), true, true ); ?> id="rememberme" /> 103 <label for="rememberme"><?php _e( 'Remember Me', 'bbpress' ); ?></label>103 <label for="rememberme"><?php esc_html_e( 'Remember Me', 'bbpress' ); ?></label> 104 104 </div> 105 105 … … 108 108 <?php do_action( 'login_form' ); ?> 109 109 110 <button type="submit" name="user-submit" id="user-submit" class="button submit user-submit"><?php _e( 'Log In', 'bbpress' ); ?></button>110 <button type="submit" name="user-submit" id="user-submit" class="button submit user-submit"><?php esc_html_e( 'Log In', 'bbpress' ); ?></button> 111 111 112 112 <?php bbp_user_login_fields(); ?> … … 120 120 <?php if ( ! empty( $settings['register'] ) ) : ?> 121 121 122 <a href="<?php echo esc_url( $settings['register'] ); ?>" title="<?php esc_attr_e( 'Register', 'bbpress' ); ?>" class="bbp-register-link"><?php _e( 'Register', 'bbpress' ); ?></a>122 <a href="<?php echo esc_url( $settings['register'] ); ?>" title="<?php esc_attr_e( 'Register', 'bbpress' ); ?>" class="bbp-register-link"><?php esc_html_e( 'Register', 'bbpress' ); ?></a> 123 123 124 124 <?php endif; ?> … … 126 126 <?php if ( ! empty( $settings['lostpass'] ) ) : ?> 127 127 128 <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>128 <a href="<?php echo esc_url( $settings['lostpass'] ); ?>" title="<?php esc_attr_e( 'Lost Password', 'bbpress' ); ?>" class="bbp-lostpass-link"><?php esc_html_e( 'Lost Password', 'bbpress' ); ?></a> 129 129 130 130 <?php endif; ?> … … 183 183 184 184 <p> 185 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?>185 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'bbpress' ); ?> 186 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 esc_attr( $settings['title'] ); ?>" /></label> 187 187 </p> 188 188 189 189 <p> 190 <label for="<?php echo $this->get_field_id( 'register' ); ?>"><?php _e( 'Register URI:', 'bbpress' ); ?>190 <label for="<?php echo $this->get_field_id( 'register' ); ?>"><?php esc_html_e( 'Register URI:', 'bbpress' ); ?> 191 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 esc_url( $settings['register'] ); ?>" /></label> 192 192 </p> 193 193 194 194 <p> 195 <label for="<?php echo $this->get_field_id( 'lostpass' ); ?>"><?php _e( 'Lost Password URI:', 'bbpress' ); ?>195 <label for="<?php echo $this->get_field_id( 'lostpass' ); ?>"><?php esc_html_e( 'Lost Password URI:', 'bbpress' ); ?> 196 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 esc_url( $settings['lostpass'] ); ?>" /></label> 197 197 </p> … … 241 241 $widget_ops = apply_filters( 'bbp_views_widget_options', array( 242 242 'classname' => 'widget_display_views', 243 'description' => __( 'A list of registered optional topic views.', 'bbpress' )243 'description' => esc_html__( 'A list of registered optional topic views.', 'bbpress' ) 244 244 ) ); 245 245 246 parent::__construct( false, __( '(bbPress) Topic Views List', 'bbpress' ), $widget_ops );246 parent::__construct( false, esc_html__( '(bbPress) Topic Views List', 'bbpress' ), $widget_ops ); 247 247 } 248 248 … … 286 286 $settings['title'] = apply_filters( 'bbp_view_widget_title', $settings['title'], $instance, $this->id_base ); 287 287 288 // Start an output buffer 289 ob_start(); 290 288 291 echo $args['before_widget']; 289 292 … … 292 295 } ?> 293 296 294 <ul >297 <ul class="bbp-views-widget"> 295 298 296 299 <?php foreach ( array_keys( bbp_get_views() ) as $view ) : ?> … … 303 306 304 307 <?php echo $args['after_widget']; 308 309 // Output the current buffer 310 echo ob_get_clean(); 305 311 } 306 312 … … 335 341 336 342 <p> 337 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?>343 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'bbpress' ); ?> 338 344 <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'] ); ?>" /> 339 345 </label> … … 382 388 $widget_ops = apply_filters( 'bbp_search_widget_options', array( 383 389 'classname' => 'widget_display_search', 384 'description' => __( 'The bbPress forum search form.', 'bbpress' )390 'description' => esc_html__( 'The bbPress forum search form.', 'bbpress' ) 385 391 ) ); 386 392 387 parent::__construct( false, __( '(bbPress) Forum Search Form', 'bbpress' ), $widget_ops );393 parent::__construct( false, esc_html__( '(bbPress) Forum Search Form', 'bbpress' ), $widget_ops ); 388 394 } 389 395 … … 464 470 465 471 <p> 466 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?>472 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'bbpress' ); ?> 467 473 <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'] ); ?>" /> 468 474 </label> … … 482 488 public function parse_settings( $instance = array() ) { 483 489 return bbp_parse_args( $instance, array( 484 'title' => __( 'Search Forums', 'bbpress' )490 'title' => esc_html__( 'Search Forums', 'bbpress' ) 485 491 ), 'search_widget_settings' ); 486 492 } … … 511 517 $widget_ops = apply_filters( 'bbp_forums_widget_options', array( 512 518 'classname' => 'widget_display_forums', 513 'description' => __( 'A list of forums with an option to set the parent.', 'bbpress' )519 'description' => esc_html__( 'A list of forums with an option to set the parent.', 'bbpress' ) 514 520 ) ); 515 521 516 parent::__construct( false, __( '(bbPress) Forums List', 'bbpress' ), $widget_ops );522 parent::__construct( false, esc_html__( '(bbPress) Forums List', 'bbpress' ), $widget_ops ); 517 523 } 518 524 … … 560 566 // bbp_pre_get_posts_normalize_forum_visibility action and function. 561 567 $widget_query = new WP_Query( array( 562 'post_type' => bbp_get_forum_post_type(), 563 'post_parent' => $settings['parent_forum'], 564 'post_status' => bbp_get_public_status_id(), 565 'posts_per_page' => get_option( '_bbp_forums_per_page', 50 ), 566 'ignore_sticky_posts' => true, 567 'no_found_rows' => true, 568 'orderby' => 'menu_order title', 569 'order' => 'ASC' 568 569 // What and how 570 'post_type' => bbp_get_forum_post_type(), 571 'post_status' => bbp_get_public_status_id(), 572 'post_parent' => $settings['parent_forum'], 573 'posts_per_page' => (int) get_option( '_bbp_forums_per_page', 50 ), 574 575 // Order 576 'orderby' => 'menu_order title', 577 'order' => 'DESC', 578 579 // Performance 580 'ignore_sticky_posts' => true, 581 'no_found_rows' => true, 582 'nopaging' => true, 583 'update_post_term_cache' => false, 584 'update_post_meta_cache' => false 570 585 ) ); 571 586 … … 581 596 } ?> 582 597 583 <ul >598 <ul class="bbp-forums-widget"> 584 599 585 600 <?php while ( $widget_query->have_posts() ) : $widget_query->the_post(); ?> … … 637 652 638 653 <p> 639 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?>654 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'bbpress' ); ?> 640 655 <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'] ); ?>" /> 641 656 </label> … … 643 658 644 659 <p> 645 <label for="<?php echo $this->get_field_id( 'parent_forum' ); ?>"><?php _e( 'Parent Forum ID:', 'bbpress' ); ?>660 <label for="<?php echo $this->get_field_id( 'parent_forum' ); ?>"><?php esc_html_e( 'Parent Forum ID:', 'bbpress' ); ?> 646 661 <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'] ); ?>" /> 647 662 </label> … … 649 664 <br /> 650 665 651 <small><?php _e( '"0" to show only root - "any" to show all', 'bbpress' ); ?></small>666 <small><?php esc_html_e( '"0" to show only root - "any" to show all', 'bbpress' ); ?></small> 652 667 </p> 653 668 … … 665 680 public function parse_settings( $instance = array() ) { 666 681 return bbp_parse_args( $instance, array( 667 'title' => __( 'Forums', 'bbpress' ),682 'title' => esc_html__( 'Forums', 'bbpress' ), 668 683 'parent_forum' => 0 669 684 ), 'forum_widget_settings' ); … … 695 710 $widget_ops = apply_filters( 'bbp_topics_widget_options', array( 696 711 'classname' => 'widget_display_topics', 697 'description' => __( 'A list of recent topics, sorted by: newness, popularity, or recent replies.', 'bbpress' )712 'description' => esc_html__( 'A list of recent topics, sorted by: newness, popularity, or recent replies.', 'bbpress' ) 698 713 ) ); 699 714 700 parent::__construct( false, __( '(bbPress) Recent Topics', 'bbpress' ), $widget_ops );715 parent::__construct( false, esc_html__( '(bbPress) Recent Topics', 'bbpress' ), $widget_ops ); 701 716 } 702 717 … … 743 758 case 'freshness' : 744 759 $topics_query = array( 745 'post_type' => bbp_get_topic_post_type(), 746 'post_parent' => $settings['parent_forum'], 747 'posts_per_page' => (int) $settings['max_shown'], 748 'post_status' => bbp_get_public_topic_statuses(), 749 'ignore_sticky_posts' => true, 750 'no_found_rows' => true, 751 'meta_key' => '_bbp_last_active_time', 752 'meta_type' => 'DATETIME', 753 'orderby' => 'meta_value', 754 'order' => 'DESC', 760 761 // What and how 762 'post_type' => bbp_get_topic_post_type(), 763 'post_status' => bbp_get_public_topic_statuses(), 764 'post_parent' => $settings['parent_forum'], 765 'posts_per_page' => (int) $settings['max_shown'], 766 'meta_query' => array( array( 767 'key' => '_bbp_last_active_time', 768 'type' => 'DATETIME' 769 ) ), 770 771 // Ordering 772 'orderby' => 'meta_value', 773 'order' => 'DESC', 774 775 // Performance 776 'ignore_sticky_posts' => true, 777 'no_found_rows' => true, 778 'nopaging' => true, 779 'update_post_term_cache' => false, 780 'update_post_meta_cache' => false 755 781 ); 756 782 break; … … 759 785 case 'popular' : 760 786 $topics_query = array( 761 'post_type' => bbp_get_topic_post_type(), 762 'post_parent' => $settings['parent_forum'], 763 'posts_per_page' => (int) $settings['max_shown'], 764 'post_status' => bbp_get_public_topic_statuses(), 765 'ignore_sticky_posts' => true, 766 'no_found_rows' => true, 767 'meta_key' => '_bbp_reply_count', 768 'meta_type' => 'NUMERIC', 769 'orderby' => 'meta_value_num', 770 'order' => 'DESC' 787 788 // What and how 789 'post_type' => bbp_get_topic_post_type(), 790 'post_status' => bbp_get_public_topic_statuses(), 791 'post_parent' => $settings['parent_forum'], 792 'posts_per_page' => (int) $settings['max_shown'], 793 'meta_query' => array( array( 794 'key' => '_bbp_reply_count', 795 'type' => 'NUMERIC' 796 ) ), 797 798 // Ordering 799 'orderby' => 'meta_value_num', 800 'order' => 'DESC', 801 802 // Performance 803 'ignore_sticky_posts' => true, 804 'no_found_rows' => true, 805 'nopaging' => true, 806 'update_post_term_cache' => false, 807 'update_post_meta_cache' => false 771 808 ); 772 809 break; … … 776 813 default : 777 814 $topics_query = array( 778 'post_type' => bbp_get_topic_post_type(), 779 'post_parent' => $settings['parent_forum'], 780 'posts_per_page' => (int) $settings['max_shown'], 781 'post_status' => bbp_get_public_topic_statuses(), 782 'ignore_sticky_posts' => true, 783 'no_found_rows' => true, 784 'order' => 'DESC' 815 816 // What and how 817 'post_type' => bbp_get_topic_post_type(), 818 'post_status' => bbp_get_public_topic_statuses(), 819 'post_parent' => $settings['parent_forum'], 820 'posts_per_page' => (int) $settings['max_shown'], 821 822 // Ordering 823 'orderby' => 'date', 824 'order' => 'DESC', 825 826 // Performance 827 'ignore_sticky_posts' => true, 828 'no_found_rows' => true, 829 'nopaging' => true, 830 'update_post_term_cache' => false, 831 'update_post_meta_cache' => false 785 832 ); 786 833 break; … … 796 843 } 797 844 845 // Start an output buffer 846 ob_start(); 847 798 848 echo $args['before_widget']; 799 849 … … 802 852 } ?> 803 853 804 <ul >854 <ul class="bbp-topics-widget <?php echo esc_attr( $settings['order_by'] ); ?>"> 805 855 806 856 <?php while ( $widget_query->have_posts() ) : … … 820 870 <?php if ( ! empty( $author_link ) ) : ?> 821 871 822 <?php printf( _x( 'by %1$s', 'widgets', 'bbpress' ), '<span class="topic-author">' . $author_link . '</span>' ); ?>872 <?php printf( esc_html_x( 'by %1$s', 'widgets', 'bbpress' ), '<span class="topic-author">' . $author_link . '</span>' ); ?> 823 873 824 874 <?php endif; ?> … … 840 890 // Reset the $post global 841 891 wp_reset_postdata(); 892 893 // Output the current buffer 894 echo ob_get_clean(); 842 895 } 843 896 … … 881 934 $settings = $this->parse_settings( $instance ); ?> 882 935 883 <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>884 <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 esc_attr( $settings['max_shown'] ); ?>" /></label></p>936 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_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> 937 <p><label for="<?php echo $this->get_field_id( 'max_shown' ); ?>"><?php esc_html_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 esc_attr( $settings['max_shown'] ); ?>" /></label></p> 885 938 886 939 <p> 887 <label for="<?php echo $this->get_field_id( 'parent_forum' ); ?>"><?php _e( 'Parent Forum ID:', 'bbpress' ); ?>940 <label for="<?php echo $this->get_field_id( 'parent_forum' ); ?>"><?php esc_html_e( 'Parent Forum ID:', 'bbpress' ); ?> 888 941 <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'] ); ?>" /> 889 942 </label> … … 891 944 <br /> 892 945 893 <small><?php _e( '"0" to show only root - "any" to show all', 'bbpress' ); ?></small>946 <small><?php esc_html_e( '"0" to show only root - "any" to show all', 'bbpress' ); ?></small> 894 947 </p> 895 948 896 <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( true, $settings['show_date'] ); ?> value="1" /></label></p>897 <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( true, $settings['show_user'] ); ?> value="1" /></label></p>949 <p><label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php esc_html_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( true, $settings['show_date'] ); ?> value="1" /></label></p> 950 <p><label for="<?php echo $this->get_field_id( 'show_user' ); ?>"><?php esc_html_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( true, $settings['show_user'] ); ?> value="1" /></label></p> 898 951 899 952 <p> 900 <label for="<?php echo $this->get_field_id( 'order_by' ); ?>"><?php _e( 'Order By:', 'bbpress' ); ?></label>953 <label for="<?php echo $this->get_field_id( 'order_by' ); ?>"><?php esc_html_e( 'Order By:', 'bbpress' ); ?></label> 901 954 <select name="<?php echo $this->get_field_name( 'order_by' ); ?>" id="<?php echo $this->get_field_id( 'order_by' ); ?>"> 902 <option <?php selected( $settings['order_by'], 'newness' ); ?> value="newness"><?php_e( 'Newest Topics', 'bbpress' ); ?></option>903 <option <?php selected( $settings['order_by'], 'popular' ); ?> value="popular"><?php_e( 'Popular Topics', 'bbpress' ); ?></option>904 <option <?php selected( $settings['order_by'], 'freshness' ); ?> value="freshness"><?php _e( 'Topics With Recent Replies', 'bbpress' ); ?></option>955 <option <?php selected( $settings['order_by'], 'newness' ); ?> value="newness"><?php esc_html_e( 'Newest Topics', 'bbpress' ); ?></option> 956 <option <?php selected( $settings['order_by'], 'popular' ); ?> value="popular"><?php esc_html_e( 'Popular Topics', 'bbpress' ); ?></option> 957 <option <?php selected( $settings['order_by'], 'freshness' ); ?> value="freshness"><?php esc_html_e( 'Topics With Recent Replies', 'bbpress' ); ?></option> 905 958 </select> 906 959 </p> … … 919 972 public function parse_settings( $instance = array() ) { 920 973 return bbp_parse_args( $instance, array( 921 'title' => __( 'Recent Topics', 'bbpress' ),974 'title' => esc_html__( 'Recent Topics', 'bbpress' ), 922 975 'max_shown' => 5, 923 976 'show_date' => false, … … 930 983 931 984 /** 932 * bbPress Stat s Widget985 * bbPress Statistics Widget 933 986 * 934 987 * Adds a widget which displays the forum statistics … … 941 994 942 995 /** 943 * bbPress Stat s Widget944 * 945 * Registers the stat s widget996 * bbPress Statistics Widget 997 * 998 * Registers the statistics widget 946 999 * 947 1000 * @since 2.3.0 bbPress (r4509) … … 953 1006 $widget_ops = apply_filters( 'bbp_stats_widget_options', array( 954 1007 'classname' => 'widget_display_stats', 955 'description' => __( 'Some statistics from your forum.', 'bbpress' )1008 'description' => esc_html__( 'Some statistics from your forum.', 'bbpress' ) 956 1009 ) ); 957 1010 958 parent::__construct( false, __( '(bbPress) Statistics', 'bbpress' ), $widget_ops );1011 parent::__construct( false, esc_html__( '(bbPress) Statistics', 'bbpress' ), $widget_ops ); 959 1012 } 960 1013 … … 1004 1057 1005 1058 /** 1006 * Update the stat s widget options1059 * Update the statistics widget options 1007 1060 * 1008 1061 * @since 2.3.0 bbPress (r4509) … … 1021 1074 1022 1075 /** 1023 * Output the stat s widget options form1076 * Output the statistics widget options form 1024 1077 * 1025 1078 * @since 2.3.0 bbPress (r4509) … … 1035 1088 1036 1089 <p> 1037 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?>1090 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_e( 'Title:', 'bbpress' ); ?> 1038 1091 <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'] ); ?>"/> 1039 1092 </label> … … 1053 1106 public function parse_settings( $instance = array() ) { 1054 1107 return bbp_parse_args( $instance, array( 1055 'title' => __( 'Forum Statistics', 'bbpress' ) 1056 ), 1057 'stats_widget_settings' ); 1108 'title' => esc_html__( 'Forum Statistics', 'bbpress' ) 1109 ), 'stats_widget_settings' ); 1058 1110 } 1059 1111 } … … 1083 1135 $widget_ops = apply_filters( 'bbp_replies_widget_options', array( 1084 1136 'classname' => 'widget_display_replies', 1085 'description' => __( 'A list of the most recent replies.', 'bbpress' )1137 'description' => esc_html__( 'A list of the most recent replies.', 'bbpress' ) 1086 1138 ) ); 1087 1139 1088 parent::__construct( false, __( '(bbPress) Recent Replies', 'bbpress' ), $widget_ops );1140 parent::__construct( false, esc_html__( '(bbPress) Recent Replies', 'bbpress' ), $widget_ops ); 1089 1141 } 1090 1142 … … 1130 1182 // bbp_pre_get_posts_normalize_forum_visibility action and function. 1131 1183 $widget_query = new WP_Query( array( 1132 'post_type' => bbp_get_reply_post_type(), 1133 'post_status' => bbp_get_public_topic_statuses(), 1134 'posts_per_page' => (int) $settings['max_shown'], 1135 'ignore_sticky_posts' => true, 1136 'no_found_rows' => true, 1184 1185 // What and when 1186 'post_type' => bbp_get_reply_post_type(), 1187 'post_status' => bbp_get_public_topic_statuses(), 1188 'posts_per_page' => (int) $settings['max_shown'], 1189 1190 // Performance 1191 'ignore_sticky_posts' => true, 1192 'no_found_rows' => true, 1193 'nopaging' => true, 1194 'update_post_term_cache' => false, 1195 'update_post_meta_cache' => false 1137 1196 ) ); 1138 1197 … … 1142 1201 } 1143 1202 1203 // Start an output buffer 1204 ob_start(); 1205 1144 1206 echo $args['before_widget']; 1145 1207 … … 1148 1210 } ?> 1149 1211 1150 <ul >1212 <ul class="bbp-replies-widget"> 1151 1213 1152 1214 <?php while ( $widget_query->have_posts() ) : $widget_query->the_post(); ?> … … 1171 1233 1172 1234 // translators: 1: reply author, 2: reply link, 3: reply timestamp 1173 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>' );1235 printf( esc_html_x( '%1$s on %2$s %3$s', 'widgets', 'bbpress' ), $author_link, $reply_link, '<div>' . bbp_get_time_since( get_the_time( 'U' ) ) . '</div>' ); 1174 1236 1175 1237 // Reply link and timestamp … … 1177 1239 1178 1240 // translators: 1: reply link, 2: reply timestamp 1179 printf( _x( '%1$s %2$s', 'widgets', 'bbpress' ), $reply_link, '<div>' . bbp_get_time_since( get_the_time( 'U' ) ) . '</div>' );1241 printf( esc_html_x( '%1$s %2$s', 'widgets', 'bbpress' ), $reply_link, '<div>' . bbp_get_time_since( get_the_time( 'U' ) ) . '</div>' ); 1180 1242 1181 1243 // Reply author and title … … 1183 1245 1184 1246 // translators: 1: reply author, 2: reply link 1185 printf( _x( '%1$s on %2$s', 'widgets', 'bbpress' ), $author_link, $reply_link );1247 printf( esc_html_x( '%1$s on %2$s', 'widgets', 'bbpress' ), $author_link, $reply_link ); 1186 1248 1187 1249 // Only the reply title … … 1189 1251 1190 1252 // translators: 1: reply link 1191 printf( _x( '%1$s', 'widgets', 'bbpress' ), $reply_link );1253 printf( esc_html_x( '%1$s', 'widgets', 'bbpress' ), $reply_link ); 1192 1254 1193 1255 endif; … … 1205 1267 // Reset the $post global 1206 1268 wp_reset_postdata(); 1269 1270 // Output the current buffer 1271 echo ob_get_clean(); 1207 1272 } 1208 1273 … … 1239 1304 $settings = $this->parse_settings( $instance ); ?> 1240 1305 1241 <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>1242 <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>1243 <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( true, $settings['show_date'] ); ?> value="1" /></label></p>1244 <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( true, $settings['show_user'] ); ?> value="1" /></label></p>1306 <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php esc_html_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> 1307 <p><label for="<?php echo $this->get_field_id( 'max_shown' ); ?>"><?php esc_html_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> 1308 <p><label for="<?php echo $this->get_field_id( 'show_date' ); ?>"><?php esc_html_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( true, $settings['show_date'] ); ?> value="1" /></label></p> 1309 <p><label for="<?php echo $this->get_field_id( 'show_user' ); ?>"><?php esc_html_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( true, $settings['show_user'] ); ?> value="1" /></label></p> 1245 1310 1246 1311 <?php … … 1257 1322 public function parse_settings( $instance = array() ) { 1258 1323 return bbp_parse_args( $instance, array( 1259 'title' => __( 'Recent Replies', 'bbpress' ),1324 'title' => esc_html__( 'Recent Replies', 'bbpress' ), 1260 1325 'max_shown' => 5, 1261 1326 'show_date' => false, 1262 1327 'show_user' => false 1263 ), 1264 'replies_widget_settings' ); 1328 ), 'replies_widget_settings' ); 1265 1329 } 1266 1330 }
Note: See TracChangeset
for help on using the changeset viewer.