1
0
mirror of https://github.com/pierre42100/comunic synced 2025-07-13 05:18:13 +00:00
Files
3rdparty
RestServer
analysing_page
crypt
fancyapps
gestionnaire_upload
luminous
client
docs
examples
languages
include
.htaccess
ada.php
as.php
bash.php
bnf.php
cpp.php
csharp.php
css.php
diff.php
ecmascript.php
erlang.php
go.php
groovy.php
haskell.php
html.php
identity.php
java.php
javascript.php
json.php
latex.php
lolcode.php
matlab.php
perl.php
php.php
python.php
rails.php
ruby.php
scala.php
scss.php
sql.php
vb.php
vim.php
xml.php
src
style
.htaccess
.travis.yml
CHANGES.markdown
Doxyfile
LICENSE
README.markdown
api-docs.html
composer.json
index.html
luminous.php
supported.php
versioncheck.php
pdf.js
phpmailer
tcpdf
video_js
assets
developer
doc
inc
minifyurl
tools
.gitignore
.htaccess
README.md
acceuil-aide-en.html
acceuil-aide-fr.html
action.php
aide.php
amis.php
api.php
archive_private_chat.php
browserconfig.xml
chat.php
commentaire.php
connecter.php
connexiondb.php
creercompte.php
deconnexion.php
exportdonnees.php
galerie_videos.php
galerieimages.php
imgcommentaire.php
index.php
listeamis.php
messagerie.php
notification.php
notification_old.php
parametres.php
privatechat.php
r.php
robots.txt
rss.php
securite.php
sitemap.xml
solvepassword.php
suppcompte.php
Pierre Hubert 990540b2b9 First commit
2016-11-19 12:08:12 +01:00

32 lines
898 B
PHP
Executable File

<?php
/*
* HTML is the 'root' scanner, we just override a couple of config settings
* here, to prevent it from looking for CSS or JS.
*/
class LuminousXMLScanner extends LuminousHTMLScanner {
public $scripts = false;
public $embedded_server = false;
public static function guess_language($src, $info) {
if (strpos(ltrim($src), '<?xml') === 0) return 1.0;
// don't catch HTML doctypes
if (strpos($src, '<!DOCTYPE') !== false) return 0;
$p = 0;
// simple tag
$lines = preg_match_all('/$/m',
preg_replace('/^\s+/m', '', $src), $m);
// avg 1 tag every 4 lines
if (preg_match_all('%<[!?/]?[a-zA-Z_:\\-]%', $src, $m)
> $lines/4) $p += 0.15;
// self closing tag
if (strpos($src, '/>') !== false) $p += 0.05;
// tag with attr
if (preg_match('/<[a-zA-Z_]\w*\s+[a-zA-Z_]\w+\s*=["\']/', $src))
$p += 0.1;
return $p;
}
}