Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/22/2013 01:55:08 AM (12 years ago)
Author:
boonebgorges
Message:

Improve inline docs in bp-core. See #5022

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-template-loader.php

    r7432 r7452  
    22
    33/**
    4  * BuddyPress Template Functions
     4 * BuddyPress Template Functions.
    55 *
    66 * This file contains functions necessary to mirror the WordPress core template
     
    1616
    1717/**
    18  * Adds BuddyPress theme support to any active WordPress theme
    19  *
    20  * @since BuddyPress (1.7)
    21  *
    22  * @param string $slug
    23  * @param string $name Optional. Default null
     18 * Get a BuddyPress template part for display in a theme.
     19 *
     20 * @since BuddyPress (1.7.0)
     21 *
    2422 * @uses bp_locate_template()
    2523 * @uses load_template()
    2624 * @uses get_template_part()
     25 *
     26 * @param string $slug Template part slug. Used to generate filenames, eg
     27 *        'friends' for 'friends.php'.
     28 * @param string $name Optional. Template part name. Used to generate
     29 *        secondary filenames, eg 'personal' for 'activity-personal.php'.
     30 * @return string Path to located template. See {@link bp_locate_template()}.
    2731 */
    2832function bp_get_template_part( $slug, $name = null ) {
     
    5155 * not found in either of those, it looks in the theme-compat folder last.
    5256 *
    53  * @since BuddyPress (1.7)
     57 * @since BuddyPress (1.7.0)
    5458 *
    5559 * @param string|array $template_names Template file(s) to search for, in order.
    56  * @param bool $load If true the template file will be loaded if it is found.
    57  * @param bool $require_once Whether to require_once or require. Default true.
    58  *                            Has no effect if $load is false.
     60 * @param bool $load Optional. If true, the template file will be loaded when
     61 *        found. If false, the path will be returned. Default: false.
     62 * @param bool $require_once Optional. Whether to require_once or require. Has
     63 *        no effect if $load is false. Default: true.
    5964 * @return string The template filename if one is located.
    6065 */
     
    98103
    99104/**
    100  * This is really cool. This function registers a new template stack location,
    101  * using WordPress's built in filters API.
     105 * Register a new template stack location.
    102106 *
    103107 * This allows for templates to live in places beyond just the parent/child
     
    105109 * with bp_locate_template(), this allows for easy template overrides.
    106110 *
    107  * @since BuddyPress (1.7)
    108  *
    109  * @param string $location Callback function that returns the stack location
    110  * @param int $priority
     111 * @since BuddyPress (1.7.0)
     112 *
     113 * @todo Make 'callable' instead of 'function'.
     114 *
     115 * @param string $location Callback function that returns the stack location.
     116 * @param int $priority Optional. The priority parameter as passed to
     117 *        add_filter(). Default: 10.
     118 * @return bool See {@link add_filter()}.
    111119 */
    112120function bp_register_template_stack( $location_callback = '', $priority = 10 ) {
     
    121129
    122130/**
    123  * Deregisters a previously registered template stack location.
    124  *
    125  * @since BuddyPress (1.7)
    126  *
    127  * @param string $location Callback function that returns the stack location
    128  * @param int $priority
     131 * Deregister a previously registered template stack location.
     132 *
     133 * @since BuddyPress (1.7.0)
     134 *
    129135 * @see bp_register_template_stack()
     136 *
     137 * @param string $location Callback function that returns the stack location.
     138 * @param int $priority Optional. The priority parameter passed to
     139 *        {@link bp_register_template_stack()}. Default: 10.
     140 * @return bool See {@link remove_filter()}.
    130141 */
    131142function bp_deregister_template_stack( $location_callback = '', $priority = 10 ) {
     
    140151
    141152/**
    142  * Call the functions added to the 'bp_template_stack' filter hook, and return
     153 * Get the "template stack", a list of registered directories where templates can be found.
     154 *
     155 * Calls the functions added to the 'bp_template_stack' filter hook, and return
    143156 * an array of the template locations.
    144157 *
    145158 * @see bp_register_template_stack()
    146159 *
    147  * @since BuddyPress (1.7)
    148  *
    149  * @global array $wp_filter Stores all of the filters
    150  * @global array $merged_filters Merges the filter hooks using this function.
    151  * @global array $wp_current_filter stores the list of current filters with the current one last
    152  *
     160 * @since BuddyPress (1.7.0)
     161 *
     162 * @global array $wp_filter Stores all of the filters.
     163 * @global array $merged_filters Merges the filter hooks using this function..
     164 * @global array $wp_current_filter stores the list of current filters with
     165 *         the current one last.
    153166 * @return array The filtered value after all hooked functions are applied to it.
    154167 */
     
    192205
    193206/**
    194  * Get a template part in an output buffer, and return it
    195  *
    196  * @since BuddyPress (1.7)
    197  *
    198  * @param string $slug
    199  * @param string $name
    200  * @return string
     207 * Put a template part into an output buffer, and return it.
     208 *
     209 * @since BuddyPress (1.7.0)
     210 *
     211 * @see bp_get_template_part() for a description of $slug and $name params.
     212 *
     213 * @param string $slug See {@link bp_get_template_part()}.
     214 * @param string $name See {@link bp_get_template_part()}.
     215 * @param bool $echo If true, template content will be echoed. If false,
     216 *        returned. Default: true.
     217 * @return string|null If $echo, returns the template content.
    201218 */
    202219function bp_buffer_template_part( $slug, $name = null, $echo = true ) {
     
    223240
    224241/**
    225  * Retrieve path to a template
     242 * Retrieve the path to a template.
    226243 *
    227244 * Used to quickly retrieve the path of a template without including the file
     
    230247 * locations without the use of the other get_*_template() functions.
    231248 *
    232  * @since BuddyPress (1.7)
    233  *
    234  * @param string $type Filename without extension.
    235  * @param array $templates An optional list of template candidates
     249 * @since BuddyPress (1.7.0)
     250 *
    236251 * @uses bp_set_theme_compat_templates()
    237252 * @uses bp_locate_template()
    238253 * @uses bp_set_theme_compat_template()
     254 *
     255 * @param string $type Filename without extension.
     256 * @param array $templates An optional list of template candidates.
    239257 * @return string Full path to file.
    240258 */
     
    272290
    273291/**
    274  * Add template locations to template files being searched for
    275  *
    276  * @since BuddyPress (1.7)
    277  *
    278  * @param array $stacks
    279  * @return array()
     292 * Add template locations to template files being searched for.
     293 *
     294 * @since BuddyPress (1.7.0)
     295 *
     296 * @param array $stacks Array of template locations.
     297 * @return array() Array of all template locations registered so far.
    280298 */
    281299function bp_add_template_stack_locations( $stacks = array() ) {
     
    294312
    295313/**
    296  * Add checks for BuddyPress conditions to parse_query action
    297  *
    298  * @since BuddyPress (1.7)
     314 * Add checks for BuddyPress conditions to 'parse_query' action.
     315 *
     316 * @since BuddyPress (1.7.0)
    299317 *
    300318 * @param WP_Query $posts_query
     
    319337
    320338/**
    321  * Possibly intercept the template being loaded
     339 * Possibly intercept the template being loaded.
    322340 *
    323341 * Listens to the 'template_include' filter and waits for any BuddyPress specific
     
    328346 * from being stomped on accident.
    329347 *
    330  * @since BuddyPress (1.7)
     348 * @since BuddyPress (1.7.0)
    331349 *
    332350 * @param string $template
    333  *
    334  * @return string The path to the template file that is being used
     351 * @return string The path to the template file that is being used.
    335352 */
    336353function bp_template_include_theme_supports( $template = '' ) {
     
    349366
    350367/**
    351  * Set the included template
    352  *
    353  * @since BuddyPress (1.8)
    354  * @param mixed $template Default false
    355  * @return mixed False if empty. Template name if template included
     368 * Set the included template.
     369 *
     370 * @since BuddyPress (1.8.0)
     371 *
     372 * @param mixed $template Default: false.
     373 * @return mixed False if empty. Template name if template included.
    356374 */
    357375function bp_set_template_included( $template = false ) {
     
    364382 * Is a BuddyPress template being included?
    365383 *
    366  * @since BuddyPress (1.8)
    367  * @return bool True if yes, false if no
     384 * @since BuddyPress (1.8.0)
     385 * @return bool True if yes, false if no.
    368386 */
    369387function bp_is_template_included() {
     
    372390
    373391/**
    374  * Attempt to load a custom BuddyPress functions file, similar to each themes
    375  * functions.php file.
    376  *
    377  * @since BuddyPress (1.7)
     392 * Attempt to load a custom BP functions file, similar to each themes functions.php file.
     393 *
     394 * @since BuddyPress (1.7.0)
    378395 *
    379396 * @global string $pagenow
     
    399416
    400417/**
    401  * Get the templates to use as the endpoint for BuddyPress template parts
    402  *
    403  * @since BuddyPress (1.7)
    404  *
    405  * @uses apply_filters()
    406  * @return array Of possible root level wrapper template files
     418 * Get the templates to use as the endpoint for BuddyPress template parts.
     419 *
     420 * @since BuddyPress (1.7.0)
     421 *
     422 * @return array Array of possible root level wrapper template files.
    407423 */
    408424function bp_get_theme_compat_templates() {
Note: See TracChangeset for help on using the changeset viewer.