Skip to content

Instantly share code, notes, and snippets.

@vrana
vrana / phpdoc-ini-sort.php
Last active April 25, 2025 14:01
Sort ini.xml in phpdoc
<?php
foreach (array_merge(["appendices/ini.core.xml"], glob("reference/*/ini.xml")) as $filename) {
$file = file_get_contents($filename);
$file = preg_replace_callback('~(&Changelog;</entry>\s*</row>\s*</thead>\s*<tbody[^>]*>)(.*</row>)(\s*</tbody>)~sU', function ($match) {
preg_match_all('~.+</row>~sU', $match[2], $matches);
$rows = $matches[0];
usort($rows, function ($a, $b) {
return ltrim(strip_tags($a)) <=> ltrim(strip_tags($b));
});
return $match[1] . implode($rows) . $match[3];
<?php
/**
* Adminer plugin that display the first CHAR/VARCHAR column of the foreign key
*
* @category Plugin
* @link http://www.adminer.org/plugins/#use
* @author Bruno VIBERT <http://www.netapsys.fr>
* @modified by Peter Hostačný <hostacny.peter AT gmail.com>
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
@vrana
vrana / readable-dates.php
Last active March 16, 2025 06:40 — forked from scr4bble/readable-dates.php
Adminer plugin that replaces UNIX timestamps with human-readable dates.
<?php
/** This plugin replaces UNIX timestamps with human-readable dates in your local format.
* Mouse click on the date field reveals timestamp back.
*
* @link https://www.adminer.org/plugins/#use
* @author Anonymous
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
@vrana
vrana / import-from-dir.php
Last active March 16, 2025 06:40 — forked from Roy-Orbison/import-from-dir.php
Import any .sql[.gz] file, from a specifiable directory, rather than only the default adminer.sql[.gz], with Adminer.
<?php
/**
* Import SQL files from a directory
*
* @author joshcangit, https://github.com/joshcangit
* @author Roy-Orbison, https://github.com/Roy-Orbison
*/
class AdminerImportFromDir {
@vrana
vrana / restore-menu-scroll.php
Last active March 16, 2025 06:40 — forked from NoxArt/restore-menu-scroll.php
AdminerRestoreMenuScroll plugin for Adminer
<?php
/** Remembers and restores scollbar position of side menu
* @author Jiří @NoxArt Petruželka, www.noxart.cz
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
class AdminerRestoreMenuScroll {
protected $script;
<?php
use Symfony\Component\VarDumper\Cloner\VarCloner;
use Symfony\Component\VarDumper\Dumper\AbstractDumper;
use Symfony\Component\VarDumper\Dumper\HtmlDumper;
/**
* Uses symfony's var-dumper for pretty treeview of decoded json in table and edit view.
* needs symfony/var-dumper, install with:
@vrana
vrana / php-serialized-column.php
Last active March 16, 2025 06:39 — forked from donwilson/php-serialized-column.php
PHP Serialized Data previewer in Adminer Editor
<?php
/** Display PHP serialized values as table in edit. Using Jakub Vrana and Martin Zeman's JSON Adminer plugin (https://raw.githubusercontent.com/vrana/adminer/master/plugins/json-column.php) as a skeleton for this plugin.
* @link https://www.adminer.org/plugins/#use
* @author Don Wilson, https://pyxol.com/
* @author Jakub Vrana, https://www.vrana.cz/
* @author Martin Zeman (Zemistr), http://www.zemistr.eu/
* @license https://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
class AdminerPHPSerializedColumn {
<?php
/**
* Show the history of the latest selected tables. Cookies based.
* Set the js variable history_length to define the history length.
* Works only with current browsers.
* @link http://www.adminer.org/plugins/#use
* @author Ale Rimoldi, http://www.ideale.ch/
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
@vrana
vrana / convention-foreign-keys.php
Last active March 16, 2025 06:37 — forked from iNecas/convention-foreign-keys.php
Convention foreign keys: plugin for Adminer (http://www.adminer.org)
<?php
/** Convention foreign keys: plugin for Adminer
* Links for foreign keys by convention user_id => users.id. Useful for Ruby On Rails like standard schema conventions.
* @author Ivan Nečas, @inecas
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
*/
class ConventionForeignKeys {
@vrana
vrana / config.neon
Last active March 16, 2025 06:34 — forked from Mikulas/config.neon
Nette user login for Adminer Editor
common:
parameters:
adminer_editor:
role: moderator
database:
host: localhost
dbname: yourDbName
user: yourDbUser
password: yourDbOass