summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wp-admin/nav-menus.php2
-rw-r--r--src/wp-content/themes/twentyeleven/inc/block-patterns.php4
-rw-r--r--src/wp-includes/class-wp-image-editor-imagick.php51
3 files changed, 24 insertions, 33 deletions
diff --git a/src/wp-admin/nav-menus.php b/src/wp-admin/nav-menus.php
index 36905bab63..82c8e264ad 100644
--- a/src/wp-admin/nav-menus.php
+++ b/src/wp-admin/nav-menus.php
@@ -1083,7 +1083,7 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
$menu_name_aria_desc = $add_new_screen ? ' aria-describedby="menu-name-desc"' : '';
if ( $one_theme_location_no_menus ) {
- $menu_name_val = 'value="' . esc_attr( 'Menu 1' ) . '"';
+ $menu_name_val = 'value="' . esc_attr__( 'Menu 1' ) . '"';
?>
<input type="hidden" name="zero-menu-state" value="true" />
<?php
diff --git a/src/wp-content/themes/twentyeleven/inc/block-patterns.php b/src/wp-content/themes/twentyeleven/inc/block-patterns.php
index bdb2619422..27b37be500 100644
--- a/src/wp-content/themes/twentyeleven/inc/block-patterns.php
+++ b/src/wp-content/themes/twentyeleven/inc/block-patterns.php
@@ -39,7 +39,7 @@ if ( function_exists( 'register_block_pattern' ) ) {
<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} -->
- <figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/patterns/pattern-flower.jpg" alt="' . esc_attr( 'A yellow flower against a dark background.', 'twentyeleven' ) . '" /></figure>
+ <figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/patterns/pattern-flower.jpg" alt="' . esc_attr__( 'A yellow flower against a dark background.', 'twentyeleven' ) . '" /></figure>
<!-- /wp:image -->
<!-- wp:paragraph {"dropCap":true} -->
<p class="has-drop-cap">' . esc_html__( 'This is just an example post to showcase the featured post section on the showcase page. Who doesn&#8217;t like flowers? I like flowers. Nullam hendrerit enim nunc. Vestibulum eget nulla magna! Fusce lobortis neque eu neque egestas tincidunt. Duis elementum consequat lorem, in eleifend justo mollis at. Nam quis adipiscing magna. Duis adipiscing est ac nibh feugiat rhoncus. Donec non lorem felis, eget commodo purus.', 'twentyeleven' ) . '</p>
@@ -117,7 +117,7 @@ if ( function_exists( 'register_block_pattern' ) ) {
<!-- /wp:heading --><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column -->
<div class="wp-block-column"><!-- wp:image {"id":null,"sizeSlug":"large","linkDestination":"none"} -->
- <figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/patterns/pattern-woman.jpg" alt="' . esc_attr( 'Photo of a woman.', 'twentyeleven' ) . '" /></figure>
+ <figure class="wp-block-image size-large"><img src="' . esc_url( get_template_directory_uri() ) . '/images/patterns/pattern-woman.jpg" alt="' . esc_attr__( 'Photo of a woman.', 'twentyeleven' ) . '" /></figure>
<!-- /wp:image --></div>
<!-- /wp:column -->
<!-- wp:column -->
diff --git a/src/wp-includes/class-wp-image-editor-imagick.php b/src/wp-includes/class-wp-image-editor-imagick.php
index 66085ac503..2e7c7039d5 100644
--- a/src/wp-includes/class-wp-image-editor-imagick.php
+++ b/src/wp-includes/class-wp-image-editor-imagick.php
@@ -484,37 +484,28 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor {
$this->image->setOption( 'png:compression-filter', '5' );
$this->image->setOption( 'png:compression-level', '9' );
$this->image->setOption( 'png:compression-strategy', '1' );
- // Check to see if a PNG is indexed, and find the pixel depth.
- if ( is_callable( array( $this->image, 'getImageDepth' ) ) ) {
- $indexed_pixel_depth = $this->image->getImageDepth();
-
- // Indexed PNG files get some additional handling.
- if ( 0 < $indexed_pixel_depth && 8 >= $indexed_pixel_depth ) {
- // Check for an alpha channel.
- if (
- is_callable( array( $this->image, 'getImageAlphaChannel' ) )
- && $this->image->getImageAlphaChannel()
- ) {
- $this->image->setOption( 'png:include-chunk', 'tRNS' );
- } else {
- $this->image->setOption( 'png:exclude-chunk', 'all' );
- }
-
- // Reduce colors in the images to maximum needed, using the global colorspace.
- $max_colors = pow( 2, $indexed_pixel_depth );
- if ( is_callable( array( $this->image, 'getImageColors' ) ) ) {
- $current_colors = $this->image->getImageColors();
- $max_colors = min( $max_colors, $current_colors );
- }
- $this->image->quantizeImage( $max_colors, $this->image->getColorspace(), 0, false, false );
-
- /**
- * If the colorspace is 'gray', use the png8 format to ensure it stays indexed.
- */
- if ( Imagick::COLORSPACE_GRAY === $this->image->getImageColorspace() ) {
- $this->image->setOption( 'png:format', 'png8' );
- }
+
+ // Indexed PNG files get some additional handling.
+ // See #63448 for details.
+ if (
+ is_callable( array( $this->image, 'getImageProperty' ) )
+ && '3' === $this->image->getImageProperty( 'png:IHDR.color-type-orig' )
+ ) {
+
+ // Check for an alpha channel.
+ if (
+ is_callable( array( $this->image, 'getImageAlphaChannel' ) )
+ && $this->image->getImageAlphaChannel()
+ ) {
+ $this->image->setOption( 'png:include-chunk', 'tRNS' );
+ } else {
+ $this->image->setOption( 'png:exclude-chunk', 'all' );
}
+ // Set the image format to Indexed PNG.
+ $this->image->setOption( 'png:format', 'png8' );
+
+ } else {
+ $this->image->setOption( 'png:exclude-chunk', 'all' );
}
}