%s', checked(get_post_meta($post->ID, Selection::EXCLUDE_META, true) !== '', true, false), esc_html__('Leave this out of the vector store', 'aipcf-ai-provider-for-cloudflare') ); } /** * @param int|string $postId * @param mixed $post */ public static function saveMetaBox($postId, $post = null): void { $postId = (int) $postId; if (!isset($_POST['aipcf_embed_exclude_nonce']) || !wp_verify_nonce(sanitize_text_field(wp_unslash((string) $_POST['aipcf_embed_exclude_nonce'])), 'aipcf_embed_exclude')) { return; } if ((defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) || wp_is_post_revision($postId) || !current_user_can('edit_post', $postId)) { return; } if (!empty($_POST['aipcf_embed_exclude'])) { update_post_meta($postId, Selection::EXCLUDE_META, '1'); } else { delete_post_meta($postId, Selection::EXCLUDE_META); } } /** * @param int|string $attachmentId */ public static function saveAttachmentMetaBox($attachmentId): void { self::saveMetaBox($attachmentId); } }