prep_atom_text_construct [ WordPress Function ]
| Parameters: |
|
| Links: | |
| Returns: |
|
| Defined at: |
|
Determine 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.
Source
<?php
function prep_atom_text_construct($data) {
if (strpos($data, '<') === false && strpos($data, '&') === false) {
return array('text', $data);
}
$parser = xml_parser_create();
xml_parse($parser, '<div>' . $data . '</div>', true);
$code = xml_get_error_code($parser);
xml_parser_free($parser);
if (!$code) {
if (strpos($data, '<') === false) {
return array('text', $data);
} else {
$data = "<div xmlns='http://www.w3.org/1999/xhtml'>$data</div>";
return array('xhtml', $data);
}
}
if (strpos($data, ']]>') == false) {
return array('html', "<![CDATA[$data]]>");
} else {
return array('html', htmlspecialchars($data));
}
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- prep_atom_text_construct() WordPress function reference ...
Determine the type of a string of data with the data formatted.
queryposts.com - Docs for page feed.php
prep_atom_text_construct (line 453). Determine the type of a string of data with the ... array prep_atom_text_construct (string $data). string $data: Input string ...
phpdoc.wordpress.org - Experimental oncology
Apr 17, 2012 ... id> <?php list($content_type, $content) = prep_atom_text_construct(get_the_title( )); ?> <title type="<?php echo $content_type ?>"><?php echo ...
exp-oncology.com.ua - /wp-includes/feed.php source - PHP Cross Reference (PHPXRef) of ...
Jun 1, 2011... value) 451 */ 452 function prep_atom_text_construct($data) { 453 if (strpos($ data, '<') === false && strpos($data, '&') === false) { 454 return ...
xref.yoast.com