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. Built from https://develop.svn.wordpress.org/trunk@61748 git-svn-id: http://core.svn.wordpress.org/trunk@61054 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -18,7 +18,7 @@ class WP_Icons_Registry {
|
||||
*
|
||||
* @var array[]
|
||||
*/
|
||||
private $registered_icons = array();
|
||||
protected $registered_icons = array();
|
||||
|
||||
|
||||
/**
|
||||
@@ -26,12 +26,12 @@ class WP_Icons_Registry {
|
||||
*
|
||||
* @var WP_Icons_Registry|null
|
||||
*/
|
||||
private static $instance = null;
|
||||
protected static $instance = null;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* WP_Icons_Registry is a singleton class, so keep this private.
|
||||
* WP_Icons_Registry is a singleton class, so keep this protected.
|
||||
*
|
||||
* For 7.0, the Icons Registry is closed for third-party icon registry,
|
||||
* serving only a subset of core icons.
|
||||
@@ -40,7 +40,7 @@ class WP_Icons_Registry {
|
||||
* SVG files and as entries in a single manifest file. On init, the
|
||||
* registry is loaded with those icons listed in the manifest.
|
||||
*/
|
||||
private function __construct() {
|
||||
protected function __construct() {
|
||||
$icons_directory = __DIR__ . '/icons/';
|
||||
$icons_directory = trailingslashit( $icons_directory );
|
||||
$manifest_path = $icons_directory . 'manifest.php';
|
||||
@@ -101,7 +101,7 @@ class WP_Icons_Registry {
|
||||
* }
|
||||
* @return bool True if the icon was registered with success and false otherwise.
|
||||
*/
|
||||
private function register( $icon_name, $icon_properties ) {
|
||||
protected function register( $icon_name, $icon_properties ) {
|
||||
if ( ! isset( $icon_name ) || ! is_string( $icon_name ) ) {
|
||||
_doing_it_wrong(
|
||||
__METHOD__,
|
||||
@@ -188,7 +188,7 @@ class WP_Icons_Registry {
|
||||
* @param string $icon_content The icon SVG content to sanitize.
|
||||
* @return string The sanitized icon SVG content.
|
||||
*/
|
||||
private function sanitize_icon_content( $icon_content ) {
|
||||
protected function sanitize_icon_content( $icon_content ) {
|
||||
$allowed_tags = array(
|
||||
'svg' => array(
|
||||
'class' => true,
|
||||
@@ -223,7 +223,7 @@ class WP_Icons_Registry {
|
||||
* @param string $icon_name Icon name including namespace.
|
||||
* @return string|null The content of the icon, if found.
|
||||
*/
|
||||
private function get_content( $icon_name ) {
|
||||
protected function get_content( $icon_name ) {
|
||||
if ( ! isset( $this->registered_icons[ $icon_name ]['content'] ) ) {
|
||||
$content = file_get_contents(
|
||||
$this->registered_icons[ $icon_name ]['filePath']
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '7.0-beta1-61747';
|
||||
$wp_version = '7.0-beta1-61748';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
||||
Reference in New Issue
Block a user