Changeset 7457
- Timestamp:
- 10/23/2013 12:14:44 AM (11 years ago)
- Location:
- trunk/bp-core
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-theme-compatibility.php
r7432 r7457 2 2 3 3 /** 4 * BuddyPress Core Theme Compatibility 4 * BuddyPress Core Theme Compatibility. 5 5 * 6 6 * @package BuddyPress … … 26 26 27 27 /** 28 * Theme Compatibility base class 28 * Theme Compatibility base class. 29 29 * 30 30 * This is only intended to be extended, and is included here as a basic guide 31 * for future Theme Packs to use. @link BP_Legacyis a good example of31 * for future Theme Packs to use. {@link BP_Legacy} is a good example of 32 32 * extending this class. 33 33 * 34 * @since BuddyPress (1.7) 35 * @todo We should probably do something similar to BP_Component::start() 34 * @since BuddyPress (1.7.0) 35 * 36 * @todo We should probably do something similar to BP_Component::start(). 37 * @todo If this is only intended to be extended, it should be abstract. 38 * 39 * @param array $properties { 40 * An array of properties describing the theme compat package. 41 * @type string $id ID of the package. Must be unique. 42 * @type string $name Name of the theme. This should match the name given 43 * in style.css. 44 * @type string $version Theme version. Used for busting script and style 45 * browser caches. 46 * @type string $dir Filesystem path of the theme. 47 * @type string $url Base URL of the theme. 48 * } 36 49 */ 37 50 class BP_Theme_Compat { 38 51 39 52 /** 40 * Should be like: 41 * 42 * array( 43 * 'id' => ID of the theme (should be unique) 44 * 'name' => Name of the theme (should match style.css) 45 * 'version' => Theme version for cache busting scripts and styling 46 * 'dir' => Path to theme 47 * 'url' => URL to theme 48 * ); 53 * Template package properties, as passed to the constructor. 54 * 49 55 * @var array 50 56 */ … … 54 60 * Pass the $properties to the object on creation. 55 61 * 56 * @since BuddyPress (1.7) 57 * @param array $properties 62 * @since BuddyPress (1.7.0) 58 63 */ 59 64 public function __construct( Array $properties = array() ) { … … 61 66 } 62 67 63 64 /** 65 * Set up the BuddyPress-specific theme compat methods 68 /** 69 * Set up the BuddyPress-specific theme compat methods. 66 70 * 67 71 * Themes shoud use this method in their constructor. 68 72 * 69 * @since BuddyPress (1.7 )73 * @since BuddyPress (1.7.0) 70 74 */ 71 75 protected function start() { … … 81 85 82 86 /** 83 * Meant to be extended in your class. 84 * 85 * @since BuddyPress (1.7) 87 * Set up global data for your template package. 88 * 89 * Meant to be overridden in your class. See 90 * {@link BP_Legacy::setup_globals()} for an example. 91 * 92 * @since BuddyPress (1.7.0) 86 93 */ 87 94 protected function setup_globals() {} 88 95 89 96 /** 90 * Meant to be extended in your class. 91 * 92 * @since BuddyPress (1.7) 97 * Set up theme hooks for your template package. 98 * 99 * Meant to be overridden in your class. See 100 * {@link BP_Legacy::setup_actions()} for an example. 101 * 102 * @since BuddyPress (1.7.0) 93 103 */ 94 104 protected function setup_actions() {} … … 97 107 * Set a theme's property. 98 108 * 99 * @since BuddyPress (1.7) 100 * @param string $property 101 * @param mixed $value 102 * @return mixed 109 * @since BuddyPress (1.7.0) 110 * 111 * @param string $property Property name. 112 * @param mixed $value Property value. 113 * @return bool True on success, false on failure. 103 114 */ 104 115 public function __set( $property, $value ) { … … 109 120 * Get a theme's property. 110 121 * 111 * @since BuddyPress (1.7) 112 * @param string $property 113 * @param mixed $value 114 * @return mixed 122 * @since BuddyPress (1.7.0) 123 * 124 * @param string $property Property name. 125 * @return mixed The value of the property if it exists, otherwise an 126 * empty string. 115 127 */ 116 128 public function __get( $property ) { … … 122 134 123 135 /** 124 * Setup the default theme compat theme 125 * 126 * @since BuddyPress (1.7) 127 * @param BP_Theme_Compat $theme 136 * Set up the default theme compat theme. 137 * 138 * @since BuddyPress (1.7.0) 139 * 140 * @param string $theme Optional. The unique ID identifier of a theme package. 128 141 */ 129 142 function bp_setup_theme_compat( $theme = '' ) { … … 140 153 141 154 /** 142 * Get s the name of the BuddyPress compatable theme used, in the event the143 * currently active WordPress theme does not explicitly support BuddyPress.155 * Get the ID of the theme package being used. 156 * 144 157 * This can be filtered or set manually. Tricky theme authors can override the 145 158 * default and include their own BuddyPress compatability layers for their themes. 146 159 * 147 * @since BuddyPress (1.7) 160 * @since BuddyPress (1.7.0) 161 * 148 162 * @uses apply_filters() 149 * @return string 163 * 164 * @return string ID of the theme package in use. 150 165 */ 151 166 function bp_get_theme_compat_id() { … … 154 169 155 170 /** 156 * Get s the name of the BuddyPress compatable theme used, in the event the157 * currently active WordPress theme does not explicitly support BuddyPress.171 * Get the name of the theme package being used. 172 * 158 173 * This can be filtered or set manually. Tricky theme authors can override the 159 174 * default and include their own BuddyPress compatability layers for their themes. 160 175 * 161 * @since BuddyPress (1.7) 176 * @since BuddyPress (1.7.0) 177 * 162 178 * @uses apply_filters() 163 * @return string 179 * 180 * @return string Name of the theme package currently in use. 164 181 */ 165 182 function bp_get_theme_compat_name() { … … 168 185 169 186 /** 170 * Get s the version of the BuddyPress compatable theme used, in the event the171 * currently active WordPress theme does not explicitly support BuddyPress.187 * Get the version of the theme package being used. 188 * 172 189 * This can be filtered or set manually. Tricky theme authors can override the 173 190 * default and include their own BuddyPress compatability layers for their themes. 174 191 * 175 * @since BuddyPress (1.7) 192 * @since BuddyPress (1.7.0) 193 * 176 194 * @uses apply_filters() 177 * @return string 195 * 196 * @return string The version string of the theme package currently in use. 178 197 */ 179 198 function bp_get_theme_compat_version() { … … 182 201 183 202 /** 184 * Get s the BuddyPress compatable theme used in the event the currently active185 * WordPress theme does not explicitly support BuddyPress. This can be filtered,203 * Get the absolute path of the theme package being used. 204 * 186 205 * or set manually. Tricky theme authors can override the default and include 187 206 * their own BuddyPress compatability layers for their themes. 188 207 * 189 * @since BuddyPress (1.7) 208 * @since BuddyPress (1.7.0) 209 * 190 210 * @uses apply_filters() 191 * @return string 211 * 212 * @return string The absolute path of the theme package currently in use. 192 213 */ 193 214 function bp_get_theme_compat_dir() { … … 196 217 197 218 /** 198 * Gets the BuddyPress compatable theme used in the event the currently active 199 * WordPress theme does not explicitly support BuddyPress. This can be filtered, 200 * or set manually. Tricky theme authors can override the default and include 201 * their own BuddyPress compatability layers for their themes. 202 * 203 * @since BuddyPress (1.7) 219 * Get the URL of the theme package being used. 220 * 221 * This can be filtered, or set manually. Tricky theme authors can override 222 * the default and include their own BuddyPress compatability layers for their 223 * themes. 224 * 225 * @since BuddyPress (1.7.0) 226 * 204 227 * @uses apply_filters() 205 * @return string 228 * 229 * @return string URL of the theme package currently in use. 206 230 */ 207 231 function bp_get_theme_compat_url() { … … 213 237 * 214 238 * If the current theme's need for theme compat hasn't yet been detected, we 215 * do so using bp_detect_theme_compat_with_current_theme() 239 * do so using bp_detect_theme_compat_with_current_theme(). 216 240 * 217 241 * @since BuddyPress (1.9.0) … … 219 243 * @uses bp_detect_theme_compat_with_current_theme() 220 244 * 221 * @return bool True if the current theme needs theme compatibility 245 * @return bool True if the current theme needs theme compatibility. 222 246 */ 223 247 function bp_use_theme_compat_with_current_theme() { … … 277 301 278 302 /** 279 * Gets true/false if the current, loaded page uses theme compatibility 280 * 281 * @since BuddyPress (1.7) 282 * @return bool 303 * Is the current page using theme compatibility? 304 * 305 * @since BuddyPress (1.7.0) 306 * 307 * @return bool True if the current page uses theme compatibility. 283 308 */ 284 309 function bp_is_theme_compat_active() { … … 292 317 293 318 /** 294 * Sets true/false if page is currently inside theme compatibility 295 * 296 * @since BuddyPress (1.7) 297 * @param bool $set 298 * @return bool 319 * Set the flag that tells whether the current page is using theme compatibility. 320 * 321 * @since BuddyPress (1.7.0) 322 * 323 * @param bool $set True to set the flag to true, false to set it to false. 324 * @return bool Returns the value of $set. 299 325 */ 300 326 function bp_set_theme_compat_active( $set = true ) { … … 305 331 306 332 /** 307 * Set the theme compat templates global 333 * Set the theme compat templates global. 308 334 * 309 335 * Stash possible template files for the current query. Useful if plugins want 310 336 * to override them, or see what files are being scanned for inclusion. 311 337 * 312 * @since BuddyPress (1.7) 338 * @since BuddyPress (1.7.0) 339 * 340 * @param array $templates The template stack. 341 * @return array The template stack (value of $templates). 313 342 */ 314 343 function bp_set_theme_compat_templates( $templates = array() ) { … … 319 348 320 349 /** 321 * Set the theme compat template global 350 * Set the theme compat template global. 322 351 * 323 352 * Stash the template file for the current query. Useful if plugins want 324 353 * to override it, or see what file is being included. 325 354 * 326 * @since BuddyPress (1.7) 355 * @since BuddyPress (1.7.0) 356 * 357 * @param string $template The template currently in use. 358 * @return string The template currently in use (value of $template). 327 359 */ 328 360 function bp_set_theme_compat_template( $template = '' ) { … … 333 365 334 366 /** 335 * Set the theme compat original_template global 367 * Set the theme compat original_template global. 336 368 * 337 369 * Stash the original template file for the current query. Useful for checking 338 370 * if BuddyPress was able to find a more appropriate template. 339 371 * 340 * @since BuddyPress (1.7) 372 * @since BuddyPress (1.7.0) 373 * 374 * @param string $template The template originally selected by WP. 375 * @return string The template originally selected by WP (value of $template). 341 376 */ 342 377 function bp_set_theme_compat_original_template( $template = '' ) { … … 347 382 348 383 /** 349 * Set the theme compat original_template global 350 * 351 * Stash the original template file for the current query. Useful for checking 352 * if BuddyPress was able to find a more appropriate template. 353 * 354 * @since BuddyPress (1.7) 384 * Check whether a given template is the one that WP originally selected to display current page. 385 * 386 * @since BuddyPress (1.7.0) 387 * 388 * @param string $template The template name to check. 389 * @return bool True if the value of $template is the same as the 390 * "original_template" originally selected by WP. Otherwise false. 355 391 */ 356 392 function bp_is_theme_compat_original_template( $template = '' ) { … … 364 400 365 401 /** 366 * Register a new BuddyPress theme package to the active theme packages array 367 * 368 * The $theme parameter is an array, which takes the following values: 369 * 370 * 'id' - ID for your theme package; should be alphanumeric only 371 * 'name' - Name of your theme package 372 * 'version' - Version of your theme package 373 * 'dir' - Directory where your theme package resides 374 * 'url' - URL where your theme package resides 402 * Register a new BuddyPress theme package in the active theme packages array. 375 403 * 376 404 * For an example of how this function is used, see: … … 379 407 * @since BuddyPress (1.7) 380 408 * 381 * @param array $theme The theme package arguments. See phpDoc for more details. 409 * @see BP_Theme_Compat for a description of the $theme parameter arguments. 410 * 411 * @param array $theme See {@link BP_Theme_Compat}. 382 412 * @param bool $override If true, overrides whatever package is currently set. 413 * Default: true. 383 414 */ 384 415 function bp_register_theme_package( $theme = array(), $override = true ) { … … 405 436 406 437 /** 407 * This fun little function fills up some WordPress globals with dummy data to 408 * stop your average page template from complaining about it missing. 409 * 410 * @since BuddyPress (1.7) 411 * @global WP_Query $wp_query 412 * @global object $post 413 * @param array $args 438 * Populate various WordPress globals with dummy data to prevent errors. 439 * 440 * This dummy data is necessary because theme compatibility essentially fakes 441 * WordPress into thinking that there is content where, in fact, there is none 442 * (at least, no WordPress post content). By providing dummy data, we ensure 443 * that template functions - things like is_page() - don't throw errors. 444 * 445 * @since BuddyPress (1.7.0) 446 * 447 * @global WP_Query $wp_query WordPress database access object. 448 * @global object $post Current post object. 449 * 450 * @param array $args Array of optional arguments. Arguments parallel the 451 * properties of {@link WP_Post}; see that class for more details. 414 452 */ 415 453 function bp_theme_compat_reset_post( $args = array() ) { … … 522 560 523 561 /** 524 * Reset main query vars and filter 'the_content' to output a BuddyPress 525 * template part as needed. 526 * 527 * @since BuddyPress (1.7) 528 * 529 * @param string $template 530 * @uses bp_is_single_user() To check if page is single user 531 * @uses bp_get_single_user_template() To get user template 532 * @uses bp_is_single_user_edit() To check if page is single user edit 533 * @uses bp_get_single_user_edit_template() To get user edit template 534 * @uses bp_is_single_view() To check if page is single view 535 * @uses bp_get_single_view_template() To get view template 536 * @uses bp_is_forum_edit() To check if page is forum edit 537 * @uses bp_get_forum_edit_template() To get forum edit template 538 * @uses bp_is_topic_merge() To check if page is topic merge 539 * @uses bp_get_topic_merge_template() To get topic merge template 540 * @uses bp_is_topic_split() To check if page is topic split 541 * @uses bp_get_topic_split_template() To get topic split template 542 * @uses bp_is_topic_edit() To check if page is topic edit 543 * @uses bp_get_topic_edit_template() To get topic edit template 544 * @uses bp_is_reply_edit() To check if page is reply edit 545 * @uses bp_get_reply_edit_template() To get reply edit template 546 * @uses bp_set_theme_compat_template() To set the global theme compat template 562 * Reset main query vars and filter 'the_content' to output a BuddyPress template part as needed. 563 * 564 * @since BuddyPress (1.7.0) 565 * 566 * @uses bp_is_single_user() To check if page is single user. 567 * @uses bp_get_single_user_template() To get user template. 568 * @uses bp_is_single_user_edit() To check if page is single user edit. 569 * @uses bp_get_single_user_edit_template() To get user edit template. 570 * @uses bp_is_single_view() To check if page is single view. 571 * @uses bp_get_single_view_template() To get view template. 572 * @uses bp_is_forum_edit() To check if page is forum edit. 573 * @uses bp_get_forum_edit_template() To get forum edit template. 574 * @uses bp_is_topic_merge() To check if page is topic merge. 575 * @uses bp_get_topic_merge_template() To get topic merge template. 576 * @uses bp_is_topic_split() To check if page is topic split. 577 * @uses bp_get_topic_split_template() To get topic split template. 578 * @uses bp_is_topic_edit() To check if page is topic edit. 579 * @uses bp_get_topic_edit_template() To get topic edit template. 580 * @uses bp_is_reply_edit() To check if page is reply edit. 581 * @uses bp_get_reply_edit_template() To get reply edit template. 582 * @uses bp_set_theme_compat_template() To set the global theme compat template. 583 * 584 * @param string $template Template name. 585 * @return string $template Template name. 547 586 */ 548 587 function bp_template_include_theme_compat( $template = '' ) { … … 596 635 597 636 /** 637 * Conditionally replace 'the_content'. 638 * 598 639 * Replaces the_content() if the post_type being displayed is one that would 599 640 * normally be handled by BuddyPress, but proper single page templates do not 600 641 * exist in the currently active theme. 601 642 * 602 * @since BuddyPress (1.7) 603 * @param string $content 604 * @return string 643 * @since BuddyPress (1.7.0) 644 * 645 * @param string $content Original post content. 646 * @return string $content Post content, potentially modified. 605 647 */ 606 648 function bp_replace_the_content( $content = '' ) { … … 635 677 636 678 /** 637 * Are we replacing the_content 638 * 639 * @since BuddyPress (1.8) 640 * @return bool 679 * Are we currently replacing the_content? 680 * 681 * @since BuddyPress (1.8.0) 682 * 683 * @return bool True if the_content is currently in the process of being 684 * filtered and replaced. 641 685 */ 642 686 function bp_do_theme_compat() { … … 647 691 648 692 /** 649 * Removes all filters from a WordPress filter, and stashes them in the $bp 650 * global in the event they need to be restored later. 651 * 652 * @since BuddyPress (1.7) 693 * Remove all filters from a WordPress filter hook. 694 * 695 * Removed filters are stashed in the $bp global, in case they need to be 696 * restored later. 697 * 698 * @since BuddyPress (1.7.0) 699 * 653 700 * @global WP_filter $wp_filter 654 701 * @global array $merged_filters 655 * @param string $tag 656 * @param int $priority 657 * @return bool 702 * 703 * @param string $tag The filter tag to remove filters from. 704 * @param int $priority Optional. If present, only those callbacks attached 705 * at a given priority will be removed. Otherwise, all callbacks 706 * attached to the tag will be removed, regardless of priority. 707 * @return bool True on success. 658 708 */ 659 709 function bp_remove_all_filters( $tag, $priority = false ) { … … 699 749 700 750 /** 701 * Restore s filters from the $bp global that were removed using702 * bp_remove_all_filters()703 * 704 * @since BuddyPress (1.7)751 * Restore filters that were removed using bp_remove_all_filters(). 752 * 753 * @since BuddyPress (1.7.0) 754 * 705 755 * @global WP_filter $wp_filter 706 756 * @global array $merged_filters 707 * @param string $tag 708 * @param int $priority 709 * @return bool 757 * 758 * @param string $tag The tag to which filters should be restored. 759 * @param int $priority Optional. If present, only those filters that were 760 * originally attached to the tag with $priority will be restored. 761 * Otherwise, all available filters will be restored, regardless of 762 * priority. 763 * @return bool True on success. 710 764 */ 711 765 function bp_restore_all_filters( $tag, $priority = false ) { … … 751 805 752 806 /** 753 * Force comments_status to 'closed' for BuddyPress post types 754 * 755 * @since BuddyPress (1.7) 756 * @param bool $open True if open, false if closed 757 * @param int $post_id ID of the post to check 758 * @return bool True if open, false if closed 807 * Force comments_status to 'closed' for BuddyPress post types. 808 * 809 * @since BuddyPress (1.7.0) 810 * 811 * @param bool $open True if open, false if closed. 812 * @param int $post_id ID of the post to check. 813 * @return bool True if open, false if closed. 759 814 */ 760 815 function bp_comments_open( $open, $post_id = 0 ) { -
trunk/bp-core/bp-core-update.php
r7248 r7457 2 2 3 3 /** 4 * BuddyPress Updater 4 * BuddyPress Updater. 5 5 * 6 6 * @package BuddyPress … … 12 12 13 13 /** 14 * If there is no raw DB version, this is the first installation 15 * 16 * @since BuddyPress (1.7) 14 * Is this a fresh installation of BuddyPress? 15 * 16 * If there is no raw DB version, we infer that this is the first installation. 17 * 18 * @since BuddyPress (1.7.0) 17 19 * 18 20 * @uses get_option() 19 * @uses bp_get_db_version() To get BuddyPress's database version 20 * @return bool True if update, False if not 21 * @uses bp_get_db_version() To get BuddyPress's database version. 22 * 23 * @return bool True if this is a fresh BP install, otherwise false. 21 24 */ 22 25 function bp_is_install() { … … 25 28 26 29 /** 27 * Compare the BuddyPress version to the DB version to determine if updating 28 * 29 * @since BuddyPress (1.6) 30 * Is this a BuddyPress update? 31 * 32 * Determined by comparing the registered BuddyPress version to the version 33 * number stored in the database. If the registered version is greater, it's 34 * an update. 35 * 36 * @since BuddyPress (1.6.0) 30 37 * 31 38 * @uses get_option() 32 * @uses bp_get_db_version() To get BuddyPress's database version 33 * @return bool True if update, False if not 39 * @uses bp_get_db_version() To get BuddyPress's database version. 40 * 41 * @return bool True if update, otherwise false. 34 42 */ 35 43 function bp_is_update() { … … 47 55 48 56 /** 49 * Determine if BuddyPress is being activated50 * 51 * @since BuddyPress (1.6 )57 * Determine whether BuddyPress is in the process of being activated. 58 * 59 * @since BuddyPress (1.6.0) 52 60 * 53 61 * @uses buddypress() 54 * @return bool True if activating BuddyPress, false if not 62 * 63 * @return bool True if activating BuddyPress, false if not. 55 64 */ 56 65 function bp_is_activation( $basename = '' ) { … … 91 100 92 101 /** 93 * Determine if BuddyPress is being deactivated94 * 95 * @since BuddyPress (1.6 )102 * Determine whether BuddyPress is in the process of being deactivated. 103 * 104 * @since BuddyPress (1.6.0) 96 105 * 97 106 * @uses buddypress() 98 * @return bool True if deactivating BuddyPress, false if not 107 * 108 * @return bool True if deactivating BuddyPress, false if not. 99 109 */ 100 110 function bp_is_deactivation( $basename = '' ) { … … 135 145 136 146 /** 137 * Update the DB to the latest version 138 * 139 * @since BuddyPress (1.6) 140 * 141 * @uses update_option() 142 * @uses bp_get_db_version() To get BuddyPress's database version 143 * @uses bp_update_option() To update BuddyPress's database version 147 * Update the BP version stored in the database to the current version. 148 * 149 * @since BuddyPress (1.6.0) 150 * 151 * @uses bp_get_db_version() To get BuddyPress's database version. 152 * @uses bp_update_option() To update BuddyPress's database version. 144 153 */ 145 154 function bp_version_bump() { … … 148 157 149 158 /** 150 * Set up the BuddyPress updater151 * 152 * @since BuddyPress (1.6 )159 * Set up the BuddyPress updater. 160 * 161 * @since BuddyPress (1.6.0) 153 162 */ 154 163 function bp_setup_updater() { … … 162 171 163 172 /** 173 * Initialize an update or installation of BuddyPress. 174 * 164 175 * BuddyPress's version updater looks at what the current database version is, 165 * and runs whatever other code is needed. 166 * 167 * This is most-often used when the data schema changes, but should also be used 176 * and runs whatever other code is needed - either the "update" or "install" 177 * code. 178 * 179 * This is most often used when the data schema changes, but should also be used 168 180 * to correct issues with BuddyPress metadata silently on software update. 169 181 * 170 * @since BuddyPress (1.7 )182 * @since BuddyPress (1.7.0) 171 183 */ 172 184 function bp_version_updater() { … … 211 223 212 224 /** 213 * Database update methods based on version numbers 214 * 215 * @since BuddyPress (1.7) 225 * Remove unused metadata from database when upgrading from < 1.5. 226 * 227 * Database update methods based on version numbers. 228 * 229 * @since BuddyPress (1.7.0) 216 230 */ 217 231 function bp_update_to_1_5() { … … 227 241 228 242 /** 229 * Database update methods based on version numbers 230 * 231 * @since BuddyPress (1.7) 243 * Remove unused metadata from database when upgrading from < 1.6. 244 * 245 * Database update methods based on version numbers. 246 * 247 * @since BuddyPress (1.7.0) 232 248 */ 233 249 function bp_update_to_1_6() { … … 247 263 248 264 /** 249 * Redirect user to B uddyPress's What's New page on activation250 * 251 * @since BuddyPress (1.7 )252 * 253 * @internal Used internally to redirect BuddyPress to the about page on activation 254 * 255 * @uses set_transient() To drop the activation transient for 30 seconds 265 * Redirect user to BP's What's New page on first page load after activation. 266 * 267 * @since BuddyPress (1.7.0) 268 * 269 * @internal Used internally to redirect BuddyPress to the about page on activation. 270 * 271 * @uses set_transient() To drop the activation transient for 30 seconds. 256 272 */ 257 273 function bp_add_activation_redirect() { … … 274 290 275 291 /** 276 * Runs on BuddyPress activation 277 * 278 * @since BuddyPress (1.6) 279 * 280 * @uses do_action() Calls 'bp_activation' hook 292 * Fire activation hooks and events. 293 * 294 * Runs on BuddyPress activation. 295 * 296 * @since BuddyPress (1.6.0) 297 * 298 * @uses do_action() Calls 'bp_activation' hook. 281 299 */ 282 300 function bp_activation() { … … 293 311 294 312 /** 295 * Runs on BuddyPress deactivation 296 * 297 * @since BuddyPress (1.6) 298 * 299 * @uses do_action() Calls 'bp_deactivation' hook 313 * Fire deactivation hooks and events. 314 * 315 * Runs on BuddyPress deactivation. 316 * 317 * @since BuddyPress (1.6.0) 318 * 319 * @uses do_action() Calls 'bp_deactivation' hook. 300 320 */ 301 321 function bp_deactivation() { … … 320 340 321 341 /** 322 * Runs when uninstalling BuddyPress 323 * 324 * @since BuddyPress (1.6) 325 * 326 * @uses do_action() Calls 'bp_uninstall' hook 342 * Fire uninstall hook. 343 * 344 * Runs when uninstalling BuddyPress. 345 * 346 * @since BuddyPress (1.6.0) 347 * 348 * @uses do_action() Calls 'bp_uninstall' hook. 327 349 */ 328 350 function bp_uninstall() { -
trunk/bp-core/bp-core-widgets.php
r7450 r7457 1 1 <?php 2 2 /** 3 * BuddyPress Widgets3 * BuddyPress Core Component Widgets. 4 4 * 5 5 * @package BuddyPress … … 10 10 if ( !defined( 'ABSPATH' ) ) exit; 11 11 12 /* Register widgets for the core component */ 12 /** 13 * Register bp-core widgets. 14 */ 13 15 function bp_core_register_widgets() { 14 16 add_action('widgets_init', create_function('', 'return register_widget("BP_Core_Login_Widget");') ); … … 20 22 21 23 /** 22 * BuddyPress Login Widget 24 * BuddyPress Login Widget. 23 25 * 24 26 * @since BuddyPress (1.9.0) … … 140 142 } 141 143 142 /*** MEMBERS WIDGET *****************/ 143 144 /** 145 * Members Widget. 146 */ 144 147 class BP_Core_Members_Widget extends WP_Widget { 145 148 149 /** 150 * Constructor method. 151 */ 146 152 function __construct() { 147 153 $widget_ops = array( … … 157 163 } 158 164 165 /** 166 * Display the Members widget. 167 * 168 * @see WP_Widget::widget() for description of parameters. 169 * 170 * @param array $args Widget arguments. 171 * @param array $instance Widget settings, as saved by the user. 172 */ 159 173 function widget( $args, $instance ) { 160 174 … … 227 241 } 228 242 243 /** 244 * Update the Members widget options. 245 * 246 * @param array $new_instance The new instance options. 247 * @param array $old_instance The old instance options. 248 * @return array $instance The parsed options to be saved. 249 */ 229 250 function update( $new_instance, $old_instance ) { 230 251 $instance = $old_instance; … … 238 259 } 239 260 261 /** 262 * Output the Members widget options form. 263 * 264 * @param $instance Settings for this widget. 265 */ 240 266 function form( $instance ) { 241 267 $defaults = array( … … 277 303 class BP_Core_Whos_Online_Widget extends WP_Widget { 278 304 305 /** 306 * Constructor method. 307 */ 279 308 function __construct() { 280 309 $widget_ops = array( … … 285 314 } 286 315 316 /** 317 * Display the Who's Online widget. 318 * 319 * @see WP_Widget::widget() for description of parameters. 320 * 321 * @param array $args Widget arguments. 322 * @param array $instance Widget settings, as saved by the user. 323 */ 287 324 function widget($args, $instance) { 288 325 … … 316 353 } 317 354 355 /** 356 * Update the Who's Online widget options. 357 * 358 * @param array $new_instance The new instance options. 359 * @param array $old_instance The old instance options. 360 * @return array $instance The parsed options to be saved. 361 */ 318 362 function update( $new_instance, $old_instance ) { 319 363 $instance = $old_instance; … … 324 368 } 325 369 370 /** 371 * Output the Who's Online widget options form. 372 * 373 * @param $instance Settings for this widget. 374 */ 326 375 function form( $instance ) { 327 376 $defaults = array( … … 346 395 class BP_Core_Recently_Active_Widget extends WP_Widget { 347 396 397 /** 398 * Constructor method. 399 */ 348 400 function __construct() { 349 401 $widget_ops = array( … … 354 406 } 355 407 408 /** 409 * Display the Recently Active widget. 410 * 411 * @see WP_Widget::widget() for description of parameters. 412 * 413 * @param array $args Widget arguments. 414 * @param array $instance Widget settings, as saved by the user. 415 */ 356 416 function widget( $args, $instance ) { 357 417 … … 385 445 } 386 446 447 /** 448 * Update the Recently Active widget options. 449 * 450 * @param array $new_instance The new instance options. 451 * @param array $old_instance The old instance options. 452 * @return array $instance The parsed options to be saved. 453 */ 387 454 function update( $new_instance, $old_instance ) { 388 455 $instance = $old_instance; … … 393 460 } 394 461 462 /** 463 * Output the Recently Active widget options form. 464 * 465 * @param $instance Settings for this widget. 466 */ 395 467 function form( $instance ) { 396 468 $defaults = array( … … 411 483 } 412 484 413 /** Widget AJAX ******************/ 414 485 /** 486 * AJAX request handler for Members widgets. 487 */ 415 488 function bp_core_ajax_widget_members() { 416 489 -
trunk/bp-core/bp-core-wpabstraction.php
r7228 r7457 1 1 <?php 2 /***** 3 * WordPress Abstraction 4 * 5 * The functions within this file will detect the version of WordPress you are running 6 * and will alter the environment so BuddyPress can run regardless. 7 * 8 * The code below mostly contains function mappings. This file is subject to change at any time. 2 /** 3 * WordPress Abstraction. 4 * 5 * The functions within this file will detect the version of WordPress you are 6 * running and will alter the environment so BuddyPress can run regardless. 7 * 8 * The code below mostly contains function mappings. This file is subject to 9 * change at any time. 9 10 */ 10 11 … … 13 14 14 15 /** 15 * Parse the WordPress core version number into the major release 16 * Parse the WordPress core version number into the major release. 16 17 * 17 18 * @since BuddyPress (1.5.2) 19 * 18 20 * @global string $wp_version 19 * @return string 21 * @return string $wp_version 20 22 */ 21 23 function bp_get_major_wp_version() { … … 35 37 36 38 if ( !function_exists( 'get_blog_option' ) ) { 39 /** 40 * @see get_blog_option() 41 */ 37 42 function get_blog_option( $blog_id, $option_name, $default = false ) { 38 43 return get_option( $option_name, $default ); … … 41 46 42 47 if ( !function_exists( 'update_blog_option' ) ) { 48 /** 49 * @see update_blog_option() 50 */ 43 51 function update_blog_option( $blog_id, $option_name, $value ) { 44 52 return update_option( $option_name, $value ); … … 47 55 48 56 if ( !function_exists( 'delete_blog_option' ) ) { 57 /** 58 * @see delete_blog_option() 59 */ 49 60 function delete_blog_option( $blog_id, $option_name ) { 50 61 return delete_option( $option_name ); … … 53 64 54 65 if ( !function_exists( 'switch_to_blog' ) ) { 66 /** 67 * @see switch_to_blog() 68 */ 55 69 function switch_to_blog() { 56 70 return bp_get_root_blog_id(); … … 59 73 60 74 if ( !function_exists( 'restore_current_blog' ) ) { 75 /** 76 * @see restore_current_blog() 77 */ 61 78 function restore_current_blog() { 62 79 return bp_get_root_blog_id(); … … 65 82 66 83 if ( !function_exists( 'get_blogs_of_user' ) ) { 84 /** 85 * @see get_blogs_of_user() 86 */ 67 87 function get_blogs_of_user() { 68 88 return false; … … 71 91 72 92 if ( !function_exists( 'update_blog_status' ) ) { 93 /** 94 * @see update_blog_status() 95 */ 73 96 function update_blog_status() { 74 97 return true; … … 77 100 78 101 if ( !function_exists( 'is_subdomain_install' ) ) { 102 /** 103 * @see is_subdomain_install() 104 */ 79 105 function is_subdomain_install() { 80 106 if ( ( defined( 'VHOST' ) && 'yes' == VHOST ) || ( defined( 'SUBDOMAIN_INSTALL' ) && SUBDOMAIN_INSTALL ) ) … … 86 112 } 87 113 114 /** 115 * Get SQL chunk for filtering spam users from member queries. 116 * 117 * @internal 118 * @todo Why is this function defined in this file? 119 * 120 * @param string $prefix Global table prefix. 121 * @return string SQL chunk. 122 */ 88 123 function bp_core_get_status_sql( $prefix = false ) { 89 124 if ( !is_multisite() ) … … 103 138 if ( !function_exists( 'mb_strlen' ) ) { 104 139 /** 105 * Fallback implementation of mb_strlen, hardcoded to UTF-8. 106 * @param string $str 107 * @param string $enc optional encoding; ignored 108 * @return int 140 * Fallback implementation of mb_strlen(), hardcoded to UTF-8. 141 * 142 * @param string $str String to be measured. 143 * @param string $enc Optional. Encoding type. Ignored. 144 * @return int String length. 109 145 */ 110 146 function mb_strlen( $str, $enc = '' ) { … … 127 163 if ( !function_exists( 'mb_strpos' ) ) { 128 164 /** 129 * Fallback implementation of mb_strpos, hardcoded to UTF-8. 130 * @param string $haystack 131 * @param string $needle 132 * @param int $offset optional; start position. 133 * @param string $encoding optional; not used. 134 * @return int 165 * Fallback implementation of mb_strpos(), hardcoded to UTF-8. 166 * 167 * @param string $haystack String to search in. 168 * @param string $needle String to search for. 169 * @param int $offset Optional. Start position for the search. Default: 0. 170 * @param string $enc Optional. Encoding type. Ignored. 171 * @return int|bool Position of needle in haystack if found, else false. 135 172 */ 136 173 function mb_strpos( $haystack, $needle, $offset = 0, $encoding = '' ) { … … 150 187 if ( !function_exists( 'mb_strrpos' ) ) { 151 188 /** 152 * Fallback implementation of mb_strrpos, hardcoded to UTF-8. 153 * @param string $haystack 154 * @param string $needle 155 * @param int $offset optional; start position. 156 * @param string $encoding optional; not used. 157 * @return int 189 * Fallback implementation of mb_strrpos(), hardcoded to UTF-8. 190 * 191 * @param string $haystack String to search in. 192 * @param string $needle String to search for. 193 * @param int $offset Optional. Start position for the search. Default: 0. 194 * @param string $enc Optional. Encoding type. Ignored. 195 * @return int Position of last needle in haystack if found, else false. 158 196 */ 159 197 function mb_strrpos( $haystack, $needle, $offset = 0, $encoding = '' ) {
Note: See TracChangeset
for help on using the changeset viewer.