Site Icon: Improvements to Site Icon API.
* Only call `get_blog_option()` when there is a blog id and we're in Mulitsite. If there is no blog id the request is for the current blog. * Check return value of `wp_get_attachment_image_src()` before getting the URL since it could be `false`. * Use `{bool}` rather than `!!` to return a boolean value. Props MikeHansenMe, obenland. Fixes #33326. Built from https://develop.svn.wordpress.org/trunk@33606 git-svn-id: http://core.svn.wordpress.org/trunk@33573 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
731c255aee
commit
dfa53a1da7
|
@ -730,23 +730,22 @@ function get_bloginfo( $show = '', $filter = 'raw' ) {
|
|||
* @return string Site Icon URL.
|
||||
*/
|
||||
function get_site_icon_url( $size = 512, $url = '', $blog_id = 0 ) {
|
||||
if ( function_exists( 'get_blog_option' ) ) {
|
||||
if ( ! $blog_id ) {
|
||||
$blog_id = get_current_blog_id();
|
||||
}
|
||||
if ( $blog_id && is_multisite() ) {
|
||||
$site_icon_id = get_blog_option( $blog_id, 'site_icon' );
|
||||
} else {
|
||||
$site_icon_id = get_option( 'site_icon' );
|
||||
}
|
||||
|
||||
if ( $site_icon_id ) {
|
||||
if ( $site_icon_id ) {
|
||||
if ( $size >= 512 ) {
|
||||
$size_data = 'full';
|
||||
} else {
|
||||
$size_data = array( $size, $size );
|
||||
}
|
||||
$url_data = wp_get_attachment_image_src( $site_icon_id, $size_data );
|
||||
$url = $url_data[0];
|
||||
if ( $url_data ) {
|
||||
$url = $url_data[0];
|
||||
}
|
||||
}
|
||||
|
||||
return $url;
|
||||
|
@ -770,7 +769,7 @@ function site_icon_url( $size = 512, $url = '', $blog_id = 0 ) {
|
|||
* @return bool
|
||||
*/
|
||||
function has_site_icon( $blog_id = 0 ) {
|
||||
return !! get_site_icon_url( 512, '', $blog_id );
|
||||
return (bool) get_site_icon_url( 512, '', $blog_id );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.3-RC2-33605';
|
||||
$wp_version = '4.3-RC2-33606';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue