Example #1
0
 public static function stripARNameSpace($page)
 {
     $context = pobject::getContext();
     $me = $context["arCurrentObject"];
     include_once $me->store->get_config('code') . "modules/mod_htmlcleaner.php";
     $cleanAR = array('rewrite' => array('^(A|IMG|DIV)$' => array('^ar:.*' => false, '^arargs:.*' => false, '^class' => array('htmlblock[ ]*uneditable[ ]*' => false), '^data-vedor-*' => false)), 'delete_emptied' => array('div', 'a'));
     return htmlcleaner::cleanup($page, $cleanAR);
 }
Example #2
0
	function cleanup($body)
	{
		$return = '';
		foreach (htmlcleaner::dessicate($body) as $part) {
			if (isset($part->attributes['style']))
				unset($part->attributes['style']);
			if (isset($part->attributes['class']))
				unset($part->attributes['class']);
			if (strstr($part->nodeValue,'<?xml:namespace')===false && $part->nodeName!='span' && $part->nodeName!='font' && $part->nodeName!='o' && $part->nodeName!='script' && $part->nodeName!='style' && $part->nodeName!='object' && $part->nodeName!='iframe' && $part->nodeName!='applet' && $part->nodeName!='meta')
				$return .= $part->toString();
		}
		return $return;
	}
Example #3
0
 function clean($html, $rules)
 {
     global $AR;
     require_once $AR->dir->install . "/lib/modules/mod_htmlcleaner.php";
     return htmlcleaner::clean($html, $rules);
 }
Example #4
0
#!/usr/local/bin/php
<?php 
$socket = fsockopen("m-2.m-2.ru", 80);
fputs($socket, "GET /subscribe/news.asp HTTP/1.0\nHOST: m-2.m-2.ru\n\n");
while (fgets($socket, 31337) != "\r\n" && !feof($socket)) {
    unset($buffer);
}
include "/www/vhosts/award.m-2.ru/adm/lib/htmlcleaner.php";
include "/www/vhosts/award.m-2.ru/lib/db.conf.php";
include "/www/vhosts/award.m-2.ru/lib/mysql.class.php";
$db = new sql();
$db->connect();
$hc = new htmlcleaner();
$s = $hc->cleanup(stripslashes($s));
while (!feof($socket)) {
    $buffer .= fread($socket, 1024);
}
$lines = explode("\n", $buffer);
foreach ($lines as $key => $value) {
    if (trim($value)) {
        $tmp = explode("|||", trim($value));
        preg_match("'(\\d{1,2})\\.(\\d{1,2})\\.(\\d{1,4}) (\\d{1,2}):(\\d{1,2}):(\\d{1,2})'", $tmp[1], $time_arr);
        $tmp[1] = mktime($time_arr[4], $time_arr[5], $time_arr[6], $time_arr[2], $time_arr[1], $time_arr[3]);
        $tmp[3] = str_replace("\\n", "||||||||n", $tmp[3]);
        $tmp[3] = $hc->cleanup(stripslashes($tmp[3]));
        $tmp[3] = str_replace("||||||||n", "\\n", $tmp[3]);
        $res = $db->query("select id from news where matID={$tmp['0']}");
        if (!$db->num_rows($res)) {
            $db->query("insert into news set time='{$tmp['1']}', title='{$tmp['2']}', text='{$tmp['3']}', matID='{$tmp['0']}'");
        }
        $arr[] = $tmp;
Example #5
0
     $article->preview("P");
     echo "<br />";
     echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class='even'>";
     $article->editform();
     echo "</td></tr></table>";
     break;
 case "Clean":
     xoops_cp_header();
     global $xoopsModule, $maintext;
     if (!empty($articleid)) {
         $article = new WfsArticle($articleid);
     } else {
         $article = new WfsArticle();
     }
     $article->loadPostVars();
     $article->maintext = htmlcleaner::cleanup($article->maintext);
     echo $article->maintext;
     echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class='even'>";
     $article->editform();
     echo "</td></tr></table>";
     break;
 case "Save":
     global $xoopsUser, $wfsConfig;
     if (empty($HTTP_POST_VARS['title'])) {
         xoops_cp_header();
         echo "<table width='100%' border='0' cellspacing='1' class='outer'><tr><td class='odd'>";
         echo _AM_NOTITLE . "<br />";
         echo "</td></tr></table>";
         break;
     }
     if (!empty($HTTP_POST_VARS['articleid'])) {
Example #6
0
 public function testTagDash()
 {
     $html = '<body><hello-world>hello world</hello-world></body>';
     $clean = htmlcleaner::cleanup($html, array());
     $this->assertEquals($html, $clean);
 }
Example #7
0
<?php

$s = urldecode($_POST["s"]);
include_once "../lib/htmlcleaner.php";
$hc = new htmlcleaner();
$s = $hc->cleanup(stripslashes($s));
$from = array("«", "»", "%u2013", " &mdash;", " -", "cellpadding=\"0\"", "<p>&nbsp;</p>\n</td>", "<p></p>", "©", "®", "%u2122", "&nbsp; </td>");
$to = array("&laquo;", "&raquo;", "&mdash;", "&nbsp;&mdash;", "&nbsp;&mdash;", "cellpadding=\"5\"", "&nbsp;\n</td>", "", "&copy;", "&reg;", "<SUP><FONT SIZE=\"-1\">TM</FONT></SUP>", "&nbsp;</td>");
$s = str_replace($from, $to, $s);
echo $s;