private function _getFileEncoding($file) { $tmp = array(); foreach ($this->config as $key => $value) { $keyt = $key; $keyt = Lms_Text::replace("\\", '/', $key); if ($keyt[strlen($keyt) - 1] == '/') { $keyt = substr($keyt, 0, strlen($keyt) - 1); } if (Lms_Text::pos($file, $keyt) === 0) { $tmp[$keyt] = $value; if ($keyt == $file) { return $value; } } } $path = explode('/', $file); $i = count($path); while ($i > 0) { $f = ''; for ($j = 0; $j < $i; $j++) { $f = $f . $path[$j] . "/"; } foreach ($tmp as $key => $value) { if ($key == $f || Lms_Text::substring($keyt, 0, Lms_Item::length($f) - 1) == $key) { return $value; } } $i--; } return 'UTF-8'; }
private function _SplitToChunks($str, $chunksLimit) { $chunks = array(); while ($chunksLimit-- > 0 && ($pos = Lms_Text::pos($str, " ")) !== false) { $chunks[] = Lms_Text::substring($str, 0, $pos); $str = ltrim(Lms_Text::substring($str, $pos)); } $chunks[] = $str; return $chunks; }