}
/** Get Adminer object
-* @return Adminer
+* @return Adminer|Plugins
*/
function adminer() {
global $adminer;
return $adminer;
}
-/** Get Driver object
-* @return Driver
-*/
-function driver() {
+/** Get Driver object */
+function driver(): Driver {
global $driver;
return $driver;
}
}
/** Disable magic_quotes_gpc
-* @param list<array> $process e.g. (&$_GET, &$_POST, &$_COOKIE)
+* @param list<array> $process e.g. [&$_GET, &$_POST, &$_COOKIE]
* @param bool $filter whether to leave values as is
* @return void modified in place
*/
}
/** Get list of values from database
-* @param mixed $column
+* @param array-key $column
* @return list<string>
*/
function get_vals(string $query, $column = 0): array {
return (preg_match('~~u', $val) && !preg_match('~[\0-\x8\xB\xC\xE-\x1F]~', $val));
}
-/** Shorten UTF-8 string
-* @return string escaped string with appended ...
-*/
-function shorten_utf8(string $string, int $length = 80, string $suffix = ""): string {
- if (!preg_match("(^(" . repeat_pattern("[\t\r\n -\x{10FFFF}]", $length) . ")($)?)u", $string, $match)) { // ~s causes trash in $match[2] under some PHP versions, (.|\n) is slow
- preg_match("(^(" . repeat_pattern("[\t\r\n -~]", $length) . ")($)?)", $string, $match);
- }
- return h($match[1]) . $suffix . (isset($match[2]) ? "" : "<i>…</i>");
-}
-
/** Format decimal number
* @param float|numeric-string $val
*/
echo "</form>\n";
}
+/** Shorten UTF-8 string
+* @return string escaped string with appended ...
+*/
+function shorten_utf8(string $string, int $length = 80, string $suffix = ""): string {
+ if (!preg_match("(^(" . repeat_pattern("[\t\r\n -\x{10FFFF}]", $length) . ")($)?)u", $string, $match)) { // ~s causes trash in $match[2] under some PHP versions, (.|\n) is slow
+ preg_match("(^(" . repeat_pattern("[\t\r\n -~]", $length) . ")($)?)", $string, $match);
+ }
+ return h($match[1]) . $suffix . (isset($match[2]) ? "" : "<i>…</i>");
+}
+
/** Get button with icon */
function icon(string $icon, string $name, string $html, string $title): string {
return "<button type='submit' name='$name' title='" . h($title) . "' class='icon icon-$icon'><span>$html</span></button>";
* @param mixed[] $params
* @return mixed
*/
- function __call($name, array $params) {
+ function __call(string $name, array $params) {
$args = array();
foreach ($params as $key => $val) {
// some plugins accept params by reference - we don't need to propage it outside, just to the other plugins