PluginProbe
bbPress / 2.2.2
bbPress v2.2.2
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 2.2.2 All 71 releases
bbpress / includes / core / sub-actions.php

sub-actions.php in bbPress 2.2.2, at includes/core/sub-actions.php

392 lines 8.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Plugin Dependency
5 *
6 * The purpose of the following hooks is to mimic the behavior of something
7 * called 'plugin dependency' which enables a plugin to have plugins of their
8 * own in a safe and reliable way.
9 *
10 * We do this in bbPress by mirroring existing WordPress hookss in many places
11 * allowing dependant plugins to hook into the bbPress specific ones, thus
12 * guaranteeing proper code execution only when bbPress is active.
13 *
14 * The following functions are wrappers for hookss, allowing them to be
15 * manually called and/or piggy-backed on top of other hooks if needed.
16 *
17 * @todo use anonymous functions when PHP minimun requirement allows (5.3)
18 */
19
20 /** Activation Actions ********************************************************/
21
22 /**
23 * Runs on bbPress activation
24 *
25 * @since bbPress (r2509)
26 * @uses register_uninstall_hook() To register our own uninstall hook
27 * @uses do_action() Calls 'bbp_activation' hook
28 */
29 function bbp_activation() {
30 do_action( 'bbp_activation' );
31 }
32
33 /**
34 * Runs on bbPress deactivation
35 *
36 * @since bbPress (r2509)
37 * @uses do_action() Calls 'bbp_deactivation' hook
38 */
39 function bbp_deactivation() {
40 do_action( 'bbp_deactivation' );
41 }
42
43 /**
44 * Runs when uninstalling bbPress
45 *
46 * @since bbPress (r2509)
47 * @uses do_action() Calls 'bbp_uninstall' hook
48 */
49 function bbp_uninstall() {
50 do_action( 'bbp_uninstall' );
51 }
52
53 /** Main Actions **************************************************************/
54
55 /**
56 * Main action responsible for constants, globals, and includes
57 *
58 * @since bbPress (r2599)
59 * @uses do_action() Calls 'bbp_loaded'
60 */
61 function bbp_loaded() {
62 do_action( 'bbp_loaded' );
63 }
64
65 /**
66 * Setup constants
67 *
68 * @since bbPress (r2599)
69 * @uses do_action() Calls 'bbp_constants'
70 */
71 function bbp_constants() {
72 do_action( 'bbp_constants' );
73 }
74
75 /**
76 * Setup globals BEFORE includes
77 *
78 * @since bbPress (r2599)
79 * @uses do_action() Calls 'bbp_boot_strap_globals'
80 */
81 function bbp_boot_strap_globals() {
82 do_action( 'bbp_boot_strap_globals' );
83 }
84
85 /**
86 * Include files
87 *
88 * @since bbPress (r2599)
89 * @uses do_action() Calls 'bbp_includes'
90 */
91 function bbp_includes() {
92 do_action( 'bbp_includes' );
93 }
94
95 /**
96 * Setup globals AFTER includes
97 *
98 * @since bbPress (r2599)
99 * @uses do_action() Calls 'bbp_setup_globals'
100 */
101 function bbp_setup_globals() {
102 do_action( 'bbp_setup_globals' );
103 }
104
105 /**
106 * Register any objects before anything is initialized
107 *
108 * @since bbPress (r4180)
109 * @uses do_action() Calls 'bbp_register'
110 */
111 function bbp_register() {
112 do_action( 'bbp_register' );
113 }
114
115 /**
116 * Initialize any code after everything has been loaded
117 *
118 * @since bbPress (r2599)
119 * @uses do_action() Calls 'bbp_init'
120 */
121 function bbp_init() {
122 do_action( 'bbp_init' );
123 }
124
125 /**
126 * Initialize widgets
127 *
128 * @since bbPress (r3389)
129 * @uses do_action() Calls 'bbp_widgets_init'
130 */
131 function bbp_widgets_init() {
132 do_action( 'bbp_widgets_init' );
133 }
134
135 /**
136 * Setup the currently logged-in user
137 *
138 * @since bbPress (r2695)
139 * @uses do_action() Calls 'bbp_setup_current_user'
140 */
141 function bbp_setup_current_user() {
142 do_action( 'bbp_setup_current_user' );
143 }
144
145 /** Supplemental Actions ******************************************************/
146
147 /**
148 * Load translations for current language
149 *
150 * @since bbPress (r2599)
151 * @uses do_action() Calls 'bbp_load_textdomain'
152 */
153 function bbp_load_textdomain() {
154 do_action( 'bbp_load_textdomain' );
155 }
156
157 /**
158 * Setup the post types
159 *
160 * @since bbPress (r2464)
161 * @uses do_action() Calls 'bbp_register_post_type'
162 */
163 function bbp_register_post_types() {
164 do_action( 'bbp_register_post_types' );
165 }
166
167 /**
168 * Setup the post statuses
169 *
170 * @since bbPress (r2727)
171 * @uses do_action() Calls 'bbp_register_post_statuses'
172 */
173 function bbp_register_post_statuses() {
174 do_action( 'bbp_register_post_statuses' );
175 }
176
177 /**
178 * Register the built in bbPress taxonomies
179 *
180 * @since bbPress (r2464)
181 * @uses do_action() Calls 'bbp_register_taxonomies'
182 */
183 function bbp_register_taxonomies() {
184 do_action( 'bbp_register_taxonomies' );
185 }
186
187 /**
188 * Register the default bbPress views
189 *
190 * @since bbPress (r2789)
191 * @uses do_action() Calls 'bbp_register_views'
192 */
193 function bbp_register_views() {
194 do_action( 'bbp_register_views' );
195 }
196
197 /**
198 * Register the default bbPress shortcodes
199 *
200 * @since bbPress (r4211)
201 * @uses do_action() Calls 'bbp_register_shortcodes'
202 */
203 function bbp_register_shortcodes() {
204 do_action( 'bbp_register_shortcodes' );
205 }
206
207 /**
208 * Enqueue bbPress specific CSS and JS
209 *
210 * @since bbPress (r3373)
211 * @uses do_action() Calls 'bbp_enqueue_scripts'
212 */
213 function bbp_enqueue_scripts() {
214 do_action( 'bbp_enqueue_scripts' );
215 }
216
217 /**
218 * Add the bbPress-specific rewrite tags
219 *
220 * @since bbPress (r2753)
221 * @uses do_action() Calls 'bbp_add_rewrite_tags'
222 */
223 function bbp_add_rewrite_tags() {
224 do_action( 'bbp_add_rewrite_tags' );
225 }
226
227 /**
228 * Add the bbPress-specific login forum action
229 *
230 * @since bbPress (r2753)
231 * @uses do_action() Calls 'bbp_login_form_login'
232 */
233 function bbp_login_form_login() {
234 do_action( 'bbp_login_form_login' );
235 }
236
237 /** User Actions **************************************************************/
238
239 /**
240 * The main action for hooking into when a user account is updated
241 *
242 * @since bbPress (r4304)
243 *
244 * @param int $user_id ID of user being edited
245 * @param array $old_user_data The old, unmodified user data
246 * @uses do_action() Calls 'bbp_profile_update'
247 */
248 function bbp_profile_update( $user_id = 0, $old_user_data = array() ) {
249 do_action( 'bbp_profile_update', $user_id, $old_user_data );
250 }
251
252 /**
253 * The main action for hooking into a user being registered
254 *
255 * @since bbPress (r4304)
256 * @param int $user_id ID of user being edited
257 * @uses do_action() Calls 'bbp_user_register'
258 */
259 function bbp_user_register( $user_id = 0 ) {
260 do_action( 'bbp_user_register', $user_id );
261 }
262
263 /** Final Action **************************************************************/
264
265 /**
266 * bbPress has loaded and initialized everything, and is okay to go
267 *
268 * @since bbPress (r2618)
269 * @uses do_action() Calls 'bbp_ready'
270 */
271 function bbp_ready() {
272 do_action( 'bbp_ready' );
273 }
274
275 /** Theme Permissions *********************************************************/
276
277 /**
278 * The main action used for redirecting bbPress theme actions that are not
279 * permitted by the current_user
280 *
281 * @since bbPress (r3605)
282 * @uses do_action()
283 */
284 function bbp_template_redirect() {
285 do_action( 'bbp_template_redirect' );
286 }
287
288 /** Theme Helpers *************************************************************/
289
290 /**
291 * The main action used for executing code before the theme has been setup
292 *
293 * @since bbPress (r3829)
294 * @uses do_action()
295 */
296 function bbp_register_theme_packages() {
297 do_action( 'bbp_register_theme_packages' );
298 }
299
300 /**
301 * The main action used for executing code before the theme has been setup
302 *
303 * @since bbPress (r3732)
304 * @uses do_action()
305 */
306 function bbp_setup_theme() {
307 do_action( 'bbp_setup_theme' );
308 }
309
310 /**
311 * The main action used for executing code after the theme has been setup
312 *
313 * @since bbPress (r3732)
314 * @uses do_action()
315 */
316 function bbp_after_setup_theme() {
317 do_action( 'bbp_after_setup_theme' );
318 }
319
320 /**
321 * Filter the plugin locale and domain.
322 *
323 * @since bbPress (r4213)
324 *
325 * @param string $locale
326 * @param string $domain
327 */
328 function bbp_plugin_locale( $locale = '', $domain = '' ) {
329 return apply_filters( 'bbp_plugin_locale', $locale, $domain );
330 }
331
332 /** Filters *******************************************************************/
333
334 /**
335 * Piggy back filter for WordPress's 'request' filter
336 *
337 * @since bbPress (r3758)
338 * @param array $query_vars
339 * @return array
340 */
341 function bbp_request( $query_vars = array() ) {
342 return apply_filters( 'bbp_request', $query_vars );
343 }
344
345 /**
346 * The main filter used for theme compatibility and displaying custom bbPress
347 * theme files.
348 *
349 * @since bbPress (r3311)
350 * @uses apply_filters()
351 * @param string $template
352 * @return string Template file to use
353 */
354 function bbp_template_include( $template = '' ) {
355 return apply_filters( 'bbp_template_include', $template );
356 }
357
358 /**
359 * Generate bbPress-specific rewrite rules
360 *
361 * @since bbPress (r2688)
362 * @param WP_Rewrite $wp_rewrite
363 * @uses do_action() Calls 'bbp_generate_rewrite_rules' with {@link WP_Rewrite}
364 */
365 function bbp_generate_rewrite_rules( $wp_rewrite ) {
366 do_action_ref_array( 'bbp_generate_rewrite_rules', array( &$wp_rewrite ) );
367 }
368
369 /**
370 * Filter the allowed themes list for bbPress specific themes
371 *
372 * @since bbPress (r2944)
373 * @uses apply_filters() Calls 'bbp_allowed_themes' with the allowed themes list
374 */
375 function bbp_allowed_themes( $themes ) {
376 return apply_filters( 'bbp_allowed_themes', $themes );
377 }
378
379 /**
380 * Maps forum/topic/reply caps to built in WordPress caps
381 *
382 * @since bbPress (r2593)
383 *
384 * @param array $caps Capabilities for meta capability
385 * @param string $cap Capability name
386 * @param int $user_id User id
387 * @param mixed $args Arguments
388 */
389 function bbp_map_meta_caps( $caps = array(), $cap = '', $user_id = 0, $args = array() ) {
390 return apply_filters( 'bbp_map_meta_caps', $caps, $cap, $user_id, $args );
391 }
392