function the_cleaners($data, $wrap = true, $safe = true) { global $TIDY_PATH; if ($TIDY_PATH) { ob_start(); passthru($TIDY_PATH . " -asxhtml -icq -f /dev/null 2>&1 <<END-XED-INPUT\n" . $data . "\nEND-XED-INPUT"); $data = ob_get_contents(); ob_end_clean(); if ($wrap) { $data = the_cleaners_strip_tidy_output($data); } return $data; } else { if ($wrap) { $data = the_cleaners_wrapper($data); } loader_import('saf.HTML.Messy'); $messy = new Messy(); $messy->safe = $safe; $data = $messy->clean($data); if ($wrap) { $data = the_cleaners_remove_wrapper($data); } return $data; } }
function onSubmit($vals) { ob_start(); passthru(appconf('wvhtml_location') . ' --targetdir=cache ' . escapeshellarg($vals['doc']->tmp_name) . ' -'); $html = ob_get_contents(); ob_end_clean(); list($one, $two) = explode('<!--Section Begins-->', $html); list($two, $three) = explode('<!--Section Ends-->', $two); loader_import('saf.HTML.Messy'); $messy = new Messy(); $two = $messy->clean($two); //echo '<pre>' . htmlentities ($two); exit; $two = str_replace('<p><div', '<div', $two); $two = str_replace('</div></p>', '</div>', $two); $vals['doc'] = $two; echo template_simple('importer.spt', $vals); exit; }
/** * Cleans the input using saf.HTML.Messy, so that tags conform to * XHTML specs. Note: This is nowhere near 100% effective. * * @access public * @param string $input * @return string * */ function clean($input) { global $loader; $loader->import('saf.HTML.Messy'); $messy = new Messy(); return $messy->clean($input); }