Make WordPress Core

Changeset 61748

Timestamp:
02/26/2026 12:15:54 PM (7 days ago)
Author:
mcsf
Message:

Icons library: Prefer 'protected' visibility in WP_Icons_Registry

Make it easier to iterate on this class in Gutenberg via class extension.

See proof of concept and discussion in:
https://github.com/WordPress/gutenberg/pull/75878

Follow-up to [61674].

Props mcsf.

See #64651.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-icons-registry.php

    r61675 r61748  
    1919     * @var array[]
    2020     */
    21     private $registered_icons = array();
     21    pr $registered_icons = array();
    2222
    2323
     
    2727     * @var WP_Icons_Registry|null
    2828     */
    29     private static $instance = null;
     29    pr static $instance = null;
    3030
    3131    /**
    3232     * Constructor.
    3333     *
    34      * WP_Icons_Registry is a singleton class, so keep this private.
     34     * WP_Icons_Registry is a singleton class, so keep this pr.
    3535     *
    3636     * For 7.0, the Icons Registry is closed for third-party icon registry,
     
    4141     * registry is loaded with those icons listed in the manifest.
    4242     */
    43     private function __construct() {
     43    pr function __construct() {
    4444        $icons_directory = __DIR__ . '/icons/';
    4545        $icons_directory = trailingslashit( $icons_directory );
     
    102102     * @return bool True if the icon was registered with success and false otherwise.
    103103     */
    104     private function register( $icon_name, $icon_properties ) {
     104    pr function register( $icon_name, $icon_properties ) {
    105105        if ( ! isset( $icon_name ) || ! is_string( $icon_name ) ) {
    106106            _doing_it_wrong(
     
    189189     * @return string The sanitized icon SVG content.
    190190     */
    191     private function sanitize_icon_content( $icon_content ) {
     191    pr function sanitize_icon_content( $icon_content ) {
    192192        $allowed_tags = array(
    193193            'svg'     => array(
     
    224224     * @return string|null The content of the icon, if found.
    225225     */
    226     private function get_content( $icon_name ) {
     226    pr function get_content( $icon_name ) {
    227227        if ( ! isset( $this->registered_icons[ $icon_name ]['content'] ) ) {
    228228            $content = file_get_contents(
Note: See TracChangeset for help on using the changeset viewer.