関数 prep_atom_text_construct()
関数 prep_atom_text_construct()
定義ファイル :/blog/wp-includes/feed.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | 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)); } } |