Skip to:
Content

bbPress.org


Ignore:
Timestamp:
04/15/2015 02:33:11 AM (11 years ago)
Author:
johnjamesjacoby
Message:

All: Update default values for $args parameters from empty strings to empty arrays.

This is a micro-optimization to avoid unnecessary calls to wp_parse_str() inside bbp_parse_args().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/users/template.php

    r5661 r5676  
    533533 * @since bbPress (r2827)
    534534 *
    535  * @param mixed $args Optional. See {@link bbp_get_admin_link()}
     535 * @param array $args Optional. See {@link bbp_get_admin_link()}
    536536 * @uses bbp_get_admin_link() To get the admin link
    537537 */
    538 function bbp_admin_link( $args = '' ) {
     538function bbp_admin_link( $args = array() ) {
    539539    echo bbp_get_admin_link( $args );
    540540}
     
    544544     * @since bbPress (r2827)
    545545     *
    546      * @param mixed $args Optional. This function supports these arguments:
     546     * @param array $args Optional. This function supports these arguments:
    547547     *  - text: The text
    548548     *  - before: Before the lnk
     
    553553     * @return The link
    554554     */
    555     function bbp_get_admin_link( $args = '' ) {
     555    function bbp_get_admin_link( $args = array() ) {
    556556        if ( ! current_user_can( 'moderate' ) ) {
    557557            return;
     
    581581 * @since bbPress (r3120)
    582582 *
    583  * @param mixed $args Optional. If it is an integer, it is used as post id.
     583 * @param array $args Optional. If it is an integer, it is used as post id.
    584584 * @uses bbp_get_author_ip() To get the post author link
    585585 */
    586 function bbp_author_ip( $args = '' ) {
     586function bbp_author_ip( $args = array() ) {
    587587    echo bbp_get_author_ip( $args );
    588588}
     
    592592     * @since bbPress (r3120)
    593593     *
    594      * @param mixed $args Optional. If an integer, it is used as reply id.
     594     * @param array $args Optional. If an integer, it is used as reply id.
    595595     * @uses get_post_meta() To check if it's a topic page
    596596     * @return string Author link of reply
    597597     */
    598     function bbp_get_author_ip( $args = '' ) {
     598    function bbp_get_author_ip( $args = array() ) {
    599599
    600600        // Used as post id
     
    859859 * @since bbPress (r2652)
    860860 *
    861  * @param mixed $args See {@link bbp_get_user_favorites_link()}
     861 * @param array $args See {@link bbp_get_user_favorites_link()}
    862862 * @param int $user_id Optional. User id
    863863 * @param bool $wrap Optional. If you want to wrap the link in <span id="favorite-toggle">.
     
    875875     * @since bbPress (r2652)
    876876     *
    877      * @param mixed $args This function supports these arguments:
     877     * @param array $args This function supports these arguments:
    878878     *  - subscribe: Favorite text
    879879     *  - unsubscribe: Unfavorite text
     
    896896     * @return string User favorites link
    897897     */
    898     function bbp_get_user_favorites_link( $args = '', $user_id = 0, $wrap = true ) {
     898    function bbp_get_user_favorites_link( $args = array(), $user_id = 0, $wrap = true ) {
    899899        if ( ! bbp_is_favorites_active() ) {
    900900            return false;
     
    10241024 * @since bbPress (r2668)
    10251025 *
    1026  * @param mixed $args See {@link bbp_get_user_subscribe_link()}
     1026 * @param array $args See {@link bbp_get_user_subscribe_link()}
    10271027 * @param int $user_id Optional. User id
    10281028 * @param bool $wrap Optional. If you want to wrap the link in <span id="subscription-toggle">.
    10291029 * @uses bbp_get_user_subscribe_link() To get the subscribe link
    10301030 */
    1031 function bbp_user_subscribe_link( $args = '', $user_id = 0, $wrap = true ) {
     1031function bbp_user_subscribe_link( $args = array(), $user_id = 0, $wrap = true ) {
    10321032    echo bbp_get_user_subscribe_link( $args, $user_id, $wrap );
    10331033}
     
    10371037     * @since bbPress (r2668)
    10381038     *
    1039      * @param mixed $args This function supports these arguments:
     1039     * @param array $args This function supports these arguments:
    10401040     *  - subscribe: Subscribe text
    10411041     *  - unsubscribe: Unsubscribe text
     
    10621062     * @return string Permanent link to topic
    10631063     */
    1064     function bbp_get_user_subscribe_link( $args = '', $user_id = 0, $wrap = true ) {
     1064    function bbp_get_user_subscribe_link( $args = array(), $user_id = 0, $wrap = true ) {
    10651065        if ( ! bbp_is_subscriptions_active() ) {
    10661066            return;
     
    16821682 * @since bbPress (r2875)
    16831683 *
    1684  * @param mixed $args Optional. If it is an integer, it is used as post id.
     1684 * @param array $args Optional. If it is an integer, it is used as post id.
    16851685 * @uses bbp_get_author_link() To get the post author link
    16861686 */
    1687 function bbp_author_link( $args = '' ) {
     1687function bbp_author_link( $args = array() ) {
    16881688    echo bbp_get_author_link( $args );
    16891689}
     
    16931693     * @since bbPress (r2875)
    16941694     *
    1695      * @param mixed $args Optional. If an integer, it is used as reply id.
     1695     * @param array $args Optional. If an integer, it is used as reply id.
    16961696     * @uses bbp_is_topic() To check if it's a topic page
    16971697     * @uses bbp_get_topic_author_link() To get the topic author link
     
    17081708     * @return string Author link of reply
    17091709     */
    1710     function bbp_get_author_link( $args = '' ) {
     1710    function bbp_get_author_link( $args = array() ) {
    17111711
    17121712        $post_id = is_numeric( $args ) ? (int) $args : 0;
     
    17971797 * @return bool
    17981798 */
    1799 function bbp_user_can_view_forum( $args = '' ) {
     1799function bbp_user_can_view_forum( $args = array() ) {
    18001800
    18011801    // Parse arguments against default values
Note: See TracChangeset for help on using the changeset viewer.