Making WordPress.org

Changeset 13080


Ignore:
Timestamp:
12/22/2023 06:07:46 AM (15 months ago)
Author:
dd32
Message:

Theme Directory: Review: Add a live preview to review trac tickets.

See https://meta.trac.wordpress.org/ticket/7382
Closes https://github.com/WordPress/wordpress.org/pull/186

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-wporg-themes-upload.php

    r12913 r13080  
    10941094        $theme_description = $this->strip_non_utf8( (string) $this->theme->display( 'Description' ) );
    10951095
     1096        // ZIP location
     1097        $theme_zip_link = "https://downloads.wordpress.org/theme/{$this->theme_slug}.{$this->theme->display( 'Version' )}.zip?nostats=1";
     1098
     1099        /*
     1100         * Build the Live Preview URL.
     1101         *
     1102         * NOTE: The username + password included below are only used for the local in-browser environment, and are not a secret.
     1103         */
     1104        $blueprint = <<<BLUEPRINT
     1105{
     1106    "preferredVersions": {
     1107        "php": "7.4",
     1108        "wp": "latest"
     1109    },
     1110    "steps": [
     1111        {
     1112            "step": "login",
     1113            "username": "admin",
     1114            "password": "password"
     1115        },
     1116        {
     1117            "step": "defineWpConfigConsts",
     1118            "consts": {
     1119                "WP_DEBUG": true
     1120            }
     1121        },
     1122        {
     1123            "step": "importFile",
     1124            "file": {
     1125                "resource": "url",
     1126                "url": "https://raw.githubusercontent.com/WordPress/theme-test-data/master/themeunittestdata.wordpress.xml",
     1127                "caption": "Downloading theme testing content"
     1128            },
     1129            "progress": {
     1130                "caption": "Installing theme testing content"
     1131            }
     1132        },
     1133        {
     1134            "step": "installPlugin",
     1135            "pluginZipFile": {
     1136                "resource": "wordpress.org/plugins",
     1137                "slug": "theme-check"
     1138            },
     1139            "options": {
     1140                "activate": true
     1141            }
     1142        },
     1143        {
     1144            "step": "installTheme",
     1145            "themeZipFile": {
     1146                "resource": "url",
     1147                "url": "{$theme_zip_link}",
     1148                "caption": "Downloading the theme"
     1149            }
     1150        }
     1151    ]
     1152}
     1153BLUEPRINT;
     1154
     1155        // NOTE: The json_encode( json_decode() ) is to remove the whitespaces used above for readability.
     1156        $live_preview_link = 'https://playground.wordpress.net/#' . urlencode( json_encode( json_decode( $blueprint ) ) );
     1157
    10961158        // Hacky way to prevent a problem with xml-rpc.
    10971159        $this->trac_ticket->description = <<<TICKET
     
    11071169
    11081170SVN - https://themes.svn.wordpress.org/{$this->theme_slug}/{$this->theme->display( 'Version' )}
    1109 ZIP - https://wordpress.org/themes/download/{$this->theme_slug}.{$this->theme->display( 'Version' )}.zip?nostats=1
     1171ZIP - {$theme_zip_link}
     1172Live preview – [{$live_preview_link} https://playground.wordpress.net/#…]
     1173
    11101174{$this->trac_ticket->parent_link}
    11111175{$this->trac_ticket->diff_line}
Note: See TracChangeset for help on using the changeset viewer.