Warning
Stable tag is unchanged at 1.3.0, so no plugin release will occur.
svn status
:
M readme.txt
/** | |
* Finalizes extension. | |
* | |
* @type {FinalizeCallback} | |
* @param {FinalizeArgs} args Args. | |
*/ | |
export async function finalize( { extendRootData } ) { | |
const script = document.getElementById( 'od-normalized-query-vars' ); | |
if ( script instanceof HTMLScriptElement ) { | |
extendRootData( { queryVars: JSON.parse( script.text ) } ); |
/** | |
* Finalizes extension. | |
* | |
* @type {FinalizeCallback} | |
* @param {FinalizeArgs} args Args. | |
*/ | |
export async function finalize( { extendRootData } ) { | |
extendRootData( { userAgent: navigator.userAgent } ); | |
} |
<?php | |
/** | |
* Plugin Name: Optimization Detective Admin UI | |
* Plugin URI: https://gist.github.com/westonruter/004094f1d49b8b98492deb3dd20bc55e | |
* Description: Provides an admin UI to inspect URL Metrics from the Optimization Detective plugin. | |
* Requires at least: 6.5 | |
* Requires PHP: 7.2 | |
* Requires Plugins: optimization-detective | |
* Version: 0.3.3 | |
* Author: Weston Ruter |
<?php | |
/** | |
* This file is intended to be executed using WP-CLI's eval-file command. | |
*/ | |
$bookmark_name = 'the-bookmark'; | |
$html = <<<HTML | |
<html lang="en"> | |
<head> |
Warning: The next_token() method was called another time for +HTML. in /var/www/html/wp-content/plugins/html-processor-debug/html-processor-debug.php on line 80 | |
<HTML xpath="/*[2][self::HTML]"> | |
Warning: The next_token() method was called another time for +HEAD. in /var/www/html/wp-content/plugins/html-processor-debug/html-processor-debug.php on line 80 | |
<HEAD xpath="/*[2][self::HTML]/*[2][self::HEAD]"> | |
Warning: The next_token() method was called another time for +META. in /var/www/html/wp-content/plugins/html-processor-debug/html-processor-debug.php on line 80 | |
<META xpath="/*[2][self::HTML]/*[2][self::HEAD]/*[3][self::META]"> | |
Warning: The next_token() method was called another time for +TITLE. in /var/www/html/wp-content/plugins/html-processor-debug/html-processor-debug.php on line 80 | |
<TITLE xpath="/*[2][self::HTML]/*[2][self::HEAD]/*[6][self::TITLE]"> | |
Warning: The next_token() method was called another time for -HEAD. in /var/www/html/wp-content/plugins/html-processor-d |
<?php | |
$sizes_values = array_filter( | |
array_map( | |
static function ( string $size ): string { | |
$size = trim( $size, " \t\f\r\n" ); | |
$lower_sizes = strtolower( $size ); | |
if ( 'auto' === $lower_sizes ) { | |
// Normalize to lower-case. | |
$size = $lower_sizes; |
Usage:
The default repetition count is 1000. You can pass a different iteration
wp eval-file html-api-benchmark.php
wp eval-file html-api-benchmark.php 10000
See PR WordPress/performance#1471
<?php | |
/** | |
* Plugin Name: Auto-Sizes via HTML Tag Processor | |
*/ | |
function auto_sizes_update_content_img_tag_with_html_tag_processor( $html ): string { | |
if ( ! is_string( $html ) ) { | |
$html = ''; | |
} |
<?php | |
$values = []; | |
foreach ( array( 'PHP_OUTPUT_HANDLER_START', 'PHP_OUTPUT_HANDLER_WRITE', 'PHP_OUTPUT_HANDLER_FLUSH', 'PHP_OUTPUT_HANDLER_CLEAN', 'PHP_OUTPUT_HANDLER_FINAL', 'PHP_OUTPUT_HANDLER_END' ) as $constant ) { | |
if ( constant( $constant ) & $phase ) { | |
$values[] = $constant; | |
} | |
} | |
error_log( 'Phase: ' . implode( ', ', $values ) ); |