Skip to content

Commit 33688bb

Browse files
committed
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: WordPress/gutenberg#75878 Follow-up to [61674]. Props mcsf. See #64651. git-svn-id: https://develop.svn.wordpress.org/trunk@61748 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 1d9abc5 commit 33688bb

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/wp-includes/class-wp-icons-registry.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,20 @@ class WP_Icons_Registry {
1818
*
1919
* @var array[]
2020
*/
21-
private $registered_icons = array();
21+
protected $registered_icons = array();
2222

2323

2424
/**
2525
* Container for the main instance of the class.
2626
*
2727
* @var WP_Icons_Registry|null
2828
*/
29-
private static $instance = null;
29+
protected 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 protected.
3535
*
3636
* For 7.0, the Icons Registry is closed for third-party icon registry,
3737
* serving only a subset of core icons.
@@ -40,7 +40,7 @@ class WP_Icons_Registry {
4040
* SVG files and as entries in a single manifest file. On init, the
4141
* registry is loaded with those icons listed in the manifest.
4242
*/
43-
private function __construct() {
43+
protected function __construct() {
4444
$icons_directory = __DIR__ . '/icons/';
4545
$icons_directory = trailingslashit( $icons_directory );
4646
$manifest_path = $icons_directory . 'manifest.php';
@@ -101,7 +101,7 @@ private function __construct() {
101101
* }
102102
* @return bool True if the icon was registered with success and false otherwise.
103103
*/
104-
private function register( $icon_name, $icon_properties ) {
104+
protected function register( $icon_name, $icon_properties ) {
105105
if ( ! isset( $icon_name ) || ! is_string( $icon_name ) ) {
106106
_doing_it_wrong(
107107
__METHOD__,
@@ -188,7 +188,7 @@ private function register( $icon_name, $icon_properties ) {
188188
* @param string $icon_content The icon SVG content to sanitize.
189189
* @return string The sanitized icon SVG content.
190190
*/
191-
private function sanitize_icon_content( $icon_content ) {
191+
protected function sanitize_icon_content( $icon_content ) {
192192
$allowed_tags = array(
193193
'svg' => array(
194194
'class' => true,
@@ -223,7 +223,7 @@ private function sanitize_icon_content( $icon_content ) {
223223
* @param string $icon_name Icon name including namespace.
224224
* @return string|null The content of the icon, if found.
225225
*/
226-
private function get_content( $icon_name ) {
226+
protected function get_content( $icon_name ) {
227227
if ( ! isset( $this->registered_icons[ $icon_name ]['content'] ) ) {
228228
$content = file_get_contents(
229229
$this->registered_icons[ $icon_name ]['filePath']

0 commit comments

Comments
 (0)