PluginProbe
bbPress / 2.6.17
bbPress v2.6.17
2.6.17 trunk 2.0 2.0-beta-1 2.0-beta-2b 2.0-beta-3 2.0-beta-3b 2.0-rc-2 2.0-rc-3 2.0-rc-4 2.0-rc-5 2.0.1 2.0.2 2.0.3 2.1 2.1-beta-1 2.1-rc1 2.1-rc2 2.1-rc3 2.1-rc4 2.1.1 2.1.2 2.1.3 2.2 2.2.1 All 72 releases
← All changes | bbpress.php +49 -86 trunk2.6.17 View file →
@@ -1,12 +1,12 @@
1 1 <?php
2 2
3 3 /**
4 - * The bbPress Plugin.
4 + * The bbPress Plugin
5 5 *
6 6 * bbPress is forum software with a twist from the creators of WordPress.
7 7 *
8 - * $Id: bbpress.php 7521 2026-09-16 04:42:18Z johnjamesjacoby $
8 + * $Id: bbpress.php 7528 2026-09-16 06:42:34Z johnjamesjacoby $
9 9 *
10 10 * @package bbPress
11 11 * @subpackage Main
12 12 */
@@ -20,12 +20,12 @@
20 20 * License: GNU General Public License v2 or later
21 21 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
22 22 * Text Domain: bbpress
23 23 * Domain Path: /languages/
24 - * Requires PHP: 7.2
24 + * Requires PHP: 5.6.20
25 25 * Requires at least: 6.0
26 26 * Tested up to: 7.1
27 - * Version: 2.7.0-alpha-3
27 + * Version: 2.6.17
28 28 */
29 29
30 30 // Exit if accessed directly
31 31 defined( 'ABSPATH' ) || exit;
@@ -31,9 +31,9 @@
31 31 defined( 'ABSPATH' ) || exit;
32 32
33 33 if ( ! class_exists( 'bbPress' ) ) :
34 34 /**
35 - * Main bbPress Class.
35 + * Main bbPress Class
36 36 *
37 37 * "Word hard. Stay bumble."
38 38 *
39 39 * @since 2.0.0 bbPress (r2464)
@@ -43,22 +43,23 @@
43 43 /** Magic *****************************************************************/
44 44
45 45 /**
46 46 * bbPress uses many variables, several of which can be filtered to
47 - * customize the way it operates. Most of those variables are stored in this
48 - * private array via PHP magic methods.
47 + * customize the way it operates. Most of these variables are stored in a
48 + * private array that gets updated with the help of PHP magic methods.
49 49 *
50 50 * This is a precautionary measure, to avoid potential errors produced by
51 - * unanticipated direct manipulation of critical run-time data.
51 + * unanticipated direct manipulation of run-time data.
52 52 *
53 - * @var array All run-time data
53 + * @see bbPress::setup_globals()
54 + * @var array
54 55 */
55 - private $data = array();
56 + private $data;
56 57
57 58 /** Not Magic *************************************************************/
58 59
59 60 /**
60 - * @var WP_User|false Current user object after setup; false before setup.
61 + * @var mixed False when not logged in; WP_User object when logged in
61 62 */
62 63 public $current_user = false;
63 64
64 65 /**
@@ -66,29 +67,29 @@
66 67 */
67 68 public $extend;
68 69
69 70 /**
70 - * @var array Topic views.
71 + * @var array Topic views
71 72 */
72 73 public $views = array();
73 74
74 75 /**
75 - * @var array Overloads get_option().
76 + * @var array Overloads get_option()
76 77 */
77 78 public $options = array();
78 79
79 80 /**
80 - * @var array Storage of options not in the database.
81 + * @var array Storage of options not in the database
81 82 */
82 83 public $not_options = array();
83 84
84 85 /**
85 - * @var array Overloads get_user_meta().
86 + * @var array Overloads get_user_meta()
86 87 */
87 88 public $user_options = array();
88 89
89 90 /**
90 - * @var array Dynamically initialized user roles.
91 + * @var array Dynamically initialized user roles
91 92 */
92 93 public $roles = array();
93 94
94 95 /** Singleton *************************************************************/
@@ -93,13 +94,13 @@
93 94
94 95 /** Singleton *************************************************************/
95 96
96 97 /**
97 - * Main bbPress Instance.
98 + * Main bbPress Instance
98 99 *
99 - * bbPress is fun.
100 - * Please load it only one time.
101 - * For this, we thank you.
100 + * bbPress is fun
101 + * Please load it only one time
102 + * For this, we thank you
102 103 *
103 104 * Insures that only one instance of bbPress exists in memory at any one
104 105 * time. Also prevents needing to define globals all over the place.
105 106 *
@@ -104,11 +105,11 @@
104 105 * time. Also prevents needing to define globals all over the place.
105 106 *
106 107 * @since 2.1.0 bbPress (r3757)
107 108 *
108 - * @staticvar bbPress|null $instance Singleton instance, created on first use.
109 + * @staticvar object $instance
109 110 * @see bbpress()
110 - * @return bbPress The one true bbPress.
111 + * @return bbPress The one true bbPress
111 112 */
112 113 public static function instance() {
113 114
114 115 // Store the instance locally to avoid private static replication
@@ -141,9 +142,9 @@
141 142 /* Do nothing here */
142 143 }
143 144
144 145 /**
145 - * A dummy magic method to prevent bbPress from being cloned.
146 + * A dummy magic method to prevent bbPress from being cloned
146 147 *
147 148 * @since 2.0.0 bbPress (r2464)
148 149 */
149 150 public function __clone() {
@@ -150,9 +151,9 @@
150 151 _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'bbpress' ), '2.1' );
151 152 }
152 153
153 154 /**
154 - * A dummy magic method to prevent bbPress from being unserialized.
155 + * A dummy magic method to prevent bbPress from being unserialized
155 156 *
156 157 * @since 2.0.0 bbPress (r2464)
157 158 */
158 159 public function __wakeup() {
@@ -159,14 +160,11 @@
159 160 _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'bbpress' ), '2.1' );
160 161 }
161 162
162 163 /**
163 - * Magic method for checking the existence of a certain custom field.
164 + * Magic method for checking the existence of a certain custom field
164 165 *
165 166 * @since 2.1.0 bbPress (r3951)
166 - *
167 - * @param string $key Runtime data key.
168 - * @return bool Whether the key has a non-null value.
169 167 */
170 168 public function __isset( $key ) {
171 169 return isset( $this->data[ $key ] );
172 170 }
@@ -171,14 +169,11 @@
171 169 return isset( $this->data[ $key ] );
172 170 }
173 171
174 172 /**
175 - * Magic method for getting bbPress variables.
173 + * Magic method for getting bbPress variables
176 174 *
177 175 * @since 2.1.0 bbPress (r3951)
178 - *
179 - * @param string $key Runtime data key.
180 - * @return mixed Stored value, or null if the key is not set.
181 176 */
182 177 public function __get( $key ) {
183 178 return isset( $this->data[ $key ] )
184 179 ? $this->data[ $key ]
@@ -185,14 +180,11 @@
185 180 : null;
186 181 }
187 182
188 183 /**
189 - * Magic method for setting bbPress variables.
184 + * Magic method for setting bbPress variables
190 185 *
191 186 * @since 2.1.0 bbPress (r3951)
192 - *
193 - * @param string $key Runtime data key.
194 - * @param mixed $value Value to store.
195 187 */
196 188 public function __set( $key, $value ) {
197 189 $this->data[ $key ] = $value;
198 190 }
@@ -197,13 +189,11 @@
197 189 $this->data[ $key ] = $value;
198 190 }
199 191
200 192 /**
201 - * Magic method for unsetting bbPress variables.
193 + * Magic method for unsetting bbPress variables
202 194 *
203 195 * @since 2.3.0 bbPress (r4628)
204 - *
205 - * @param string $key Runtime data key to remove.
206 196 */
207 197 public function __unset( $key ) {
208 198 if ( isset( $this->data[ $key ] ) ) {
209 199 unset( $this->data[ $key ] );
@@ -210,15 +200,11 @@
210 200 }
211 201 }
212 202
213 203 /**
214 - * Magic method to prevent notices and errors from invalid method calls.
204 + * Magic method to prevent notices and errors from invalid method calls
215 205 *
216 206 * @since 2.2.0 bbPress (r4252)
217 - *
218 - * @param string $name Name of the inaccessible method.
219 - * @param array $args Arguments passed to the method.
220 - * @return null
221 207 */
222 208 public function __call( $name = '', $args = array() ) {
223 209 unset( $name, $args );
224 210 return null;
@@ -237,9 +223,9 @@
237 223 private function setup_environment() {
238 224
239 225 /** Versions **********************************************************/
240 226
241 - $this->version = '2.7.0-alpha-3';
227 + $this->version = '2.6.17';
242 228 $this->db_version = '263';
243 229
244 230 /** Paths *************************************************************/
245 231
@@ -338,9 +324,9 @@
338 324 $this->tab_index = apply_filters( 'bbp_default_tab_index', 100 );
339 325 }
340 326
341 327 /**
342 - * Include required files.
328 + * Include required files
343 329 *
344 330 * @since 2.0.0 bbPress (r2626)
345 331 *
346 332 * @access private
@@ -363,9 +349,8 @@
363 349 /** Components ********************************************************/
364 350
365 351 // Common
366 352 require $this->includes_dir . 'common/ajax.php';
367 - require $this->includes_dir . 'common/blocks.php';
368 353 require $this->includes_dir . 'common/classes.php';
369 354 require $this->includes_dir . 'common/engagements.php';
370 355 require $this->includes_dir . 'common/functions.php';
371 356 require $this->includes_dir . 'common/formatting.php';
@@ -418,9 +403,9 @@
418 403 }
419 404 }
420 405
421 406 /**
422 - * Setup the default hooks and actions.
407 + * Setup the default hooks and actions
423 408 *
424 409 * @since 2.0.0 bbPress (r2644)
425 410 *
426 411 * @access private
@@ -446,9 +431,8 @@
446 431 'register_post_types', // Register post types (forum|topic|reply)
447 432 'register_post_statuses', // Register post statuses (closed|spam|orphan|hidden)
448 433 'register_taxonomies', // Register taxonomies (topic-tag)
449 434 'register_shortcodes', // Register shortcodes (bbp-login)
450 - 'register_blocks', // Register blocks (bbp-login)
451 435 'register_views', // Register the views (no-replies)
452 436 'register_theme_packages', // Register bundled theme packages (bbp-theme-compat/bbp-themes)
453 437 'load_textdomain', // Load textdomain (bbpress)
454 438 'add_rewrite_tags', // Add rewrite tags (view|user|edit|search)
@@ -467,9 +451,9 @@
467 451
468 452 /** Public Methods ********************************************************/
469 453
470 454 /**
471 - * Register bundled theme packages.
455 + * Register bundled theme packages
472 456 *
473 457 * Note that since we currently have complete control over bbp-themes and
474 458 * the bbp-theme-compat folders, it's fine to hardcode these here. If at a
475 459 * later date we need to automate this, and API will need to be built.
@@ -535,9 +519,9 @@
535 519 load_plugin_textdomain( $this->domain, false, $this->lang_base );
536 520 }
537 521
538 522 /**
539 - * Setup the post types for forums, topics and replies.
523 + * Setup the post types for forums, topics and replies
540 524 *
541 525 * @since 2.0.0 bbPress (r2597)
542 526 */
543 527 public static function register_post_types() {
@@ -561,9 +545,8 @@
561 545 'exclude_from_search' => true,
562 546 'show_in_nav_menus' => true,
563 547 'public' => true,
564 548 'show_ui' => current_user_can( 'bbp_forums_admin' ),
565 - 'show_in_rest' => true,
566 549 'rest_controller_class' => 'BBP_REST_Posts_Controller',
567 550 'can_export' => true,
568 551 'hierarchical' => true,
569 552 'query_var' => true,
@@ -592,9 +575,8 @@
592 575 'exclude_from_search' => true,
593 576 'show_in_nav_menus' => false,
594 577 'public' => true,
595 578 'show_ui' => current_user_can( 'bbp_topics_admin' ),
596 - 'show_in_rest' => true,
597 579 'rest_controller_class' => 'BBP_REST_Posts_Controller',
598 580 'can_export' => true,
599 581 'hierarchical' => false,
600 582 'query_var' => true,
@@ -623,9 +605,8 @@
623 605 'has_archive' => false,
624 606 'show_in_nav_menus' => false,
625 607 'public' => true,
626 608 'show_ui' => current_user_can( 'bbp_replies_admin' ),
627 - 'show_in_rest' => true,
628 609 'rest_controller_class' => 'BBP_REST_Posts_Controller',
629 610 'can_export' => true,
630 611 'hierarchical' => false,
631 612 'query_var' => true,
@@ -636,16 +617,14 @@
636 617 );
637 618 }
638 619
639 620 /**
640 - * Register the post statuses used by bbPress.
621 + * Register the post statuses used by bbPress
641 622 *
642 623 * We do some manipulation of the 'trash' status so trashed topics and
643 624 * replies can be viewed from within the theme.
644 625 *
645 626 * @since 2.0.0 bbPress (r2727)
646 - *
647 - * @global stdClass[] $wp_post_statuses Registered post status objects, keyed by status name.
648 627 */
649 628 public static function register_post_statuses() {
650 629
651 630 // Closed
@@ -743,9 +722,9 @@
743 722 }
744 723 }
745 724
746 725 /**
747 - * Register the topic tag taxonomy.
726 + * Register the topic tag and forum moderator taxonomies
748 727 *
749 728 * @since 2.0.0 bbPress (r2464) Added bbp_get_topic_tag_tax_id() taxonomy
750 729 */
751 730 public static function register_taxonomies() {
@@ -773,9 +752,9 @@
773 752 );
774 753 }
775 754
776 755 /**
777 - * Register the bbPress views.
756 + * Register the bbPress views
778 757 *
779 758 * @since 2.0.0 bbPress (r2789)
780 759 */
781 760 public static function register_views() {
@@ -814,9 +793,9 @@
814 793 );
815 794 }
816 795
817 796 /**
818 - * Register the bbPress shortcodes.
797 + * Register the bbPress shortcodes
819 798 *
820 799 * @since 2.0.0 bbPress (r3031)
821 800 */
822 801 public function register_shortcodes() {
@@ -823,20 +802,11 @@
823 802 $this->shortcodes = new BBP_Shortcodes();
824 803 }
825 804
826 805 /**
827 - * Register the bbPress blocks.
828 - *
829 - * @since 2.7.0 bbPress (r7382)
830 - */
831 - public function register_blocks() {
832 - $this->blocks = new BBP_Blocks();
833 - }
834 -
835 - /**
836 806 * Register bbPress meta-data
837 807 *
838 - * Counts added in 2.6.0 to avoid negative values.
808 + * Counts added in 2.6.0 to avoid negative values
839 809 *
840 810 * @since 2.6.0 bbPress (r6300)
841 811 */
842 812 public function register_meta() {
@@ -864,14 +834,15 @@
864 834 );
865 835
866 836 /** Post **************************************************************/
867 837
868 - // Forum
869 - $count['object_subtype'] = bbp_get_forum_post_type();
838 + // Counts
870 839 register_meta( 'post', '_bbp_topic_count', $count );
871 840 register_meta( 'post', '_bbp_reply_count', $count );
872 841 register_meta( 'post', '_bbp_total_topic_count', $count );
873 842 register_meta( 'post', '_bbp_total_reply_count', $count );
843 + register_meta( 'post', '_bbp_voice_count', $count );
844 + register_meta( 'post', '_bbp_anonymous_reply_count', $count );
874 845 register_meta( 'post', '_bbp_topic_count_hidden', $count );
875 846 register_meta( 'post', '_bbp_reply_count_hidden', $count );
876 847 register_meta( 'post', '_bbp_total_topic_count_hidden', $count );
877 848 register_meta( 'post', '_bbp_total_reply_count_hidden', $count );
@@ -876,19 +847,11 @@
876 847 register_meta( 'post', '_bbp_total_topic_count_hidden', $count );
877 848 register_meta( 'post', '_bbp_total_reply_count_hidden', $count );
878 849 register_meta( 'post', '_bbp_forum_subforum_count', $count );
879 850
880 - // Topic
881 - $count['object_subtype'] = bbp_get_topic_post_type();
882 - register_meta( 'post', '_bbp_reply_count', $count );
883 - register_meta( 'post', '_bbp_voice_count', $count );
884 - register_meta( 'post', '_bbp_anonymous_reply_count', $count );
885 - register_meta( 'post', '_bbp_reply_count_hidden', $count );
851 + /** User **************************************************************/
886 852
887 - /* User ***************************************************************/
888 -
889 - // Counts
890 - $count['object_subtype'] = '';
853 + // Counts
891 854 register_meta( 'user', '_bbp_topic_count', $count );
892 855 register_meta( 'user', '_bbp_reply_count', $count );
893 856
894 857 // Activity
@@ -906,9 +869,9 @@
906 869 );
907 870 }
908 871
909 872 /**
910 - * Setup the currently logged-in user.
873 + * Setup the currently logged-in user
911 874 *
912 875 * @since 2.0.0 bbPress (r2697)
913 876 */
914 877 public function setup_current_user() {
@@ -915,9 +878,9 @@
915 878 $this->current_user = wp_get_current_user();
916 879 }
917 880
918 881 /**
919 - * Setup the user engagements strategy.
882 + * Setup the user engagements strategy
920 883 *
921 884 * @since 2.6.0 bbPress (r6875)
922 885 */
923 886 public function setup_engagements() {
@@ -930,9 +893,9 @@
930 893 $this->engagements = new $class_name();
931 894 }
932 895
933 896 /**
934 - * Initialize forum-specific roles.
897 + * Initialize forum-specific roles
935 898 *
936 899 * @since 2.6.0
937 900 */
938 901 public function roles_init() {
@@ -956,9 +919,9 @@
956 919
957 920 /** Custom Rewrite Rules **************************************************/
958 921
959 922 /**
960 - * Add the bbPress-specific rewrite tags.
923 + * Add the bbPress-specific rewrite tags
961 924 *
962 925 * @since 2.0.0 bbPress (r2753)
963 926 */
964 927 public static function add_rewrite_tags() {