including type-ahead of keywords and tables
* @link https://codemirror.net/5/
* @link https://www.adminer.org/plugins/#use
* @author Jakub Vrana, https://www.vrana.cz/
* @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 AdminerCodemirror {
private $root;
function __construct($root = "codemirror5") {
$this->root = $root;
}
function syntaxHighlighting($tableStatuses) {
$connection = Adminer\connection();
?>
root/lib/codemirror.js");
echo Adminer\script_src("$this->root/addon/runmode/runmode.js");
echo Adminer\script_src("$this->root/addon/hint/show-hint.js");
echo Adminer\script_src("$this->root/mode/javascript/javascript.js");
if (Adminer\support("sql")) {
echo Adminer\script_src("$this->root/mode/sql/sql.js");
echo Adminer\script_src("$this->root/addon/hint/sql-hint.js");
}
$tables = array();
foreach ($tableStatuses as $status) {
foreach (Adminer\fields($status["Name"]) as $name => $field) {
$tables[$status["Name"]][] = $name;
}
}
?>