mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Deprecate get_theme_data(). Use wp_get_theme() instead. see #20103.
git-svn-id: https://develop.svn.wordpress.org/trunk@20269 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -258,92 +258,6 @@ function get_template_directory_uri() {
|
||||
return apply_filters( 'template_directory_uri', $template_dir_uri, $template, $theme_root_uri );
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve theme data from parsed theme file.
|
||||
*
|
||||
* The description will have the tags filtered with the following HTML elements
|
||||
* whitelisted. The <b>'a'</b> element with the <em>href</em> and <em>title</em>
|
||||
* attributes. The <b>abbr</b> element with the <em>title</em> attribute. The
|
||||
* <b>acronym</b> element with the <em>title</em> attribute allowed. The
|
||||
* <b>code</b>, <b>em</b>, and <b>strong</b> elements also allowed.
|
||||
*
|
||||
* The style.css file must contain theme name, theme URI, and description. The
|
||||
* data can also contain author URI, author, template (parent template),
|
||||
* version, status, and finally tags. Some of these are not used by WordPress
|
||||
* administration panels, but are used by theme directory web sites which list
|
||||
* the theme.
|
||||
*
|
||||
* @since 1.5.0
|
||||
*
|
||||
* @param string $theme_file Theme file path.
|
||||
* @return array Theme data.
|
||||
*/
|
||||
function get_theme_data( $theme_file ) {
|
||||
$default_headers = array(
|
||||
'Name' => 'Theme Name',
|
||||
'URI' => 'Theme URI',
|
||||
'Description' => 'Description',
|
||||
'Author' => 'Author',
|
||||
'AuthorURI' => 'Author URI',
|
||||
'Version' => 'Version',
|
||||
'Template' => 'Template',
|
||||
'Status' => 'Status',
|
||||
'Tags' => 'Tags'
|
||||
);
|
||||
|
||||
$themes_allowed_tags = array(
|
||||
'a' => array(
|
||||
'href' => array(),'title' => array()
|
||||
),
|
||||
'abbr' => array(
|
||||
'title' => array()
|
||||
),
|
||||
'acronym' => array(
|
||||
'title' => array()
|
||||
),
|
||||
'code' => array(),
|
||||
'em' => array(),
|
||||
'strong' => array()
|
||||
);
|
||||
|
||||
$theme_data = get_file_data( $theme_file, $default_headers, 'theme' );
|
||||
|
||||
$theme_data['Name'] = $theme_data['Title'] = wp_kses( $theme_data['Name'], $themes_allowed_tags );
|
||||
|
||||
$theme_data['URI'] = esc_url( $theme_data['URI'] );
|
||||
|
||||
$theme_data['Description'] = wptexturize( wp_kses( $theme_data['Description'], $themes_allowed_tags ) );
|
||||
|
||||
$theme_data['AuthorURI'] = esc_url( $theme_data['AuthorURI'] );
|
||||
|
||||
$theme_data['Template'] = wp_kses( $theme_data['Template'], $themes_allowed_tags );
|
||||
|
||||
$theme_data['Version'] = wp_kses( $theme_data['Version'], $themes_allowed_tags );
|
||||
|
||||
if ( $theme_data['Status'] == '' )
|
||||
$theme_data['Status'] = 'publish';
|
||||
else
|
||||
$theme_data['Status'] = wp_kses( $theme_data['Status'], $themes_allowed_tags );
|
||||
|
||||
if ( $theme_data['Tags'] == '' )
|
||||
$theme_data['Tags'] = array();
|
||||
else
|
||||
$theme_data['Tags'] = array_map( 'trim', explode( ',', wp_kses( $theme_data['Tags'], array() ) ) );
|
||||
|
||||
if ( $theme_data['Author'] == '' ) {
|
||||
$theme_data['Author'] = $theme_data['AuthorName'] = __('Anonymous');
|
||||
} else {
|
||||
$theme_data['AuthorName'] = wp_kses( $theme_data['Author'], $themes_allowed_tags );
|
||||
if ( empty( $theme_data['AuthorURI'] ) ) {
|
||||
$theme_data['Author'] = $theme_data['AuthorName'];
|
||||
} else {
|
||||
$theme_data['Author'] = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>', $theme_data['AuthorURI'], esc_attr__( 'Visit author homepage' ), $theme_data['AuthorName'] );
|
||||
}
|
||||
}
|
||||
|
||||
return $theme_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve theme roots.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user