Avoid a PHP notice in _WP_Editors::wp_fullscreen_html() when no $post global is set.

props marcochiesi.
fixes #30071.

git-svn-id: https://develop.svn.wordpress.org/trunk@31112 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2015-01-09 10:27:05 +00:00
parent 1e5ed7fdfd
commit 1710690c99

View File

@ -1251,7 +1251,7 @@ final class _WP_Editors {
$width = isset( $content_width ) && 800 > $content_width ? $content_width : 800;
$width = $width + 22; // compensate for the padding and border
$dfw_width = get_user_setting( 'dfw_width', $width );
$save = isset( $post->post_status ) && $post->post_status == 'publish' ? __('Update') : __('Save');
$save = $post && $post->post_status == 'publish' ? __('Update') : __('Save');
?>
<div id="wp-fullscreen-body" class="wp-core-ui<?php if ( is_rtl() ) echo ' rtl'; ?>" data-theme-width="<?php echo (int) $width; ?>" data-dfw-width="<?php echo (int) $dfw_width; ?>">
@ -1316,7 +1316,7 @@ final class _WP_Editors {
<div id="wp-fullscreen-save">
<input type="button" class="button button-primary right" value="<?php echo $save; ?>" onclick="wp.editor.fullscreen.save();" />
<span class="wp-fullscreen-saved-message"><?php if ( $post->post_status == 'publish' ) _e('Updated.'); else _e('Saved.'); ?></span>
<span class="wp-fullscreen-saved-message"><?php if ( $post && $post->post_status == 'publish' ) _e('Updated.'); else _e('Saved.'); ?></span>
<span class="wp-fullscreen-error-message"><?php _e('Save failed.'); ?></span>
<span class="spinner"></span>
</div>