From ed37e852cc681ce3f5167b8ec273e44efd316787 Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Fri, 3 Nov 2023 11:35:16 -0700 Subject: [PATCH] Theme: Enable the new global header/footer --- .env/0-sandbox.php | 24 +-- .gitignore | 1 + README.md | 3 +- composer.json | 17 ++ composer.lock | 280 +++++++++++++++++++++++++++++++- themes/wporg-5ftf/footer.php | 7 +- themes/wporg-5ftf/functions.php | 6 - themes/wporg-5ftf/header.php | 7 +- 8 files changed, 303 insertions(+), 42 deletions(-) diff --git a/.env/0-sandbox.php b/.env/0-sandbox.php index 5d0efff..56b2e7c 100644 --- a/.env/0-sandbox.php +++ b/.env/0-sandbox.php @@ -3,24 +3,14 @@ * These are stubs for closed source code, or things that only apply to local environments. */ +defined( 'WPINC' ) || die(); -namespace { - defined( 'WPINC' ) || die(); +define( 'WPORG_SUPPORT_FORUMS_BLOGID', 419 ); - define( 'WPORG_SUPPORT_FORUMS_BLOGID', 419 ); +require_once WPMU_PLUGIN_DIR . '/wporg-mu-plugins/mu-plugins/loader.php'; - /** - * Stub. - */ - function bump_stats_extra( $name, $value, $views = 1 ) { - } -} - -namespace WordPressdotorg\MU_Plugins\Helpers { - /** - * Stub. - */ - function natural_language_join( array $list, $conjunction = 'and' ): string { - return implode( ', ', $list ); - } +/** + * Stub. + */ +function bump_stats_extra( $name, $value, $views = 1 ) { } diff --git a/.gitignore b/.gitignore index aba9404..fa4bd0d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ coverage mu-plugins/vendor +mu-plugins/wporg-mu-plugins mu-plugins/0-sandbox.php node_modules diff --git a/README.md b/README.md index 0973b68..d794dd4 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,8 @@ In order to contribute with code changes, you'll want to set up a local environm 1. Ensure this newly cloned `wp-content` folder is where it should be in the WP structure. 1. Copy over the base theme with: `svn export https://meta.svn.wordpress.org/sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg themes/pub/wporg` (this should be run from the `wp-content` folder). 1. Install the sandbox mu-plugin with `cd wp-content && mkdir mu-plugins && ln -s .env/0-sandbox.php mu-plugins/0-sandbox.php` -1. If you are making changes to the plugins, you can run `composer install` at `/wp-content/plugins/wporg-5ftf` and then `composer run test` to run the WP unit tests. +1. Run `composer install` inside the content directory. + ### Configuring the site diff --git a/composer.json b/composer.json index feaebae..7f208fd 100644 --- a/composer.json +++ b/composer.json @@ -14,11 +14,28 @@ "_comment": "Work around `test:watch` timeout, see https://github.com/spatie/phpunit-watcher/issues/63#issuecomment-545633709", "process-timeout": 0, "allow-plugins": { + "composer/installers": true, "dealerdirect/phpcodesniffer-composer-installer": true + }, + "preferred-install": { + "wporg/*": "source" } }, + "extra": { + "installer-paths": { + "mu-plugins/{$name}": [ "wporg/wporg-mu-plugins" ] + } + }, + "repositories": [ + { + "type": "vcs", + "url": "git@github.com:WordPress/wporg-mu-plugins.git" + } + ], "require": {}, "require-dev" : { + "composer/installers": "~1.0", + "wporg/wporg-mu-plugins": "dev-build", "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "wp-coding-standards/wpcs": "2.3.*", "phpunit/phpunit": "^9", diff --git a/composer.lock b/composer.lock index ec10eae..afbf9b3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,9 +4,66 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "114d3ada367d4155f2264353107d144a", + "content-hash": "e3ccf274a19dc4972ae883e5055c71c4", "packages": [], "packages-dev": [ + { + "name": "adhocore/jwt", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/adhocore/php-jwt.git", + "reference": "6c434af7170090bb7a8880d2bc220a2254ba7899" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/adhocore/php-jwt/zipball/6c434af7170090bb7a8880d2bc220a2254ba7899", + "reference": "6c434af7170090bb7a8880d2bc220a2254ba7899", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.5 || ^7.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Ahc\\Jwt\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jitendra Adhikari", + "email": "jiten.adhikary@gmail.com" + } + ], + "description": "Ultra lightweight JSON web token (JWT) library for PHP5.5+.", + "keywords": [ + "auth", + "json-web-token", + "jwt", + "jwt-auth", + "jwt-php", + "token" + ], + "support": { + "issues": "https://github.com/adhocore/php-jwt/issues", + "source": "https://github.com/adhocore/php-jwt/tree/1.1.2" + }, + "funding": [ + { + "url": "https://paypal.me/ji10", + "type": "custom" + } + ], + "time": "2021-02-20T09:56:44+00:00" + }, { "name": "clue/stdio-react", "version": "v2.6.0", @@ -219,6 +276,157 @@ ], "time": "2020-11-06T11:48:09+00:00" }, + { + "name": "composer/installers", + "version": "v1.12.0", + "source": { + "type": "git", + "url": "https://github.com/composer/installers.git", + "reference": "d20a64ed3c94748397ff5973488761b22f6d3f19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/installers/zipball/d20a64ed3c94748397ff5973488761b22f6d3f19", + "reference": "d20a64ed3c94748397ff5973488761b22f6d3f19", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0 || ^2.0" + }, + "replace": { + "roundcube/plugin-installer": "*", + "shama/baton": "*" + }, + "require-dev": { + "composer/composer": "1.6.* || ^2.0", + "composer/semver": "^1 || ^3", + "phpstan/phpstan": "^0.12.55", + "phpstan/phpstan-phpunit": "^0.12.16", + "symfony/phpunit-bridge": "^4.2 || ^5", + "symfony/process": "^2.3" + }, + "type": "composer-plugin", + "extra": { + "class": "Composer\\Installers\\Plugin", + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Installers\\": "src/Composer/Installers" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kyle Robinson Young", + "email": "kyle@dontkry.com", + "homepage": "https://github.com/shama" + } + ], + "description": "A multi-framework Composer library installer", + "homepage": "https://composer.github.io/installers/", + "keywords": [ + "Craft", + "Dolibarr", + "Eliasis", + "Hurad", + "ImageCMS", + "Kanboard", + "Lan Management System", + "MODX Evo", + "MantisBT", + "Mautic", + "Maya", + "OXID", + "Plentymarkets", + "Porto", + "RadPHP", + "SMF", + "Starbug", + "Thelia", + "Whmcs", + "WolfCMS", + "agl", + "aimeos", + "annotatecms", + "attogram", + "bitrix", + "cakephp", + "chef", + "cockpit", + "codeigniter", + "concrete5", + "croogo", + "dokuwiki", + "drupal", + "eZ Platform", + "elgg", + "expressionengine", + "fuelphp", + "grav", + "installer", + "itop", + "joomla", + "known", + "kohana", + "laravel", + "lavalite", + "lithium", + "magento", + "majima", + "mako", + "mediawiki", + "miaoxing", + "modulework", + "modx", + "moodle", + "osclass", + "pantheon", + "phpbb", + "piwik", + "ppi", + "processwire", + "puppet", + "pxcms", + "reindex", + "roundcube", + "shopware", + "silverstripe", + "sydes", + "sylius", + "symfony", + "tastyigniter", + "typo3", + "wordpress", + "yawik", + "zend", + "zikula" + ], + "support": { + "issues": "https://github.com/composer/installers/issues", + "source": "https://github.com/composer/installers/tree/v1.12.0" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2021-09-13T08:19:44+00:00" + }, { "name": "dealerdirect/phpcodesniffer-composer-installer", "version": "v0.7.2", @@ -3358,16 +3566,16 @@ }, { "name": "symfony/yaml", - "version": "v5.4.23", + "version": "v5.4.30", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "4cd2e3ea301aadd76a4172756296fe552fb45b0b" + "reference": "c6980e82a6656f6ebfabfd82f7585794cb122554" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/4cd2e3ea301aadd76a4172756296fe552fb45b0b", - "reference": "4cd2e3ea301aadd76a4172756296fe552fb45b0b", + "url": "https://api.github.com/repos/symfony/yaml/zipball/c6980e82a6656f6ebfabfd82f7585794cb122554", + "reference": "c6980e82a6656f6ebfabfd82f7585794cb122554", "shasum": "" }, "require": { @@ -3413,7 +3621,7 @@ "description": "Loads and dumps YAML files", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/yaml/tree/v5.4.23" + "source": "https://github.com/symfony/yaml/tree/v5.4.30" }, "funding": [ { @@ -3429,7 +3637,7 @@ "type": "tidelift" } ], - "time": "2023-04-23T19:33:36+00:00" + "time": "2023-10-27T18:36:14+00:00" }, { "name": "theseer/tokenizer", @@ -3532,6 +3740,60 @@ }, "time": "2020-05-13T23:57:56+00:00" }, + { + "name": "wporg/wporg-mu-plugins", + "version": "dev-build", + "source": { + "type": "git", + "url": "https://github.com/WordPress/wporg-mu-plugins.git", + "reference": "5a3aea4d294be57809b5e6ed53a2caa88cbaa043" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/WordPress/wporg-mu-plugins/zipball/5a3aea4d294be57809b5e6ed53a2caa88cbaa043", + "reference": "5a3aea4d294be57809b5e6ed53a2caa88cbaa043", + "shasum": "" + }, + "require": { + "adhocore/jwt": "^1.0" + }, + "require-dev": { + "composer/installers": "~1.0", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", + "phpcompatibility/phpcompatibility-wp": "*", + "phpunit/phpunit": "^9.5", + "wp-coding-standards/wpcs": "2.*", + "wp-phpunit/wp-phpunit": "~6.0", + "wporg/wporg-repo-tools": "dev-trunk", + "yoast/phpunit-polyfills": "^1.1" + }, + "type": "wordpress-muplugin", + "extra": { + "sync-svn": { + "main-branch": "trunk", + "paths": { + "mu-plugins/": "https://dotorg.svn.wordpress.org/wordpress/website/wp-content/mu-plugins/pub-sync/" + } + } + }, + "scripts": { + "format": [ + "phpcbf -p" + ], + "lint": [ + "phpcs" + ] + }, + "license": [ + "GPL-2.0-or-later" + ], + "description": "`mu-plugins` for the WordPress.org network", + "support": { + "source": "https://github.com/WordPress/wporg-mu-plugins/tree/build", + "issues": "https://github.com/WordPress/wporg-mu-plugins/issues" + }, + "time": "2023-10-26T23:21:38+00:00" + }, { "name": "yoast/phpunit-polyfills", "version": "1.1.0", @@ -3652,7 +3914,9 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "wporg/wporg-mu-plugins": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": [], diff --git a/themes/wporg-5ftf/footer.php b/themes/wporg-5ftf/footer.php index dec6ba4..a2975b3 100644 --- a/themes/wporg-5ftf/footer.php +++ b/themes/wporg-5ftf/footer.php @@ -8,8 +8,5 @@ namespace WordPressDotOrg\FiveForTheFuture\Theme; ' ); -} else { - require WPORGPATH . 'footer.php'; -} +// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped +echo do_blocks( '' ); diff --git a/themes/wporg-5ftf/functions.php b/themes/wporg-5ftf/functions.php index 5f56cdc..6b74d86 100644 --- a/themes/wporg-5ftf/functions.php +++ b/themes/wporg-5ftf/functions.php @@ -2,12 +2,6 @@ namespace WordPressDotOrg\FiveForTheFuture\Theme; -// Temporary for local environments. Remove this when the new header launches. -// See https://github.com/WordPress/wporg-mu-plugins/issues/38 -if ( ! defined( 'FEATURE_2021_GLOBAL_HEADER_FOOTER' ) ) { - define( 'FEATURE_2021_GLOBAL_HEADER_FOOTER', false ); -} - /** * Sets up theme defaults and registers support for various WordPress features. * diff --git a/themes/wporg-5ftf/header.php b/themes/wporg-5ftf/header.php index 82c250f..5422321 100644 --- a/themes/wporg-5ftf/header.php +++ b/themes/wporg-5ftf/header.php @@ -4,11 +4,8 @@ namespace WordPressDotOrg\FiveForTheFuture\Theme; \WordPressdotorg\skip_to( '#main' ); -if ( FEATURE_2021_GLOBAL_HEADER_FOOTER ) { - echo do_blocks( '' ); -} else { - require WPORGPATH . 'header.php'; -} +// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped +echo do_blocks( '' ); ?>