437
437
* translated data. We are doing so now as it is safe to do. However, as
438
438
* Name and Title could have been used as the key for get_themes(), both remain
439
439
* untranslated for back compatibility. This means that ['Name'] is not ideal,
440
* and care should be taken to use $theme->display('Name') to get a properly
440
* and care should be taken to use `$theme::display( 'Name' )` to get a properly
441
441
* translated header.
443
443
* @param mixed $offset
447
447
switch ( $offset ) {
450
// See note above about using translated data. get() is not ideal.
451
// It is only for backwards compatibility. Use display().
451
* See note above about using translated data. get() is not ideal.
452
* It is only for backward compatibility. Use display().
452
454
return $this->get('Name');
454
456
return $this->display( 'Author');
769
771
$this->name_translated = translate( $value, $this->get('TextDomain' ) );
770
772
return $this->name_translated;
772
if ( empty( $value ) || ! function_exists( 'get_theme_feature_list' ) )
774
if ( empty( $value ) || ! function_exists( 'get_theme_feature_list' ) ) {
775
778
static $tags_list;
776
779
if ( ! isset( $tags_list ) ) {
777
$tags_list = array();
781
// As of 4.6, deprecated tags which are only used to provide translation for older themes.
782
'black' => __( 'Black' ), 'blue' => __( 'Blue' ), 'brown' => __( 'Brown' ),
783
'gray' => __( 'Gray' ), 'green' => __( 'Green' ), 'orange' => __( 'Orange' ),
784
'pink' => __( 'Pink' ), 'purple' => __( 'Purple' ), 'red' => __( 'Red' ),
785
'silver' => __( 'Silver' ), 'tan' => __( 'Tan' ), 'white' => __( 'White' ),
786
'yellow' => __( 'Yellow' ), 'dark' => __( 'Dark' ), 'light' => __( 'Light' ),
787
'fixed-layout' => __( 'Fixed Layout' ), 'fluid-layout' => __( 'Fluid Layout' ),
788
'responsive-layout' => __( 'Responsive Layout' ), 'blavatar' => __( 'Blavatar' ),
789
'photoblogging' => __( 'Photoblogging' ), 'seasonal' => __( 'Seasonal' ),
778
792
$feature_list = get_theme_feature_list( false ); // No API
779
foreach ( $feature_list as $tags )
793
foreach ( $feature_list as $tags ) {
780
794
$tags_list += $tags;
783
798
foreach ( $value as &$tag ) {
919
934
* This is typically the absolute URL to wp-content/themes. This forms the basis
920
935
* for all other URLs returned by WP_Theme, so we pass it to the public function
921
* get_theme_root_uri() and allow it to run the theme_root_uri filter.
936
* get_theme_root_uri() and allow it to run the {@see 'theme_root_uri'} filter.
1029
1044
$page_templates += $this->parent()->get_page_templates( $post );
1032
* Filter list of page templates for a theme.
1047
* Filters list of page templates for a theme.
1035
1050
* @since 4.4.0 Converted to allow complete control over the `$page_templates` array.
1191
1206
public static function get_allowed( $blog_id = null ) {
1193
* Filter the array of themes allowed on the network.
1208
* Filters the array of themes allowed on the network.
1195
1210
* Site is provided as context so that a list of network allowed themes can
1196
1211
* be filtered further.
1334
* Enables a theme for all sites on the current network.
1340
* @param string|array $stylesheets Stylesheet name or array of stylesheet names.
1342
public static function network_enable_theme( $stylesheets ) {
1343
if ( ! is_multisite() ) {
1347
if ( ! is_array( $stylesheets ) ) {
1348
$stylesheets = array( $stylesheets );
1351
$allowed_themes = get_site_option( 'allowedthemes' );
1352
foreach ( $stylesheets as $stylesheet ) {
1353
$allowed_themes[ $stylesheet ] = true;
1356
update_site_option( 'allowedthemes', $allowed_themes );
1360
* Disables a theme for all sites on the current network.
1366
* @param string|array $stylesheets Stylesheet name or array of stylesheet names.
1368
public static function network_disable_theme( $stylesheets ) {
1369
if ( ! is_multisite() ) {
1373
if ( ! is_array( $stylesheets ) ) {
1374
$stylesheets = array( $stylesheets );
1377
$allowed_themes = get_site_option( 'allowedthemes' );
1378
foreach ( $stylesheets as $stylesheet ) {
1379
if ( isset( $allowed_themes[ $stylesheet ] ) ) {
1380
unset( $allowed_themes[ $stylesheet ] );
1384
update_site_option( 'allowedthemes', $allowed_themes );
1319
1388
* Sorts themes by name.