private function standardize_html() { //-- STANDARDIZE THE HTML CODE // * protect against client-side scripting and html denied tags :: the < ? ? > or < % % > tag(s) will be detected and if present, will be replaced with dummy tags to prevent code injection // * remove all weird / unsafe characters (ex: non-utf8) // * replace multiple spaces with just one space //-- //-- if ($this->is_std != false) { return; // avoid to re-parse } //end if //-- $this->is_std = true; //-- //-- remove all non utf8 characters $this->html = (string) preg_replace((string) Smart::lower_unsafe_characters(), '', (string) $this->html); //-- standardize new lines, tabs and line ends $this->html = (string) str_replace(array("", "\r\n", "\r", ' />', '/>'), array('', "\n", "\n", '>', '>'), (string) $this->html); //-- protect against server-side tags $this->html = (string) str_replace(array('<' . '?', '?' . '>', '<' . '%', '%' . '>'), array('<tag-question:start', 'tag-question:end>', '<tag-percent:start', 'tag-percent:end>'), (string) $this->html); //-- //-- standardize spaces and new lines $arr_spaces_cleanup = array('/([\\t ])+/si' => ' ', '/^([\\t ])+/mi' => '', '/([\\t ])+$/mi' => '', '/[\\r\\n]+([\\t ]?[\\r\\n]+)+/si' => "\n"); //-- $this->html = (string) preg_replace((array) array_keys((array) $arr_spaces_cleanup), (array) array_values((array) $arr_spaces_cleanup), (string) $this->html); $this->html = (string) SmartUnicode::fix_charset($this->html); //-- }