Making WordPress.org

Changeset 13088

Timestamp:
01/02/2024 02:44:07 AM (7 months ago)
Author:
tellyworth
Message:

Plugin Directory: Improved preview links for plugin mods

This adds separate "preview" and "pcp" links.

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

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/list-table/class-plugin-posts.php

    r13076 r13088  
    712712
    713713            printf(
    714                 '<a href="%1$s">%2$s</a><br>%3$s<br>(<a href="%4$s" target="_blank">preview</a>)</li>',
     714                '<a href="%1$s">%2$s</a><br>%3$s<br>(<a href="%4$s" target="_blank">preview</a>)</li>',
    715715                esc_url( $url ),
    716716                esc_html( $name ),
    717717                esc_html( $zip_size ),
    718                 esc_url( Template::preview_link_zip( $post->post_name, $zip_file->ID ) )
     718                esc_url( Template::preview_link_zip( $post->post_name, $zip_file->ID ) ),
     719                esc_url( Template::preview_link_zip( $post->post_name, $zip_file->ID, 'pcp' ) )
    719720            );
    720721        }
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-review-tools.php

    r13076 r13088  
    129129                $zip_size                   = size_format( filesize( get_attached_file( $zip_file->ID ) ), 1 );
    130130                $zip_preview                = Template::preview_link_zip( $slug, $zip_file->ID );
     131
    131132
    132133                printf(
    133                     '<li>%1$s <a href="%2$s">%3$s</a> (%4$s) (<a href="%5$s" target="_blank">preview</a>)</li>',
     134                    '<li>%1$s <a href="%2$s">%3$s</a> (%4$s) (<a href="%5$s" target="_blank">preview</a>)</li>',
    134135                    esc_html( $zip_date ),
    135136                    esc_url( $zip_url ),
    136137                    esc_html( basename( $zip_url ) ),
    137138                    esc_html( $zip_size ),
    138                     esc_url( $zip_preview )
     139                    esc_url( $zip_preview ),
     140                    esc_url( $zip_pcp )
    139141                );
    140142            }
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin-blueprint.php

    r13076 r13088  
    3737        $plugin = Plugin_Directory::get_plugin_post( $request['plugin_slug'] );
    3838
    39         // Direct zip preview for plugin reviewers
    4039        if ( $request->get_param('zip_hash') ) {
    41             foreach ( get_attached_media( 'application/zip', $plugin ) as $zip_file ) {
    42                 if ( hash_equals( Template::preview_link_hash( $zip_file->ID, 0 ), $request->get_param('zip_hash') ) ||
    43                      hash_equals( Template::preview_link_hash( $zip_file->ID, -1 ), $request->get_param('zip_hash') ) ) {
    44                     $zip_url = wp_get_attachment_url( $zip_file->ID );
    45                     $zip_blueprint =<<<EOF
    46 {
    47     "landingPage": "/wp-admin/plugins.php",
    48     "preferredVersions": {
    49         "php": "8.0",
    50         "wp": "latest"
    51     },
    52     "phpExtensionBundles": [
    53         "kitchen-sink"
    54     ],
    55     "features": {
    56         "networking": true
    57     },
    58     "steps": [
    59         {
    60             "step": "installPlugin",
    61             "pluginZipFile": {
    62                 "resource": "wordpress.org/plugins",
    63                 "slug": "plugin-check"
    64             }
    65         },
    66         {
    67             "step": "installPlugin",
    68             "pluginZipFile": {
    69                 "resource": "url",
    70                 "url": "$zip_url"
    71             }
    72         },
    73         {
    74             "step": "login",
    75             "username": "admin",
    76             "password": "password"
    77         }
    78     ]
    79 }
    80 EOF;
    81                     header( 'Access-Control-Allow-Origin: https://playground.wordpress.net' );
    82                     die( $zip_blueprint );
    83                 }
    84             }
     40            $this->reviewer_blueprint( $request, $plugin );
    8541        }
    8642
     
    10258    }
    10359
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123
     124
     125
     126
     127
     128
     129
     130
    104131}
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php

    r13076 r13088  
    772772     * @return false|string           The preview URL.
    773773     */
    774     public static function preview_link_zip( $slug, $attachment_id ) {
     774    public static function preview_link_zip( $slug, $attachment_id ) {
    775775
    776776        $zip_hash = self::preview_link_hash( $attachment_id );
     
    779779        }
    780780        $zip_blueprint = sprintf( 'https://wordpress.org/plugins/wp-json/plugins/v1/plugin/%s/blueprint.json?zip_hash=%s', esc_attr( $slug ), esc_attr( $zip_hash ) );
     781
     782
     783
    781784        $zip_preview = add_query_arg( 'blueprint-url', urlencode($zip_blueprint), 'https://playground.wordpress.net/' );
    782785
Note: See TracChangeset for help on using the changeset viewer.