PluginProbe
bbPress / 2.0-rc-4
bbPress v2.0-rc-4
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
bbpress / bbp-includes / bbp-core-hooks.php

bbp-core-hooks.php in bbPress 2.0-rc-4, at bbp-includes/bbp-core-hooks.php

704 lines 23.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * bbPress Filters & Actions
5 *
6 * @package bbPress
7 * @subpackage Hooks
8 *
9 * This file contains the actions and filters that are used through-out bbPress.
10 * They are consolidated here to make searching for them easier, and to help
11 * developers understand at a glance the order in which things occur.
12 *
13 * There are a few common places that additional actions can currently be found
14 *
15 * - bbPress: In {@link bbPress::setup_actions()} in bbpress.php
16 * - Component: In {@link BBP_Component::setup_actions()} in
17 * bbp-includes/bbp-classes.php
18 * - Admin: More in {@link BBP_Admin::setup_actions()} in
19 * bbp-admin/bbp-admin.php
20 */
21
22 // Exit if accessed directly
23 if ( !defined( 'ABSPATH' ) ) exit;
24
25 /** ACTIONS *******************************************************************/
26
27 /**
28 * Attach bbPress to WordPress
29 *
30 * bbPress uses its own internal actions to help aid in additional plugin
31 * development, and to limit the amount of potential future code changes when
32 * updates to WordPress occur.
33 */
34 add_action( 'plugins_loaded', 'bbp_loaded', 10 );
35 add_action( 'init', 'bbp_init', 10 );
36 add_action( 'widgets_init', 'bbp_widgets_init', 10 );
37 add_action( 'generate_rewrite_rules', 'bbp_generate_rewrite_rules', 10 );
38 add_action( 'wp_enqueue_scripts', 'bbp_enqueue_scripts', 10 );
39 add_filter( 'template_include', 'bbp_template_include', 10 );
40
41 /**
42 * bbp_loaded - Attached to 'plugins_loaded' above
43 *
44 * Attach various loader actions to the bbp_loaded action.
45 * The load order helps to load code at the correct time.
46 * v---Load order
47 */
48 add_action( 'bbp_loaded', 'bbp_constants', 2 );
49 add_action( 'bbp_loaded', 'bbp_boot_strap_globals', 4 );
50 add_action( 'bbp_loaded', 'bbp_includes', 6 );
51 add_action( 'bbp_loaded', 'bbp_setup_globals', 8 );
52 add_action( 'bbp_loaded', 'bbp_register_theme_directory', 10 );
53
54 /**
55 * bbp_init - Attached to 'init' above
56 *
57 * Attach various initialization actions to the init action.
58 * The load order helps to load code at the correct time.
59 * v---Load order
60 */
61 add_action( 'bbp_init', 'bbp_load_textdomain', 2 );
62 add_action( 'bbp_init', 'bbp_setup_option_filters', 4 );
63 add_action( 'bbp_init', 'bbp_setup_current_user', 6 );
64 add_action( 'bbp_init', 'bbp_setup_theme_compat', 8 );
65 add_action( 'bbp_init', 'bbp_setup_akismet', 10 );
66 add_action( 'bbp_init', 'bbp_setup_buddypress', 12 );
67 add_action( 'bbp_init', 'bbp_register_post_types', 14 );
68 add_action( 'bbp_init', 'bbp_register_post_statuses', 16 );
69 add_action( 'bbp_init', 'bbp_register_taxonomies', 18 );
70 add_action( 'bbp_init', 'bbp_register_views', 20 );
71 add_action( 'bbp_init', 'bbp_register_shortcodes', 22 );
72 add_action( 'bbp_init', 'bbp_add_rewrite_tags', 24 );
73 add_action( 'bbp_init', 'bbp_ready', 999 );
74
75 // Multisite Global Forum Access
76 add_action( 'bbp_setup_current_user', 'bbp_global_access_role_mask', 10 );
77
78 // Theme Compat
79 add_action( 'bbp_enqueue_scripts', 'bbp_theme_compat_enqueue_css', 10 );
80
81 // Widgets
82 add_action( 'bbp_widgets_init', array( 'BBP_Login_Widget', 'register_widget' ), 10 );
83 add_action( 'bbp_widgets_init', array( 'BBP_Views_Widget', 'register_widget' ), 10 );
84 add_action( 'bbp_widgets_init', array( 'BBP_Forums_Widget', 'register_widget' ), 10 );
85 add_action( 'bbp_widgets_init', array( 'BBP_Topics_Widget', 'register_widget' ), 10 );
86 add_action( 'bbp_widgets_init', array( 'BBP_Replies_Widget', 'register_widget' ), 10 );
87
88 // Template - Head, foot, errors and messages
89 add_action( 'wp_head', 'bbp_head' );
90 add_filter( 'wp_title', 'bbp_title', 10, 3 );
91 add_action( 'wp_footer', 'bbp_footer' );
92 add_action( 'bbp_loaded', 'bbp_login_notices' );
93 add_action( 'bbp_head', 'bbp_topic_notices' );
94 add_action( 'bbp_template_notices', 'bbp_template_notices' );
95
96 // Add to body class
97 add_filter( 'body_class', 'bbp_body_class', 10, 2 );
98
99 // Caps & Roles
100 add_filter( 'map_meta_cap', 'bbp_map_meta_caps', 10, 4 );
101 add_action( 'bbp_activation', 'bbp_add_roles', 1 );
102 add_action( 'bbp_activation', 'bbp_add_caps', 2 );
103 add_action( 'bbp_deactivation', 'bbp_remove_caps', 1 );
104 add_action( 'bbp_deactivation', 'bbp_remove_roles', 2 );
105
106 // Options & Settings
107 add_action( 'bbp_activation', 'bbp_add_options', 1 );
108
109 // Multisite
110 add_action( 'bbp_new_site', 'bbp_add_roles', 2 );
111 add_action( 'bbp_new_site', 'bbp_add_caps', 4 );
112 add_action( 'bbp_new_site', 'bbp_add_options', 6 );
113
114 // Topic Tag Page
115 add_action( 'template_redirect', 'bbp_manage_topic_tag_handler', 1 );
116
117 // Before and After the Query
118 add_action( 'pre_get_posts', 'bbp_pre_get_posts', 2 );
119 add_action( 'pre_get_posts', 'bbp_pre_get_posts_exclude_forums', 4 );
120
121 // Restrict forum access
122 add_action( 'template_redirect', 'bbp_forum_enforce_hidden', -1 );
123 add_action( 'template_redirect', 'bbp_forum_enforce_private', -1 );
124
125 // Profile Edit
126 add_action( 'template_redirect', 'bbp_edit_user_handler', 1 );
127
128 // Profile Page Messages
129 add_action( 'bbp_template_notices', 'bbp_notice_edit_user_success' );
130 add_action( 'bbp_template_notices', 'bbp_notice_edit_user_is_super_admin', 2 );
131
132 // Update forum branch
133 add_action( 'bbp_trashed_forum', 'bbp_update_forum_walker' );
134 add_action( 'bbp_untrashed_forum', 'bbp_update_forum_walker' );
135 add_action( 'bbp_deleted_forum', 'bbp_update_forum_walker' );
136 add_action( 'bbp_spammed_forum', 'bbp_update_forum_walker' );
137 add_action( 'bbp_unspammed_forum', 'bbp_update_forum_walker' );
138
139 // New/Edit Reply
140 add_action( 'template_redirect', 'bbp_new_reply_handler' );
141 add_action( 'template_redirect', 'bbp_edit_reply_handler', 1 );
142 add_action( 'bbp_new_reply', 'bbp_update_reply', 10, 6 );
143 add_action( 'bbp_edit_reply', 'bbp_update_reply', 10, 6 );
144
145 // Before Delete/Trash/Untrash Reply
146 add_action( 'trash_post', 'bbp_trash_reply' );
147 add_action( 'untrash_post', 'bbp_untrash_reply' );
148 add_action( 'delete_post', 'bbp_delete_reply' );
149
150 // After Deleted/Trashed/Untrashed Reply
151 add_action( 'trashed_post', 'bbp_trashed_reply' );
152 add_action( 'untrashed_post', 'bbp_untrashed_reply' );
153 add_action( 'deleted_post', 'bbp_deleted_reply' );
154
155 // New/Edit Topic
156 add_action( 'template_redirect', 'bbp_new_topic_handler' );
157 add_action( 'template_redirect', 'bbp_edit_topic_handler', 1 );
158 add_action( 'bbp_new_topic', 'bbp_update_topic', 10, 5 );
159 add_action( 'bbp_edit_topic', 'bbp_update_topic', 10, 5 );
160
161 // Split/Merge Topic
162 add_action( 'template_redirect', 'bbp_merge_topic_handler', 1 );
163 add_action( 'template_redirect', 'bbp_split_topic_handler', 1 );
164 add_action( 'bbp_merged_topic', 'bbp_merge_topic_count', 1, 3 );
165 add_action( 'bbp_post_split_topic', 'bbp_split_topic_count', 1, 3 );
166
167 // Before Delete/Trash/Untrash Topic
168 add_action( 'trash_post', 'bbp_trash_topic' );
169 add_action( 'untrash_post', 'bbp_untrash_topic' );
170 add_action( 'delete_post', 'bbp_delete_topic' );
171
172 // After Deleted/Trashed/Untrashed Topic
173 add_action( 'trashed_post', 'bbp_trashed_topic' );
174 add_action( 'untrashed_post', 'bbp_untrashed_topic' );
175 add_action( 'deleted_post', 'bbp_deleted_topic' );
176
177 // Topic/Reply Actions
178 add_action( 'template_redirect', 'bbp_toggle_topic_handler', 1 );
179 add_action( 'template_redirect', 'bbp_toggle_reply_handler', 1 );
180
181 // Favorites
182 add_action( 'template_redirect', 'bbp_favorites_handler', 1 );
183 add_action( 'bbp_trash_topic', 'bbp_remove_topic_from_all_favorites' );
184 add_action( 'bbp_delete_topic', 'bbp_remove_topic_from_all_favorites' );
185
186 // Subscriptions
187 add_action( 'template_redirect', 'bbp_subscriptions_handler', 1 );
188 add_action( 'bbp_trash_topic', 'bbp_remove_topic_from_all_subscriptions' );
189 add_action( 'bbp_delete_topic', 'bbp_remove_topic_from_all_subscriptions' );
190 add_action( 'bbp_new_reply', 'bbp_notify_subscribers', 1, 1 );
191
192 // Sticky
193 add_action( 'bbp_trash_topic', 'bbp_unstick_topic' );
194 add_action( 'bbp_delete_topic', 'bbp_unstick_topic' );
195
196 // Update topic branch
197 add_action( 'bbp_trashed_topic', 'bbp_update_topic_walker' );
198 add_action( 'bbp_untrashed_topic', 'bbp_update_topic_walker' );
199 add_action( 'bbp_deleted_topic', 'bbp_update_topic_walker' );
200 add_action( 'bbp_spammed_topic', 'bbp_update_topic_walker' );
201 add_action( 'bbp_unspammed_topic', 'bbp_update_topic_walker' );
202
203 // Update reply branch
204 add_action( 'bbp_trashed_reply', 'bbp_update_reply_walker' );
205 add_action( 'bbp_untrashed_reply', 'bbp_update_reply_walker' );
206 add_action( 'bbp_deleted_reply', 'bbp_update_reply_walker' );
207 add_action( 'bbp_spammed_reply', 'bbp_update_reply_walker' );
208 add_action( 'bbp_unspammed_reply', 'bbp_update_reply_walker' );
209
210 // User status
211 add_action( 'make_ham_user', 'bbp_make_ham_user' );
212 add_action( 'make_spam_user', 'bbp_make_spam_user' );
213
214 // User role
215 add_action( 'bbp_new_topic', 'bbp_global_access_auto_role' );
216 add_action( 'bbp_new_reply', 'bbp_global_access_auto_role' );
217
218 // Flush rewrite rules
219 add_action( 'bbp_activation', 'flush_rewrite_rules' );
220 add_action( 'bbp_deactivation', 'flush_rewrite_rules' );
221
222 /**
223 * When a new site is created in a multisite installation, run the activation
224 * routine on that site
225 *
226 * @since bbPress (r3283)
227 *
228 * @param int $blog_id
229 * @param int $user_id
230 * @param string $domain
231 * @param string $path
232 * @param int $site_id
233 * @param array() $meta
234 */
235 function bbp_new_site( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
236
237 // Switch to the new blog
238 switch_to_blog( $blog_id );
239
240 // Do the bbPress activation routine
241 do_action( 'bbp_new_site' );
242
243 // restore original blog
244 restore_current_blog();
245 }
246 add_action( 'wpmu_new_blog', 'bbp_new_site', 10, 6 );
247
248 /** FILTERS *******************************************************************/
249
250 /**
251 * Template Compatibility
252 *
253 * If you want to completely bypass this and manage your own custom bbPress
254 * template hierarchy, start here by removing this filter, then look at how
255 * bbp_template_include() works and do something similar. :)
256 */
257 add_filter( 'bbp_template_include', 'bbp_template_include_theme_supports', 2, 1 );
258 add_filter( 'bbp_template_include', 'bbp_template_include_theme_compat', 4, 2 );
259
260 /**
261 * Feeds
262 *
263 * bbPress comes with a number of custom RSS2 feeds that get handled outside
264 * the normal scope of feeds that WordPress would normally serve. To do this,
265 * we filter every page request, listen for a feed request, and trap it.
266 */
267 add_filter( 'request', 'bbp_request_feed_trap' );
268
269 // Links
270 add_filter( 'paginate_links', 'bbp_add_view_all' );
271 add_filter( 'bbp_get_topic_permalink', 'bbp_add_view_all' );
272 add_filter( 'bbp_get_reply_permalink', 'bbp_add_view_all' );
273 add_filter( 'bbp_get_forum_permalink', 'bbp_add_view_all' );
274
275 // wp_filter_kses on new/edit topic/reply title
276 add_filter( 'bbp_new_reply_pre_title', 'wp_filter_kses' );
277 add_filter( 'bbp_new_topic_pre_title', 'wp_filter_kses' );
278 add_filter( 'bbp_edit_reply_pre_title', 'wp_filter_kses' );
279 add_filter( 'bbp_edit_topic_pre_title', 'wp_filter_kses' );
280
281 // balanceTags, wp_filter_kses and wp_rel_nofollow on new/edit topic/reply text
282 add_filter( 'bbp_new_reply_pre_content', 'balanceTags' );
283 add_filter( 'bbp_new_reply_pre_content', 'wp_rel_nofollow' );
284 add_filter( 'bbp_new_reply_pre_content', 'wp_filter_kses' );
285 add_filter( 'bbp_new_topic_pre_content', 'balanceTags' );
286 add_filter( 'bbp_new_topic_pre_content', 'wp_rel_nofollow' );
287 add_filter( 'bbp_new_topic_pre_content', 'wp_filter_kses' );
288 add_filter( 'bbp_edit_reply_pre_content', 'balanceTags' );
289 add_filter( 'bbp_edit_reply_pre_content', 'wp_rel_nofollow' );
290 add_filter( 'bbp_edit_reply_pre_content', 'wp_filter_kses' );
291 add_filter( 'bbp_edit_topic_pre_content', 'balanceTags' );
292 add_filter( 'bbp_edit_topic_pre_content', 'wp_rel_nofollow' );
293 add_filter( 'bbp_edit_topic_pre_content', 'wp_filter_kses' );
294
295 // Add number format filter to functions requiring numeric output
296 add_filter( 'bbp_get_forum_topic_count', 'bbp_number_format' );
297 add_filter( 'bbp_get_forum_topic_reply_count', 'bbp_number_format' );
298
299 // No follow and stripslashes on user profile links
300 add_filter( 'bbp_get_reply_author_link', 'wp_rel_nofollow' );
301 add_filter( 'bbp_get_reply_author_link', 'stripslashes' );
302 add_filter( 'bbp_get_topic_author_link', 'wp_rel_nofollow' );
303 add_filter( 'bbp_get_topic_author_link', 'stripslashes' );
304 add_filter( 'bbp_get_user_favorites_link', 'wp_rel_nofollow' );
305 add_filter( 'bbp_get_user_favorites_link', 'stripslashes' );
306 add_filter( 'bbp_get_user_subscribe_link', 'wp_rel_nofollow' );
307 add_filter( 'bbp_get_user_subscribe_link', 'stripslashes' );
308 add_filter( 'bbp_get_user_profile_link', 'wp_rel_nofollow' );
309 add_filter( 'bbp_get_user_profile_link', 'stripslashes' );
310 add_filter( 'bbp_get_user_profile_edit_link', 'wp_rel_nofollow' );
311 add_filter( 'bbp_get_user_profile_edit_link', 'stripslashes' );
312
313 // Run filters on reply content
314 add_filter( 'bbp_get_reply_content', 'capital_P_dangit' );
315 add_filter( 'bbp_get_reply_content', 'wptexturize', 3 );
316 add_filter( 'bbp_get_reply_content', 'convert_chars', 5 );
317 add_filter( 'bbp_get_reply_content', 'make_clickable', 9 );
318 add_filter( 'bbp_get_reply_content', 'force_balance_tags', 25 );
319 add_filter( 'bbp_get_reply_content', 'convert_smilies', 20 );
320 add_filter( 'bbp_get_reply_content', 'wpautop', 30 );
321
322 // Run filters on topic content
323 add_filter( 'bbp_get_topic_content', 'capital_P_dangit' );
324 add_filter( 'bbp_get_topic_content', 'wptexturize', 3 );
325 add_filter( 'bbp_get_topic_content', 'convert_chars', 5 );
326 add_filter( 'bbp_get_topic_content', 'make_clickable', 9 );
327 add_filter( 'bbp_get_topic_content', 'force_balance_tags', 25 );
328 add_filter( 'bbp_get_topic_content', 'convert_smilies', 20 );
329 add_filter( 'bbp_get_topic_content', 'wpautop', 30 );
330
331 // Revisions
332 add_filter( 'bbp_get_reply_content', 'bbp_reply_content_append_revisions', 1, 2 );
333 add_filter( 'bbp_get_topic_content', 'bbp_topic_content_append_revisions', 1, 2 );
334
335 // Canonical
336 add_filter( 'redirect_canonical', 'bbp_redirect_canonical' );
337
338 // Login/Register/Lost Password
339 add_filter( 'login_redirect', 'bbp_redirect_login', 2, 3 );
340 add_filter( 'logout_url', 'bbp_logout_url', 2, 2 );
341
342 // Fix post author id for anonymous posts (set it back to 0) when the post status is changed
343 add_filter( 'wp_insert_post_data', 'bbp_fix_post_author', 30, 2 );
344
345 // Suppress private forum details
346 add_filter( 'bbp_get_forum_topic_count', 'bbp_suppress_private_forum_meta', 10, 2 );
347 add_filter( 'bbp_get_forum_reply_count', 'bbp_suppress_private_forum_meta', 10, 2 );
348 add_filter( 'bbp_get_forum_post_count', 'bbp_suppress_private_forum_meta', 10, 2 );
349 add_filter( 'bbp_get_forum_freshness_link', 'bbp_suppress_private_forum_meta', 10, 2 );
350 add_filter( 'bbp_get_author_link', 'bbp_suppress_private_author_link', 10, 2 );
351 add_filter( 'bbp_get_topic_author_link', 'bbp_suppress_private_author_link', 10, 2 );
352 add_filter( 'bbp_get_reply_author_link', 'bbp_suppress_private_author_link', 10, 2 );
353
354 /**
355 * Add filters to anonymous post author data
356 *
357 * This is used to clean-up any anonymous user data that is submitted via the
358 * new topic and new reply forms.
359 *
360 * @uses add_filter() To add filters
361 */
362 function bbp_pre_anonymous_filters () {
363
364 // Post author name
365 $filters = array(
366 'trim' => 10,
367 'sanitize_text_field' => 10,
368 'wp_filter_kses' => 10,
369 '_wp_specialchars' => 30
370 );
371 foreach ( $filters as $filter => $priority )
372 add_filter( 'bbp_pre_anonymous_post_author_name', $filter, $priority );
373
374 // Email saves
375 foreach ( array( 'trim', 'sanitize_email', 'wp_filter_kses' ) as $filter )
376 add_filter( 'bbp_pre_anonymous_post_author_email', $filter );
377
378 // Save URL
379 foreach ( array( 'trim', 'wp_strip_all_tags', 'esc_url_raw', 'wp_filter_kses' ) as $filter )
380 add_filter( 'bbp_pre_anonymous_post_author_website', $filter );
381 }
382 bbp_pre_anonymous_filters();
383
384 /**
385 * On multisite installations you must first allow themes to be activated and
386 * show up on the theme selection screen. This function will let the bbPress
387 * bundled themes show up and bypass this step.
388 *
389 * @since bbPress (r2944)
390 *
391 * @uses apply_filters() Calls 'bbp_allowed_themes' with the allowed themes list
392 */
393 function bbp_allowed_themes( $themes ) {
394 $themes['bbp-twentyten'] = 1;
395
396 return apply_filters( 'bbp_allowed_themes', $themes );
397 }
398 add_filter( 'allowed_themes', 'bbp_allowed_themes' );
399
400 /** Admin *********************************************************************/
401
402 if ( is_admin() ) {
403
404 /** Actions ***************************************************************/
405
406 add_action( 'bbp_init', 'bbp_admin' );
407 add_action( 'bbp_admin_init', 'bbp_admin_forums', 9 );
408 add_action( 'bbp_admin_init', 'bbp_admin_topics', 9 );
409 add_action( 'bbp_admin_init', 'bbp_admin_replies', 9 );
410 add_action( 'bbp_admin_init', 'bbp_admin_settings_help' );
411 add_action( 'admin_menu', 'bbp_admin_separator' );
412 add_action( 'custom_menu_order', 'bbp_admin_custom_menu_order' );
413 add_action( 'menu_order', 'bbp_admin_menu_order' );
414
415 /**
416 * Run the updater late on 'bbp_admin_init' to ensure that all alterations
417 * to the permalink structure have taken place. This fixes the issue of
418 * permalinks not being flushed properly when a bbPress update occurs.
419 */
420 add_action( 'bbp_admin_init', 'bbp_setup_updater', 999 );
421
422 /** Filters ***************************************************************/
423
424 // Run wp_kses_data on topic/reply content in admin section
425 add_filter( 'bbp_get_reply_content', 'wp_kses_data' );
426 add_filter( 'bbp_get_topic_content', 'wp_kses_data' );
427 }
428
429 /**
430 * Plugin Dependency
431 *
432 * The purpose of the following actions is to mimic the behavior of something
433 * called 'plugin dependency' which enables a plugin to have plugins of their
434 * own in a safe and reliable way.
435 *
436 * We do this in bbPress by mirroring existing WordPress actions in many places
437 * allowing dependant plugins to hook into the bbPress specific ones, thus
438 * guaranteeing proper code execution only when bbPress is active.
439 *
440 * The following functions are wrappers for their actions, allowing them to be
441 * manually called and/or piggy-backed on top of other actions if needed.
442 */
443
444 /** Activation Actions ********************************************************/
445
446 /**
447 * Runs on bbPress activation
448 *
449 * @since bbPress (r2509)
450 *
451 * @uses register_uninstall_hook() To register our own uninstall hook
452 * @uses do_action() Calls 'bbp_activation' hook
453 */
454 function bbp_activation() {
455 do_action( 'bbp_activation' );
456 }
457
458 /**
459 * Runs on bbPress deactivation
460 *
461 * @since bbPress (r2509)
462 *
463 * @uses do_action() Calls 'bbp_deactivation' hook
464 */
465 function bbp_deactivation() {
466 do_action( 'bbp_deactivation' );
467 }
468
469 /**
470 * Runs when uninstalling bbPress
471 *
472 * @since bbPress (r2509)
473 *
474 * @uses do_action() Calls 'bbp_uninstall' hook
475 */
476 function bbp_uninstall() {
477 do_action( 'bbp_uninstall' );
478 }
479
480 /** Main Actions **************************************************************/
481
482 /**
483 * Main action responsible for constants, globals, and includes
484 *
485 * @since bbPress (r2599)
486 *
487 * @uses do_action() Calls 'bbp_loaded'
488 */
489 function bbp_loaded() {
490 do_action( 'bbp_loaded' );
491 }
492
493 /**
494 * Setup constants
495 *
496 * @since bbPress (r2599)
497 *
498 * @uses do_action() Calls 'bbp_constants'
499 */
500 function bbp_constants() {
501 do_action( 'bbp_constants' );
502 }
503
504 /**
505 * Setup globals BEFORE includes
506 *
507 * @since bbPress (r2599)
508 *
509 * @uses do_action() Calls 'bbp_boot_strap_globals'
510 */
511 function bbp_boot_strap_globals() {
512 do_action( 'bbp_boot_strap_globals' );
513 }
514
515 /**
516 * Include files
517 *
518 * @since bbPress (r2599)
519 *
520 * @uses do_action() Calls 'bbp_includes'
521 */
522 function bbp_includes() {
523 do_action( 'bbp_includes' );
524 }
525
526 /**
527 * Setup globals AFTER includes
528 *
529 * @since bbPress (r2599)
530 *
531 * @uses do_action() Calls 'bbp_setup_globals'
532 */
533 function bbp_setup_globals() {
534 do_action( 'bbp_setup_globals' );
535 }
536
537 /**
538 * Initialize any code after everything has been loaded
539 *
540 * @since bbPress (r2599)
541 *
542 * @uses do_action() Calls 'bbp_init'
543 */
544 function bbp_init() {
545 do_action ( 'bbp_init' );
546 }
547
548 /**
549 * Initialize widgets
550 *
551 * @since bbPress (r3389)
552 *
553 * @uses do_action() Calls 'bbp_widgets_init'
554 */
555 function bbp_widgets_init() {
556 do_action ( 'bbp_widgets_init' );
557 }
558
559 /** Supplemental Actions ******************************************************/
560
561 /**
562 * Setup the currently logged-in user
563 *
564 * @since bbPress (r2695)
565 *
566 * @uses do_action() Calls 'bbp_setup_current_user'
567 */
568 function bbp_setup_current_user() {
569 do_action ( 'bbp_setup_current_user' );
570 }
571
572 /**
573 * Load translations for current language
574 *
575 * @since bbPress (r2599)
576 *
577 * @uses do_action() Calls 'bbp_load_textdomain'
578 */
579 function bbp_load_textdomain() {
580 do_action( 'bbp_load_textdomain' );
581 }
582
583 /**
584 * Sets up the theme directory
585 *
586 * @since bbPress (r2507)
587 *
588 * @uses do_action() Calls 'bbp_register_theme_directory'
589 */
590 function bbp_register_theme_directory() {
591 do_action( 'bbp_register_theme_directory' );
592 }
593
594 /**
595 * Setup the post types
596 *
597 * @since bbPress (r2464)
598 *
599 * @uses do_action() Calls 'bbp_register_post_type'
600 */
601 function bbp_register_post_types() {
602 do_action ( 'bbp_register_post_types' );
603 }
604
605 /**
606 * Setup the post statuses
607 *
608 * @since bbPress (r2727)
609 *
610 * @uses do_action() Calls 'bbp_register_post_statuses'
611 */
612 function bbp_register_post_statuses() {
613 do_action ( 'bbp_register_post_statuses' );
614 }
615
616 /**
617 * Register the built in bbPress taxonomies
618 *
619 * @since bbPress (r2464)
620 *
621 * @uses do_action() Calls 'bbp_register_taxonomies'
622 */
623 function bbp_register_taxonomies() {
624 do_action ( 'bbp_register_taxonomies' );
625 }
626
627 /**
628 * Register the default bbPress views
629 *
630 * @since bbPress (r2789)
631 *
632 * @uses do_action() Calls 'bbp_register_views'
633 */
634 function bbp_register_views() {
635 do_action ( 'bbp_register_views' );
636 }
637
638 /**
639 * Enqueue bbPress specific CSS and JS
640 *
641 * @since bbPress (r3373)
642 *
643 * @uses do_action() Calls 'bbp_enqueue_scripts'
644 */
645 function bbp_enqueue_scripts() {
646 do_action ( 'bbp_enqueue_scripts' );
647 }
648
649 /**
650 * Add the bbPress-specific rewrite tags
651 *
652 * @since bbPress (r2753)
653 *
654 * @uses do_action() Calls 'bbp_add_rewrite_tags'
655 */
656 function bbp_add_rewrite_tags() {
657 do_action ( 'bbp_add_rewrite_tags' );
658 }
659
660 /**
661 * Generate bbPress-specific rewrite rules
662 *
663 * @since bbPress (r2688)
664 *
665 * @param WP_Rewrite $wp_rewrite
666 *
667 * @uses do_action() Calls 'bbp_generate_rewrite_rules' with {@link WP_Rewrite}
668 */
669 function bbp_generate_rewrite_rules( $wp_rewrite ) {
670 do_action_ref_array( 'bbp_generate_rewrite_rules', array( &$wp_rewrite ) );
671 }
672
673 /** Final Action **************************************************************/
674
675 /**
676 * bbPress has loaded and initialized everything, and is okay to go
677 *
678 * @since bbPress (r2618)
679 *
680 * @uses do_action() Calls 'bbp_ready'
681 */
682 function bbp_ready() {
683 do_action( 'bbp_ready' );
684 }
685
686 /** Theme Compatibility Filter ************************************************/
687
688 /**
689 * The main filter used for theme compatibility and displaying custom bbPress
690 * theme files.
691 *
692 * @since bbPress (r3311)
693 *
694 * @uses apply_filters()
695 *
696 * @param string $template
697 * @return string Template file to use
698 */
699 function bbp_template_include( $template = '' ) {
700 return apply_filters( 'bbp_template_include', $template );
701 }
702
703 ?>
704