Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/23/2013 06:47:12 PM (13 years ago)
Author:
boonebgorges
Message:

Improve inline docs in bp-forums. See #5022

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-forums/bp-forums-bbpress-sa.php

    r7298 r7468  
    11<?php
    22/**
    3  * BuddyPress bbPress 1.x integration
     3 * BuddyPress bbPress 1.x integration.
    44 *
    55 * @package BuddyPress
     
    1010if ( !defined( 'ABSPATH' ) ) exit;
    1111
     12/**
     13 * Bootstrap bbPress 1.x, and manipulate globals to integrate with BuddyPress.
     14 *
     15 * @return bool|null Returns false on failure.
     16 */
    1217function bp_forums_load_bbpress() {
    1318        global $bp, $wpdb, $wp_roles, $current_user, $wp_users_object;
     
    122127add_action( 'bbpress_init', 'bp_forums_load_bbpress' );
    123128
    124 /* WP to bbP wrapper functions */
     129/** WP to bbPress wrapper functions ******************************************/
     130
     131/**
     132 * Get the current bbPress user.
     133 *
     134 * @return object $current_user Current user object from WordPress.
     135 */
    125136function bb_get_current_user() { global $current_user; return $current_user; }
     137
     138/**
     139 * Get userdata for a bbPress user.
     140 *
     141 * @param int $user_id User ID.
     142 * @return object User data from WordPress.
     143 */
    126144function bb_get_user( $user_id ) { return get_userdata( $user_id ); }
     145
     146/**
     147 * Cache users.
     148 *
     149 * Noop.
     150 *
     151 * @param array $users
     152 */
    127153function bb_cache_users( $users ) {}
    128154
     
    141167
    142168/**
    143  * bbPress needs the DB class to be BPDB, but we want to use WPDB, so we can
    144  * extend it and use this.
     169 * bbPress needs the DB class to be BPDB, but we want to use WPDB, so we can extend it and use this.
    145170 *
    146171 * The class is pluggable, so that plugins that swap out WPDB with a custom
     
    152177                var $db_servers = array();
    153178
     179                /**
     180                 * Constructor
     181                 *
     182                 * @see WPDB::__construct() for description of parameters.
     183                 */
    154184                function __construct( $dbuser, $dbpassword, $dbname, $dbhost ) {
    155185                        parent::__construct( $dbuser, $dbpassword, $dbname, $dbhost );
     
    165195                 * Determine if a database supports a particular feature.
    166196                 *
    167                  * Overriden here to work around differences between bbPress', and WordPress', implementation differences.
    168                  * In particular, when BuddyPress tries to run bbPress' SQL installation script, the collation check always
    169                  * failed. The capability is long supported by WordPress' minimum required MySQL version, so this is safe.
     197                 * Overriden here to work around differences between bbPress's
     198                 * and WordPress's implementations. In particular, when
     199                 * BuddyPress tries to run bbPress' SQL installation script,
     200                 * the collation check always failed. The capability is long
     201                 * supported by WordPress' minimum required MySQL version, so
     202                 * this is safe.
     203                 *
     204                 * @see WPDB::has_cap() for a description of parameters and
     205                 *      return values.
     206                 *
     207                 * @param string $db_cap See {@link WPDB::has_cap()}.
     208                 * @param string $_table_name See {@link WPDB::has_cap()}.
     209                 * @return bool See {@link WPDB::has_cap()}.
    170210                 */
    171211                function has_cap( $db_cap, $_table_name='' ) {
     
    177217
    178218                /**
    179                  * Initialises the class variables based on provided arguments.
    180                  * Based on, and taken from, the BackPress class in turn taken from the 1.0 branch of bbPress.
     219                 * Initialize the class variables based on provided arguments.
     220                 *
     221                 * Based on, and taken from, the BackPress class in turn taken
     222                 * from the 1.0 branch of bbPress.
     223                 *
     224                 * @see BBDB::__construct() for a description of params.
    181225                 */
    182226                function init( $args ) {
     
    205249                }
    206250
     251                /**
     252                 * Stub for escape_deep() compatibility.
     253                 *
     254                 * @see WPDB::escape_deep() for description of parameters and
     255                 *      return values.
     256                 *
     257                 * @param mixed $data See {@link WPDB::escape_deep()}.
     258                 * @return mixed $data See {@link WPDB::escape_deep()}.
     259                 */
    207260                function escape_deep( $data ) {
    208261                        return $this->escape( $data );
     
    211264endif; // class_exists( 'BPDB' )
    212265
    213 /* BBPress needs this function to convert vars */
     266/**
     267 * Convert object to given output format.
     268 *
     269 * bbPress needs this to convert vars.
     270 *
     271 * @param object $object Object to convert.
     272 * @param string $output Type of object to return. OBJECT, ARRAY_A, or ARRAY_N.
     273 */
    214274function backpress_convert_object( &$object, $output ) {
    215275        if ( is_array( $object ) ) {
     
    226286
    227287/**
     288 * Parse and execute queries for updating a set of database tables.
     289 *
    228290 * Copied from wp-admin/includes/upgrade.php, this will take care of creating
    229291 * the bbPress stand-alone tables without loading a conflicting WP Admin.
    230292 *
    231  * @param array $queries
    232  * @param bool $execute Optional; defaults to true.
    233  * @return array
     293 * @see dbDelta() for a description of parameters and return value.
     294 *
     295 * @param array $queries See {@link dbDelta()}.
     296 * @param bool $execute See {@link dbDelta()}.
     297 * @return array See {@link dbDelta()}.
    234298 */
    235299function bp_bb_dbDelta($queries, $execute = true) {
Note: See TracChangeset for help on using the changeset viewer.