Changeset 9641
- Timestamp:
- 03/24/2015 06:19:49 AM (11 years ago)
- Location:
- trunk/src/bp-core
- Files:
-
- 2 edited
-
bp-core-component.php (modified) (20 diffs)
-
bp-core-dependency.php (modified) (33 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-component.php
r9351 r9641 223 223 ) ); 224 224 225 // Slug used for permalink URI chunk after root 225 /** 226 * Filters the slug to be used for the permalink URI chunk after root. 227 * 228 * @since BuddyPress (1.5.0) 229 * 230 * @param string $value Slug to use in permalink URI chunk. 231 */ 226 232 $this->slug = apply_filters( 'bp_' . $this->id . '_slug', $r['slug'] ); 227 233 228 // Slug used for root directory 234 /** 235 * Filters the slug used for root directory. 236 * 237 * @since BuddyPress (1.5.0) 238 * 239 * @param string $value Root directory slug. 240 */ 229 241 $this->root_slug = apply_filters( 'bp_' . $this->id . '_root_slug', $r['root_slug'] ); 230 242 231 // Does this component have a top-level directory? 243 /** 244 * Filters the component's top-level directory if available. 245 * 246 * @since BuddyPress (1.5.0) 247 * 248 * @param bool $value Whether or not there is a top-level directory. 249 */ 232 250 $this->has_directory = apply_filters( 'bp_' . $this->id . '_has_directory', $r['has_directory'] ); 233 251 234 // Does this component have a top-level directory? 252 /** 253 * Filters the component's directory title. 254 * 255 * @since BuddyPress (2.0.0) 256 * 257 * @param string $value Title to use for the directory. 258 */ 235 259 $this->directory_title = apply_filters( 'bp_' . $this->id . '_directory_title', $r['directory_title'] ); 236 260 237 // Search string 261 /** 262 * Filters the placeholder text for search inputs for component. 263 * 264 * @since BuddyPress (1.5.0) 265 * 266 * @param string $value Name to use in search input placeholders. 267 */ 238 268 $this->search_string = apply_filters( 'bp_' . $this->id . '_search_string', $r['search_string'] ); 239 269 240 // Notifications callback 270 /** 271 * Filters the callable function that formats the component's notifications. 272 * 273 * @since BuddyPress (1.5.0) 274 * 275 * @param string $value Function callback. 276 */ 241 277 $this->notification_callback = apply_filters( 'bp_' . $this->id . '_notification_callback', $r['notification_callback'] ); 242 278 … … 256 292 buddypress()->loaded_components[$this->slug] = $this->id; 257 293 258 // Call action 294 /** 295 * Fires at the end of the setup_globals method inside BP_Component. 296 * 297 * This is a dynamic hook that is based on the component string ID. 298 * 299 * @since BuddyPress (1.5.0) 300 */ 259 301 do_action( 'bp_' . $this->id . '_setup_globals' ); 260 302 } … … 321 363 } 322 364 323 // Call action 365 /** 366 * Fires at the end of the includes method inside BP_Component. 367 * 368 * This is a dynamic hook that is based on the component string ID. 369 * 370 * @since BuddyPress (1.5.0) 371 */ 324 372 do_action( 'bp_' . $this->id . '_includes' ); 325 373 } … … 381 429 add_action( 'bp_generate_rewrite_rules', array( $this, 'generate_rewrite_rules' ), 10 ); 382 430 383 // Additional actions can be attached here 431 /** 432 * Fires at the end of the setup_actions method inside BP_Component. 433 * 434 * This is a dynamic hook that is based on the component string ID. 435 * 436 * @since BuddyPress (1.5.0) 437 */ 384 438 do_action( 'bp_' . $this->id . '_setup_actions' ); 385 439 } … … 420 474 } 421 475 422 // Call action 476 /** 477 * Fires at the end of the setup_nav method inside BP_Component. 478 * 479 * This is a dynamic hook that is based on the component string ID. 480 * 481 * @since BuddyPress (1.5.0) 482 */ 423 483 do_action( 'bp_' . $this->id . '_setup_nav' ); 424 484 } … … 448 508 } 449 509 450 // Filter the passed admin nav 510 /** 511 * Filters the admin navigation passed into setup_admin_bar. 512 * 513 * This is a dynamic hook that is based on the component string ID. 514 * 515 * @since BuddyPress (1.9.0) 516 * 517 * @param array $wp_admin_nav Array of navigation items to add. 518 */ 451 519 $wp_admin_nav = apply_filters( 'bp_' . $this->id . '_admin_nav', $wp_admin_nav ); 452 520 … … 466 534 } 467 535 468 // Call action 536 /** 537 * Fires at the end of the setup_admin_bar method inside BP_Component. 538 * 539 * This is a dynamic hook that is based on the component string ID. 540 * 541 * @since BuddyPress (1.5.0) 542 */ 469 543 do_action( 'bp_' . $this->id . '_setup_admin_bar' ); 470 544 } … … 478 552 */ 479 553 public function setup_title() { 554 555 /** 556 * Fires in the setup_title method inside BP_Component. 557 * 558 * This is a dynamic hook that is based on the component string ID. 559 * 560 * @since BuddyPress (1.5.0) 561 */ 480 562 do_action( 'bp_' . $this->id . '_setup_title' ); 481 563 } … … 489 571 */ 490 572 public function setup_cache_groups() { 573 574 /** 575 * Fires in the setup_cache_groups method inside BP_Component. 576 * 577 * This is a dynamic hook that is based on the component string ID. 578 * 579 * @since BuddyPress (2.2.0) 580 */ 491 581 do_action( 'bp_' . $this->id . '_setup_cache_groups' ); 492 582 } … … 501 591 public function register_global_tables( $tables = array() ) { 502 592 503 // This filter allows for component-specific filtering of table names 504 // To filter *all* tables, use the 'bp_core_get_table_prefix' filter instead 593 /** 594 * Filters the global tables for the component, so that it may use WordPress' database API. 595 * 596 * This is a dynamic hook that is based on the component string ID. 597 * It allows for component-specific filtering of table names. To filter 598 * *all* tables, use the 'bp_core_get_table_prefix' filter instead. 599 * 600 * @since BuddyPress (1.6.0) 601 */ 505 602 $tables = apply_filters( 'bp_' . $this->id . '_global_tables', $tables ); 506 603 … … 515 612 } 516 613 614 /** 615 * Fires at the end of the register_global_tables method inside BP_Component. 616 * 617 * This is a dynamic hook that is based on the component string ID. 618 * 619 * @since BuddyPress (2.0.0) 620 */ 517 621 do_action( 'bp_' . $this->id . '_register_global_tables' ); 518 622 } … … 531 635 global $wpdb; 532 636 533 // This filter allows for component-specific filtering of table names 534 // To filter *all* tables, use the 'bp_core_get_table_prefix' filter instead 637 /** 638 * Filters the global meta_tables for the component. 639 * 640 * This is a dynamic hook that is based on the component string ID. 641 * It allows for component-specific filtering of table names. To filter 642 * *all* tables, use the 'bp_core_get_table_prefix' filter instead. 643 * 644 * @since BuddyPress (2.0.0) 645 */ 535 646 $tables = apply_filters( 'bp_' . $this->id . '_meta_tables', $tables ); 536 647 … … 548 659 } 549 660 661 /** 662 * Fires at the end of the register_meta_tables method inside BP_Component. 663 * 664 * This is a dynamic hook that is based on the component string ID. 665 * 666 * @since BuddyPress (2.0.0) 667 */ 550 668 do_action( 'bp_' . $this->id . '_register_meta_tables' ); 551 669 } … … 559 677 */ 560 678 public function register_post_types() { 679 680 /** 681 * Fires in the register_post_types method inside BP_Component. 682 * 683 * This is a dynamic hook that is based on the component string ID. 684 * 685 * @since BuddyPress (1.5.0) 686 */ 561 687 do_action( 'bp_' . $this->id . '_register_post_types' ); 562 688 } … … 570 696 */ 571 697 public function register_taxonomies() { 698 699 /** 700 * Fires in the register_taxonomies method inside BP_Component. 701 * 702 * This is a dynamic hook that is based on the component string ID. 703 * 704 * @since BuddyPress (1.5.0) 705 */ 572 706 do_action( 'bp_' . $this->id . '_register_taxonomies' ); 573 707 } … … 581 715 */ 582 716 public function add_rewrite_tags() { 717 718 /** 719 * Fires in the add_rewrite_tags method inside BP_Component. 720 * 721 * This is a dynamic hook that is based on the component string ID. 722 * 723 * @since BuddyPress (1.5.0) 724 */ 583 725 do_action( 'bp_' . $this->id . '_add_rewrite_tags' ); 584 726 } … … 592 734 */ 593 735 public function add_rewrite_rules() { 736 737 /** 738 * Fires in the add_rewrite_rules method inside BP_Component. 739 * 740 * This is a dynamic hook that is based on the component string ID. 741 * 742 * @since BuddyPress (1.9.0) 743 */ 594 744 do_action( 'bp_' . $this->id . '_add_rewrite_rules' ); 595 745 } … … 603 753 */ 604 754 public function add_permastructs() { 755 756 /** 757 * Fires in the add_permastructs method inside BP_Component. 758 * 759 * This is a dynamic hook that is based on the component string ID. 760 * 761 * @since BuddyPress (1.9.0) 762 */ 605 763 do_action( 'bp_' . $this->id . '_add_permastructs' ); 606 764 } … … 615 773 */ 616 774 public function parse_query( $query ) { 775 776 /** 777 * Fires in the parse_query method inside BP_Component. 778 * 779 * This is a dynamic hook that is based on the component string ID. 780 * 781 * @since BuddyPress (1.9.0) 782 * 783 * @param object $query Main WP_Query object. Passed by reference. 784 */ 617 785 do_action_ref_array( 'bp_' . $this->id . '_parse_query', array( &$query ) ); 618 786 } … … 626 794 */ 627 795 public function generate_rewrite_rules() { 796 797 /** 798 * Fires in the generate_rewrite_rules method inside BP_Component. 799 * 800 * This is a dynamic hook that is based on the component string ID. 801 * 802 * @since BuddyPress (1.5.0) 803 */ 628 804 do_action( 'bp_' . $this->id . '_generate_rewrite_rules' ); 629 805 } -
trunk/src/bp-core/bp-core-dependency.php
r9604 r9641 22 22 */ 23 23 function bp_include() { 24 25 /** 26 * Fires inside the 'bp_include' function, where plugins should include files. 27 * 28 * @since BuddyPress (1.2.5) 29 */ 24 30 do_action( 'bp_include' ); 25 31 } … … 29 35 */ 30 36 function bp_setup_components() { 37 38 /** 39 * Fires inside the 'bp_setup_components' function, where plugins should initialize components. 40 * 41 * @since BuddyPress (1.6.0) 42 */ 31 43 do_action( 'bp_setup_components' ); 32 44 } … … 36 48 */ 37 49 function bp_setup_canonical_stack() { 50 51 /** 52 * Fires inside the 'bp_setup_canonical_stack' function, where plugins should set up their canonical URL. 53 * 54 * @since BuddyPress (2.1.0) 55 */ 38 56 do_action( 'bp_setup_canonical_stack' ); 39 57 } … … 45 63 */ 46 64 function bp_register_taxonomies() { 65 66 /** 67 * Fires inside the 'bp_register_taxonomies' function, where plugins should register taxonomies. 68 * 69 * @since BuddyPress (2.2.0) 70 */ 47 71 do_action( 'bp_register_taxonomies' ); 48 72 } … … 52 76 */ 53 77 function bp_setup_globals() { 78 79 /** 80 * Fires inside the 'bp_setup_globals' function, where plugins should initialize global settings. 81 * 82 * @since BuddyPress (1.2.0) 83 */ 54 84 do_action( 'bp_setup_globals' ); 55 85 } … … 59 89 */ 60 90 function bp_setup_nav() { 91 92 /** 93 * Fires inside the 'bp_setup_nav' function, where plugins should register their navigation items. 94 * 95 * @since BuddyPress (1.2.0) 96 */ 61 97 do_action( 'bp_setup_nav' ); 62 98 } … … 66 102 */ 67 103 function bp_setup_admin_bar() { 68 if ( bp_use_wp_admin_bar() ) 104 if ( bp_use_wp_admin_bar() ) { 105 106 /** 107 * Fires inside the 'bp_setup_admin_bar' function, where plugins should add items to the WP admin bar. 108 * 109 * This hook will only fire if bp_use_wp_admin_bar() returns true. 110 * 111 * @since BuddyPress (1.5.0) 112 */ 69 113 do_action( 'bp_setup_admin_bar' ); 114 } 70 115 } 71 116 … … 74 119 */ 75 120 function bp_setup_title() { 121 122 /** 123 * Fires inside the 'bp_setup_title' function, where plugins should modify the page title. 124 * 125 * @since BuddyPress (1.5.0) 126 */ 76 127 do_action( 'bp_setup_title' ); 77 128 } … … 81 132 */ 82 133 function bp_setup_widgets() { 134 135 /** 136 * Fires inside the 'bp_register_widgets' function, where plugins should register widgets. 137 * 138 * @since BuddyPress (1.2.0) 139 */ 83 140 do_action( 'bp_register_widgets' ); 84 141 } … … 90 147 */ 91 148 function bp_setup_cache_groups() { 149 150 /** 151 * Fires inside the 'bp_setup_cache_groups' function, where cache groups are registered. 152 * 153 * @since BuddyPress (2.2.0) 154 */ 92 155 do_action( 'bp_setup_cache_groups' ); 93 156 } … … 112 175 } 113 176 177 /** 178 * Fires to set up the current user setup process. 179 * 180 * @since BuddyPress (1.7.0) 181 */ 114 182 do_action( 'bp_setup_current_user' ); 115 183 } … … 119 187 */ 120 188 function bp_init() { 189 190 /** 191 * Fires inside the 'bp_init' function, BuddyPress' main initialization hook. 192 * 193 * @since BuddyPress (1.2.0) 194 */ 121 195 do_action( 'bp_init' ); 122 196 } … … 128 202 */ 129 203 function bp_loaded() { 204 205 /** 206 * Fires inside the 'bp_loaded' function, which fires after BP's core plugin files have been loaded. 207 * 208 * @since BuddyPress (1.2.5) 209 */ 130 210 do_action( 'bp_loaded' ); 131 211 } … … 137 217 */ 138 218 function bp_ready() { 219 220 /** 221 * Fires inside the 'bp_ready' function, which runs after BP is set up and the page is about to render. 222 * 223 * @since BuddyPress (1.6.0) 224 */ 139 225 do_action( 'bp_ready' ); 140 226 } … … 147 233 */ 148 234 function bp_actions() { 235 236 /** 237 * Fires inside the 'bp_actions' function, which runs just before rendering. 238 * 239 * @since BuddyPress (1.5.0) 240 */ 149 241 do_action( 'bp_actions' ); 150 242 } … … 157 249 */ 158 250 function bp_screens() { 251 252 /** 253 * Fires inside the 'bp_screens' function, which runs just before rendering. 254 * 255 * Runs just after 'bp_actions'. Use this hook to attach your template loaders. 256 * 257 * @since BuddyPress (1.5.0) 258 */ 159 259 do_action( 'bp_screens' ); 160 260 } … … 166 266 */ 167 267 function bp_widgets_init() { 268 269 /** 270 * Fires inside the 'bp_widgets_init' function, which runs after widgets have been set up. 271 * 272 * Hooked to 'widgets_init'. 273 * 274 * @since BuddyPress (1.6.0) 275 */ 168 276 do_action ( 'bp_widgets_init' ); 169 277 } … … 192 300 */ 193 301 function bp_template_redirect() { 302 303 /** 304 * Fires inside the 'bp_template_redirect' function. 305 * 306 * @since BuddyPress (1.6.0) 307 */ 194 308 do_action( 'bp_template_redirect' ); 195 309 } … … 207 321 */ 208 322 function bp_register_theme_directory() { 323 324 /** 325 * Fires inside the 'bp_register_theme_directory' function. 326 * 327 * The main action used registering theme directories. 328 * 329 * @since BuddyPress (1.7.0) 330 */ 209 331 do_action( 'bp_register_theme_directory' ); 210 332 } … … 220 342 */ 221 343 function bp_register_theme_packages() { 344 345 /** 346 * Fires inside the 'bp_register_theme_packages' function. 347 * 348 * @since BuddyPress (1.7.0) 349 */ 222 350 do_action( 'bp_register_theme_packages' ); 223 351 } … … 231 359 */ 232 360 function bp_enqueue_scripts() { 361 362 /** 363 * Fires inside the 'bp_enqueue_scripts' function, where BP enqueues its CSS and JS. 364 * 365 * @since BuddyPress (1.6.0) 366 */ 233 367 do_action ( 'bp_enqueue_scripts' ); 234 368 } … … 242 376 */ 243 377 function bp_add_rewrite_tags() { 378 379 /** 380 * Fires inside the 'bp_add_rewrite_tags' function, where BP adds its custom rewrite tags. 381 * 382 * @since BuddyPress (1.8.0) 383 */ 244 384 do_action( 'bp_add_rewrite_tags' ); 245 385 } … … 253 393 */ 254 394 function bp_add_rewrite_rules() { 395 396 /** 397 * Fires inside the 'bp_add_rewrite_rules' function, where BP adds its custom rewrite rules. 398 * 399 * @since BuddyPress (1.9.0) 400 */ 255 401 do_action( 'bp_add_rewrite_rules' ); 256 402 } … … 264 410 */ 265 411 function bp_add_permastructs() { 412 413 /** 414 * Fires inside the 'bp_add_permastructs' function, where BP adds its BP-specific permalink structure. 415 * 416 * @since BuddyPress (1.9.0) 417 */ 266 418 do_action( 'bp_add_permastructs' ); 267 419 } … … 278 430 */ 279 431 function bp_setup_theme() { 432 433 /** 434 * Fires inside the 'bp_setup_theme' function. 435 * 436 * @since BuddyPress (1.6.0) 437 */ 280 438 do_action ( 'bp_setup_theme' ); 281 439 } … … 296 454 */ 297 455 function bp_after_setup_theme() { 456 457 /** 458 * Fires inside the 'bp_after_setup_theme' function. 459 * 460 * @since BuddyPress (1.7.0) 461 */ 298 462 do_action ( 'bp_after_setup_theme' ); 299 463 } … … 312 476 */ 313 477 function bp_request( $query_vars = array() ) { 478 479 /** 480 * Filters the query_vars for the current request. 481 * 482 * @since BuddyPress (1.7.0) 483 * 484 * @param array $query_vars Array of query variables. 485 */ 314 486 return apply_filters( 'bp_request', $query_vars ); 315 487 } … … 322 494 * @param string $redirect_to See 'login_redirect'. 323 495 * @param string $redirect_to_raw See 'login_redirect'. 324 * @param string $user See 'login_redirect'. 496 * @param bool $user See 'login_redirect'. 497 * 498 * @return string 325 499 */ 326 500 function bp_login_redirect( $redirect_to = '', $redirect_to_raw = '', $user = false ) { 501 502 /** 503 * Filters the URL to redirect to after login. 504 * 505 * @since BuddyPress (1.7.0) 506 * 507 * @param string $redirect_to The redirect destination URL. 508 * @param string $redirect_to_raw The requested redirect destination URL passed as a parameter. 509 * @param WP_User|WP_Error $user WP_User object if login was successful, WP_Error object otherwise. 510 */ 327 511 return apply_filters( 'bp_login_redirect', $redirect_to, $redirect_to_raw, $user ); 328 512 } … … 341 525 */ 342 526 function bp_template_include( $template = '' ) { 527 528 /** 529 * Filters the template to use with template_include. 530 * 531 * @since BuddyPress (1.6.0) 532 * 533 * @param string $template The path of the template to include. 534 */ 343 535 return apply_filters( 'bp_template_include', $template ); 344 536 } 345 537 346 538 /** 347 * Fire the 'bp_generate_rewrite_rules' filter, where BP generates its rewrite rules.539 * Fire the 'bp_generate_rewrite_rules' action, where BP generates its rewrite rules. 348 540 * 349 541 * @since BuddyPress (1.7.0) … … 354 546 */ 355 547 function bp_generate_rewrite_rules( $wp_rewrite ) { 548 549 /** 550 * Fires inside the 'bp_generate_rewrite_rules' function. 551 * 552 * @since BuddyPress (1.7.0) 553 * 554 * @param WP_Rewrite $wp_rewrite WP_Rewrite object. Passed by reference. 555 */ 356 556 do_action_ref_array( 'bp_generate_rewrite_rules', array( &$wp_rewrite ) ); 357 557 } … … 367 567 */ 368 568 function bp_allowed_themes( $themes ) { 569 570 /** 571 * Filters the allowed themes list for BuddyPress-specific themes. 572 * 573 * @since BuddyPress (1.7.0) 574 * 575 * @param string $template The path of the template to include. 576 */ 369 577 return apply_filters( 'bp_allowed_themes', $themes ); 370 578 } … … 393 601 $action = sanitize_key( $_POST['action'] ); 394 602 395 // This dynamic action is probably the one you want to use. It narrows down 396 // the scope of the 'action' without needing to check it in your function. 603 /** 604 * Fires at the end of the bp_post_request function. 605 * 606 * This dynamic action is probably the one you want to use. It narrows down 607 * the scope of the 'action' without needing to check it in your function. 608 * 609 * @since BuddyPress (1.9.0) 610 */ 397 611 do_action( 'bp_post_request_' . $action ); 398 612 399 // Use this static action if you don't mind checking the 'action' yourself. 613 /** 614 * Fires at the end of the bp_post_request function. 615 * 616 * Use this static action if you don't mind checking the 'action' yourself. 617 * 618 * @since BuddyPress (1.9.0) 619 * 620 * @param string $action The action being run. 621 */ 400 622 do_action( 'bp_post_request', $action ); 401 623 } … … 422 644 $action = sanitize_key( $_GET['action'] ); 423 645 424 // This dynamic action is probably the one you want to use. It narrows down 425 // the scope of the 'action' without needing to check it in your function. 646 /** 647 * Fires at the end of the bp_get_request function. 648 * 649 * This dynamic action is probably the one you want to use. It narrows down 650 * the scope of the 'action' without needing to check it in your function. 651 * 652 * @since BuddyPress (1.9.0) 653 */ 426 654 do_action( 'bp_get_request_' . $action ); 427 655 428 // Use this static action if you don't mind checking the 'action' yourself. 656 /** 657 * Fires at the end of the bp_get_request function. 658 * 659 * Use this static action if you don't mind checking the 'action' yourself. 660 * 661 * @since BuddyPress (1.9.0) 662 * 663 * @param string $action The action being run. 664 */ 429 665 do_action( 'bp_get_request', $action ); 430 666 }
Note: See TracChangeset
for help on using the changeset viewer.