Пример #1
0
 public static function clean($html, $settings = null)
 {
     global $AR, $ARCurrent;
     $context = pobject::getContext();
     $me = $context["arCurrentObject"];
     if (!isset($settings)) {
         if (!$ARCurrent->arEditorSettings) {
             $settings = $me->call("editor.ini");
         } else {
             $settings = $ARCurrent->arEditorSettings;
         }
     }
     if ($settings["htmlcleaner"]["enabled"] || $settings["htmlcleaner"] === true) {
         include_once $me->store->get_config("code") . "modules/mod_htmlcleaner.php";
         $config = $settings["htmlcleaner"];
         $html = htmlcleaner::cleanup($html, $config);
     }
     if ($settings["htmltidy"]["enabled"] || $settings["htmltidy"] === true) {
         include_once $me->store->get_config("code") . "modules/mod_tidy.php";
         if ($settings["htmltidy"] === true) {
             $config = array();
             $config["options"] = $AR->Tidy->options;
         } else {
             $config = $settings["htmltidy"];
         }
         $config["temp"] = $me->store->get_config("files") . "temp/";
         $config["path"] = $AR->Tidy->path;
         $tidy = new ARtidy($config);
         $result = $tidy->clean($html);
         $html = $result["html"];
     }
     if ($settings["allow_tags"]) {
         $html = strip_tags($html, $settings["allow_tags"]);
     }
     $html = self::stripARNameSpace($html);
     return new ar_content_htmlContent($html);
 }
Пример #2
0
 public static function clean($page, $settings = false)
 {
     global $AR;
     global $ARCurrent;
     $context = pobject::getContext();
     $me = $context["arCurrentObject"];
     if (!$settings) {
         if (!$ARCurrent->arEditorSettings) {
             $settings = $me->call("editor.ini");
         } else {
             $settings = $ARCurrent->arEditorSettings;
         }
     }
     if ($settings["htmlcleaner"]["enabled"] || $settings["htmlcleaner"] === true) {
         require_once $me->store->get_config("code") . "modules/mod_htmlcleaner.php";
         $config = $settings["htmlcleaner"];
         $page = htmlcleaner::cleanup($page, $config);
     }
     if ($settings["htmltidy"]["enabled"] || $settings["htmltidy"] === true) {
         require_once $me->store->get_config("code") . "modules/mod_tidy.php";
         if ($settings["htmltidy"] === true) {
             $config = array();
             $config["options"] = $AR->Tidy->options;
         } else {
             $config = $settings["htmltidy"];
         }
         $config["temp"] = $me->store->get_config("files") . "temp/";
         $config["path"] = $AR->Tidy->path;
         $tidy = new ARtidy($config);
         $result = $tidy->clean($page);
         $page = $result["html"];
     }
     if ($settings["allow_tags"]) {
         $page = strip_tags($page, $settings["allow_tags"]);
     }
     return $page;
 }
Пример #3
0
 function tidy($html, $config)
 {
     global $AR;
     require_once $AR->dir->install . "/lib/modules/mod_tidy.php";
     return ARtidy::clean($html, $config);
 }