Changeset 7451
- Timestamp:
- 10/20/2013 07:21:38 PM (11 years ago)
- Location:
- trunk/bp-core
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-loader.php
r7347 r7451 2 2 3 3 /** 4 * BuddyPress Core Loader 5 * 6 * Core contains the commonly used functions, classes, and API 's4 * BuddyPress Core Loader. 5 * 6 * Core contains the commonly used functions, classes, and APIs. 7 7 * 8 8 * @package BuddyPress … … 16 16 17 17 /** 18 * Start the members component creation process 19 * 20 * @since BuddyPress (1.5 )18 * Start the members component creation process. 19 * 20 * @since BuddyPress (1.5.0) 21 21 * 22 22 * @uses BP_Core::bootstrap() … … 33 33 34 34 /** 35 * Populate the global data needed before BuddyPress can continue 35 * Populate the global data needed before BuddyPress can continue. 36 36 * 37 37 * This involves figuring out the currently required, active, deactive, 38 38 * and optional components. 39 39 * 40 * @since BuddyPress (1.5 )40 * @since BuddyPress (1.5.0) 41 41 */ 42 42 private function bootstrap() { … … 109 109 } 110 110 111 /** 112 * Include bp-core files. 113 * 114 * @see BP_Component::includes() for description of parameters. 115 * 116 * @param array $includes See {@link BP_Component::includes()}. 117 */ 111 118 public function includes( $includes = array() ) { 112 119 … … 122 129 123 130 /** 131 * Set up bp-core global settings. 132 * 124 133 * Sets up a majority of the BuddyPress globals that require a minimal 125 134 * amount of processing, meaning they cannot be set in the BuddyPress class. 126 135 * 127 * @since BuddyPress (1.5) 136 * @since BuddyPress (1.5.0) 137 * 138 * @see BP_Component::setup_globals() for description of parameters. 139 * 140 * @param array $args See {@link BP_Component::setup_globals()}. 128 141 */ 129 142 public function setup_globals( $args = array() ) { … … 185 198 186 199 /** 187 * Setup BuddyBar navigation 188 * 189 * @since BuddyPress (1.5) 190 */ 191 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 200 * Set up component navigation. 201 * 202 * @since BuddyPress (1.5.0) 203 * 204 * @see BP_Component::setup_nav() for a description of arguments. 205 * 206 * @param array $main_nav Optional. See BP_Component::setup_nav() for 207 * description. 208 * @param array $sub_nav Optional. See BP_Component::setup_nav() for 209 * description. 210 */ 211 public function setup_nav( $main_nav = array(), $sub_nav = array() ) { 192 212 $bp = buddypress(); 193 213 … … 228 248 229 249 /** 230 * Set up the BuddyPress Core component231 * 232 * @since BuddyPress (1.6 )233 * 234 * @global BuddyPress $bp 250 * Set up the BuddyPress Core component. 251 * 252 * @since BuddyPress (1.6.0) 253 * 254 * @global BuddyPress $bp BuddyPress global settings object. 235 255 */ 236 256 function bp_setup_core() { -
trunk/bp-core/bp-core-moderation.php
r6342 r7451 1 1 <?php 2 2 /** 3 * BuddyPress Moderation Functions 3 * BuddyPress Moderation Functions. 4 4 * 5 5 * @package BuddyPress 6 6 * @subpackage Core 7 * @since BuddyPress (1.6 )7 * @since BuddyPress (1.6.0) 8 8 */ 9 9 … … 14 14 15 15 /** 16 * Check for flooding 16 * Check for flooding. 17 17 * 18 18 * Check to make sure that a user is not making too many posts in a short amount 19 19 * of time. 20 20 * 21 * @param int $user_id User id to check for flood 22 * @return bool True if there is no flooding, true if there is 23 * @since BuddyPress (1.6) 24 * @uses current_user_can() To check if the current user can throttle 25 * @uses bp_get_option() To get the throttle time 26 * @uses get_transient() To get the last posted transient of the ip 27 * @uses get_user_meta() To get the last posted meta of the user 21 * @since BuddyPress (1.6.0) 22 * 23 * @uses current_user_can() To check if the current user can throttle. 24 * @uses bp_get_option() To get the throttle time. 25 * @uses get_transient() To get the last posted transient of the ip. 26 * @uses get_user_meta() To get the last posted meta of the user. 27 * 28 * @param int $user_id User id to check for flood. 29 * @return bool True if there is no flooding, false if there is. 28 30 */ 29 31 function bp_core_check_for_flood( $user_id = 0 ) { … … 45 47 46 48 /** 47 * Check for moderation keys and too many links 48 * 49 * @param int $user_id Topic or reply author ID 50 * @param string $title The title of the content 51 * @param string $content The content being posted 52 * @return bool True if test is passed, false if fail 53 * @since BuddyPress (1.6) 54 * @uses bp_current_author_ip() To get current user IP address 55 * @uses bp_current_author_ua() To get current user agent 56 * @uses bp_current_user_can() Allow super admins to bypass blacklist 49 * Check for moderation keys and too many links. 50 * 51 * @since BuddyPress (1.6.0) 52 * 53 * @uses bp_current_author_ip() To get current user IP address. 54 * @uses bp_current_author_ua() To get current user agent. 55 * @uses bp_current_user_can() Allow super admins to bypass blacklist. 56 * 57 * @param int $user_id Topic or reply author ID. 58 * @param string $title The title of the content. 59 * @param string $content The content being posted. 60 * @return bool True if test is passed, false if fail. 57 61 */ 58 62 function bp_core_check_for_moderation( $user_id = 0, $title = '', $content = '' ) { … … 151 155 152 156 /** 153 * Checks for blocked keys 154 * 155 * @param int $user_id Topic or reply author ID 156 * @param string $title The title of the content 157 * @param string $content The content being posted 158 * @return bool True if test is passed, false if fail 159 * @uses bp_current_author_ip() To get current user IP address 160 * @uses bp_current_author_ua() To get current user agent 161 * @uses bp_current_user_can() Allow super admins to bypass blacklist 162 * @since BuddyPress (1.6) 157 * Check for blocked keys. 158 * 159 * @since BuddyPress (1.6.0) 160 * 161 * @uses bp_current_author_ip() To get current user IP address. 162 * @uses bp_current_author_ua() To get current user agent. 163 * @uses bp_current_user_can() Allow super admins to bypass blacklist. 164 * 165 * @param int $user_id Topic or reply author ID. 166 * @param string $title The title of the content. 167 * @param string $content The content being posted. 168 * @return bool True if test is passed, false if fail. 163 169 */ 164 170 function bp_core_check_for_blacklist( $user_id = 0, $title = '', $content = '' ) { … … 239 245 240 246 /** 241 * Get the current-user IP address 242 * 243 * @return string 244 * @since BuddyPress (1.6) 247 * Get the current user's IP address. 248 * 249 * @since BuddyPress (1.6.0) 250 * 251 * @return string IP address. 245 252 */ 246 253 function bp_core_current_user_ip() { … … 251 258 252 259 /** 253 * Get the current-user user-agent 254 * 255 * @return string 256 * @since BuddyPress (1.6) 260 * Get the current user's user-agent. 261 * 262 * @since BuddyPress (1.6.0) 263 * 264 * @return string User agent string. 257 265 */ 258 266 function bp_core_current_user_ua() { -
trunk/bp-core/bp-core-options.php
r7228 r7451 2 2 3 3 /** 4 * BuddyPress Options 4 * BuddyPress Options. 5 5 * 6 6 * @package BuddyPress … … 12 12 13 13 /** 14 * Get the default site options and their values 15 * 16 * @since BuddyPress (1.6 )17 * 18 * @return array Filtered option names and values 14 * Get the default site options and their values. 15 * 16 * @since BuddyPress (1.6.0) 17 * 18 * @return array Filtered option names and values. 19 19 */ 20 20 function bp_get_default_options() { … … 87 87 88 88 /** 89 * Add default options 89 * Add default options when BuddyPress is first activated. 90 90 * 91 91 * Hooked to bp_activate, it is only called once when BuddyPress is activated. 92 92 * This is non-destructive, so existing settings will not be overridden. 93 93 * 94 * @since BuddyPress (1.6) 95 * 96 * @uses bp_get_default_options() To get default options 97 * @uses add_option() Adds default options 98 * @uses do_action() Calls 'bp_add_options' 94 * Currently unused. 95 * 96 * @since BuddyPress (1.6.0) 97 * 98 * @uses bp_get_default_options() To get default options. 99 * @uses add_option() Adds default options. 100 * @uses do_action() Calls 'bp_add_options'. 99 101 */ 100 102 function bp_add_options() { … … 112 114 113 115 /** 114 * Delete default options 116 * Delete default options. 115 117 * 116 118 * Hooked to bp_uninstall, it is only called once when BuddyPress is uninstalled. 117 119 * This is destructive, so existing settings will be destroyed. 118 120 * 119 * @since BuddyPress (1.6) 120 * 121 * @uses bp_get_default_options() To get default options 122 * @uses delete_option() Removes default options 123 * @uses do_action() Calls 'bp_delete_options' 121 * Currently unused. 122 * 123 * @since BuddyPress (1.6.0) 124 * 125 * @uses bp_get_default_options() To get default options. 126 * @uses delete_option() Removes default options. 127 * @uses do_action() Calls 'bp_delete_options'. 124 128 */ 125 129 function bp_delete_options() { … … 137 141 138 142 /** 139 * Add filters to each BuddyPress option and allow them to be overloaded from 140 * inside the $bp->options array. 141 * 142 * @since BuddyPress (1.6) 143 * 144 * @uses bp_get_default_options() To get default options 145 * @uses add_filter() To add filters to 'pre_option_{$key}' 146 * @uses do_action() Calls 'bp_add_option_filters' 143 * Add filters to each BP option, allowing them to be overloaded from inside the $bp->options array. 144 * 145 * Currently unused. 146 * 147 * @since BuddyPress (1.6.0) 148 * 149 * @uses bp_get_default_options() To get default options. 150 * @uses add_filter() To add filters to 'pre_option_{$key}'. 151 * @uses do_action() Calls 'bp_add_option_filters'. 147 152 */ 148 153 function bp_setup_option_filters() { … … 160 165 161 166 /** 162 * Filter default options and allow them to be overloaded from inside the 163 * $bp->options array. 167 * Filter default options and allow them to be overloaded from inside the $bp->options array. 168 * 169 * Currently unused. 164 170 * 165 171 * @since BuddyPress (1.6) … … 187 193 188 194 /** 189 * Retrieve an option 190 * 191 * This is a wrapper for get_blog_option(), which in turn stores settings data (such as bp-pages)192 * on the appropriate blog, given your current setup.195 * Retrieve an option. 196 * 197 * This is a wrapper for {@link get_blog_option()}, which in turn stores settings data 198 * (such as bp-pages) on the appropriate blog, given your current setup. 193 199 * 194 200 * The 'bp_get_option' filter is primarily for backward-compatibility. 195 201 * 196 * @package BuddyPress 197 * @since BuddyPress (1.5) 202 * @since BuddyPress (1.5.0) 198 203 * 199 204 * @uses bp_get_root_blog_id() 200 * @param string $option_name The option to be retrieved 201 * @param string $default Optional. Default value to be returned if the option isn't set 202 * @return mixed The value for the option 205 * 206 * @param string $option_name The option to be retrieved. 207 * @param string $default Optional. Default value to be returned if the option 208 * isn't set. See {@link get_blog_option()}. 209 * @return mixed The value for the option. 203 210 */ 204 211 function bp_get_option( $option_name, $default = '' ) { … … 209 216 210 217 /** 211 * Save an option 212 * 213 * This is a wrapper for update_blog_option(), which in turn stores settings data (such as bp-pages)214 * on the appropriate blog, given your current setup.215 * 216 * @package BuddyPress217 * @since BuddyPress (1.5 )218 * Save an option. 219 * 220 * This is a wrapper for {@link update_blog_option()}, which in turn stores 221 * settings data (such as bp-pages) on the appropriate blog, given your current 222 * setup. 223 * 224 * @since BuddyPress (1.5.0) 218 225 * 219 226 * @uses bp_get_root_blog_id() 220 * @param string $option_name The option key to be set 221 * @param string $value The value to be set 227 * 228 * @param string $option_name The option key to be set. 229 * @param string $value The value to be set. 222 230 */ 223 231 function bp_update_option( $option_name, $value ) { … … 226 234 227 235 /** 228 * Delete an option 229 * 230 * This is a wrapper for delete_blog_option(), which in turn deletes settings data (such as231 * bp-pages) on the appropriate blog, given your current setup.232 * 233 * @package BuddyPress234 * @since BuddyPress (1.5 )236 * Delete an option. 237 * 238 * This is a wrapper for {@link delete_blog_option()}, which in turn deletes 239 * settings data (such as bp-pages) on the appropriate blog, given your current 240 * setup. 241 * 242 * @since BuddyPress (1.5.0) 235 243 * 236 244 * @uses bp_get_root_blog_id() 237 * @param string $option_name The option key to be set 245 * 246 * @param string $option_name The option key to be deleted. 238 247 */ 239 248 function bp_delete_option( $option_name ) { … … 242 251 243 252 /** 244 * When switching from single to multisite we need to copy blog options to 245 * site options. 246 * 247 * This function is no longer used 248 * 249 * @package BuddyPress Core 250 * @deprecated Since BuddyPress (1.6) 253 * Copy BP options from a single site to multisite config. 254 * 255 * Run when switching from single to multisite and we need to copy blog options 256 * to site options. 257 * 258 * This function is no longer used. 259 * 260 * @deprecated 1.6.0 251 261 */ 252 262 function bp_core_activate_site_options( $keys = array() ) { … … 275 285 276 286 /** 287 * Fetch global BP options. 288 * 277 289 * BuddyPress uses common options to store configuration settings. Many of these 278 290 * settings are needed at run time. Instead of fetching them all and adding many 279 291 * initial queries to each page load, let's fetch them all in one go. 280 292 * 281 * @package BuddyPress Core 282 * @todo Use settings API and audit these methods 293 * @todo Use settings API and audit these methods. 294 * 295 * @return array $root_blog_options_meta List of options. 283 296 */ 284 297 function bp_core_get_root_options() { … … 376 389 * Is profile sycing disabled? 377 390 * 378 * @since BuddyPress (1.6) 379 * 380 * @param bool $default Optional.Default value true 381 * 382 * @uses bp_get_option() To get the profile sync option 383 * @return bool Is profile sync enabled or not 391 * @since BuddyPress (1.6.0) 392 * 393 * @uses bp_get_option() To get the profile sync option. 394 * 395 * @param bool $default Optional. Fallback value if not found in the database. 396 * Default: true. 397 * @return bool True if profile sync is enabled, otherwise false. 384 398 */ 385 399 function bp_disable_profile_sync( $default = true ) { … … 390 404 * Is the Toolbar hidden for logged out users? 391 405 * 392 * @since BuddyPress (1.6) 393 * 394 * @param bool $default Optional.Default value true 395 * 396 * @uses bp_get_option() To get the logged out Toolbar option 397 * @return bool Is logged out Toolbar enabled or not 406 * @since BuddyPress (1.6.0) 407 * 408 * @uses bp_get_option() To get the logged out Toolbar option. 409 * 410 * @param bool $default Optional. Fallback value if not found in the database. 411 * Default: true. 412 * @return bool True if the admin bar should be hidden for logged-out users, 413 * otherwise false. 398 414 */ 399 415 function bp_hide_loggedout_adminbar( $default = true ) { … … 404 420 * Are members able to upload their own avatars? 405 421 * 406 * @since BuddyPress (1.6) 407 * 408 * @param bool $default Optional. Default value true 409 * 410 * @uses bp_get_option() To get the avatar uploads option 411 * @return bool Are avatar uploads allowed? 422 * @since BuddyPress (1.6.0) 423 * 424 * @uses bp_get_option() To get the avatar uploads option. 425 * 426 * @param bool $default Optional. Fallback value if not found in the database. 427 * Default: true. 428 * @return bool True if avatar uploads are disabled, otherwise false. 412 429 */ 413 430 function bp_disable_avatar_uploads( $default = true ) { … … 418 435 * Are members able to delete their own accounts? 419 436 * 420 * @since BuddyPress (1.6) 421 * 422 * @param bool $default Optional. Default value 423 * 424 * @uses bp_get_option() To get the account deletion option 425 * @return bool Is account deletion allowed? 437 * @since BuddyPress (1.6.0) 438 * 439 * @uses bp_get_option() To get the account deletion option. 440 * 441 * @param bool $default Optional. Fallback value if not found in the database. 442 * Default: true. 443 * @return bool True if users are able to delete their own accounts, otherwise 444 * false. 426 445 */ 427 446 function bp_disable_account_deletion( $default = false ) { … … 432 451 * Are blog and forum activity stream comments disabled? 433 452 * 434 * @since BuddyPress (1.6) 435 * 436 * @param bool $default Optional. Default value false 437 * @todo split and move into blog and forum components 438 * @uses bp_get_option() To get the blog/forum comments option 439 * @return bool Is blog/forum comments allowed? 453 * @since BuddyPress (1.6.0) 454 * 455 * @todo split and move into blog and forum components. 456 * @uses bp_get_option() To get the blog/forum comments option. 457 * 458 * @param bool $default Optional. Fallback value if not found in the database. 459 * Default: false. 460 * @return bool True if activity comments are disabled for blog and forum 461 * items, otherwise false. 440 462 */ 441 463 function bp_disable_blogforum_comments( $default = false ) { … … 446 468 * Is group creation turned off? 447 469 * 448 * @since BuddyPress (1.6) 449 * 450 * @param bool $default Optional. Default value true 451 * 452 * @todo Move into groups component 453 * @uses bp_get_option() To get the group creation 454 * @return bool Allow group creation? 470 * @since BuddyPress (1.6.0) 471 * 472 * @todo Move into groups component. 473 * @uses bp_get_option() To get the group creation. 474 * 475 * @param bool $default Optional. Fallback value if not found in the database. 476 * Default: true. 477 * @return bool True if group creation is restricted, otherwise false. 455 478 */ 456 479 function bp_restrict_group_creation( $default = true ) { … … 459 482 460 483 /** 461 * Have we migrated to using the WordPress Toolbar?462 * 463 * @since BuddyPress (1.6 )464 * 465 * @ param bool $default Optional. Default value true466 * 467 * @ todo Move into groups component468 * @uses bp_get_option() To get the WP editor option469 * @return bool Use WP editor?484 * Should the old BuddyBar be forced in place of the WP admin bar? 485 * 486 * @since BuddyPress (1.6.0) 487 * 488 * @uses bp_get_option() To get the BuddyBar option. 489 * 490 * @param bool $default Optional. Fallback value if not found in the database. 491 * Default: true. 492 * @return bool True if the BuddyBar should be forced on, otherwise false. 470 493 */ 471 494 function bp_force_buddybar( $default = true ) { … … 474 497 475 498 /** 476 * Output the group forums root parent forum id 477 * 478 * @since BuddyPress (1.6 )479 * 480 * @param bool $default Optional. Default value499 * Output the group forums root parent forum id. 500 * 501 * @since BuddyPress (1.6.0) 502 * 503 * @param bool $default Optional. Default: '0'. 481 504 */ 482 505 function bp_group_forums_root_id( $default = '0' ) { … … 484 507 } 485 508 /** 486 * Return the group forums root parent forum id 509 * Return the group forums root parent forum id. 487 510 * 488 * @since BuddyPress (1.6 )511 * @since BuddyPress (1.6.0) 489 512 * 490 * @ param bool $default Optional. Default value 0513 * @uses bp_get_option() To get the root forum ID from the database. 491 514 * 492 * @ uses bp_get_option() To get the maximum title length493 * @return int Is anonymous posting allowed?515 * @param bool $default Optional. Default: '0'. 516 * @return int The ID of the group forums root forum. 494 517 */ 495 518 function bp_get_group_forums_root_id( $default = '0' ) { … … 498 521 499 522 /** 500 * Checks if BuddyPress Group Forums are enabled 501 * 502 * @since BuddyPress (1.6) 503 * 504 * @param bool $default Optional. Default value true 505 * 506 * @uses bp_get_option() To get the group forums option 507 * @return bool Is group forums enabled or not 523 * Check whether BuddyPress Group Forums are enabled. 524 * 525 * @since BuddyPress (1.6.0) 526 * 527 * @uses bp_get_option() To get the group forums option. 528 * 529 * @param bool $default Optional. Fallback value if not found in the database. 530 * Default: true. 531 * @return bool True if group forums are active, otherwise false. 508 532 */ 509 533 function bp_is_group_forums_active( $default = true ) { … … 512 536 513 537 /** 514 * Checks if Akismet is enabled 515 * 516 * @since BuddyPress (1.6) 517 * 518 * @param bool $default Optional. Default value true 519 * 520 * @uses bp_get_option() To get the Akismet option 521 * @return bool Is Akismet enabled or not 538 * Check whether Akismet is enabled. 539 * 540 * @since BuddyPress (1.6.0) 541 * 542 * @uses bp_get_option() To get the Akismet option. 543 * 544 * @param bool $default Optional. Fallback value if not found in the database. 545 * Default: true. 546 * @return bool True if Akismet is enabled, otherwise false. 522 547 */ 523 548 function bp_is_akismet_active( $default = true ) { … … 526 551 527 552 /** 528 * Get the current theme package ID 529 * 530 * @since BuddyPress (1.7) 531 * 532 * @param string $default Optional. Default value 'default' 533 * @uses get_option() To get the subtheme option 534 * @return string ID of the subtheme 553 * Get the current theme package ID. 554 * 555 * @since BuddyPress (1.7.0) 556 * 557 * @uses get_option() To get the theme package option. 558 * 559 * @param bool $default Optional. Fallback value if not found in the database. 560 * Default: 'legacy'. 561 * @return string ID of the theme package. 535 562 */ 536 563 function bp_get_theme_package_id( $default = 'legacy' ) {
Note: See TracChangeset
for help on using the changeset viewer.