--- a/meta-box/inc/core.php
+++ b/meta-box/inc/core.php
@@ -3,7 +3,7 @@
public function init() {
add_filter( 'plugin_action_links_meta-box/meta-box.php', [ $this, 'plugin_links' ], 20 );
- // Uses priority 20 to support custom port types registered using the default priority.
+ // Uses priority 20 to support custom post types registered using the default priority.
add_action( 'init', [ $this, 'register_meta_boxes' ], 20 );
add_action( 'edit_page_form', [ $this, 'fix_page_template' ] );
$this->add_context_hooks();
--- a/meta-box/inc/fields/block-editor.php
+++ b/meta-box/inc/fields/block-editor.php
@@ -33,6 +33,26 @@
RWMB_Helpers_Field::localize_script_once( 'rwmb-block-editor', 'rwmbBlockEditor', [
'editor_settings' => $editor_settings,
] );
+
+ // Load block categories.
+ wp_add_inline_script(
+ 'wp-blocks',
+ sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $block_editor_context ) ) ),
+ 'after'
+ );
+
+ // Preload server-registered block schemas.
+ wp_add_inline_script(
+ 'wp-blocks',
+ 'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings(), JSON_HEX_TAG | JSON_UNESCAPED_SLASHES ) . ');'
+ );
+
+ // Load 3rd party blocks.
+ add_filter( 'should_load_block_editor_scripts_and_styles', '__return_true' );
+
+ if ( ! did_action( 'enqueue_block_editor_assets' ) ) {
+ do_action( 'enqueue_block_editor_assets' );
+ }
}
/**
--- a/meta-box/inc/fields/file.php
+++ b/meta-box/inc/fields/file.php
@@ -51,8 +51,17 @@
if ( is_numeric( $attachment ) ) {
$result = wp_delete_attachment( $attachment );
} else {
- $path = str_replace( home_url( '/' ), trailingslashit( ABSPATH ), $attachment );
- $result = unlink( $path ); // phpcs:ignore WordPress.WP.AlternativeFunctions.unlink_unlink
+ $path = str_replace( home_url( '/' ), trailingslashit( ABSPATH ), $attachment );
+
+ // Security: validate resolved path is within $field['upload_dir'] directory.
+ $real_path = realpath( $path );
+ $real_path = wp_normalize_path( $real_path );
+ $allowed_base = ! empty( $field['upload_dir'] ) ? trailingslashit( wp_normalize_path( $field['upload_dir'] ) ) : '';
+ if ( ! $real_path || ! $allowed_base || ! str_starts_with( $real_path, $allowed_base ) ) {
+ wp_send_json_error( __( 'Error: The file is outside the allowed upload directory', 'meta-box' ) );
+ }
+
+ $result = unlink( $real_path ); // phpcs:ignore WordPress.WP.AlternativeFunctions.unlink_unlink
}
if ( $result ) {
--- a/meta-box/inc/fields/time.php
+++ b/meta-box/inc/fields/time.php
@@ -20,6 +20,12 @@
public static function normalize( $field ) {
$field = parent::normalize( $field );
$field['js_options']['timeFormat'] = empty( $field['format'] ) ? $field['js_options']['timeFormat'] : $field['format'];
+ // This field does not support timestamp.
+ // Prevent the timestamp from being set to true, like switching from a date field to a time field in the builder.
+ if ( isset( $field['timestamp'] ) ) {
+ $field['timestamp'] = false;
+ }
+
return $field;
}
--- a/meta-box/inc/loader.php
+++ b/meta-box/inc/loader.php
@@ -7,7 +7,7 @@
class RWMB_Loader {
protected function constants() {
// Script version, used to add version for scripts and styles.
- define( 'RWMB_VER', '5.11.1' );
+ define( 'RWMB_VER', '5.11.2' );
list( $path, $url ) = self::get_path( dirname( __DIR__ ) );
--- a/meta-box/inc/sanitizer.php
+++ b/meta-box/inc/sanitizer.php
@@ -83,7 +83,6 @@
'user' => [ $this, 'sanitize_object' ],
'video' => [ $this, 'sanitize_object' ],
'wysiwyg' => 'wp_kses_post',
- 'block_editor' => 'wp_kses_post',
];
$type = $field['type'];
@@ -205,7 +204,14 @@
* @return array
*/
private function sanitize_file( $value, $field ) {
- return $field['upload_dir'] ? array_map( 'esc_url_raw', $value ) : $this->sanitize_object( $value );
+ if ( ! $field['upload_dir'] ) {
+ return $this->sanitize_object( $value );
+ }
+
+ // Security: sanitize URLs and reject path traversal sequences.
+ return array_filter( array_map( function ( $url ) {
+ return str_contains( $url, '..' ) ? '' : esc_url_raw( $url );
+ }, $value ) );
}
/**
--- a/meta-box/js/block-editor/build/block-editor.asset.php
+++ b/meta-box/js/block-editor/build/block-editor.asset.php
@@ -1 +1 @@
-<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-block-library', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-format-library', 'wp-i18n', 'wp-media-utils', 'wp-primitives'), 'version' => '54b94dd750fd475c5136');
+<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-block-library', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-format-library', 'wp-i18n', 'wp-media-utils', 'wp-primitives'), 'version' => '025c2e5baa0baf143b8f');
--- a/meta-box/meta-box.php
+++ b/meta-box/meta-box.php
@@ -3,7 +3,7 @@
* Plugin Name: Meta Box
* Plugin URI: https://metabox.io
* Description: Create custom meta boxes and custom fields in WordPress.
- * Version: 5.11.1
+ * Version: 5.11.2
* Author: MetaBox.io
* Author URI: https://metabox.io
* License: GPL2+
--- a/meta-box/vendor/composer/installed.php
+++ b/meta-box/vendor/composer/installed.php
@@ -1,9 +1,9 @@
<?php return array(
'root' => array(
'name' => 'wpmetabox/meta-box',
- 'pretty_version' => '5.11.1',
- 'version' => '5.11.1.0',
- 'reference' => '21cc88efff8892a93a8218ba1b00a142eabb0d86',
+ 'pretty_version' => '5.11.2',
+ 'version' => '5.11.2.0',
+ 'reference' => '270c63653de72c4677b99450551fcd71fbf84b93',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -11,9 +11,9 @@
),
'versions' => array(
'wpmetabox/meta-box' => array(
- 'pretty_version' => '5.11.1',
- 'version' => '5.11.1.0',
- 'reference' => '21cc88efff8892a93a8218ba1b00a142eabb0d86',
+ 'pretty_version' => '5.11.2',
+ 'version' => '5.11.2.0',
+ 'reference' => '270c63653de72c4677b99450551fcd71fbf84b93',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),