Created
November 16, 2014 12:12
-
-
Save bystrano/2cb48e161f52f474a086 to your computer and use it in GitHub Desktop.
Un fichier probe.php qui charge SPIP pour eldoc-php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( ! isset($_GET['secret']) | |
|| $_GET['secret'] !== "sesame") { | |
exit; | |
} | |
// require() whatever you need here | |
ob_start(); | |
include ('spip.php'); | |
ob_end_clean(); | |
echo "(setq php-remote-functions '("; | |
$funcs = get_defined_functions(); | |
foreach ( array_merge($funcs['internal'], $funcs['user']) as $func ) { | |
if ( preg_match('/[^A-Za-z0-9_]/', $func) > 0 ) { | |
continue; | |
} | |
$f = new ReflectionFunction($func); | |
$line = '("' . $func . '" ' ; | |
$params = ''; | |
foreach ($f->getParameters() as $param) { | |
$param_text = '"'; | |
if ($param->isOptional()) { | |
$param_text .= '['; | |
} | |
$param_text .= ($param->isPassedByReference() ? '&' : '') | |
. '$' . $param->getName(); | |
if ($param->isOptional()) { | |
$param_text .= ']'; | |
} | |
$param_text .= '" '; | |
$line .= $param_text; | |
} | |
$line .= ")\n"; | |
echo $line; | |
} | |
echo "))"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment