Making WordPress.org

Changeset 10196


Ignore:
Timestamp:
08/21/2020 05:55:20 AM (6 years ago)
Author:
dd32
Message:

Plugin Directory: Consistently redirect to the referer instead of just back to the plugin page.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin-favorites.php

    r9666 r10196  
    6262     */
    6363    public function favorite( $request ) {
    64         $location = get_permalink( Plugin_Directory::get_plugin_post( $request['plugin_slug'] ) );
    65         header( "Location: $location" );
    66 
    67         $result = array(
    68             'location' => $location,
    69         );
     64        $plugin = Plugin_Directory::get_plugin_post( $request['plugin_slug'] );
     65        $result = [
     66            'location' => wp_get_referer() ?: get_permalink( $plugin ),
     67        ];
     68        header( 'Location: ' . $result['location'] );
    7069
    7170        if ( ! isset( $request['favorite'] ) && ! isset( $request['unfavorite'] ) ) {
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin-self-close.php

    r9702 r10196  
    5757     */
    5858    public function self_close( $request ) {
    59         $plugin   = Plugin_Directory::get_plugin_post( $request['plugin_slug'] );
    60         $location = get_permalink( $plugin );
    61         header( "Location: $location" );
    62 
     59        $plugin = Plugin_Directory::get_plugin_post( $request['plugin_slug'] );
    6360        $result = [
    64             'location' => $location,
     61            'location' => wp_get_referer() ?: get_permalink( $plugin ),
    6562        ];
     63        header( 'Location: ' . $result['location'] );
    6664
    6765        // Close the plugin.
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin-self-transfer.php

    r10126 r10196  
    6666     */
    6767    public function self_transfer( $request ) {
    68         $plugin   = Plugin_Directory::get_plugin_post( $request['plugin_slug'] );
    69         $location = get_permalink( $plugin ) . 'advanced/';
    70         header( "Location: $location" );
     68        $plugin = Plugin_Directory::get_plugin_post( $request['plugin_slug'] );
    7169        $result = [
    72             'location'    => $location,
     70            'location'    => wp_get_referer() ?: get_permalink( $plugin ),
    7371            'transferred' => false,
    7472        ];
     73        header( 'Location: ' . $result['location'] );
    7574
    7675        // New owner must also have commit rights.
Note: See TracChangeset for help on using the changeset viewer.