Making WordPress.org

Changeset 13083


Ignore:
Timestamp:
12/22/2023 07:42:36 AM (3 years ago)
Author:
dd32
Message:

Theme Directory: Review: Install the parent theme in live previews.

See #7382.

File:
1 edited

Legend:

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

    r13082 r13083  
    10971097                $theme_zip_link = "https://downloads.wordpress.org/theme/{$this->theme_slug}.{$this->theme->display( 'Version' )}.zip?nostats=1";
    10981098
    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                  */
     1099                // Build the Live Preview Blueprint & URL.
     1100                 $blueprint_parent_step = '';
     1101                 if (
     1102                        $this->theme->parent() &&
     1103                        in_array( 'buddypress', $this->theme->get( 'Tags' ) )
     1104                ) {
     1105                        $blueprint_parent_step = <<<BLUEPRINT_PARENT_BP
     1106                        {
     1107                                "step": "installPlugin",
     1108                                "pluginZipFile": {
     1109                                        "resource": "wordpress.org/plugins",
     1110                                        "slug": "buddypress"
     1111                                },
     1112                                "options": {
     1113                                        "activate": true
     1114                                }
     1115                        },
     1116                        BLUEPRINT_PARENT_BP;
     1117                } elseif ( $this->theme->parent() ) {
     1118                        $blueprint_parent_step = <<<BLUEPRINT_PARENT_THEME
     1119                        {
     1120                                "step": "installTheme",
     1121                                "themeZipFile": {
     1122                                        "resource": "wordpress.org/themes",
     1123                                        "slug": "{$this->theme->get_template()}"
     1124                                }
     1125                        },
     1126                        BLUEPRINT_PARENT_THEME;
     1127                }
     1128
     1129                // NOTE: The username + password included below are only used for the local in-browser environment, and are not a secret.
    11041130                $blueprint = <<<BLUEPRINT
    1105 {
    1106         "preferredVersions": {
    1107                 "php": "7.4",
    1108                 "wp": "latest"
    1109         },
    1110         "steps": [
    11111131                {
    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"
     1132                        "preferredVersions": {
     1133                                "php": "7.4",
     1134                                "wp": "latest"
    11281135                        },
    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 }
    1153 BLUEPRINT;
     1136                        "steps": [
     1137                                {
     1138                                        "step": "login",
     1139                                        "username": "admin",
     1140                                        "password": "password"
     1141                                },
     1142                                {
     1143                                        "step": "defineWpConfigConsts",
     1144                                        "consts": {
     1145                                                "WP_DEBUG": true
     1146                                        }
     1147                                },
     1148                                {
     1149                                        "step": "importFile",
     1150                                        "file": {
     1151                                                "resource": "url",
     1152                                                "url": "https://raw.githubusercontent.com/WordPress/theme-test-data/master/themeunittestdata.wordpress.xml",
     1153                                                "caption": "Downloading theme testing content"
     1154                                        },
     1155                                        "progress": {
     1156                                                "caption": "Installing theme testing content"
     1157                                        }
     1158                                },
     1159                                {
     1160                                        "step": "installPlugin",
     1161                                        "pluginZipFile": {
     1162                                                "resource": "wordpress.org/plugins",
     1163                                                "slug": "theme-check"
     1164                                        },
     1165                                        "options": {
     1166                                                "activate": true
     1167                                        }
     1168                                },
     1169                                {$blueprint_parent_step}
     1170                                {
     1171                                        "step": "installTheme",
     1172                                        "themeZipFile": {
     1173                                                "resource": "url",
     1174                                                "url": "{$theme_zip_link}",
     1175                                                "caption": "Downloading the theme"
     1176                                        }
     1177                                }
     1178                        ]
     1179                }
     1180                BLUEPRINT;
    11541181
    11551182                // NOTE: The json_encode( json_decode() ) is to remove the whitespaces used above for readability.
Note: See TracChangeset for help on using the changeset viewer.