Пример #1
0
/**
 * Validates the XML to only allow tags defined in the DTD
 *
 * @param string $html_content
 * @return string - DTD valid XML
 */
function anno_validate_xml_content_on_save($html_content)
{
    // Strip all tags not defined by DTD
    $content = anno_to_xml($html_content);
    // Convert remaining br to break tags. Unable to do this with phpQuery, it thinks break tag should be opened and closed
    $content = str_replace(array('<br />', '<br>'), '<break />', $content);
    $content = str_replace('&nbsp;', '&#xA0;', $content);
    $content = strip_tags($content, implode('', array_unique(anno_get_dtd_valid_elements())));
    return $content;
}
Пример #2
0
function anno_xslt_transform($content, $action = 'xml')
{
    error_reporting(-1);
    ini_set('error_reporting', E_ALL);
    // HTML->XML
    if ($action == 'xml') {
        $content = trim(anno_to_xml($content));
    } else {
        $content = trim(anno_process_editor_content($content));
    }
    error_reporting(0);
    return $content;
}