Definition at line 22 of file Magic.php.
◆ _is_ascii()
Magic::_is_ascii |
( |
|
$file | ) |
|
Definition at line 41 of file Magic.php.
References $file, and $i.
Referenced by get_language().
43 $arr = unpack(
"C*",
$file);
44 for (
$i=1;
$i<
sizeof($arr);
$i++) {
45 if ($arr[
$i]<32 && $arr[
$i]!=13 && $arr[
$i]!=10) {
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
◆ get_language()
Magic::get_language |
( |
|
$filename | ) |
|
Definition at line 52 of file Magic.php.
References $filename, $lang, $test, _is_ascii(), array, and load_file().
55 $extensionspl = explode($this->config->separator,
$filename);
56 $extension = $extensionspl[
sizeof($extensionspl)-1];
57 $langstr = $this->config->extensions[$extension];
59 $langarr = explode(
"|", $langstr);
62 if (
sizeof($langarr)==1 && $langarr[0]!=
"") {
71 if ($this->config->file == undef) {
74 $this->is_ascii = $this->
_is_ascii($this->config->file);
76 if (isset($langstr)) {
81 foreach ($langarr as
$lang) {
82 if ($this->is_ascii && in_array($lang, $this->config->langfunctions)) {
83 array_push($outarray, $lang);
84 } elseif (in_array($lang, $this->config->binfunctions)) {
85 array_push($outarray, $lang);
88 $testarray = $outarray;
90 if ($this->is_ascii) {
91 $testarray = $this->config->langfunctions;
93 $testarray = $this->config->binfunctions;
96 foreach ($testarray as
$test) {
97 $func =
"detect_" .
$test;
98 if ($this->config->$func()) {
Create styles array
The data for the language used.
◆ load_file()
Magic::load_file |
( |
|
$filename | ) |
|
◆ Magic()
The documentation for this class was generated from the following file:
- Services/COPage/syntax_highlight/php/Beautifier/Magic.php