Definition at line 22 of file Magic.php.
◆ _is_ascii()
Magic::_is_ascii |
( |
|
$file | ) |
|
Definition at line 39 of file Magic.php.
References $file.
Referenced by get_language().
41 $arr = unpack(
"C*",
$file);
42 for($i=1; $i<
sizeof($arr); $i++)
44 if ($arr[$i]<32 && $arr[$i]!=13 && $arr[$i]!=10)
return false;
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
◆ get_language()
Magic::get_language |
( |
|
$filename | ) |
|
Definition at line 49 of file Magic.php.
References $filename, $lang, $test, _is_ascii(), array, and load_file().
52 $extensionspl = explode($this->config->separator,
$filename);
53 $extension = $extensionspl[
sizeof($extensionspl)-1];
54 $langstr = $this->config->extensions[$extension];
56 $langarr = explode(
"|", $langstr);
59 if (
sizeof($langarr)==1 && $langarr[0]!=
"")
return $langstr;
66 if ($this->config->file == undef)
return "illegal";
67 $this->is_ascii = $this->
_is_ascii($this->config->file);
75 foreach($langarr as
$lang)
77 if ($this->is_ascii && in_array($lang, $this->config->langfunctions))
78 array_push($outarray, $lang);
79 else if(in_array($lang, $this->config->binfunctions))
80 array_push($outarray, $lang);
82 $testarray = $outarray;
86 if ($this->is_ascii) $testarray = $this->config->langfunctions;
87 else $testarray = $this->config->binfunctions;
89 foreach($testarray as
$test)
91 $func =
"detect_".$test;
92 if ($this->config->$func())
return $test;
Create styles array
The data for the language used.
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
◆ load_file()
Magic::load_file |
( |
|
$filename | ) |
|
Definition at line 29 of file Magic.php.
References $filename, and $text.
Referenced by get_language().
31 if (!($filehandle = @fopen(
$filename,
"rb")))
return undef;
32 set_magic_quotes_runtime(0);
34 set_magic_quotes_runtime(get_magic_quotes_gpc());
◆ Magic()
The documentation for this class was generated from the following file:
- Services/COPage/syntax_highlight/php/Beautifier/Magic.php