This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Rewrites URLs in a WXR file while keeping track of the URLs found. | |
| * | |
| * This is a huge deal! It unlocks fast, streamed, resumable, fault-tolerant | |
| * WordPress data migrations through WXR files AND directly between sites. | |
| * | |
| * In particular, this script: | |
| * | |
| * * Lists all the URLs found in the XML document |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Rewrites URLs in a WXR file while keeping track of the URLs found. | |
| * | |
| * This is a huge deal! It unlocks fast, streamed, resumable, fault-tolerant | |
| * WordPress data migrations through WXR files AND directly between sites. | |
| * | |
| * In particular, this script: | |
| * | |
| * * Lists all the URLs found in the XML document |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * A copy of the WP_Interactivity_API_Directives_Processor class | |
| * from the Gutenberg plugin. | |
| * | |
| * @package WordPress | |
| * @subpackage Interactivity API | |
| * @since 6.5.0 | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "landingPage": "/wp-admin/", | |
| "steps": [ | |
| { | |
| "step": "runPHP", | |
| "code": "<?php require '/wordpress/wp-load.php'; $user_id = wp_create_user('myuser', 'mypass', 'myuser@localhost'); (new WP_User($user_id))->set_role('editor');" | |
| }, | |
| { | |
| "step": "login", | |
| "username": "myuser", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function download_url_stream_socket_client( $url ) { | |
| $stream = stream_socket_client( | |
| $url, | |
| $errno, | |
| $errstr, | |
| 30, | |
| STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * This is a fun exploration I've done of porting the Tag Processor API over to C as a PHP extension. | |
| * For now this is just a part of the parse_next_attribute() function. | |
| */ | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| #include <stdbool.h> | |
| #include <ctype.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script type="module"> | |
| const TOKEN_KEY = 'githubToken'; | |
| // OAUTH FLOW {{{ | |
| // If there is a code in the URL, store it in localStorage | |
| const urlParams = new URLSearchParams(window.location.search); | |
| const code = urlParams.get('code'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| emcc ./module.c -sSIDE_MODULE -o module.o | |
| emcc ./main.c \ | |
| -lnodefs.js \ | |
| -o ./main.js \ | |
| -sMAIN_MODULE \ | |
| -sEXPORTED_FUNCTIONS='["_main","ccall", "UTF8ToString", "lengthBytesUTF8", "FS"]' \ | |
| -sEXTRA_EXPORTED_RUNTIME_METHODS='["ccall", "UTF8ToString", "lengthBytesUTF8", "FS"]' \ | |
| -sFORCE_FILESYSTEM=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Emscripten has an official image, but it's super slow on Apple Silicon. | |
| # Ubuntu is much faster: | |
| FROM ubuntu:lunar as emscripten | |
| SHELL ["/bin/bash", "-c"] | |
| WORKDIR /root | |
| # Install Emscripten and build dependencies {{{ | |
| RUN apt-get update && \ | |
| apt-get --no-install-recommends -y install \ | |
| build-essential automake autoconf libtool pkgconf flex make re2c gdb git \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { phpVars } from '@php-wasm/common'; | |
| import { ProgressTracker } from '@php-wasm/progress'; | |
| import { | |
| PlaygroundClient, | |
| runBlueprint, | |
| StepDefinition, | |
| Blueprint, | |
| connectPlayground, | |
| } from '@wp-playground/client'; | |
| const query = new URL(document.location.href).searchParams; |