* @since 3.0.0 * @since 7.0.0 Refactored to BeyondWords namespace with snake_case methods. */ namespace BeyondWords\Editor\Classic; /** * PostMetabox * * @since 3.0.0 * @since 7.0.0 Refactored to BeyondWords namespace with snake_case methods. */ defined( 'ABSPATH' ) || exit; class Metabox { /** * Init. * * @since 4.0.0 * @since 6.0.0 Make static. * @since 7.0.0 Refactored to BeyondWords namespace with snake_case methods. */ public static function init() { add_action( 'add_meta_boxes', [ self::class, 'add_meta_box_callback'] ); } /** * Adds the meta box container. * * @since 6.0.0 Make static. * @since 7.0.0 Refactored to BeyondWords namespace with snake_case methods. * * @param string $post_type */ public static function add_meta_box_callback( $post_type ) { $post_types = \BeyondWords\Settings\Utils::get_compatible_post_types(); if ( ! in_array( $post_type, $post_types ) ) { return; } add_meta_box( 'beyondwords', __( 'BeyondWords', 'speechkit' ), [ self::class, 'render_meta_box_content'], $post_type, 'side', 'default', [ '__back_compat_meta_box' => true, ] ); } /** * Render Meta Box content. * * @since 7.0.0 Refactored to BeyondWords namespace with snake_case methods. * * @param int|\WP_Post $post The WordPress post ID, or post object. * * @since 3.0.0 * @since 3.7.0 Show "Pending review" notice for posts with status of "pending" * @since 4.0.0 Content ID is no longer an int * @since 4.1.0 Add "Player style" and update component display conditions * @since 6.0.0 Make static and add Magic Embed support. */ public static function render_meta_box_content( $post ) { $post = get_post( $post ); if ( ! ( $post instanceof \WP_Post ) ) { return; } $has_content = \BeyondWords\Post\Meta::has_content( $post->ID ); // Single nonce guarding the Content/Format/Player