or another $own element inside it would break the block's HTML, and the editor would
* reject the block as invalid even though it still parses.
*/
private static function assert_inline( $value, $own ) {
$names = array_map( static function ( $t ) { return ltrim( $t, '/' ); }, \AdiBridge\Html::tag_names( $value ) );
$bad = array_values( array_unique( array_merge( array_diff( $names, self::INLINE_TAGS ), array_intersect( $names, array( $own ) ) ) ) );
if ( $bad ) {
throw new Tool_Error( esc_html( 'This is a single block of text: send inline text only (bold, italic, links, line breaks), without <' . implode( '>, <', $bad ) . '>. To add paragraphs or sections, edit the page in the block editor.' ) );
}
if ( false !== strpos( $value, '' ) ) {
throw new Tool_Error( 'This is a single block of text: HTML comments () are not allowed in it — an unclosed one would hide the rest of the page.' );
}
if ( ! self::balanced( $value ) ) {
throw new Tool_Error( 'The formatting tags in this text are not balanced (every
, , … needs its closing tag, in order). Nothing was changed.' );
}
}
/**
* Custom HTML / shortcode blocks may hold any markup, but nothing left open: an unclosed comment
* or