Changeset 13088
- Timestamp:
- 01/02/2024 02:44:07 AM (7 months ago)
- 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 712 712 713 713 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>', 715 715 esc_url( $url ), 716 716 esc_html( $name ), 717 717 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' ) ) 719 720 ); 720 721 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-review-tools.php
r13076 r13088 129 129 $zip_size = size_format( filesize( get_attached_file( $zip_file->ID ) ), 1 ); 130 130 $zip_preview = Template::preview_link_zip( $slug, $zip_file->ID ); 131 131 132 132 133 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>', 134 135 esc_html( $zip_date ), 135 136 esc_url( $zip_url ), 136 137 esc_html( basename( $zip_url ) ), 137 138 esc_html( $zip_size ), 138 esc_url( $zip_preview ) 139 esc_url( $zip_preview ), 140 esc_url( $zip_pcp ) 139 141 ); 140 142 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin-blueprint.php
r13076 r13088 37 37 $plugin = Plugin_Directory::get_plugin_post( $request['plugin_slug'] ); 38 38 39 // Direct zip preview for plugin reviewers40 39 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 ); 85 41 } 86 42 … … 102 58 } 103 59 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 104 131 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
r13076 r13088 772 772 * @return false|string The preview URL. 773 773 */ 774 public static function preview_link_zip( $slug, $attachment_id ) {774 public static function preview_link_zip( $slug, $attachment_id ) { 775 775 776 776 $zip_hash = self::preview_link_hash( $attachment_id ); … … 779 779 } 780 780 $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 781 784 $zip_preview = add_query_arg( 'blueprint-url', urlencode($zip_blueprint), 'https://playground.wordpress.net/' ); 782 785
Note: See TracChangeset
for help on using the changeset viewer.