Skip to content

Instantly share code, notes, and snippets.

@bystrano
Created Nov 16, 2014
Embed
What would you like to do?
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