Skip to content

Commit 2749008

Browse files
committed
3.7.8
1 parent 03eeb2b commit 2749008

5 files changed

Lines changed: 74 additions & 52 deletions

File tree

readme.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ To auto post to Instagram and/or Pinterest, [Upgrade to WordPress to Buffer Pro]
137137

138138
== Changelog ==
139139

140+
= 3.7.8 (2022-03-08) =
141+
* Fix: Call to undefined function _disable_block_editor_for_navigation_post_type when creating/updating Post in Gutenberg or via the REST API in WordPress 5.9+
142+
* Fix: Scheduled Posts: Publish action would not run when using Gutenberg
143+
* Fix: Customizer: Don't load inline CSS for menu icon when loading WordPress Admin > Theme > Customize
144+
140145
= 3.7.7 (2022-03-03) =
141146
* Added: Status: Insert Tags: Insert tag at textarea caret position, with leading/trailing space as applicable
142147
* Fix: Multisite: Activation: Use wp_insert_site hook when available in WordPress 5.1 and higher

vendor/includes/admin/admin.php

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -253,23 +253,26 @@ public function admin_scripts_css() {
253253
// CSS - always load
254254
// Menu Icon is inline, because when Gravity Forms no conflict mode is ON, it kills all enqueued styles,
255255
// which results in a large menu SVG icon displaying.
256-
?>
257-
<style type="text/css">
258-
li.toplevel_page_<?php echo $this->base->plugin->settingsName; ?>-settings a div.wp-menu-image,
259-
li.toplevel_page_<?php echo $this->base->plugin->settingsName; ?> a div.wp-menu-image,
260-
li.toplevel_page_<?php echo $this->base->plugin->name; ?>-settings a div.wp-menu-image,
261-
li.toplevel_page_<?php echo $this->base->plugin->name; ?> a div.wp-menu-image {
262-
background: url(<?php echo $this->base->plugin->url; ?>/vendor/assets/images/icons/<?php echo strtolower( $this->base->plugin->account ); ?>-light.svg) center no-repeat;
263-
background-size: 16px 16px;
264-
}
265-
li.toplevel_page_<?php echo $this->base->plugin->settingsName; ?>-settings a div.wp-menu-image img,
266-
li.toplevel_page_<?php echo $this->base->plugin->settingsName; ?> a div.wp-menu-image img,
267-
li.toplevel_page_<?php echo $this->base->plugin->name; ?>-settings a div.wp-menu-image img,
268-
li.toplevel_page_<?php echo $this->base->plugin->name; ?> a div.wp-menu-image img {
269-
display: none;
270-
}
271-
</style>
272-
<?php
256+
// However, don't load this on customize.php, as it wrongly outputs above the opening <html> tag.
257+
if ( $screen['screen'] != 'customize' ) {
258+
?>
259+
<style type="text/css">
260+
li.toplevel_page_<?php echo $this->base->plugin->settingsName; ?>-settings a div.wp-menu-image,
261+
li.toplevel_page_<?php echo $this->base->plugin->settingsName; ?> a div.wp-menu-image,
262+
li.toplevel_page_<?php echo $this->base->plugin->name; ?>-settings a div.wp-menu-image,
263+
li.toplevel_page_<?php echo $this->base->plugin->name; ?> a div.wp-menu-image {
264+
background: url(<?php echo $this->base->plugin->url; ?>/vendor/assets/images/icons/<?php echo strtolower( $this->base->plugin->account ); ?>-light.svg) center no-repeat;
265+
background-size: 16px 16px;
266+
}
267+
li.toplevel_page_<?php echo $this->base->plugin->settingsName; ?>-settings a div.wp-menu-image img,
268+
li.toplevel_page_<?php echo $this->base->plugin->settingsName; ?> a div.wp-menu-image img,
269+
li.toplevel_page_<?php echo $this->base->plugin->name; ?>-settings a div.wp-menu-image img,
270+
li.toplevel_page_<?php echo $this->base->plugin->name; ?> a div.wp-menu-image img {
271+
display: none;
272+
}
273+
</style>
274+
<?php
275+
}
273276
wp_enqueue_style( $this->base->plugin->name, $this->base->plugin->url . 'vendor/assets/css/admin.css', array(), $this->base->plugin->version );
274277

275278
// Don't load anything else if we're not on a Plugin or Post screen

vendor/includes/admin/publish.php

Lines changed: 26 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -117,10 +117,22 @@ public function transition_post_status( $new_status, $old_status, $post ) {
117117
* Metadata is included in the call to wp_insert_post(), meaning that it's saved to the Post before we use it.
118118
*/
119119

120-
// Flag to determine if the current Post is a Gutenberg Post
120+
$this->base->get_class( 'log' )->add_to_debug_log( 'Post ID: #' . $post->ID );
121+
122+
// If transitioning from future to publish, this is a scheduled Post being published by WordPress Cron.
123+
// We don't need to know whether it's a Gutenberg, Classic Editor or REST API request.
124+
if ( $old_status == 'future' && $new_status == 'publish' ) {
125+
$this->base->get_class( 'log' )->add_to_debug_log( 'Scheduled Post being published by WordPress' );
126+
127+
add_action( 'wp_insert_post', array( $this, 'wp_insert_post_publish' ), 999 );
128+
129+
// Don't need to do anything else, so exit.
130+
return;
131+
}
132+
133+
// Flag to determine if the current Post is a Gutenberg Post or Rest API Request.
121134
$is_gutenberg_post = $this->is_gutenberg_post( $post );
122135
$is_rest_api_request = $this->is_rest_api_request();
123-
$this->base->get_class( 'log' )->add_to_debug_log( 'Post ID: #' . $post->ID );
124136
$this->base->get_class( 'log' )->add_to_debug_log( 'Gutenberg Post: ' . ( $is_gutenberg_post ? 'Yes' : 'No' ) );
125137
$this->base->get_class( 'log' )->add_to_debug_log( 'REST API Request: ' . ( $is_rest_api_request ? 'Yes' : 'No' ) );
126138

@@ -158,7 +170,7 @@ public function transition_post_status( $new_status, $old_status, $post ) {
158170
* Classic Editor
159171
*/
160172
if ( ! $is_rest_api_request ) {
161-
$this->base->get_class( 'log' )->add_to_debug_log( 'Classic Editor: Publish' );
173+
$this->base->get_class( 'log' )->add_to_debug_log( 'Classic Editor: Publish' );
162174

163175
add_action( 'wp_insert_post', array( $this, 'wp_insert_post_publish' ), 999 );
164176

@@ -254,10 +266,6 @@ private function is_rest_api_request() {
254266
/**
255267
* Helper function to determine if the Post can use, or has used, the Gutenberg Editor.
256268
*
257-
* It's never 100% reliable, because:
258-
* - Post Content may contain Block markup, even though the user reverted back to the Classic Editor,
259-
* - Just because a Post (i.e. a Post's Post Type) can use the Block Editor, doesn't mean it does!
260-
*
261269
* Should be used in conjunction with REST_REQUEST checks; if both are true, we're using Gutenberg.
262270
*
263271
* @since 3.6.8
@@ -267,33 +275,19 @@ private function is_rest_api_request() {
267275
*/
268276
private function is_gutenberg_post( $post ) {
269277

270-
// If the Post's content contains Gutenberg block markup, we might be editing a Gutenberg Post
271-
if ( strpos( $post->post_content, '<!-- wp:' ) !== false ) {
272-
return true;
273-
}
274-
275-
if ( ! post_type_exists( $post->post_type ) ) {
276-
return false;
277-
}
278-
279-
if ( ! post_type_supports( $post->post_type, 'editor' ) ) {
280-
return false;
281-
}
278+
// Load post.php so that functions required for checking the Post are loaded.
279+
if ( ! function_exists( 'use_block_editor_for_post' ) ) {
280+
require_once ABSPATH . 'wp-admin/includes/post.php';
281+
}
282282

283-
$post_type_object = get_post_type_object( $post->post_type );
284-
if ( $post_type_object && ! $post_type_object->show_in_rest ) {
285-
return false;
286-
}
283+
// If the function still doesn't exist, assume the Post isn't a Gutenberg Post.
284+
if ( ! function_exists( 'use_block_editor_for_post' ) ) {
285+
error_log( 'use_block_editor_for_post() function does not exist.' );
286+
return false;
287+
}
287288

288-
/**
289-
* Filter whether a post is able to be edited in the block editor.
290-
*
291-
* @since 5.0.0
292-
*
293-
* @param bool $use_block_editor Whether the post type can be edited or not. Default true.
294-
* @param string $post_type The post type being checked.
295-
*/
296-
return apply_filters( 'use_block_editor_for_post_type', true, $post->post_type );
289+
// Return whether Post is Gutenberg Post.
290+
return use_block_editor_for_post( $post );
297291

298292
}
299293

vendor/includes/admin/screen.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,16 @@ public function get_current_screen() {
110110
);
111111
break;
112112

113+
/**
114+
* Bulk Publish
115+
*/
116+
case $this->base->plugin->name . '-bulk-publish':
117+
return array(
118+
'screen' => 'bulk_publish',
119+
'section' => 'bulk_publish',
120+
);
121+
break;
122+
113123
/**
114124
* Log
115125
*/
@@ -120,6 +130,16 @@ public function get_current_screen() {
120130
);
121131
break;
122132

133+
/**
134+
* WordPress Screens
135+
*/
136+
case 'customize':
137+
return array(
138+
'screen' => 'customize',
139+
'section' => 'customize',
140+
);
141+
break;
142+
123143
}
124144

125145
// If here, we couldn't determine the screen

wp-to-buffer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/**
33
* Plugin Name: WP to Buffer
44
* Plugin URI: http://www.wpzinc.com/plugins/wp-to-buffer-pro
5-
* Version: 3.7.7
5+
* Version: 3.7.8
66
* Author: WP Zinc
77
* Author URI: http://www.wpzinc.com
88
* Description: Send WordPress Pages, Posts or Custom Post Types to your Buffer (buffer.com) account for scheduled publishing to social networks.
@@ -74,8 +74,8 @@ public function __construct() {
7474

7575
$this->plugin->settingsName = 'wp-to-buffer-pro'; // Settings key - used in both Free + Pro, and for oAuth
7676
$this->plugin->account = 'Buffer';
77-
$this->plugin->version = '3.7.7';
78-
$this->plugin->buildDate = '2022-03-03 18:00:00';
77+
$this->plugin->version = '3.7.8';
78+
$this->plugin->buildDate = '2022-03-08 18:00:00';
7979
$this->plugin->requires = '5.0';
8080
$this->plugin->tested = '5.9.1';
8181
$this->plugin->folder = plugin_dir_path( __FILE__ );

0 commit comments

Comments
 (0)