Ejemplo n.º 1
0
 public function testDataAtributesDash()
 {
     $html = '<body>testbody<span data-dash="dash">frml</span></body>';
     $compiled = htmlparser::parse($html);
     $clean = htmlparser::compile($compiled);
     $this->assertEquals($html, $clean);
 }
Ejemplo n.º 2
0
/**
 * Smarty plugin
 * @package Smarty
 * @subpackage plugins
 */
function smarty_modifier_preview($node_content)
{
    if (!empty($_POST['no_html'])) {
        $node_content = htmlspecialchars($node_content);
    }
    require INCLUDE_DIR . 'htmlparse.inc';
    global $htmlparse;
    htmlparser::htmlparse($node_content);
    if (!empty($htmlparse)) {
        $error = $htmlparse;
        echo "<span class='most_important'> {$error} </span>";
        return false;
    }
    $node_content = EregI_Replace("((( )|(\n)|(^))+)(http://|ftp://|https://)([[:alnum:]][^,[:space:]]*)", "\\2<a target='_blank'href=\"\\6\\7\">\\6\\7</a>", $node_content);
    $node_content = strip_tags($node_content, '<a><b><i><u><img><br><p><font>');
    $node_content = str_replace("\n", "<br>", $node_content);
    return $node_content;
}
Ejemplo n.º 3
0
 public static function compile($page, $language = '')
 {
     $context = pobject::getContext();
     $me = $context["arCurrentObject"];
     include_once $me->store->get_config('code') . "modules/mod_url.php";
     include_once $me->store->get_config('code') . "modules/mod_htmlparser.php";
     if (!$language) {
         $language = $me->nls;
     }
     $page = URL::RAWtoAR($page, $language);
     $newpage = $page;
     $nodes = htmlparser::parse($newpage, array('noTagResolving' => true));
     // FIXME: the isChanged check is paranoia mode on. New code ahead.
     // will only use the new compile method when it is needed (htmlblocks)
     // otherwise just return the $page, so 99.9% of the sites don't walk
     // into bugs. 21-05-2007
     $isChanged = page::compileWorker($nodes);
     if ($isChanged) {
         return htmlparser::compile($nodes);
     } else {
         return $page;
     }
 }
Ejemplo n.º 4
0
 function esiInclude($page)
 {
     /* TODO:
     			[v] alt
     			[v] onerror
     		*/
     global $ARCurrent, $AR;
     // parse <esi:include src="view.html">
     $regExp = '|<esi:include.*?' . '>|i';
     preg_match_all($regExp, $page, $matches);
     foreach ($matches[0] as $match) {
         $parts = htmlparser::parse($match);
         $src = $parts['children'][0]['attribs']['src'];
         $alt = $parts['children'][0]['attribs']['alt'];
         $onerror = $parts['children'][0]['attribs']['onerror'];
         $replacement = ESI::esiFetch($src);
         if ($replacement == false && isset($alt)) {
             $replacement = ESI::esiFetch($alt);
         }
         if ($replacement == false && isset($onerror) && $onerror == "continue") {
             $replacement = "";
         }
         if ($replacement !== false) {
             $page = str_replace($match, $replacement, $page);
         } else {
             return false;
         }
     }
     return $page;
 }