force sync from /var/www/html/panel: 2025-09-08T20:36:30Z
This commit is contained in:
commit
4f717c9ee8
18119 changed files with 2566034 additions and 0 deletions
26
modules/ftp/plugins/luminous/languages/javascript.php
Executable file
26
modules/ftp/plugins/luminous/languages/javascript.php
Executable file
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
class LuminousJavaScriptScanner extends LuminousECMAScriptScanner {
|
||||
// mostly the same for now
|
||||
|
||||
public static function guess_language($src, $info) {
|
||||
// JavaScript is surprisingly indistinct when you think about it,
|
||||
// so these are a bit of a stretch and it's hard to ever return a
|
||||
// value more than ~40%
|
||||
$p = 0;
|
||||
// var x =
|
||||
// not amazingly distinct, but something
|
||||
if (preg_match('/var\s++\w++\s*+=/', $src)) $p += 0.05;
|
||||
// $, jquery
|
||||
if (preg_match('/\\b$\\( | jQuery/x', $src)) $p += 0.20;
|
||||
// typeof x == undefined
|
||||
if (preg_match('/typeof\s++\w++\s*+[!=]{2,3}+\s*+[\'"]?+undefined/i', $src))
|
||||
$p += 0.10;
|
||||
if (strpos($src, 'document.') !== false) $p += 0.10;
|
||||
if (strpos($src, 'Math.') !== false) $p += 0.05;
|
||||
// Anonymous functions
|
||||
if (preg_match('/function\s*+\\([^)]*+\\)\s*+\\{/', $src))
|
||||
$p += 0.05;
|
||||
return $p;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue