Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
05/03/2015 06:51:25 PM (9 years ago)
Author:
tw2113
Message:

First pass at cleanup of Activity component documetnation.

See #6396.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/classes/class-bp-activity-activity.php

    r9819 r9833  
    123123     * Constructor method.
    124124     *
    125      * @param int $id Optional. The ID of a specific activity item.
     125     * @param int|bool $id Optional. The ID of a specific activity item.
    126126     */
    127127    public function __construct( $id = false ) {
     
    212212         * @since BuddyPress (1.0.0)
    213213         *
    214          * @param BP_Activity_Activity Current instance of the activity item being saved.
     214         * @param BP_Activity_Activity $this Current instance of the activity item being saved. Passed by reference.
    215215         */
    216216        do_action_ref_array( 'bp_activity_before_save', array( &$this ) );
     
    249249         * @since BuddyPress (1.0.0)
    250250         *
    251          * @param BP_Activity_Activity Reference to current instance of activity being saved.
     251         * @param BP_Activity_Activity $this Current instance of activity item being saved. Passed by reference.
    252252         */
    253253        do_action_ref_array( 'bp_activity_after_save', array( &$this ) );
     
    460460         *
    461461         * @param array  $where_conditions Current conditions for MySQL WHERE statement.
    462          * @param array  $r Parsed arguments passed into method.
    463          * @param string $select_sql Current SELECT MySQL statement at point of execution.
    464          * @param string $from_sql Current FROM MySQL statement at point of execution.
    465          * @param string $join_sql Current INNER JOIN MySQL statement at point of execution.
     462         * @param array  $r                Parsed arguments passed into method.
     463         * @param string $select_sql       Current SELECT MySQL statement at point of execution.
     464         * @param string $from_sql         Current FROM MySQL statement at point of execution.
     465         * @param string $join_sql         Current INNER JOIN MySQL statement at point of execution.
    466466         */
    467467        $where_conditions = apply_filters( 'bp_activity_get_where_conditions', $where_conditions, $r, $select_sql, $from_sql, $join_sql );
     
    509509         * @since BuddyPress (2.0.0)
    510510         *
    511          * @param bool                 Whether to use legacy structure or not.
    512          * @param BP_Activity_Activity Current method being called.
    513          * @param array                $r Parsed arguments passed into method.
     511         * @param bool                 $value Whether to use legacy structure or not.
     512         * @param BP_Activity_Activity $value Current method being called.
     513         * @param array                $r     Parsed arguments passed into method.
    514514         */
    515515        if ( apply_filters( 'bp_use_legacy_activity_query', false, __METHOD__, $r ) ) {
     
    532532                 * @since BuddyPress (1.5.0)
    533533                 *
    534                  * @param string Concatenated MySQL statement pieces to be query results with for legacy query.
     534                 * @param string $value      Concatenated MySQL statement pieces to be query results with for legacy query.
    535535                 * @param string $select_sql Final SELECT MySQL statement portion for legacy query.
    536                  * @param string $from_sql Final FROM MySQL statement portion for legacy query.
    537                  * @param string $where_sql Final WHERE MySQL statement portion for legacy query.
    538                  * @param string $sort Final sort direction for legacy query.
     536                 * @param string $from_sql   Final FROM MySQL statement portion for legacy query.
     537                 * @param string $where_sql  Final WHERE MySQL statement portion for legacy query.
     538                 * @param string $sort       Final sort direction for legacy query.
    539539                 */
    540540                $activities = $wpdb->get_results( apply_filters( 'bp_activity_get_user_join_filter', "{$select_sql} {$from_sql} {$join_sql} {$where_sql} ORDER BY a.date_recorded {$sort}", $select_sql, $from_sql, $where_sql, $sort, $pag_sql ) );
     
    557557             *
    558558             * @param string $activity_ids_sql MySQL statement used to query for Activity IDs.
    559              * @param array  $r Array of arguments passed into method.
     559             * @param array  $r                Array of arguments passed into method.
    560560             */
    561561            $activity_ids_sql = apply_filters( 'bp_activity_paged_activities_sql', $activity_ids_sql, $r );
     
    607607             * @since BuddyPress (1.5.0)
    608608             *
    609              * @param string MySQL statement used to query for total activities.
     609             * @param string $value     MySQL statement used to query for total activities.
    610610             * @param string $where_sql MySQL WHERE statement portion.
    611              * @param string $sort sort direction for query.
     611             * @param string $sort      Sort direction for query.
    612612             */
    613613            $total_activities_sql = apply_filters( 'bp_activity_total_activities_sql', "SELECT count(DISTINCT a.id) FROM {$bp->activity->table_name} a {$join_sql} {$where_sql}", $where_sql, $sort );
     
    632632     *
    633633     * @param array $activity_ids Array of activity IDs.
     634     *
    634635     * @return array
    635636     */
     
    696697     *
    697698     * @param array $activities Activities array.
     699     *
    698700     * @return array
    699701     */
     
    736738     *
    737739     * @param array $activities Array of activities.
     740     *
     741     * @return array $activities Array of activities.
    738742     */
    739743    protected static function prefetch_object_data( $activities ) {
     
    760764     *
    761765     * @param array $activities Array of activities.
     766     *
    762767     * @return array
    763768     */
     
    787792     *
    788793     * @param array $meta_query An array of meta_query filters. See the
    789      *   documentation for WP_Meta_Query for details.
     794     *                          documentation for WP_Meta_Query for details.
     795     *
    790796     * @return array $sql_array 'join' and 'where' clauses.
    791797     */
     
    827833     *
    828834     * @param array $date_query An array of date_query parameters. See the
    829      *        documentation for the first parameter of WP_Date_Query.
     835     *                          documentation for the first parameter of WP_Date_Query.
     836     *
    830837     * @return string
    831838     */
     
    855862     * @param  array $r      Current activity arguments. Same as those of BP_Activity_Activity::get(),
    856863     *                       but merged with defaults.
     864     *
    857865     * @return array 'sql' WHERE SQL string and 'override' activity args
    858866     */
     
    956964     * @deprecated Use BP_Activity_Activity::get() with an 'in' parameter instead.
    957965     *
    958      * @param mixed $activity_ids Array or comma-separated string of activity IDs to retrieve
    959      * @param int $max Maximum number of results to return. (Optional; default is no maximum)
    960      * @param int $page The set of results that the user is viewing. Used in pagination. (Optional; default is 1)
    961      * @param int $per_page Specifies how many results per page. Used in pagination. (Optional; default is 25)
    962      * @param string MySQL column sort; ASC or DESC. (Optional; default is DESC)
    963      * @param bool $display_comments Retrieve an activity item's associated comments or not. (Optional; default is false)
     966     * @param mixed    $activity_ids    Array or comma-separated string of activity IDs to retrieve
     967     * @param int|bool $max              Maximum number of results to return. (Optional; default is no maximum)
     968     * @param int      $page            The set of results that the user is viewing. Used in pagination. (Optional; default is 1)
     969     * @param int      $per_page        Specifies how many results per page. Used in pagination. (Optional; default is 25)
     970     * @param string   $sort             MySQL column sort; ASC or DESC. (Optional; default is DESC)
     971     * @param bool     $display_comments Retrieve an activity item's associated comments or not. (Optional; default is false)
    964972     * @return array
    965973     */
     
    10411049     *
    10421050     * @param array $args {
    1043      *     @int $id Optional. The ID of a specific item to delete.
    1044      *     @string $action Optional. The action to filter by.
    1045      *     @string $content Optional. The content to filter by.
    1046      *     @string $component Optional. The component name to filter by.
    1047      *     @string $type Optional. The activity type to filter by.
    1048      *     @string $primary_link Optional. The primary URL to filter by.
    1049      *     @int $user_id Optional. The user ID to filter by.
    1050      *     @int $item_id Optional. The associated item ID to filter by.
    1051      *     @int $secondary_item_id Optional. The secondary associated item ID to filter by.
    1052      *     @string $date_recorded Optional. The date to filter by.
    1053      *     @int $hide_sitewide Optional. Default: false.
     1051     *     @int    $id                Optional. The ID of a specific item to delete.
     1052     *     @string $action            Optional. The action to filter by.
     1053     *     @string $content           Optional. The content to filter by.
     1054     *     @string $component         Optional. The component name to filter by.
     1055     *     @string $type              Optional. The activity type to filter by.
     1056     *     @string $primary_link      Optional. The primary URL to filter by.
     1057     *     @int    $user_id          Optional. The user ID to filter by.
     1058     *     @int    $item_id          Optional. The associated item ID to filter by.
     1059     *     @int    $secondary_item_id Optional. The secondary associated item ID to filter by.
     1060     *     @string $date_recorded     Optional. The date to filter by.
     1061     *     @int    $hide_sitewide    Optional. Default: false.
    10541062     * }
     1063     *
    10551064     * @return array|bool An array of deleted activity IDs on success, false on failure.
    10561065     */
     
    12161225     *
    12171226     * @param array $activity_ids Activity IDs whose comments should be deleted.
    1218      * @param bool $delete_meta Should we delete the activity meta items for these comments?
     1227     * @param bool  $delete_meta  Should we delete the activity meta items for these comments?
     1228     *
    12191229     * @return bool True on success.
    12201230     */
     
    12451255     *
    12461256     * @param array $activity_ids Activity IDs whose meta should be deleted.
     1257     *
    12471258     * @return bool True on success.
    12481259     */
     
    12641275     * @global wpdb $wpdb WordPress database object
    12651276     *
    1266      * @param array $activities Activities to fetch comments for.
    1267      * @param bool $spam Optional. 'ham_only' (default), 'spam_only' or 'all'.
     1277     * @param array  $activities Activities to fetch comments for.
     1278     * @param string $spam       Optional. 'ham_only' (default), 'spam_only' or 'all'.
     1279     *
    12681280     * @return array The updated activities with nested comments.
    12691281     */
     
    12941306     * @global wpdb $wpdb WordPress database object.
    12951307     *
    1296      * @param int $activity_id Activity ID to fetch comments for.
    1297      * @param int $left Left-most node boundary.
    1298      * @param into $right Right-most node boundary.
    1299      * @param bool $spam Optional. 'ham_only' (default), 'spam_only' or 'all'.
    1300      * @param int $top_level_parent_id Optional. The id of the root-level parent activity item.
     1308     * @param int    $activity_id         Activity ID to fetch comments for.
     1309     * @param int    $left                Left-most node boundary.
     1310     * @param int    $right               Right-most node boundary.
     1311     * @param string $spam                Optional. 'ham_only' (default), 'spam_only' or 'all'.
     1312     * @param int    $top_level_parent_id Optional. The id of the root-level parent activity item.
     1313     *
    13011314     * @return array The updated activities with nested comments.
    13021315     */
     
    13481361             * @since BuddyPress (2.0.0)
    13491362             *
    1350              * @param bool                 Whether or not to use the legacy query.
    1351              * @param BP_Activity_Activity Magic method referring to currently called method.
    1352              * @param array $func_args    Array of the method's argument list.
     1363             * @param bool                 $value     Whether or not to use the legacy query.
     1364             * @param BP_Activity_Activity $value     Magic method referring to currently called method.
     1365             * @param array                $func_args Array of the method's argument list.
    13531366             */
    13541367            if ( apply_filters( 'bp_use_legacy_activity_query', false, __METHOD__, $func_args ) ) {
     
    13591372                 * @since BuddyPress (1.5.0)
    13601373                 *
    1361                  * @param string Prepared statement for the activity query.
     1374                 * @param string $value       Prepared statement for the activity query.
    13621375                 * @param int    $activity_id Activity ID to fetch comments for.
    1363                  * @param int    $left Left-most node boundary.
    1364                  * @param int    $right Right-most node boundary.
    1365                  * @param string $spam_sql SQL Statement portion to differentiate between ham or spam.
     1376                 * @param int    $left        Left-most node boundary.
     1377                 * @param int    $right       Right-most node boundary.
     1378                 * @param string $spam_sql    SQL Statement portion to differentiate between ham or spam.
    13661379                 */
    13671380                $sql = apply_filters( 'bp_activity_comments_user_join_filter', $wpdb->prepare( "SELECT a.*, u.user_email, u.user_nicename, u.user_login, u.display_name{$fullname_select} FROM {$bp->activity->table_name} a, {$wpdb->users} u{$fullname_from} WHERE u.ID = a.user_id {$fullname_where} AND a.type = 'activity_comment' {$spam_sql} AND a.item_id = %d AND a.mptt_left > %d AND a.mptt_left < %d ORDER BY a.date_recorded ASC", $top_level_parent_id, $left, $right ), $activity_id, $left, $right, $spam_sql );
     
    14891502     *
    14901503     * @param int $parent_id ID of an activity or activity comment.
     1504     *
    14911505     * @return object Numerically indexed array of child comments.
    14921506     */
     
    15071521     *        the activity table, but these items are not full-fledged
    15081522     *        activity items.) Default: true.
     1523     *
    15091524     * @return array List of component names.
    15101525     */
     
    15271542     *
    15281543     * @param int $limit Optional. Number of items to fetch. Default: 35.
     1544     *
    15291545     * @return array $activity_feed List of activity items, with RSS data added.
    15301546     */
     
    15511567     * @see BP_Activity_Activity::get_filter_sql()
    15521568     *
    1553      * @param string $field The database field.
     1569     * @param string     $field The database field.
    15541570     * @param array|bool $items The values for the IN clause, or false when none are found.
     1571     *
     1572     * @return string|bool.
    15551573     */
    15561574    public static function get_in_operator_sql( $field, $items ) {
     
    15871605     * @param array $filter_array {
    15881606     *     Fields and values to filter by.
    1589      *     @type array|string|id $user_id User ID(s).
    1590      *     @type array|string $object Corresponds to the 'component'
    1591      *           column in the database.
    1592      *     @type array|string $action Corresponds to the 'type' column
    1593      *           in the database.
    1594      *     @type array|string|int $primary_id Corresponds to the 'item_id'
    1595      *           column in the database.
     1607     *
     1608     *     @type array|string|int $user_id User ID(s).
     1609     *     @type array|string     $object       Corresponds to the 'component'
     1610     *                                          column in the database.
     1611     *     @type array|string     $action       Corresponds to the 'type' column
     1612     *                                          in the database.
     1613     *     @type array|string|int $primary_id   Corresponds to the 'item_id'
     1614     *                                          column in the database.
    15961615     *     @type array|string|int $secondary_id Corresponds to the
    1597      *           'secondary_item_id' column in the database.
    1598      *     @type int $offset Return only those items with an ID greater
    1599      *           than the offset value.
    1600      *     @type string $since Return only those items that have a
    1601      *           date_recorded value greater than a given MySQL-formatted
    1602      *           date.
     1616     *                                          'secondary_item_id' column in the database.
     1617     *     @type int              $offset      Return only those items with an ID greater
     1618     *                                          than the offset value.
     1619     *     @type string           $since        Return only those items that have a
     1620     *                                          date_recorded value greater than a
     1621     *                                          given MySQL-formatted date.
    16031622     * }
     1623     *
    16041624     * @return string The filter clause, for use in a SQL query.
    16051625     */
     
    16781698     * @since BuddyPress (1.2.0)
    16791699     *
    1680      * @param int The ID of the user whose favorites you're counting.
    1681      * @return int A count of the user's favorites.
     1700     * @param int $user_id The ID of the user whose favorites you're counting.
     1701     *
     1702     * @return int $value A count of the user's favorites.
    16821703     */
    16831704    public static function total_favorite_count( $user_id ) {
     
    16971718     *
    16981719     * @param string $content The content to filter by.
     1720     *
    16991721     * @return int|bool The ID of the first matching item if found, otherwise false.
    17001722     */
     
    17111733     *
    17121734     * @param int $user_id The ID of the user whose activity you want to mark hidden.
    1713      * @param int
     1735     *
     1736     * @return mixed
    17141737     */
    17151738    public static function hide_all_for_user( $user_id ) {
     
    17391762     * @param  array $base         Array with keys needing to be replaced
    17401763     * @param  array $replacements Array with the replaced keys
     1764     *
    17411765     * @return array
    17421766     */
Note: See TracChangeset for help on using the changeset viewer.