Making WordPress.org


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

Plugin Directory: Improved preview links for plugin mods

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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, $type = null ) {
    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        if ( is_string( $type ) ) {
     782            $zip_blueprint = add_query_arg( 'type', strval( $type ), $zip_blueprint );
     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.