Astra_Ext_White_Label_Markup::network_themes_page( array $themes )
White labels the theme on the network admin themes page.
Description
Parameters
- $themes
-
(array) (Required) Themes Array.
Return
(array)
Source
File: classes/class-astra-ext-white-label-markup.php
public function network_themes_page( $themes ) {
$astra_key = 'astra';
if ( isset( $themes[ $astra_key ] ) && is_network_admin() ) {
$network_theme_data = array();
if ( false !== self::get_whitelabel_string( 'astra', 'name', false ) ) {
$network_theme_data['Name'] = self::get_whitelabel_string( 'astra', 'name', false );
foreach ( $themes as $theme_key => $theme ) {
if ( isset( $theme['parent'] ) && 'Astra' == $theme['parent'] ) {
$themes[ $theme_key ]['parent'] = self::get_whitelabel_string( 'astra', 'name', false );
}
}
}
if ( false !== self::get_whitelabel_string( 'astra', 'description', false ) ) {
$network_theme_data['Description'] = self::get_whitelabel_string( 'astra', 'description', false );
}
if ( false !== self::get_whitelabel_string( 'astra-agency', 'author', false ) ) {
$author_url = ( '' === self::get_whitelabel_string( 'astra-agency', 'author_url', '' ) ) ? '#' : self::get_whitelabel_string( 'astra-agency', 'author_url', '' );
$network_theme_data['Author'] = self::get_whitelabel_string( 'astra-agency', 'author', false );
$network_theme_data['AuthorURI'] = $author_url;
$network_theme_data['ThemeURI'] = $author_url;
}
if ( count( $network_theme_data ) > 0 ) {
$reflection_object = new ReflectionObject( $themes[ $astra_key ] );
$headers = $reflection_object->getProperty( 'headers' );
$headers->setAccessible( true );
$headers_sanitized = $reflection_object->getProperty( 'headers_sanitized' );
$headers_sanitized->setAccessible( true );
// Set white labeled theme data.
$headers->setValue( $themes[ $astra_key ], $network_theme_data );
$headers_sanitized->setValue( $themes[ $astra_key ], $network_theme_data );
// Reset back to private.
$headers->setAccessible( false );
$headers_sanitized->setAccessible( false );
}
}
return $themes;
}
Expand full source code Collapse full source code View on Trac