Changeset 7446
- Timestamp:
- 10/19/2013 06:41:17 PM (11 years ago)
- Location:
- trunk/bp-core
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-cssjs.php
r7298 r7446 1 1 <?php 2 2 /** 3 * Core component CSS & JS 3 * Core component CSS & JS. 4 4 * 5 5 * @package BuddyPress … … 10 10 if ( !defined( 'ABSPATH' ) ) exit; 11 11 12 /** 13 * Load the JS for "Are you sure?" .confirm links. 14 */ 12 15 function bp_core_confirmation_js() { 13 16 … … 36 39 37 40 /** 38 * bp_core_add_jquery_cropper() 39 * 40 * Makes sure the jQuery jCrop library is loaded. 41 * 42 * @package BuddyPress Core 41 * Enqueues jCrop library and hooks BP's custom cropper JS. 43 42 */ 44 43 function bp_core_add_jquery_cropper() { … … 50 49 51 50 /** 52 * bp_core_add_cropper_inline_js() 53 * 54 * Adds the inline JS needed for the cropper to work on a per-page basis. 55 * 56 * @package BuddyPress Core 51 * Output the inline JS needed for the cropper to work on a per-page basis. 57 52 */ 58 53 function bp_core_add_cropper_inline_js() { … … 120 115 121 116 /** 122 * bp_core_add_cropper_inline_css() 123 * 124 * Adds the inline CSS needed for the cropper to work on a per-page basis. 117 * Output the inline CSS for the BP image cropper. 125 118 * 126 119 * @package BuddyPress Core … … 144 137 145 138 /** 146 * Adds AJAX target URL so themes can access the WordPress AJAX functionality.139 * Define the 'ajaxurl' JS variable, used by themes as an AJAX endpoint. 147 140 * 148 * @since BuddyPress (1.1 )141 * @since BuddyPress (1.1.0) 149 142 */ 150 143 function bp_core_add_ajax_url_js() { … … 158 151 159 152 /** 160 * Returns the proper value for BP's ajaxurl153 * Get the proper value for BP's ajaxurl. 161 154 * 162 155 * Designed to be sensitive to FORCE_SSL_ADMIN and non-standard multisite 163 156 * configurations. 164 157 * 165 * @since BuddyPress (1.7 )158 * @since BuddyPress (1.7.0) 166 159 * 167 * @return string 160 * @return string AJAX endpoint URL. 168 161 */ 169 162 function bp_core_ajax_url() { -
trunk/bp-core/bp-core-dependency.php
r7367 r7446 2 2 3 3 /** 4 * Plugin Dependency 4 * Plugin Dependency Action Hooks. 5 5 * 6 6 * The purpose of the following hooks is to mimic the behavior of something … … 8 8 * own in a safe and reliable way. 9 9 * 10 * We do this in BuddyPress by mirroring existing WordPress hooks sin many places10 * We do this in BuddyPress by mirroring existing WordPress hooks in many places 11 11 * allowing dependant plugins to hook into the BuddyPress specific ones, thus 12 12 * guaranteeing proper code execution only when BuddyPress is active. 13 13 * 14 * The following functions are wrappers for hooks s, allowing them to be14 * The following functions are wrappers for hooks, allowing them to be 15 15 * manually called and/or piggy-backed on top of other hooks if needed. 16 16 * … … 19 19 20 20 /** 21 * Include files on this action21 * Fire the 'bp_include' action, where plugins should include files. 22 22 */ 23 23 function bp_include() { … … 26 26 27 27 /** 28 * Include files on this action28 * Fire the 'bp_setup_components' action, where plugins should initialize components. 29 29 */ 30 30 function bp_setup_components() { … … 33 33 34 34 /** 35 * Setup global variables and objects35 * Fire the 'bp_setup_globals' action, where plugins should initialize global settings. 36 36 */ 37 37 function bp_setup_globals() { … … 40 40 41 41 /** 42 * Set navigation elements42 * Fire the 'bp_setup_nav' action, where plugins should register their navigation items. 43 43 */ 44 44 function bp_setup_nav() { … … 47 47 48 48 /** 49 * Set up BuddyPress implementation of the WP Toolbar49 * Fire the 'bp_setup_admin_bar' action, where plugins should add items to the WP admin bar. 50 50 */ 51 51 function bp_setup_admin_bar() { … … 55 55 56 56 /** 57 * Set the page title57 * Fire the 'bp_setup_title' action, where plugins should modify the page title. 58 58 */ 59 59 function bp_setup_title() { … … 62 62 63 63 /** 64 * Register widgets64 * Fire the 'bp_register_widgets' action, where plugins should register widgets. 65 65 */ 66 66 function bp_setup_widgets() { … … 69 69 70 70 /** 71 * Set up the currently logged-in user72 * 73 * @uses did_action() To make sure the user isn't loaded out of order 74 * @uses do_action() Calls 'bp_setup_current_user' 71 * Set up the currently logged-in user. 72 * 73 * @uses did_action() To make sure the user isn't loaded out of order. 74 * @uses do_action() Calls 'bp_setup_current_user'. 75 75 */ 76 76 function bp_setup_current_user() { … … 86 86 87 87 /** 88 * Initlialize code88 * Fire the 'bp_init' action, BuddyPress's main initialization hook. 89 89 */ 90 90 function bp_init() { … … 93 93 94 94 /** 95 * Attached to plugins_loaded 95 * Fire the 'bp_loaded' action, which fires after BP's core plugin files have been loaded. 96 * 97 * Attached to 'plugins_loaded'. 96 98 */ 97 99 function bp_loaded() { … … 100 102 101 103 /** 102 * Attached to wp 104 * Fire the 'bp_ready' action, which runs after BP is set up and the page is about to render. 105 * 106 * Attached to 'wp'. 103 107 */ 104 108 function bp_ready() { … … 107 111 108 112 /** 109 * Attach potential template actions 113 * Fire the 'bp_actions' action, which runs just before rendering. 114 * 115 * Attach potential template actions, such as catching form requests or routing 116 * custom URLs. 110 117 */ 111 118 function bp_actions() { … … 114 121 115 122 /** 116 * Attach potential template screens 123 * Fire the 'bp_screens' action, which runs just before rendering. 124 * 125 * Runs just after 'bp_actions'. Use this hook to attach your template 126 * loaders. 117 127 */ 118 128 function bp_screens() { … … 121 131 122 132 /** 123 * Initialize widgets 133 * Fire 'bp_widgets_init', which runs after widgets have been set up. 134 * 135 * Hooked to 'widgets_init'. 124 136 */ 125 137 function bp_widgets_init() { … … 128 140 129 141 /** 130 * BuddyPress head scripts 142 * Fire 'bp_head', which is used to hook scripts and styles in the <head>. 143 * 144 * Hooked to 'wp_head'. 131 145 */ 132 146 function bp_head() { … … 137 151 138 152 /** 139 * The main action used for redirecting BuddyPress theme actions that are not 140 * permitted by the current_user 141 * 142 * @since BuddyPress (1.6) 153 * Fire the 'bp_template_redirect' action. 154 * 155 * Run at 'template_redirect', just before WordPress selects and loads a theme 156 * template. The main purpose of this hook in BuddyPress is to redirect users 157 * who do not have the proper permission to access certain content. 158 * 159 * @since BuddyPress (1.6.0) 143 160 * 144 161 * @uses do_action() … … 151 168 152 169 /** 153 * The main action used registering theme directory 154 * 155 * @since BuddyPress (1.5) 170 * Fire the 'bp_register_theme_directory' action. 171 * 172 * The main action used registering theme directories. 173 * 174 * @since BuddyPress (1.5.0) 175 * 156 176 * @uses do_action() 157 177 */ … … 161 181 162 182 /** 163 * The main action used registering theme packages 164 * 165 * @since BuddyPress (1.7) 183 * Fire the 'bp_register_theme_packages' action. 184 * 185 * The main action used registering theme packages. 186 * 187 * @since BuddyPress (1.7.0) 188 * 166 189 * @uses do_action() 167 190 */ … … 171 194 172 195 /** 173 * Enqueue BuddyPress specific CSS and JS174 * 175 * @since BuddyPress (1.6 )176 * 177 * @uses do_action() Calls 'bp_enqueue_scripts' 196 * Fire the 'bp_enqueue_scripts' action, where BP enqueues its CSS and JS. 197 * 198 * @since BuddyPress (1.6.0) 199 * 200 * @uses do_action() Calls 'bp_enqueue_scripts'. 178 201 */ 179 202 function bp_enqueue_scripts() { … … 182 205 183 206 /** 184 * Add the BuddyPress-specific rewrite tags 185 * 186 * @since BuddyPress (1.8) 187 * @uses do_action() Calls 'bp_add_rewrite_tags' 207 * Fire the 'bp_add_rewrite_tag' action, where BP adds its custom rewrite tags. 208 * 209 * @since BuddyPress (1.8.0) 210 * 211 * @uses do_action() Calls 'bp_add_rewrite_tags'. 188 212 */ 189 213 function bp_add_rewrite_tags() { … … 192 216 193 217 /** 194 * Add the BuddyPress-specific rewrite rules 195 * 196 * @since BuddyPress (1.9) 197 * @uses do_action() Calls 'bp_add_rewrite_rules' 218 * Fire the 'bp_add_rewrite_rules' action, where BP adds its custom rewrite rules. 219 * 220 * @since BuddyPress (1.9.0) 221 * 222 * @uses do_action() Calls 'bp_add_rewrite_rules'. 198 223 */ 199 224 function bp_add_rewrite_rules() { … … 202 227 203 228 /** 204 * Add the BuddyPress-specific permalink structures 205 * 206 * @since BuddyPress (1.9) 207 * @uses do_action() Calls 'bp_add_permastructs' 229 * Fire the 'bp_add_permastructs' action, where BP adds its BP-specific permalink structure. 230 * 231 * @since BuddyPress (1.9.0) 232 * 233 * @uses do_action() Calls 'bp_add_permastructs'. 208 234 */ 209 235 function bp_add_permastructs() { … … 212 238 213 239 /** 214 * Piggy back action for BuddyPress sepecific theme actions before the theme has 215 * been setup and the theme's functions.php has loaded. 216 * 217 * @since BuddyPress (1.6) 218 * 219 * @uses do_action() Calls 'bp_setup_theme' 240 * Fire the 'bp_setup_theme' action. 241 * 242 * The main purpose of 'bp_setup_theme' is give themes a place to load their 243 * BuddyPress-specific functionality. 244 * 245 * @since BuddyPress (1.6.0) 246 * 247 * @uses do_action() Calls 'bp_setup_theme'. 220 248 */ 221 249 function bp_setup_theme() { … … 224 252 225 253 /** 226 * Piggy back action for BuddyPress sepecific theme actions once the theme has 227 * been setup and the theme's functions.php has loaded. 254 * Fire the 'bp_after_setup_theme' action. 255 * 256 * Piggy-back action for BuddyPress-specific theme actions once the theme has 257 * been set up and the theme's functions.php has loaded. 228 258 * 229 259 * Hooked to 'after_setup_theme' with a priority of 100. This allows plenty of … … 231 261 * before our theme compatibility layer kicks in. 232 262 * 233 * @since BuddyPress (1.6 )234 * 235 * @uses do_action() Calls 'bp_after_setup_theme' 263 * @since BuddyPress (1.6.0) 264 * 265 * @uses do_action() Calls 'bp_after_setup_theme'. 236 266 */ 237 267 function bp_after_setup_theme() { … … 242 272 243 273 /** 244 * Piggy back filter for WordPress's 'request' filter 245 * 246 * @since BuddyPress (1.7) 247 * @param array $query_vars 248 * @return array 274 * Fire the 'bp_request' filter, a piggy-back of WP's 'request'. 275 * 276 * @since BuddyPress (1.7.0) 277 * 278 * @see WP::parse_request() for a description of parameters. 279 * 280 * @param array $query_vars See {@link WP::parse_request()}. 281 * @return array $query_vars See {@link WP::parse_request()}. 249 282 */ 250 283 function bp_request( $query_vars = array() ) { … … 253 286 254 287 /** 255 * Piggy back filter to handle login redirects.256 * 257 * @since BuddyPress (1.7 )258 * 259 * @param string $redirect_to 260 * @param string $redirect_to_raw 261 * @param string $user 288 * Fire the 'bp_login_redirect' filter, a piggy-back of WP's 'login_redirect'. 289 * 290 * @since BuddyPress (1.7.0) 291 * 292 * @param string $redirect_to See 'login_redirect'. 293 * @param string $redirect_to_raw See 'login_redirect'. 294 * @param string $user See 'login_redirect'. 262 295 */ 263 296 function bp_login_redirect( $redirect_to = '', $redirect_to_raw = '', $user = false ) { … … 266 299 267 300 /** 268 * The main filter used for theme compatibility and displaying custom BuddyPress 269 * theme files. 270 * 271 * @since BuddyPress (1.6) 301 * Fire 'bp_template_include', main filter used for theme compatibility and displaying custom BP theme files. 302 * 303 * Hooked to 'template_include'. 304 * 305 * @since BuddyPress (1.6.0) 272 306 * 273 307 * @uses apply_filters() 274 308 * 275 * @param string $template 276 * @return string Template file to use 309 * @param string $template See 'template_include'. 310 * @return string Template file to use. 277 311 */ 278 312 function bp_template_include( $template = '' ) { … … 281 315 282 316 /** 283 * Generate BuddyPress-specific rewrite rules 284 * 285 * @since BuddyPress (1.7) 286 * @param WP_Rewrite $wp_rewrite 287 * @uses do_action() Calls 'bp_generate_rewrite_rules' with {@link WP_Rewrite} 317 * Fire the 'bp_generate_rewrite_rules' filter, where BP generates its rewrite rules. 318 * 319 * @since BuddyPress (1.7.0) 320 * 321 * @uses do_action() Calls 'bp_generate_rewrite_rules' with {@link WP_Rewrite}. 322 * 323 * @param WP_Rewrite $wp_rewrite See 'generate_rewrite_rules'. 288 324 */ 289 325 function bp_generate_rewrite_rules( $wp_rewrite ) { … … 292 328 293 329 /** 294 * Filter the allowed themes list for BuddyPress specific themes 295 * 296 * @since BuddyPress (1.7) 297 * @uses apply_filters() Calls 'bp_allowed_themes' with the allowed themes list 330 * Fire the 'bp_allowed_themes' filter. 331 * 332 * Filter the allowed themes list for BuddyPress-specific themes. 333 * 334 * @since BuddyPress (1.7.0) 335 * 336 * @uses apply_filters() Calls 'bp_allowed_themes' with the allowed themes list. 298 337 */ 299 338 function bp_allowed_themes( $themes ) { -
trunk/bp-core/bp-core-filters.php
r7427 r7446 2 2 3 3 /** 4 * BuddyPress Filters 5 * 6 * This file contains the filters that are used through -out BuddyPress. They are4 * BuddyPress Filters. 5 * 6 * This file contains the filters that are used throughout BuddyPress. They are 7 7 * consolidated here to make searching for them easier, and to help developers 8 8 * understand at a glance the order in which things occur. 9 9 * 10 * There are a few common places that additional filters can currently be found 10 * There are a few common places that additional filters can currently be found. 11 11 * 12 12 * - BuddyPress: In {@link BuddyPress::setup_actions()} in buddypress.php … … 25 25 26 26 /** 27 * Attach BuddyPress to WordPress 27 * Attach BuddyPress to WordPress. 28 28 * 29 29 * BuddyPress uses its own internal actions to help aid in third-party plugin … … 54 54 55 55 /** 56 * Template Compatibility 56 * Template Compatibility. 57 57 * 58 58 * If you want to completely bypass this and manage your own custom BuddyPress … … 70 70 71 71 /** 72 * bp_core_exclude_pages() 73 * 74 * Excludes specific pages from showing on page listings, for example the "Activation" page. 75 * 76 * @package BuddyPress Core 72 * Prevent specific pages (eg 'Activate') from showing on page listings. 73 * 77 74 * @uses bp_is_active() checks if a BuddyPress component is active. 78 * @return array The list of page ID's to exclude 75 * 76 * @param array $pages List of excluded page IDs, as passed to the 77 * 'wp_list_pages_excludes' filter. 78 * @return array The exclude list, with BP's pages added. 79 79 */ 80 80 function bp_core_exclude_pages( $pages = array() ) { … … 100 100 101 101 /** 102 * bp_core_email_from_name_filter() 103 * 104 * Sets the "From" name in emails sent to the name of the site and not "WordPress" 105 * 106 * @package BuddyPress Core 107 * @uses bp_get_option() fetches the value for a meta_key in the wp_X_options table 108 * @return string The blog name for the root blog 102 * Set "From" name in outgoing email to the site name. 103 * 104 * @uses bp_get_option() fetches the value for a meta_key in the wp_X_options table. 105 * 106 * @return string The blog name for the root blog. 109 107 */ 110 108 function bp_core_email_from_name_filter() { … … 114 112 115 113 /** 116 * bp_core_filter_comments()117 *118 114 * Filter the blog post comments array and insert BuddyPress URLs for users. 119 115 * 120 * @package BuddyPress Core 116 * @param array $comments The array of comments supplied to the comments template. 117 * @param int $post->ID The post ID. 118 * @return array $comments The modified comment array. 121 119 */ 122 120 function bp_core_filter_comments( $comments, $post_id ) { … … 151 149 152 150 /** 153 * When a user logs in, redirect him in a logical way 154 * 155 * @ package BuddyPress Core156 * 157 * @uses apply_filters Filter bp_core_login_redirect to modify where users are redirected to on158 * login159 * @param string $redirect_to The URL to be redirected to, sanitized in wp-login.php151 * When a user logs in, redirect him in a logical way. 152 * 153 * @uses apply_filters() Filter 'bp_core_login_redirect' to modify where users 154 * are redirected to on login. 155 * 156 * @param string $redirect_to The URL to be redirected to, sanitized 157 * in wp-login.php. 160 158 * @param string $redirect_to_raw The unsanitized redirect_to URL ($_REQUEST['redirect_to']) 161 * @param WP_User $user The WP_User object corresponding to a successfully logged-in user. Otherwise162 * a WP_Error object163 * @return string The redirect URL 159 * @param WP_User $user The WP_User object corresponding to a successfully 160 * logged-in user. Otherwise a WP_Error object. 161 * @return string The redirect URL. 164 162 */ 165 163 function bp_core_login_redirect( $redirect_to, $redirect_to_raw, $user ) { … … 196 194 add_filter( 'bp_login_redirect', 'bp_core_login_redirect', 10, 3 ); 197 195 198 /*** 199 * bp_core_filter_user_welcome_email() 200 * 201 * Replace the generated password in the welcome email. 202 * This will not filter when the site admin registers a user. 203 * 204 * @uses locate_template To see if custom registration files exist 205 * @param string $welcome_email Complete email passed through WordPress 206 * @return string Filtered $welcome_email with 'PASSWORD' replaced by [User Set] 196 /** 197 * Replace the generated password in the welcome email with '[User Set]'. 198 * 199 * On a standard BP installation, users who register themselves also set their 200 * own passwords. Therefore there is no need for the insecure practice of 201 * emailing the plaintext password to the user in the welcome email. 202 * 203 * This filter will not fire when a user is registered by the site admin. 204 * 205 * @param string $welcome_email Complete email passed through WordPress. 206 * @return string Filtered $welcome_email with the password replaced 207 * by '[User Set]'. 207 208 */ 208 209 function bp_core_filter_user_welcome_email( $welcome_email ) { … … 217 218 add_filter( 'update_welcome_user_email', 'bp_core_filter_user_welcome_email' ); 218 219 219 /*** 220 * bp_core_filter_blog_welcome_email() 221 * 222 * Replace the generated password in the welcome email. 223 * This will not filter when the site admin registers a user. 224 * 225 * @uses locate_template To see if custom registration files exist 226 * @param string $welcome_email Complete email passed through WordPress 227 * @param integer $blog_id ID of the blog user is joining 228 * @param integer $user_id ID of the user joining 229 * @param string $password Password of user 230 * @return string Filtered $welcome_email with $password replaced by [User Set] 220 /** 221 * Replace the generated password in the welcome email with '[User Set]'. 222 * 223 * On a standard BP installation, users who register themselves also set their 224 * own passwords. Therefore there is no need for the insecure practice of 225 * emailing the plaintext password to the user in the welcome email. 226 * 227 * This filter will not fire when a user is registered by the site admin. 228 * 229 * @param string $welcome_email Complete email passed through WordPress. 230 * @param int $blog_id ID of the blog user is joining. 231 * @param int $user_id ID of the user joining. 232 * @param string $password Password of user. 233 * @return string Filtered $welcome_email with $password replaced by '[User Set]'. 231 234 */ 232 235 function bp_core_filter_blog_welcome_email( $welcome_email, $blog_id, $user_id, $password ) { … … 241 244 add_filter( 'update_welcome_email', 'bp_core_filter_blog_welcome_email', 10, 4 ); 242 245 243 // Notify user of signup success. 246 /** 247 * Notify new users of a successful registration (with blog). 248 * 249 * This function filter's WP's 'wpmu_signup_blog_notification', and replaces 250 * WP's default welcome email with a BuddyPress-specific message. 251 * 252 * @see wpmu_signup_blog_notification() for a description of parameters. 253 * 254 * @param string $domain The new blog domain. 255 * @param string $path The new blog path. 256 * @param string $title The site title. 257 * @param string $user The user's login name. 258 * @param string $user_email The user's email address. 259 * @param string $key The activation key created in wpmu_signup_blog() 260 * @param array $meta By default, contains the requested privacy setting and 261 * lang_id. 262 * @return bool True on success, false on failure. 263 */ 244 264 function bp_core_activation_signup_blog_notification( $domain, $path, $title, $user, $user_email, $key, $meta ) { 245 265 … … 272 292 add_filter( 'wpmu_signup_blog_notification', 'bp_core_activation_signup_blog_notification', 1, 7 ); 273 293 294 /** 295 * Notify new users of a successful registration (without blog). 296 * 297 * @see wpmu_signup_user_notification() for a full description of params. 298 * 299 * @param string $user The user's login name. 300 * @param string $user_email The user's email address. 301 * @param string $key The activation key created in wpmu_signup_user() 302 * @param array $meta By default, an empty array. 303 * @return bool True on success, false on failure. 304 */ 274 305 function bp_core_activation_signup_user_notification( $user, $user_email, $key, $meta ) { 275 306 … … 301 332 302 333 /** 303 * Filter the page title for BuddyPress pages 304 * 305 * @global object $bp BuddyPress global settings 306 * @param string $title Original page title 334 * Filter the page title for BuddyPress pages. 335 * 336 * @since BuddyPress (1.5.0) 337 * 338 * @see wp_title() 339 * @global object $bp BuddyPress global settings. 340 * 341 * @param string $title Original page title. 307 342 * @param string $sep How to separate the various items within the page title. 308 * @param string $seplocation Direction to display title 309 * @return string new page title 310 * @see wp_title() 311 * @since BuddyPress (1.5) 343 * @param string $seplocation Direction to display title. 344 * @return string New page title. 312 345 */ 313 346 function bp_modify_page_title( $title, $sep, $seplocation ) {
Note: See TracChangeset
for help on using the changeset viewer.