Making WordPress.org

Changeset 14927


Ignore:
Timestamp:
06/02/2026 02:49:33 AM (3 months ago)
Author:
dd32
Message:

Plugin Directory: Update GeoPattern to 1.1.2 and tidy generated icon output

Props dd32, slaFFik.
Closes https://github.com/WordPress/wordpress.org/pull/659.
Fixes #8270.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
Files:
4 added
1 deleted
2 edited
8 moved

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-geopattern.php

    r6287 r14927  
    44use RedeyeVentures\GeoPattern\GeoPattern;
    55
    6 require __DIR__ . '/libs/geopattern-1.1.0/geopattern_loader.php';
     6require __DIR__ . '/libs/geopattern-1.1.2/geopattern_loader.php';
    77
    88/**
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/libs/geopattern-1.1.2/GeoPattern/GeoPattern.php

    r14926 r14927  
    434434                    $xyT1 = 6 * $xSize / 2 - $xSize / 2;
    435435                    $xyT2 = $dy - 6 * $xSize / 2;
    436                     $this->svg->addGroup($group, array_merge($styles, ['transform' => "translate($xyT1, $xyT2) rotate(45, $halfXSize, $halfXSize"]));
     436                    $this->svg->addGroup($group, array_merge($styles, ['transform' => "translate($xyT1, $xyT2) rotate(45, $halfXSize, $halfXSize)"]));
    437437                }
    438438
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/libs/geopattern-1.1.2/GeoPattern/SVGElements/Base.php

    r14926 r14927  
    1212    }
    1313
     14    // WordPress.org: round generated floats (opacity, coordinates, transforms) to 3 decimal
     15    // places. The upstream generator emits full PHP precision, e.g. fill-opacity="0.080666666666667",
     16    // which is invisible once rendered but inflates every icon. See https://meta.trac.wordpress.org/ticket/8270.
     17    protected function trimPrecision($value)
     18    {
     19        return preg_replace_callback(
     20            '/-?\d*\.\d+/',
     21            function ($matches) {
     22                return rtrim(rtrim(number_format((float) $matches[0], 3, '.', ''), '0'), '.');
     23            },
     24            (string) $value
     25        );
     26    }
     27
    1428    public function elementsToString()
    1529    {
     
    1731        foreach ($this->elements as $key => $value)
    1832        {
    19             $string .= "$key=\"$value\" ";
     33            $string .= "$key=\"".$this->trimPrecision($value)."\" ";
    2034        }
    2135        return $string;
     
    3246                foreach ($value as $k => $v)
    3347                {
    34                     $string .= "$k:$v;";
     48                    $string .= "$k:".$this->trimPrecision($v).";";
    3549                }
    3650                $string .= '" ';
     
    3852            else
    3953            {
    40                 $string .= "$key=\"$value\" ";
     54                $string .= "$key=\"".$this->trimPrecision($value)."\" ";
    4155            }
    4256        }
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/phpcs.xml.dist

    r8336 r14927  
    44
    55        <!-- Exclude external libraries -->
    6         <exclude-pattern>/libs/geopattern-1.1.0/*</exclude-pattern>
     6        <exclude-pattern>/libs/geopattern-1.1.2/*</exclude-pattern>
    77        <exclude-pattern>/libs/michelf-php-markdown-1.6.0/*</exclude-pattern>
    88
Note: See TracChangeset for help on using the changeset viewer.