| @@ -7,10 +7,10 @@ | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * Registers a metabox on Posts, Pages and public facing Custom Post Types |
| 11 | - * that do not use the block editor, saving settings when the Post is saved | |
| 12 | - * in the WordPress Administration interface. | |
| 11 | + * and saves its settings when the Post is saved in the WordPress Administration | |
| 12 | + * interface. | |
| 13 | 13 | * |
| 14 | 14 | * @package ConvertKit |
| 15 | 15 | * @author ConvertKit |
| 16 | 16 | */ |
| @@ -26,9 +26,9 @@ | ||
| 26 | 26 | // Register "Add New" Kit button on Pages. |
| 27 | 27 | add_filter( 'views_edit-page', array( $this, 'output_wp_list_table_buttons' ) ); |
| 28 | 28 | |
| 29 | 29 | add_action( 'post_submitbox_misc_actions', array( $this, 'output_pre_publish_actions' ) ); |
| 30 | - add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ), 10, 2 ); | |
| 30 | + add_action( 'add_meta_boxes', array( $this, 'add_meta_boxes' ) ); | |
| 31 | 31 | add_action( 'save_post', array( $this, 'save_post_meta' ) ); |
| 32 | 32 | |
| 33 | 33 | } |
| 34 | 34 | |
| @@ -132,11 +132,8 @@ | ||
| 132 | 132 | |
| 133 | 133 | // Enqueue Post CSS. |
| 134 | 134 | wp_enqueue_style( 'convertkit-post', CONVERTKIT_PLUGIN_URL . 'resources/backend/css/post.css', array(), CONVERTKIT_PLUGIN_VERSION ); |
| 135 | 135 | |
| 136 | - // Enqueue Refresh Resources CSS. | |
| 137 | - wp_enqueue_style( 'convertkit-admin-refresh-resources', CONVERTKIT_PLUGIN_URL . 'resources/backend/css/refresh-resources.css', array(), CONVERTKIT_PLUGIN_VERSION ); | |
| 138 | - | |
| 139 | 136 | /** |
| 140 | 137 | * Enqueue CSS for the Settings Screen at Settings > Kit |
| 141 | 138 | * |
| 142 | 139 | * @since 1.9.6.4 |
| @@ -180,12 +177,11 @@ | ||
| 180 | 177 | * Adds a meta box for the given Post Type. |
| 181 | 178 | * |
| 182 | 179 | * @since 1.9.6 |
| 183 | 180 | * |
| 184 | - * @param string $post_type Post Type. | |
| 185 | - * @param WP_Post $post Post. | |
| 181 | + * @param string $post_type Post Type. | |
| 186 | 182 | */ |
| 187 | - public function add_meta_boxes( $post_type, $post ) { | |
| 183 | + public function add_meta_boxes( $post_type ) { | |
| 188 | 184 | |
| 189 | 185 | // Don't register the meta box if this Post Type isn't supported. |
| 190 | 186 | $supported_post_types = convertkit_get_supported_post_types(); |
| 191 | 187 | if ( ! in_array( $post_type, $supported_post_types, true ) ) { |
| @@ -191,13 +187,8 @@ | ||
| 191 | 187 | if ( ! in_array( $post_type, $supported_post_types, true ) ) { |
| 192 | 188 | return; |
| 193 | 189 | } |
| 194 | 190 | |
| 195 | - // Don't register the meta box if the block editor is being used, as register_post_meta() handles saving post meta. | |
| 196 | - if ( function_exists( 'use_block_editor_for_post' ) && use_block_editor_for_post( $post ) ) { | |
| 197 | - return; | |
| 198 | - } | |
| 199 | - | |
| 200 | 191 | // Register Meta Box. |
| 201 | 192 | add_meta_box( 'wp-convertkit-meta-box', __( 'Kit', 'convertkit' ), array( $this, 'display_meta_box' ), $post_type, 'normal' ); |
| 202 | 193 | |
| 203 | 194 | // Enqueue JS and CSS. |
| @@ -281,15 +272,10 @@ | ||
| 281 | 272 | if ( ! isset( $_POST['wp-convertkit'] ) ) { |
| 282 | 273 | return; |
| 283 | 274 | } |
| 284 | 275 | |
| 285 | - // Bail if the current user cannot edit this Post. | |
| 286 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { | |
| 287 | - return; | |
| 288 | - } | |
| 289 | - | |
| 290 | 276 | // Save Post's settings. |
| 291 | - $this->save_post_settings( $post_id, wp_unslash( $_POST['wp-convertkit'] ) ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | |
| 277 | + $this->save_post_settings( $post_id, $_POST['wp-convertkit'] ); | |
| 292 | 278 | |
| 293 | 279 | } |
| 294 | 280 | |
| 295 | 281 | /** |
| @@ -317,9 +303,9 @@ | ||
| 317 | 303 | continue; |
| 318 | 304 | } |
| 319 | 305 | |
| 320 | 306 | // Sanitize value. |
| 321 | - $new_value = sanitize_text_field( $settings[ $key ] ); | |
| 307 | + $new_value = sanitize_text_field( wp_unslash( $settings[ $key ] ) ); | |
| 322 | 308 | |
| 323 | 309 | // Skip if the setting value is -2, as this means it's a Bulk Edit request and this setting |
| 324 | 310 | // is set as 'No Change'. |
| 325 | 311 | if ( $new_value == '-2' ) { // phpcs:ignore Universal.Operators.StrictComparisons.LooseEqual |