Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
07/10/2013 07:57:39 PM (12 years ago)
Author:
r-a-y
Message:

Better phpDoc and inline comments for bp_register_theme_package().

Props ericlewis. Fixes #5088.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-theme-compatibility.php

    r7228 r7266  
    316316 * Register a new BuddyPress theme package to the active theme packages array
    317317 *
    318  * @since BuddyPress (1.7)
    319  * @param array $theme
     318 * The $theme parameter is an array, which takes the following values:
     319 *
     320 *  'id'      - ID for your theme package; should be alphanumeric only
     321 *  'name'    - Name of your theme package
     322 *  'version' - Version of your theme package
     323 *  'dir'     - Directory where your theme package resides
     324 *  'url'     - URL where your theme package resides
     325 *
     326 * For an example of how this function is used, see:
     327 * {@link BuddyPress::register_theme_packages()}.
     328 *
     329 * @since BuddyPress (1.7)
     330 *
     331 * @param array $theme The theme package arguments. See phpDoc for more details.
     332 * @param bool $override If true, overrides whatever package is currently set.
    320333 */
    321334function bp_register_theme_package( $theme = array(), $override = true ) {
    322335
    323336    // Create new BP_Theme_Compat object from the $theme array
    324     if ( is_array( $theme ) )
     337    if ( is_array( $theme ) ) {
    325338        $theme = new BP_Theme_Compat( $theme );
     339    }
    326340
    327341    // Bail if $theme isn't a proper object
    328     if ( ! is_a( $theme, 'BP_Theme_Compat' ) )
     342    if ( ! is_a( $theme, 'BP_Theme_Compat' ) ) {
    329343        return;
     344    }
    330345
    331346    // Load up BuddyPress
    332347    $bp = buddypress();
    333348
    334     // Only override if the flag is set and not previously registered
     349    // Only set if the theme package was not previously registered or if the
     350    // override flag is set
    335351    if ( empty( $bp->theme_compat->packages[$theme->id] ) || ( true === $override ) ) {
    336352        $bp->theme_compat->packages[$theme->id] = $theme;
Note: See TracChangeset for help on using the changeset viewer.