Add ID attribute to style element from wp_add_inline_style().

props westonruter.
fixes #30032.
Built from https://develop.svn.wordpress.org/trunk@29956


git-svn-id: http://core.svn.wordpress.org/trunk@29703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2014-10-18 17:58:19 +00:00
parent ccbf1571f3
commit 26c8088a97
1 changed files with 9 additions and 5 deletions

View File

@ -120,12 +120,14 @@ class WP_Styles extends WP_Dependencies {
}
public function add_inline_style( $handle, $code ) {
if ( !$code )
if ( ! $code ) {
return false;
}
$after = $this->get_data( $handle, 'after' );
if ( !$after )
if ( ! $after ) {
$after = array();
}
$after[] = $code;
@ -135,15 +137,17 @@ class WP_Styles extends WP_Dependencies {
public function print_inline_style( $handle, $echo = true ) {
$output = $this->get_data( $handle, 'after' );
if ( empty( $output ) )
if ( empty( $output ) ) {
return false;
}
$output = implode( "\n", $output );
if ( !$echo )
if ( ! $echo ) {
return $output;
}
echo "<style type='text/css'>\n";
echo "<style id='wp-inline-style-" . esc_attr( $handle ) . "' type='text/css'>\n";
echo "$output\n";
echo "</style>\n";