Skip to:
Content

BuddyPress.org

Ticket #7156: 7156.5.patch

File 7156.5.patch, 10.8 KB (added by imath, 5 years ago)
  • src/bp-blogs/classes/class-bp-blogs-component.php

    diff --git src/bp-blogs/classes/class-bp-blogs-component.php src/bp-blogs/classes/class-bp-blogs-component.php
    index a1be1e808..800fea526 100644
    class BP_Blogs_Component extends BP_Component { 
    352352
    353353                parent::setup_cache_groups();
    354354        }
     355
     356        /**
     357         * Init the BP REST API.
     358         *
     359         * @since 6.0.0
     360         *
     361         * @param array $controllers Optional. See BP_Component::rest_api_init() for
     362         *                           description.
     363         */
     364        public function rest_api_init( $controllers = array() ) {
     365                if ( is_multisite() ) {
     366                        $controllers = array(
     367                                'BP_REST_Blogs_Endpoint',
     368                        );
     369
     370                        // Support to Blog Avatar.
     371                        if ( bp_is_active( 'blogs', 'site-icon' ) ) {
     372                                $controllers[] = 'BP_REST_Attachments_Blog_Avatar_Endpoint';
     373                        }
     374                }
     375
     376                parent::rest_api_init( $controllers );
     377        }
    355378}
  • new file src/bp-core/classes/class-bp-rest-attachments-group-avatar-endpoint.php

    diff --git src/bp-core/classes/class-bp-rest-attachments-group-avatar-endpoint.php src/bp-core/classes/class-bp-rest-attachments-group-avatar-endpoint.php
    new file mode 100644
    index 000000000..51c7d1c04
    - +  
     1<?php
     2/**
     3 * BP REST: BP_REST_Attachments_Group_Avatar_Endpoint class
     4 *
     5 * @package BuddyPress
     6 * @deprecated 6.0.0
     7 */
     8
     9defined( 'ABSPATH' ) || exit;
     10
     11_deprecated_file( basename( __FILE__ ), '6.0.0', 'bp-groups/classes/class-bp-rest-attachments-group-avatar-endpoint.php' );
     12
     13/** BP_REST_Attachments_Group_Avatar_Endpoint class */
     14require_once trailingslashit( constant( 'BP_PLUGIN_DIR' ) . constant( 'BP_SOURCE_SUBDIRECTORY' ) ) . 'bp-groups/classes/class-bp-rest-attachments-group-avatar-endpoint.php';
  • new file src/bp-core/classes/class-bp-rest-attachments-member-avatar-endpoint.php

    diff --git src/bp-core/classes/class-bp-rest-attachments-member-avatar-endpoint.php src/bp-core/classes/class-bp-rest-attachments-member-avatar-endpoint.php
    new file mode 100644
    index 000000000..d217dcdcf
    - +  
     1<?php
     2/**
     3 * BP REST: BP_REST_Attachments_Member_Avatar_Endpoint class
     4 *
     5 * @package BuddyPress
     6 * @deprecated 6.0.0
     7 */
     8
     9defined( 'ABSPATH' ) || exit;
     10
     11_deprecated_file( basename( __FILE__ ), '6.0.0', 'bp-members/classes/class-class-bp-rest-attachments-member-avatar-endpoint.php' );
     12
     13/** BP_REST_Attachments_Member_Avatar_Endpoint class */
     14require_once trailingslashit( constant( 'BP_PLUGIN_DIR' ) . constant( 'BP_SOURCE_SUBDIRECTORY' ) ) . 'bp-members/classes/class-bp-rest-attachments-member-avatar-endpoint.php';
  • src/bp-friends/classes/class-bp-friends-component.php

    diff --git src/bp-friends/classes/class-bp-friends-component.php src/bp-friends/classes/class-bp-friends-component.php
    index 90a244b75..e2a044ec2 100644
    class BP_Friends_Component extends BP_Component { 
    321321
    322322                parent::setup_cache_groups();
    323323        }
     324
     325        /**
     326         * Init the BP REST API.
     327         *
     328         * @since 6.0.0
     329         *
     330         * @param array $controllers Optional. See BP_Component::rest_api_init() for
     331         *                           description.
     332         */
     333        public function rest_api_init( $controllers = array() ) {
     334                parent::rest_api_init( array( 'BP_REST_Friends_Endpoint' ) );
     335        }
    324336}
  • src/bp-groups/classes/class-bp-groups-component.php

    diff --git src/bp-groups/classes/class-bp-groups-component.php src/bp-groups/classes/class-bp-groups-component.php
    index 2f07fceae..547ba32fc 100644
    class BP_Groups_Component extends BP_Component { 
    928928         * Init the BP REST API.
    929929         *
    930930         * @since 5.0.0
     931         * @since 6.0.0 Adds the Group Cover REST endpoint.
    931932         *
    932933         * @param array $controllers Optional. See BP_Component::rest_api_init() for
    933934         *                           description.
    934935         */
    935936        public function rest_api_init( $controllers = array() ) {
    936                 parent::rest_api_init( array(
     937                $controllers = array(
    937938                        'BP_REST_Groups_Endpoint',
    938939                        'BP_REST_Group_Membership_Endpoint',
    939940                        'BP_REST_Group_Invites_Endpoint',
    940941                        'BP_REST_Group_Membership_Request_Endpoint',
    941942                        'BP_REST_Attachments_Group_Avatar_Endpoint',
    942                 ) );
     943                );
     944
     945                // Support to Group Cover.
     946                if ( bp_is_active( 'groups', 'cover_image' ) ) {
     947                        $controllers[] = 'BP_REST_Attachments_Group_Cover_Endpoint';
     948                }
     949
     950                parent::rest_api_init( $controllers );
    943951        }
    944952
    945953        /**
  • src/bp-members/classes/class-bp-members-component.php

    diff --git src/bp-members/classes/class-bp-members-component.php src/bp-members/classes/class-bp-members-component.php
    index 25818244e..daebb2ab2 100644
    class BP_Members_Component extends BP_Component { 
    654654         * Init the BP REST API.
    655655         *
    656656         * @since 5.0.0
     657         * @since 6.0.0 Adds the Member Cover and Signup REST endpoints.
    657658         *
    658659         * @param array $controllers Optional. See BP_Component::rest_api_init() for
    659660         *                           description.
    660661         */
    661662        public function rest_api_init( $controllers = array() ) {
    662                 parent::rest_api_init( array(
     663                $controllers = array(
    663664                        /**
    664665                         * As the Members component is always loaded,
    665666                         * let's register the Components endpoint here.
    class BP_Members_Component extends BP_Component { 
    667668                        'BP_REST_Components_Endpoint',
    668669                        'BP_REST_Members_Endpoint',
    669670                        'BP_REST_Attachments_Member_Avatar_Endpoint',
    670                 ) );
     671                );
     672
     673                if ( bp_is_active( 'members', 'cover_image' ) ) {
     674                        $controllers[] = 'BP_REST_Attachments_Member_Cover_Endpoint';
     675                }
     676
     677                if ( bp_get_signup_allowed() ) {
     678                        $controllers[] = 'BP_REST_Signup_Endpoint';
     679                }
     680
     681                parent::rest_api_init( $controllers );
    671682        }
    672683
    673684        /**
  • src/class-buddypress.php

    diff --git src/class-buddypress.php src/class-buddypress.php
    index e4e559eae..61c153af9 100644
    class BuddyPress { 
    550550                        'BP_Akismet'                => 'activity',
    551551                        'BP_REST_Activity_Endpoint' => 'activity',
    552552
    553                         'BP_Admin'                                   => 'core',
    554                         'BP_Attachment_Avatar'                       => 'core',
    555                         'BP_Attachment_Cover_Image'                  => 'core',
    556                         'BP_Attachment'                              => 'core',
    557                         'BP_Button'                                  => 'core',
    558                         'BP_Block'                                   => 'core',
    559                         'BP_Component'                               => 'core',
    560                         'BP_Customizer_Control_Range'                => 'core',
    561                         'BP_Date_Query'                              => 'core',
    562                         'BP_Email_Delivery'                          => 'core',
    563                         'BP_Email_Address'                           => 'core',
    564                         'BP_Email_Recipient'                         => 'core',
    565                         'BP_Email_Sender'                            => 'core',
    566                         'BP_Email_Participant'                       => 'core',
    567                         'BP_Email'                                   => 'core',
    568                         'BP_Embed'                                   => 'core',
    569                         'BP_Media_Extractor'                         => 'core',
    570                         'BP_Members_Suggestions'                     => 'core',
    571                         'BP_PHPMailer'                               => 'core',
    572                         'BP_Recursive_Query'                         => 'core',
    573                         'BP_Suggestions'                             => 'core',
    574                         'BP_Theme_Compat'                            => 'core',
    575                         'BP_User_Query'                              => 'core',
    576                         'BP_Walker_Category_Checklist'               => 'core',
    577                         'BP_Walker_Nav_Menu_Checklist'               => 'core',
    578                         'BP_Walker_Nav_Menu'                         => 'core',
    579                         'BP_Invitation_Manager'                      => 'core',
    580                         'BP_Invitation'                              => 'core',
    581                         'BP_REST_Components_Endpoint'                => 'core',
    582                         'BP_REST_Attachments'                        => 'core',
    583                         'BP_REST_Attachments_Member_Avatar_Endpoint' => 'core',
    584                         'BP_REST_Attachments_Group_Avatar_Endpoint'  => 'core',
    585 
    586                         'BP_Core_Friends_Widget' => 'friends',
     553                        'BP_REST_Blogs_Endpoint'                   => 'blogs',
     554                        'BP_REST_Attachments_Blog_Avatar_Endpoint' => 'blogs',
     555
     556                        'BP_Admin'                     => 'core',
     557                        'BP_Attachment_Avatar'         => 'core',
     558                        'BP_Attachment_Cover_Image'    => 'core',
     559                        'BP_Attachment'                => 'core',
     560                        'BP_Button'                    => 'core',
     561                        'BP_Block'                     => 'core',
     562                        'BP_Component'                 => 'core',
     563                        'BP_Customizer_Control_Range'  => 'core',
     564                        'BP_Date_Query'                => 'core',
     565                        'BP_Email_Delivery'            => 'core',
     566                        'BP_Email_Address'             => 'core',
     567                        'BP_Email_Recipient'           => 'core',
     568                        'BP_Email_Sender'              => 'core',
     569                        'BP_Email_Participant'         => 'core',
     570                        'BP_Email'                     => 'core',
     571                        'BP_Embed'                     => 'core',
     572                        'BP_Media_Extractor'           => 'core',
     573                        'BP_Members_Suggestions'       => 'core',
     574                        'BP_PHPMailer'                 => 'core',
     575                        'BP_Recursive_Query'           => 'core',
     576                        'BP_Suggestions'               => 'core',
     577                        'BP_Theme_Compat'              => 'core',
     578                        'BP_User_Query'                => 'core',
     579                        'BP_Walker_Category_Checklist' => 'core',
     580                        'BP_Walker_Nav_Menu_Checklist' => 'core',
     581                        'BP_Walker_Nav_Menu'           => 'core',
     582                        'BP_Invitation_Manager'        => 'core',
     583                        'BP_Invitation'                => 'core',
     584                        'BP_REST_Components_Endpoint'  => 'core',
     585                        'BP_REST_Attachments'          => 'core',
     586
     587                        'BP_Core_Friends_Widget'   => 'friends',
     588                        'BP_REST_Friends_Endpoint' => 'friends',
    587589
    588590                        'BP_Group_Extension'                        => 'groups',
    589591                        'BP_Group_Member_Query'                     => 'groups',
    class BuddyPress { 
    591593                        'BP_REST_Group_Membership_Endpoint'         => 'groups',
    592594                        'BP_REST_Group_Invites_Endpoint'            => 'groups',
    593595                        'BP_REST_Group_Membership_Request_Endpoint' => 'groups',
    594 
    595                         'BP_Core_Members_Template'       => 'members',
    596                         'BP_Core_Members_Widget'         => 'members',
    597                         'BP_Core_Recently_Active_Widget' => 'members',
    598                         'BP_Core_Whos_Online_Widget'     => 'members',
    599                         'BP_Registration_Theme_Compat'   => 'members',
    600                         'BP_Signup'                      => 'members',
    601                         'BP_REST_Members_Endpoint'       => 'members',
     596                        'BP_REST_Attachments_Group_Avatar_Endpoint' => 'groups',
     597                        'BP_REST_Attachments_Group_Cover_Endpoint'  => 'groups',
     598
     599                        'BP_Core_Members_Template'                   => 'members',
     600                        'BP_Core_Members_Widget'                     => 'members',
     601                        'BP_Core_Recently_Active_Widget'             => 'members',
     602                        'BP_Core_Whos_Online_Widget'                 => 'members',
     603                        'BP_Registration_Theme_Compat'               => 'members',
     604                        'BP_Signup'                                  => 'members',
     605                        'BP_REST_Members_Endpoint'                   => 'members',
     606                        'BP_REST_Attachments_Member_Avatar_Endpoint' => 'members',
     607                        'BP_REST_Attachments_Member_Cover_Endpoint'  => 'members',
     608                        'BP_REST_Signup_Endpoint'                    => 'members',
    602609
    603610                        'BP_REST_Messages_Endpoint' => 'messages',
    604611