Theme: Enable the new global header/footer

This commit is contained in:
Ian Dunn 2023-11-03 11:35:16 -07:00
parent b0496e7a84
commit ed37e852cc
8 changed files with 303 additions and 42 deletions

View file

@ -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 ) {
}

1
.gitignore vendored
View file

@ -4,6 +4,7 @@
coverage
mu-plugins/vendor
mu-plugins/wporg-mu-plugins
mu-plugins/0-sandbox.php
node_modules

View file

@ -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

View file

@ -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",

280
composer.lock generated
View file

@ -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": [],

View file

@ -8,8 +8,5 @@ namespace WordPressDotOrg\FiveForTheFuture\Theme;
<?php
if ( FEATURE_2021_GLOBAL_HEADER_FOOTER ) {
echo do_blocks( '<!-- wp:wporg/global-footer /-->' );
} else {
require WPORGPATH . 'footer.php';
}
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
echo do_blocks( '<!-- wp:wporg/global-footer /-->' );

View file

@ -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.
*

View file

@ -4,11 +4,8 @@ namespace WordPressDotOrg\FiveForTheFuture\Theme;
\WordPressdotorg\skip_to( '#main' );
if ( FEATURE_2021_GLOBAL_HEADER_FOOTER ) {
echo do_blocks( '<!-- wp:wporg/global-header /-->' );
} else {
require WPORGPATH . 'header.php';
}
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
echo do_blocks( '<!-- wp:wporg/global-header /-->' );
?>