Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
04/08/2023 06:31:46 AM (4 years ago)
Author:
imath
Message:

Make sure all Groups component URLs are built using BP rewrites API

  • Introduce the bp_groups_get_create_url() to ease Groups create URLs generation.
  • Improve bp_groups_get_path_chunks() to deal with front-end group admin URLs and the Groups create URLs.
  • Deprecate bp_get_groups_directory_permalink() in favor of bp_get_groups_directory_url().
  • Replace all remaining deprecated functions usage.
  • Start putting deprecated functions behind a function_exists( 'bp_classic' ) check, corresponding functions were added inside the BP Classic backcompat plugin.
  • Adjust some Groups routing unit tests.

Props r-a-y, johnjamesjacoby, boonebgorges

Closes ​https://github.com/buddypress/buddypress/pull/83
See #4954

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-core/deprecated/12.0.php

    r13446 r13449  
    1212}
    1313
    14 /**
    15  * Add support for a top-level ("root") component.
    16  *
    17  * This function originally (pre-1.5) let plugins add support for pages in the
    18  * root of the install. These root level pages are now handled by actual
    19  * WordPress pages and this function is now a convenience for compatibility
    20  * with the new method.
    21  *
    22  * @since 1.0.0
    23  * @deprecated 12.0.0
    24  *
    25  * @param string $slug The slug of the component being added to the root list.
    26  */
    27 function bp_core_add_root_component( $slug ) {
    28         _deprecated_function( __FUNCTION__, '12.0.0' );
     14// These functions has been moved to the BP Classic plugin.
     15if ( ! function_exists( 'bp_classic' ) ) {
     16        /**
     17         * Add support for a top-level ("root") component.
     18         *
     19         * This function originally (pre-1.5) let plugins add support for pages in the
     20         * root of the install. These root level pages are now handled by actual
     21         * WordPress pages and this function is now a convenience for compatibility
     22         * with the new method.
     23         *
     24         * @since 1.0.0
     25         * @deprecated 12.0.0
     26         *
     27         * @param string $slug The slug of the component being added to the root list.
     28         */
     29        function bp_core_add_root_component( $slug ) {
     30                _deprecated_function( __FUNCTION__, '12.0.0' );
     31        }
     32
     33        /**
     34         * Return the domain for the root blog.
     35         *
     36         * Eg: http://example.com OR https://example.com
     37         *
     38         * @since 1.0.0
     39         * @deprecated 12.0.0
     40         *
     41         * @return string The domain URL for the blog.
     42         */
     43        function bp_core_get_root_domain() {
     44                _deprecated_function( __FUNCTION__, '12.0.0', 'bp_rewrites_get_root_url()' );
     45                $domain = bp_rewrites_get_root_url();
     46
     47                /**
     48                 * Filters the domain for the root blog.
     49                 *
     50                 * @since 1.0.1
     51                 * @deprecated 12.0.0 Use {@see 'bp_rewrites_get_root_url'} instead.
     52                 *
     53                 * @param string $domain The domain URL for the blog.
     54                 */
     55                return apply_filters_deprecated( 'bp_core_get_root_domain', array( $domain ), '12.0.0', 'bp_rewrites_get_root_url' );
     56        }
     57
     58        /**
     59         * Return the "root domain", the URL of the BP root blog.
     60         *
     61         * @since 1.1.0
     62         * @deprecated 12.0.0
     63         *
     64         * @return string URL of the BP root blog.
     65         */
     66        function bp_get_root_domain() {
     67                _deprecated_function( __FUNCTION__, '12.0.0', 'bp_get_root_url()' );
     68                $domain = bp_get_root_url();
     69
     70                /**
     71                 *  Filters the "root domain", the URL of the BP root blog.
     72                 *
     73                 * @since 1.2.4
     74                 * @deprecated 12.0.0 Use {@see 'bp_get_root_url'} instead.
     75                 *
     76                 * @param string $domain URL of the BP root blog.
     77                 */
     78                return apply_filters_deprecated( 'bp_get_root_domain', array( $domain ), '12.0.0', 'bp_get_root_url' );
     79        }
     80
     81        /**
     82         * Output the "root domain", the URL of the BP root blog.
     83         *
     84         * @since 1.1.0
     85         * @deprecated 12.0.0
     86         */
     87        function bp_root_domain() {
     88                _deprecated_function( __FUNCTION__, '12.0.0', 'bp_root_url()' );
     89                bp_root_url();
     90        }
     91
     92        /**
     93         * Renders the page mapping admin panel.
     94         *
     95         * @since 1.6.0
     96         * @deprecated 12.0.0
     97         */
     98        function bp_core_admin_slugs_settings() {
     99                _deprecated_function( __FUNCTION__, '12.0.0' );
     100        }
     101
     102        /**
     103         * Generate a list of directory pages, for use when building Components panel markup.
     104         *
     105         * @since 2.4.1
     106         * @deprecated 12.0.0
     107         *
     108         * @return array
     109         */
     110        function bp_core_admin_get_directory_pages() {
     111                _deprecated_function( __FUNCTION__, '12.0.0' );
     112
     113                $directory_pages = (array) bp_core_get_directory_pages();
     114                $return          =  wp_list_pluck( $directory_pages, 'name', 'id' );
     115
     116                return apply_filters_deprecated( 'bp_directory_pages', array( $return ), '12.0.0' );
     117        }
     118
     119        /**
     120         * Generate a list of static pages, for use when building Components panel markup.
     121         *
     122         * By default, this list contains 'register' and 'activate'.
     123         *
     124         * @since 2.4.1
     125         * @deprecated 12.0.0
     126         *
     127         * @return array
     128         */
     129        function bp_core_admin_get_static_pages() {
     130                _deprecated_function( __FUNCTION__, '12.0.0' );
     131
     132                $static_pages = array(
     133                        'register' => __( 'Register', 'buddypress' ),
     134                        'activate' => __( 'Activate', 'buddypress' ),
     135                );
     136
     137                return apply_filters_deprecated( 'bp_directory_pages', array( $static_pages ), '12.0.0' );
     138        }
     139
     140        /**
     141         * Creates reusable markup for page setup on the Components and Pages dashboard panel.
     142         *
     143         * @package BuddyPress
     144         * @since 1.6.0
     145         * @deprecated 12.0.0
     146         */
     147        function bp_core_admin_slugs_options() {
     148                _deprecated_function( __FUNCTION__, '12.0.0' );
     149
     150                do_action_deprecated( 'bp_active_external_directories', array(), '12.0.0' );
     151                do_action_deprecated( 'bp_active_external_pages', array(), '12.0.0' );
     152        }
     153
     154        /**
     155         * Handle saving of the BuddyPress slugs.
     156         *
     157         * @since 1.6.0
     158         * @deprecated 12.0.0
     159         */
     160        function bp_core_admin_slugs_setup_handler() {
     161                _deprecated_function( __FUNCTION__, '12.0.0' );
     162        }
    29163}
    30164
    … …  
    67201
    68202        return apply_filters_deprecated( 'bp_core_component_slug_from_root_slug', array( $root_slug, $root_slug ), '12.0.0' );
    69 }
    70 
    71 /**
    72  * Renders the page mapping admin panel.
    73  *
    74  * @since 1.6.0
    75  * @deprecated 12.0.0
    76  */
    77 function bp_core_admin_slugs_settings() {
    78         _deprecated_function( __FUNCTION__, '12.0.0' );
    79 }
    80 
    81 /**
    82  * Generate a list of directory pages, for use when building Components panel markup.
    83  *
    84  * @since 2.4.1
    85  * @deprecated 12.0.0
    86  *
    87  * @return array
    88  */
    89 function bp_core_admin_get_directory_pages() {
    90         _deprecated_function( __FUNCTION__, '12.0.0' );
    91 
    92         $directory_pages = (array) bp_core_get_directory_pages();
    93         $return          =  wp_list_pluck( $directory_pages, 'name', 'id' );
    94 
    95         return apply_filters_deprecated( 'bp_directory_pages', array( $return ), '12.0.0' );
    96 }
    97 
    98 /**
    99  * Generate a list of static pages, for use when building Components panel markup.
    100  *
    101  * By default, this list contains 'register' and 'activate'.
    102  *
    103  * @since 2.4.1
    104  * @deprecated 12.0.0
    105  *
    106  * @return array
    107  */
    108 function bp_core_admin_get_static_pages() {
    109         _deprecated_function( __FUNCTION__, '12.0.0' );
    110 
    111         $static_pages = array(
    112                 'register' => __( 'Register', 'buddypress' ),
    113                 'activate' => __( 'Activate', 'buddypress' ),
    114         );
    115 
    116         return apply_filters_deprecated( 'bp_directory_pages', array( $static_pages ), '12.0.0' );
    117 }
    118 
    119 /**
    120  * Creates reusable markup for page setup on the Components and Pages dashboard panel.
    121  *
    122  * @package BuddyPress
    123  * @since 1.6.0
    124  * @deprecated 12.0.0
    125  */
    126 function bp_core_admin_slugs_options() {
    127         _deprecated_function( __FUNCTION__, '12.0.0' );
    128 
    129         do_action_deprecated( 'bp_active_external_directories', array(), '12.0.0' );
    130         do_action_deprecated( 'bp_active_external_pages', array(), '12.0.0' );
    131 }
    132 
    133 /**
    134  * Handle saving of the BuddyPress slugs.
    135  *
    136  * @since 1.6.0
    137  * @deprecated 12.0.0
    138  */
    139 function bp_core_admin_slugs_setup_handler() {
    140         _deprecated_function( __FUNCTION__, '12.0.0' );
    141203}
    142204
    … …  
    297359        _deprecated_function( __FUNCTION__, '12.0.0', 'bp_displayed_user_url()' );
    298360        bp_displayed_user_url();
     361}
     362
     363/**
     364 * Output group directory permalink.
     365 *
     366 * @since 1.5.0
     367 * @deprecated 12.0.0
     368 */
     369function bp_groups_directory_permalink() {
     370        _deprecated_function( __FUNCTION__, '12.0.0', 'bp_groups_directory_url()' );
     371        bp_groups_directory_url();
     372}
     373
     374/**
     375 * Return group directory permalink.
     376 *
     377 * @since 1.5.0
     378 * @deprecated 12.0.0
     379 *
     380 * @return string
     381 */
     382function bp_get_groups_directory_permalink() {
     383        _deprecated_function( __FUNCTION__, '12.0.0', 'bp_get_groups_directory_url()' );
     384
     385        $url = bp_get_groups_directory_url();
     386
     387        /**
     388         * Filters the group directory permalink.
     389         *
     390         * @since 1.5.0
     391         * @deprecated 12.0.0
     392         *
     393         * @param string $url Permalink for the group directory.
     394         */
     395        return apply_filters_deprecated( 'bp_get_groups_directory_permalink', array( $url ), '12.0.0', 'bp_get_groups_directory_url' );
    299396}
    300397
Note: See TracChangeset for help on using the changeset viewer.