prep_atom_text_construct

函数


prep_atom_text_construct ( $data )
参数
  • (string)
    $data
    Input string.
    Required:
返回值
  • (array) array(type, value)
定义位置
  • wp-includes/feed.php
    , line 582
引入
2.5.0
弃用

Determines the type of a string of data with the data formatted.

Tell whether the type is text, HTML, or XHTML, per RFC 4287 section 3.1.

In the case of WordPress, text is defined as containing no markup,
XHTML is defined as “well formed”, and HTML as tag soup (i.e., the rest).

Container div tags are added to XHTML values, per section 3.1.1.3.

function prep_atom_text_construct( $data ) {
	if ( strpos( $data, '" );
	}

	$parser = xml_parser_create();
	xml_parse( $parser, '
' . $data . '
', true ); $code = xml_get_error_code( $parser ); xml_parser_free( $parser ); unset( $parser ); if ( ! $code ) { if ( strpos( $data, '$data

“;
return array( ‘xhtml’, $data );
}
}

if ( strpos( $data, ‘]]>’ ) === false ) {
return array( ‘html’, “” );
} else {
return array( ‘html’, htmlspecialchars( $data ) );
}
}