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/topics/template.php

    r5674 r5676  
    118118 * @since bbPress (r2485)
    119119 *
    120  * @param mixed $args All the arguments supported by {@link WP_Query}
     120 * @param array $args All the arguments supported by {@link WP_Query}
    121121 * @uses current_user_can() To check if the current user can edit other's topics
    122122 * @uses bbp_get_topic_post_type() To get the topic post type
     
    139139 * @return object Multidimensional array of topic information
    140140 */
    141 function bbp_has_topics( $args = '' ) {
     141function bbp_has_topics( $args = array() ) {
    142142    global $wp_rewrite;
    143143
     
    835835 * @since bbPress (r2966)
    836836 *
    837  * @param mixed $args See {@link bbp_get_topic_pagination()}
     837 * @param array $args See {@link bbp_get_topic_pagination()}
    838838 * @uses bbp_get_topic_pagination() To get the topic pagination links
    839839 */
    840 function bbp_topic_pagination( $args = '' ) {
     840function bbp_topic_pagination( $args = array() ) {
    841841    echo bbp_get_topic_pagination( $args );
    842842}
     
    846846     * @since bbPress (r2966)
    847847     *
    848      * @param mixed $args This function supports these arguments:
     848     * @param array $args This function supports these arguments:
    849849     *  - topic_id: Topic id
    850850     *  - before: Before the links
     
    865865     * @return string Pagination links
    866866     */
    867     function bbp_get_topic_pagination( $args = '' ) {
     867    function bbp_get_topic_pagination( $args = array() ) {
    868868        global $wp_rewrite;
    869869
     
    14841484 * @uses bbp_get_topic_author_link() To get the topic author link
    14851485 */
    1486 function bbp_topic_author_link( $args = '' ) {
     1486function bbp_topic_author_link( $args = array() ) {
    14871487    echo bbp_get_topic_author_link( $args );
    14881488}
     
    15081508     * @return string Author link of topic
    15091509     */
    1510     function bbp_get_topic_author_link( $args = '' ) {
     1510    function bbp_get_topic_author_link( $args = array() ) {
    15111511
    15121512        // Parse arguments against default values
     
    23382338 *
    23392339 * @param int $topic_id Optional. Topic id
    2340  * @param mixed $args See {@link bbp_get_topic_tag_list()}
     2340 * @param array $args See {@link bbp_get_topic_tag_list()}
    23412341 * @uses bbp_get_topic_tag_list() To get the topic tag list
    23422342 */
     
    25292529 * @since bbPress (r2727)
    25302530 *
    2531  * @param mixed $args See {@link bbp_get_topic_edit_link()}
     2531 * @param array $args See {@link bbp_get_topic_edit_link()}
    25322532 * @uses bbp_get_topic_edit_link() To get the topic edit link
    25332533 */
    2534 function bbp_topic_edit_link( $args = '' ) {
     2534function bbp_topic_edit_link( $args = array() ) {
    25352535    echo bbp_get_topic_edit_link( $args );
    25362536}
     
    25412541     * @since bbPress (r2727)
    25422542     *
    2543      * @param mixed $args This function supports these args:
     2543     * @param array $args This function supports these args:
    25442544     *  - id: Optional. Topic id
    25452545     *  - link_before: Before the link
     
    25552555     * @return string Topic edit link
    25562556     */
    2557     function bbp_get_topic_edit_link( $args = '' ) {
     2557    function bbp_get_topic_edit_link( $args = array() ) {
    25582558
    25592559        // Parse arguments against default values
     
    26462646 * @since bbPress (r2727)
    26472647 *
    2648  * @param mixed $args See {@link bbp_get_topic_trash_link()}
     2648 * @param array $args See {@link bbp_get_topic_trash_link()}
    26492649 * @uses bbp_get_topic_trash_link() To get the topic trash link
    26502650 */
    2651 function bbp_topic_trash_link( $args = '' ) {
     2651function bbp_topic_trash_link( $args = array() ) {
    26522652    echo bbp_get_topic_trash_link( $args );
    26532653}
     
    26582658     * @since bbPress (r2727)
    26592659     *
    2660      * @param mixed $args This function supports these args:
     2660     * @param array $args This function supports these args:
    26612661     *  - id: Optional. Topic id
    26622662     *  - link_before: Before the link
     
    26792679     * @return string Topic trash link
    26802680     */
    2681     function bbp_get_topic_trash_link( $args = '' ) {
     2681    function bbp_get_topic_trash_link( $args = array() ) {
    26822682
    26832683        // Parse arguments against default values
     
    27212721 * @since bbPress (r2727)
    27222722 *
    2723  * @param mixed $args See {@link bbp_get_topic_close_link()}
     2723 * @param array $args See {@link bbp_get_topic_close_link()}
    27242724 * @uses bbp_get_topic_close_link() To get the topic close link
    27252725 */
    2726 function bbp_topic_close_link( $args = '' ) {
     2726function bbp_topic_close_link( $args = array() ) {
    27272727    echo bbp_get_topic_close_link( $args );
    27282728}
     
    27332733     * @since bbPress (r2727)
    27342734     *
    2735      * @param mixed $args This function supports these args:
     2735     * @param array $args This function supports these args:
    27362736     *  - id: Optional. Topic id
    27372737     *  - link_before: Before the link
     
    27502750     * @return string Topic close link
    27512751     */
    2752     function bbp_get_topic_close_link( $args = '' ) {
     2752    function bbp_get_topic_close_link( $args = array() ) {
    27532753
    27542754        // Parse arguments against default values
     
    27812781 * @since bbPress (r5504)
    27822782 *
    2783  * @param mixed $args See {@link bbp_get_topic_approve_link()}
     2783 * @param array $args See {@link bbp_get_topic_approve_link()}
    27842784 * @uses bbp_get_topic_approve_link() To get the topic approve link
    27852785 */
    2786 function bbp_topic_approve_link( $args = '' ) {
     2786function bbp_topic_approve_link( $args = array() ) {
    27872787    echo bbp_get_topic_approve_link( $args );
    27882788}
     
    27932793     * @since bbPress (r5504)
    27942794     *
    2795      * @param mixed $args This function supports these args:
     2795     * @param array $args This function supports these args:
    27962796     *  - id: Optional. Topic id
    27972797     *  - link_before: Before the link
     
    28112811     * @return string Topic approve link
    28122812     */
    2813     function bbp_get_topic_approve_link( $args = '' ) {
     2813    function bbp_get_topic_approve_link( $args = array() ) {
    28142814
    28152815        // Parse arguments against default values
     
    28422842 * @since bbPress (r2754)
    28432843 *
    2844  * @param mixed $args See {@link bbp_get_topic_stick_link()}
     2844 * @param array $args See {@link bbp_get_topic_stick_link()}
    28452845 * @uses bbp_get_topic_stick_link() To get the topic stick link
    28462846 */
    2847 function bbp_topic_stick_link( $args = '' ) {
     2847function bbp_topic_stick_link( $args = array() ) {
    28482848    echo bbp_get_topic_stick_link( $args );
    28492849}
     
    28542854     * @since bbPress (r2754)
    28552855     *
    2856      * @param mixed $args This function supports these args:
     2856     * @param array $args This function supports these args:
    28572857     *  - id: Optional. Topic id
    28582858     *  - link_before: Before the link
     
    28732873     * @return string Topic stick link
    28742874     */
    2875     function bbp_get_topic_stick_link( $args = '' ) {
     2875    function bbp_get_topic_stick_link( $args = array() ) {
    28762876
    28772877        // Parse arguments against default values
     
    29192919 * @since bbPress (r2756)
    29202920 *
    2921  * @param mixed $args
     2921 * @param array $args
    29222922 * @uses bbp_get_topic_merge_link() To get the topic merge link
    29232923 */
    2924 function bbp_topic_merge_link( $args = '' ) {
     2924function bbp_topic_merge_link( $args = array() ) {
    29252925    echo bbp_get_topic_merge_link( $args );
    29262926}
     
    29312931     * @since bbPress (r2756)
    29322932     *
    2933      * @param mixed $args This function supports these args:
     2933     * @param array $args This function supports these args:
    29342934     *  - id: Optional. Topic id
    29352935     *  - link_before: Before the link
     
    29452945     * @return string Topic merge link
    29462946     */
    2947     function bbp_get_topic_merge_link( $args = '' ) {
     2947    function bbp_get_topic_merge_link( $args = array() ) {
    29482948
    29492949        // Parse arguments against default values
     
    29722972 * @since bbPress (r2727)
    29732973 *
    2974  * @param mixed $args See {@link bbp_get_topic_spam_link()}
     2974 * @param array $args See {@link bbp_get_topic_spam_link()}
    29752975 * @uses bbp_get_topic_spam_link() Topic spam link
    29762976 */
    2977 function bbp_topic_spam_link( $args = '' ) {
     2977function bbp_topic_spam_link( $args = array() ) {
    29782978    echo bbp_get_topic_spam_link( $args );
    29792979}
     
    29842984     * @since bbPress (r2727)
    29852985     *
    2986      * @param mixed $args This function supports these args:
     2986     * @param array $args This function supports these args:
    29872987     *  - id: Optional. Topic id
    29882988     *  - link_before: Before the link
     
    30013001     * @return string Topic spam link
    30023002     */
    3003     function bbp_get_topic_spam_link( $args = '' ) {
     3003    function bbp_get_topic_spam_link( $args = array() ) {
    30043004
    30053005        // Parse arguments against default values
     
    32183218 *  - selected: Override the selected option
    32193219 */
    3220 function bbp_topic_type_select( $args = '' ) {
     3220function bbp_topic_type_select( $args = array() ) {
    32213221    echo bbp_get_form_topic_type_dropdown( $args );
    32223222}
     
    32333233 *  - selected: Override the selected option
    32343234 */
    3235 function bbp_form_topic_type_dropdown( $args = '' ) {
     3235function bbp_form_topic_type_dropdown( $args = array() ) {
    32363236    echo bbp_get_form_topic_type_dropdown( $args );
    32373237}
     
    32523252     * @uses bbp_is_topic_sticky() To check if the topic is a sticky
    32533253     */
    3254     function bbp_get_form_topic_type_dropdown( $args = '' ) {
     3254    function bbp_get_form_topic_type_dropdown( $args = array() ) {
    32553255
    32563256        // Parse arguments against default values
     
    33233323 *  - selected: Override the selected option
    33243324 */
    3325 function bbp_form_topic_status_dropdown( $args = '' ) {
     3325function bbp_form_topic_status_dropdown( $args = array() ) {
    33263326    echo bbp_get_form_topic_status_dropdown( $args );
    33273327}
     
    33413341     *  - selected: Override the selected option
    33423342     */
    3343     function bbp_get_form_topic_status_dropdown( $args = '' ) {
     3343    function bbp_get_form_topic_status_dropdown( $args = array() ) {
    33443344
    33453345        // Parse arguments against default values
     
    34063406 * @uses bbp_get_single_topic_description() Return the eventual output
    34073407 */
    3408 function bbp_single_topic_description( $args = '' ) {
     3408function bbp_single_topic_description( $args = array() ) {
    34093409    echo bbp_get_single_topic_description( $args );
    34103410}
     
    34153415     * @since bbPress (r2860)
    34163416     *
    3417      * @param mixed $args This function supports these arguments:
     3417     * @param array $args This function supports these arguments:
    34183418     *  - topic_id: Topic id
    34193419     *  - before: Before the text
     
    34303430     * @return string Filtered topic description
    34313431     */
    3432     function bbp_get_single_topic_description( $args = '' ) {
     3432    function bbp_get_single_topic_description( $args = array() ) {
    34333433
    34343434        // Parse arguments against default values
Note: See TracChangeset for help on using the changeset viewer.