$file = php_shrink($file);
$filename = $project . (preg_match('~-dev$~', $VERSION) ? "" : "-$VERSION") . ($driver ? "-$driver" : "") . ($_SESSION["lang"] ? "-$_SESSION[lang]" : "") . ".php";
-fwrite(fopen($filename, "w"), $file); // file_put_contents() since PHP 5
+file_put_contents($filename, $file);
echo "$filename created (" . strlen($file) . " B).\n";
}
$s = "<?php\n\$translations = array(\n$s);\n";
if ($s != $file) {
- fwrite(fopen($filename, "w"), $s); // file_put_contents() since PHP 5
+ file_put_contents($filename, $s);
echo "$filename updated.\n";
}
}
if ($plugins === null) {
$plugins = array();
foreach (get_declared_classes() as $class) {
- if (preg_match('~^Adminer.~i', $class) && strcasecmp($this->_findRootClass($class), 'Adminer')) { // can use interface since PHP 5
+ if (preg_match('~^Adminer.~i', $class) && strcasecmp($this->_findRootClass($class), 'Adminer')) { //! can use interface
$plugins[$class] = new $class;
}
}
}
$this->plugins = $plugins;
- // it is possible to use ReflectionObject in PHP 5 to find out which plugins defines which methods at once
+ //! it is possible to use ReflectionObject to find out which plugins defines which methods at once
}
function _callParent($function, $args) {
- switch (count($args)) { // call_user_func_array(array('parent', $function), $args) works since PHP 5
- case 0: return parent::$function();
- case 1: return parent::$function($args[0]);
- case 2: return parent::$function($args[0], $args[1]);
- case 3: return parent::$function($args[0], $args[1], $args[2]);
- case 4: return parent::$function($args[0], $args[1], $args[2], $args[3]);
- case 5: return parent::$function($args[0], $args[1], $args[2], $args[3], $args[4]);
- case 6: return parent::$function($args[0], $args[1], $args[2], $args[3], $args[4], $args[5]);
- default: trigger_error('Too many parameters.', E_USER_WARNING);
- }
+ return call_user_func_array(array('parent', $function), $args);
}
function _applyPlugin($function, $args) {