| name file |
size |
edit |
permission |
action |
| .htaccess | 1444 KB | October 31 2025 08:48:41 | 0644 |
|
| .htaccess.bk | 714 KB | December 05 2024 23:54:43 | 0644 |
|
| .private | - | December 05 2024 23:53:49 | 0755 |
|
| default.php | 16395 KB | December 05 2024 23:53:33 | 0644 |
|
| index.php | 405 KB | December 05 2024 23:53:40 | 0644 |
|
| license.txt | 19915 KB | October 03 2025 03:33:36 | 0644 |
|
| readme.html | 7409 KB | October 03 2025 03:33:36 | 0644 |
|
| wp-activate.php | 7387 KB | December 05 2024 23:53:39 | 0644 |
|
| wp-admin | - | December 05 2024 23:53:40 | 0755 |
|
| wp-blog-header.php | 351 KB | December 05 2024 23:53:40 | 0644 |
|
| wp-comments-post.php | 2323 KB | December 05 2024 23:53:40 | 0644 |
|
| wp-config-sample.php | 3336 KB | December 05 2024 23:53:40 | 0644 |
|
| wp-config.php | 3531 KB | December 05 2024 23:54:43 | 0644 |
|
| wp-content | - | October 31 2025 08:48:41 | 0755 |
|
| wp-cron.php | 5617 KB | December 05 2024 23:53:39 | 0644 |
|
| wp-includes | - | December 05 2024 23:53:40 | 0755 |
|
| wp-links-opml.php | 2502 KB | December 05 2024 23:53:40 | 0644 |
|
| wp-load.php | 3937 KB | December 05 2024 23:53:40 | 0644 |
|
| wp-login.php | 51367 KB | December 05 2024 23:53:39 | 0644 |
|
| wp-mail.php | 8543 KB | December 05 2024 23:53:40 | 0644 |
|
| wp-settings.php | 29032 KB | December 05 2024 23:53:40 | 0644 |
|
| wp-signup.php | 34385 KB | December 05 2024 23:53:39 | 0644 |
|
| wp-trackback.php | 5102 KB | December 05 2024 23:53:39 | 0644 |
|
| xmlrpc.php | 3246 KB | December 05 2024 23:53:39 | 0644 |
|
'blue-orange',
* …
* ]
*
* @internal
*
* @since 6.3.0
*
* @var array
*/
private static $global_styles_block_names;
/**
* An array of duotone filter data from global, theme, and custom presets.
*
* Example:
* [
* 'wp-duotone-blue-orange' => [
* 'slug' => 'blue-orange',
* 'colors' => [ '#0000ff', '#ffcc00' ],
* ],
* 'wp-duotone-red-yellow' => [
* 'slug' => 'red-yellow',
* 'colors' => [ '#cc0000', '#ffff33' ],
* ],
* …
* ]
*
* @internal
*
* @since 6.3.0
*
* @var array
*/
private static $global_styles_presets;
/**
* All of the duotone filter data from presets for CSS custom properties on
* the page.
*
* Example:
* [
* 'wp-duotone-blue-orange' => [
* 'slug' => 'blue-orange',
* 'colors' => [ '#0000ff', '#ffcc00' ],
* ],
* …
* ]
*
* @internal
*
* @since 6.3.0
*
* @var array
*/
private static $used_global_styles_presets = array();
/**
* All of the duotone filter data for SVGs on the page. Includes both
* presets and custom filters.
*
* Example:
* [
* 'wp-duotone-blue-orange' => [
* 'slug' => 'blue-orange',
* 'colors' => [ '#0000ff', '#ffcc00' ],
* ],
* 'wp-duotone-000000-ffffff-2' => [
* 'slug' => '000000-ffffff-2',
* 'colors' => [ '#000000', '#ffffff' ],
* ],
* …
* ]
*
* @internal
*
* @since 6.3.0
*
* @var array
*/
private static $used_svg_filter_data = array();
/**
* All of the block CSS declarations for styles on the page.
*
* Example:
* [
* [
* 'selector' => '.wp-duotone-000000-ffffff-2.wp-block-image img',
* 'declarations' => [
* 'filter' => 'url(#wp-duotone-000000-ffffff-2)',
* ],
* ],
* …
* ]
*
* @internal
*
* @since 6.3.0
*
* @var array
*/
private static $block_css_declarations = array();
/**
* Clamps a value between an upper and lower bound.
*
* Direct port of colord's clamp function.
*
* @link https://github.com/omgovich/colord/blob/3f859e03b0ca622eb15480f611371a0f15c9427f/src/helpers.ts#L23 Sourced from colord.
*
* @internal
*
* @since 6.3.0
*
* @param float $number The number to clamp.
* @param float $min The minimum value.
* @param float $max The maximum value.
* @return float The clamped value.
*/
private static function colord_clamp( $number, $min = 0, $max = 1 ) {
return $number > $max ? $max : ( $number > $min ? $number : $min );
}
/**
* Processes and clamps a degree (angle) value properly.
*
* Direct port of colord's clampHue function.
*
* @link https://github.com/omgovich/colord/blob/3f859e03b0ca622eb15480f611371a0f15c9427f/src/helpers.ts#L32 Sourced from colord.
*
* @internal
*
* @since 6.3.0
*
* @param float $degrees The hue to clamp.
* @return float The clamped hue.
*/
private static function colord_clamp_hue( $degrees ) {
$degrees = is_finite( $degrees ) ? $degrees % 360 : 0;
return $degrees > 0 ? $degrees : $degrees + 360;
}
/**
* Converts a hue value to degrees from 0 to 360 inclusive.
*
* Direct port of colord's parseHue function.
*
* @link https://github.com/omgovich/colord/blob/3f859e03b0ca622eb15480f611371a0f15c9427f/src/helpers.ts#L40 Sourced from colord.
*
* @internal
*
* @since 6.3.0
*
* @param float $value The hue value to parse.
* @param string $unit The unit of the hue value.
* @return float The parsed hue value.
*/
private static function colord_parse_hue( $value, $unit = 'deg' ) {
$angle_units = array(
'grad' => 360 / 400,
'turn' => 360,
'rad' => 360 / ( M_PI * 2 ),
);
$factor = isset( $angle_units[ $unit ] ) ? $angle_units[ $unit ] : 1;
return (float) $value * $factor;
}
/**
* Parses any valid Hex3, Hex4, Hex6 or Hex8 string and converts it to an RGBA object.
*
* Direct port of colord's parseHex function.
*
* @link https://github.com/omgovich/colord/blob/3f859e03b0ca622eb15480f611371a0f15c9427f/src/colorModels/hex.ts#L8 Sourced from colord.
*
* @internal
*
* @since 6.3.0
*
* @param string $hex The hex string to parse.
* @return array|null An array of RGBA values or null if the hex string is invalid.
*/
private static function colord_parse_hex( $hex ) {
$is_match = preg_match(
'/^#([0-9a-f]{3,8})$/i',
$hex,
$hex_match
);
if ( ! $is_match ) {
return null;
}
$hex = $hex_match[1];
if ( 4 >= strlen( $hex ) ) {
return array(
'r' => (int) base_convert( $hex[0] . $hex[0], 16, 10 ),
'g' => (int) base_convert( $hex[1] . $hex[1], 16, 10 ),
'b' => (int) base_convert( $hex[2] . $hex[2], 16, 10 ),
'a' => 4 === strlen( $hex ) ? round( base_convert( $hex[3] . $hex[3], 16, 10 ) / 255, 2 ) : 1,
);
}
if ( 6 === strlen( $hex ) || 8 === strlen( $hex ) ) {
return array(
'r' => (int) base_convert( substr( $hex, 0, 2 ), 16, 10 ),
'g' => (int) base_convert( substr( $hex, 2, 2 ), 16, 10 ),
'b' => (int) base_convert( substr( $hex, 4, 2 ), 16, 10 ),
'a' => 8 === strlen( $hex ) ? round( (int) base_convert( substr( $hex, 6, 2 ), 16, 10 ) / 255, 2 ) : 1,
);
}
return null;
}
/**
* Clamps an array of RGBA values.
*
* Direct port of colord's clampRgba function.
*
* @link https://github.com/omgovich/colord/blob/3f859e03b0ca622eb15480f611371a0f15c9427f/src/colorModels/rgb.ts#L5 Sourced from colord.
*
* @internal
*
* @since 6.3.0
*
* @param array $rgba The RGBA array to clamp.
* @return array The clamped RGBA array.
*/
private static function colord_clamp_rgba( $rgba ) {
$rgba['r'] = self::colord_clamp( $rgba['r'], 0, 255 );
$rgba['g'] = self::colord_clamp( $rgba['g'], 0, 255 );
$rgba['b'] = self::colord_clamp( $rgba['b'], 0, 255 );
$rgba['a'] = self::colord_clamp( $rgba['a'] );
return $rgba;
}
/**
* Parses a valid RGB[A] CSS color function/string.
*
* Direct port of colord's parseRgbaString function.
*
* @link https://github.com/omgovich/colord/blob/3f859e03b0ca622eb15480f611371a0f15c9427f/src/colorModels/rgbString.ts#L18 Sourced from colord.
*
* @internal
*
* @since 6.3.0
*
* @param string $input The RGBA string to parse.
* @return array|null An array of RGBA values or null if the RGB string is invalid.
*/
private static function colord_parse_rgba_string( $input ) {
// Functional syntax.
$is_match = preg_match(
'/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i',
$input,
$match
);
if ( ! $is_match ) {
// Whitespace syntax.
$is_match = preg_match(
'/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i',
$input,
$match
);
}
if ( ! $is_match ) {
return null;
}
/*
* For some reason, preg_match doesn't include empty matches at the end
* of the array, so we add them manually to make things easier later.
*/
for ( $i = 1; $i <= 8; $i++ ) {
if ( ! isset( $match[ $i ] ) ) {
$match[ $i ] = '';
}
}
if ( $match[2] !== $match[4] || $match[4] !== $match[6] ) {
return null;
}
return self::colord_clamp_rgba(
array(
'r' => (float) $match[1] / ( $match[2] ? 100 / 255 : 1 ),
'g' => (float) $match[3] / ( $match[4] ? 100 / 255 : 1 ),
'b' => (float) $match[5] / ( $match[6] ? 100 / 255 : 1 ),
'a' => '' === $match[7] ? 1 : (float) $match[7] / ( $match[8] ? 100 : 1 ),
)
);
}
/**
* Clamps an array of HSLA values.
*
* Direct port of colord's clampHsla function.
*
* @link https://github.com/omgovich/colord/blob/3f859e03b0ca622eb15480f611371a0f15c9427f/src/colorModels/hsl.ts#L6 Sourced from colord.
*
* @internal
*
* @since 6.3.0
*
* @param array $hsla The HSLA array to clamp.
* @return array The clamped HSLA array.
*/
private static function colord_clamp_hsla( $hsla ) {
$hsla['h'] = self::colord_clamp_hue( $hsla['h'] );
$hsla['s'] = self::colord_clamp( $hsla['s'], 0, 100 );
$hsla['l'] = self::colord_clamp( $hsla['l'], 0, 100 );
$hsla['a'] = self::colord_clamp( $hsla['a'] );
return $hsla;
}
/**
* Converts an HSVA array to RGBA.
*
* Direct port of colord's hsvaToRgba function.
*
* @link https://github.com/omgovich/colord/blob/3f859e03b0ca622eb15480f611371a0f15c9427f/src/colorModels/hsv.ts#L52 Sourced from colord.
*
* @internal
*
* @since 6.3.0
*
* @param array $hsva The HSVA array to convert.
* @return array The RGBA array.
*/
private static function colord_hsva_to_rgba( $hsva ) {
$h = ( $hsva['h'] / 360 ) * 6;
$s = $hsva['s'] / 100;
$v = $hsva['v'] / 100;
$a = $hsva['a'];
$hh = floor( $h );
$b = $v * ( 1 - $s );
$c = $v * ( 1 - ( $h - $hh ) * $s );
$d = $v * ( 1 - ( 1 - $h + $hh ) * $s );
$module = $hh % 6;
return array(
'r' => array( $v, $c, $b, $b, $d, $v )[ $module ] * 255,
'g' => array( $d, $v, $v, $c, $b, $b )[ $module ] * 255,
'b' => array( $b, $b, $d, $v, $v, $c )[ $module ] * 255,
'a' => $a,
);
}
/**
* Converts an HSLA array to HSVA.
*
* Direct port of colord's hslaToHsva function.
*
* @link https://github.com/omgovich/colord/blob/3f859e03b0ca622eb15480f611371a0f15c9427f/src/colorModels/hsl.ts#L33 Sourced from colord.
*
* @internal
*
* @since 6.3.0
*
* @param array $hsla The HSLA array to convert.
* @return array The HSVA array.
*/
private static function colord_hsla_to_hsva( $hsla ) {
$h = $hsla['h'];
$s = $hsla['s'];
$l = $hsla['l'];
$a = $hsla['a'];
$s *= ( $l < 50 ? $l : 100 - $l ) / 100;
return array(
'h' => $h,
's' => $s > 0 ? ( ( 2 * $s ) / ( $l + $s ) ) * 100 : 0,
'v' => $l + $s,
'a' => $a,
);
}
/**
* Converts an HSLA array to RGBA.
*
* Direct port of colord's hslaToRgba function.
*
* @link https://github.com/omgovich/colord/blob/3f859e03b0ca622eb15480f611371a0f15c9427f/src/colorModels/hsl.ts#L55 Sourced from colord.
*
* @internal
*
* @since 6.3.0
*
* @param array $hsla The HSLA array to convert.
* @return array The RGBA array.
*/
private static function colord_hsla_to_rgba( $hsla ) {
return self::colord_hsva_to_rgba( self::colord_hsla_to_hsva( $hsla ) );
}
/**
* Parses a valid HSL[A] CSS color function/string.
*
* Direct port of colord's parseHslaString function.
*
* @link https://github.com/omgovich/colord/blob/3f859e03b0ca622eb15480f611371a0f15c9427f/src/colorModels/hslString.ts#L17 Sourced from colord.
*
* @internal
*
* @since 6.3.0
*
* @param string $input The HSLA string to parse.
* @return array|null An array of RGBA values or null if the RGB string is invalid.
*/
private static function colord_parse_hsla_string( $input ) {
// Functional syntax.
$is_match = preg_match(
'/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i',
$input,
$match
);
if ( ! $is_match ) {
// Whitespace syntax.
$is_match = preg_match(
'/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i',
$input,
$match
);
}
if ( ! $is_match ) {
return null;
}
/*
* For some reason, preg_match doesn't include empty matches at the end
* of the array, so we add them manually to make things easier later.
*/
for ( $i = 1; $i <= 6; $i++ ) {
if ( ! isset( $match[ $i ] ) ) {
$match[ $i ] = '';
}
}
$hsla = self::colord_clamp_hsla(
array(
'h' => self::colord_parse_hue( $match[1], $match[2] ),
's' => (float) $match[3],
'l' => (float) $match[4],
'a' => '' === $match[5] ? 1 : (float) $match[5] / ( $match[6] ? 100 : 1 ),
)
);
return self::colord_hsla_to_rgba( $hsla );
}
/**
* Tries to convert an incoming string into RGBA values.
*
* Direct port of colord's parse function simplified for our use case. This
* version only supports string parsing and only returns RGBA values.
*
* @link https://github.com/omgovich/colord/blob/3f859e03b0ca622eb15480f611371a0f15c9427f/src/parse.ts#L37 Sourced from colord.
*
* @internal
*
* @since 6.3.0
*
* @param string $input The string to parse.
* @return array|null An array of RGBA values or null if the string is invalid.
*/
private static function colord_parse( $input ) {
$result = self::colord_parse_hex( $input );
if ( ! $result ) {
$result = self::colord_parse_rgba_string( $input );
}
if ( ! $result ) {
$result = self::colord_parse_hsla_string( $input );
}
return $result;
}
/**
* Takes the inline CSS duotone variable from a block and return the slug.
*
* Handles styles slugs like:
* var:preset|duotone|blue-orange
* var(--wp--preset--duotone--blue-orange)
*
* @internal
*
* @since 6.3.0
*
* @param string $duotone_attr The duotone attribute from a block.
* @return string The slug of the duotone preset or an empty string if no slug is found.
*/
private static function get_slug_from_attribute( $duotone_attr ) {
// Uses Branch Reset Groups `(?|…)` to return one capture group.
preg_match( '/(?|var:preset\|duotone\|(\S+)|var\(--wp--preset--duotone--(\S+)\))/', $duotone_attr, $matches );
return ! empty( $matches[1] ) ? $matches[1] : '';
}
/**
* Checks if we have a valid duotone preset.
*
* Valid presets are defined in the $global_styles_presets array.
*
* @internal
*
* @since 6.3.0
*
* @param string $duotone_attr The duotone attribute from a block.
* @return bool True if the duotone preset present and valid.
*/
private static function is_preset( $duotone_attr ) {
$slug = self::get_slug_from_attribute( $duotone_attr );
$filter_id = self::get_filter_id( $slug );
return array_key_exists( $filter_id, self::get_all_global_styles_presets() );
}
/**
* Gets the CSS variable name for a duotone preset.
*
* Example output:
* --wp--preset--duotone--blue-orange
*
* @internal
*
* @since 6.3.0
*
* @param string $slug The slug of the duotone preset.
* @return string The CSS variable name.
*/
private static function get_css_custom_property_name( $slug ) {
return "--wp--preset--duotone--$slug";
}
/**
* Get the ID of the duotone filter.
*
* Example output:
* wp-duotone-blue-orange
*
* @internal
*
* @since 6.3.0
*
* @param string $slug The slug of the duotone preset.
* @return string The ID of the duotone filter.
*/
private static function get_filter_id( $slug ) {
return "wp-duotone-$slug";
}
/**
* Get the CSS variable for a duotone preset.
*
* Example output:
* var(--wp--preset--duotone--blue-orange)
*
* @internal
*
* @since 6.3.0
*
* @param string $slug The slug of the duotone preset.
* @return string The CSS variable.
*/
private static function get_css_var( $slug ) {
$name = self::get_css_custom_property_name( $slug );
return "var($name)";
}
/**
* Get the URL for a duotone filter.
*
* Example output:
* url(#wp-duotone-blue-orange)
*
* @internal
*
* @since 6.3.0
*
* @param string $filter_id The ID of the filter.
* @return string The URL for the duotone filter.
*/
private static function get_filter_url( $filter_id ) {
return "url(#$filter_id)";
}
/**
* Gets the SVG for the duotone filter definition.
*
* Whitespace is removed when SCRIPT_DEBUG is not enabled.
*
* @internal
*
* @since 6.3.0
*
* @param string $filter_id The ID of the filter.
* @param array $colors An array of color strings.
* @return string An SVG with a duotone filter definition.
*/
private static function get_filter_svg( $filter_id, $colors ) {
$duotone_values = array(
'r' => array(),
'g' => array(),
'b' => array(),
'a' => array(),
);
foreach ( $colors as $color_str ) {
$color = self::colord_parse( $color_str );
if ( null === $color ) {
$error_message = sprintf(
/* translators: 1: Duotone colors, 2: theme.json, 3: settings.color.duotone */
__( '"%1$s" in %2$s %3$s is not a hex or rgb string.' ),
$color_str,
'theme.json',
'settings.color.duotone'
);
_doing_it_wrong( __METHOD__, $error_message, '6.3.0' );
} else {
$duotone_values['r'][] = $color['r'] / 255;
$duotone_values['g'][] = $color['g'] / 255;
$duotone_values['b'][] = $color['b'] / 255;
$duotone_values['a'][] = $color['a'];
}
}
ob_start();
?>