Skip to content

Instantly share code, notes, and snippets.

@bystrano
Created November 16, 2014 12:12
Show Gist options
  • Save bystrano/2cb48e161f52f474a086 to your computer and use it in GitHub Desktop.
Save bystrano/2cb48e161f52f474a086 to your computer and use it in GitHub Desktop.
Un fichier probe.php qui charge SPIP pour eldoc-php
<?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