Subversion Repositories oidplus

Rev

Rev 1046 | Rev 1067 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1046 Rev 1064
Line 105... Line 105...
105
        if ($res === false) $res = iconv('UTF-8', 'UTF-8//IGNORE', $text);
105
        if ($res === false) $res = iconv('UTF-8', 'UTF-8//IGNORE', $text);
106
 
106
 
107
        return $res;
107
        return $res;
108
}
108
}
109
 
109
 
-
 
110
function vts_utf8_decode($text) {
-
 
111
        $enc = mb_detect_encoding($text, null, true);
-
 
112
        if ($enc === false) $enc = mb_detect_encoding($text, ['ASCII', 'UTF-8', 'Windows-1252', 'ISO-8859-1'], true);
-
 
113
        if ($enc === false) $enc = null;
-
 
114
 
-
 
115
        if ($enc !== 'UTF-8') return $text;
-
 
116
 
-
 
117
        $res = mb_convert_encoding($text, 'Windows-1252', $enc);
-
 
118
        if ($res === false) $res = iconv('Windows-1252', 'Windows-1252//IGNORE', $text);
-
 
119
 
-
 
120
        return $res;
-
 
121
}
-
 
122
 
110
function stripHtmlComments($html) {
123
function stripHtmlComments($html) {
111
        // https://stackoverflow.com/questions/11337332/how-to-remove-html-comments-in-php
124
        // https://stackoverflow.com/questions/11337332/how-to-remove-html-comments-in-php
112
        $html = preg_replace("~<!--(?!<!)[^\[>].*?-->~s", "", $html);
125
        $html = preg_replace("~<!--(?!<!)[^\[>].*?-->~s", "", $html);
113
        return $html;
126
        return $html;
114
}
127
}