From f8a2d8b8b345633625111152d95c191171f90051 Mon Sep 17 00:00:00 2001 From: Jaime Jimenez Date: Mon, 12 Jun 2023 14:27:57 +0200 Subject: [PATCH] =?UTF-8?q?A=C3=B1adida=20la=20libreria=20datatables=20edi?= =?UTF-8?q?tor=20a=20third=20party?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ThirdParty/DatatablesEditor/Bootstrap.php | 54 + .../DatatablesEditor/DataTables.php | 36 + .../ThirdParty/DatatablesEditor/Database.php | 473 +++ .../Database/Driver/Db2Query.php | 161 + .../Database/Driver/Db2Result.php | 82 + .../Database/Driver/FirebirdQuery.php | 137 + .../Database/Driver/FirebirdResult.php | 77 + .../Database/Driver/MysqlQuery.php | 121 + .../Database/Driver/MysqlResult.php | 73 + .../Database/Driver/OracleQuery.php | 203 ++ .../Database/Driver/OracleResult.php | 82 + .../Database/Driver/PostgresQuery.php | 146 + .../Database/Driver/PostgresResult.php | 75 + .../Database/Driver/SqliteQuery.php | 112 + .../Database/Driver/SqliteResult.php | 73 + .../Database/Driver/SqlserverQuery.php | 153 + .../Database/Driver/SqlserverResult.php | 71 + .../DatatablesEditor/Database/Query.php | 1295 +++++++ .../DatatablesEditor/Database/Result.php | 68 + .../ThirdParty/DatatablesEditor/Editor.php | 2600 ++++++++++++++ .../DatatablesEditor/Editor/Field.php | 961 ++++++ .../DatatablesEditor/Editor/Format.php | 346 ++ .../DatatablesEditor/Editor/Join.php | 1049 ++++++ .../DatatablesEditor/Editor/Mjoin.php | 33 + .../DatatablesEditor/Editor/Options.php | 341 ++ .../Editor/SearchBuilderOptions.php | 335 ++ .../Editor/SearchPaneOptions.php | 467 +++ .../DatatablesEditor/Editor/Upload.php | 735 ++++ .../DatatablesEditor/Editor/Validate.php | 1396 ++++++++ .../Editor/ValidateOptions.php | 99 + ci4/app/ThirdParty/DatatablesEditor/Ext.php | 222 ++ .../DatatablesEditor/HtmLawed/Htmlaw.php | 112 + .../DatatablesEditor/HtmLawed/Htmlawed.php | 1587 +++++++++ .../ThirdParty/DatatablesEditor/License.txt | 22 + .../ThirdParty/DatatablesEditor/composer.json | 36 + .../ThirdParty/DatatablesEditor/composer.php | 12 + .../ThirdParty/DatatablesEditor/config.php | 30 + .../DataTables-Database-Driver-Db2Query.html | 2310 +++++++++++++ .../DataTables-Database-Driver-Db2Result.html | 515 +++ ...aTables-Database-Driver-FirebirdQuery.html | 2311 +++++++++++++ ...Tables-Database-Driver-FirebirdResult.html | 523 +++ ...DataTables-Database-Driver-MysqlQuery.html | 2185 ++++++++++++ ...ataTables-Database-Driver-MysqlResult.html | 515 +++ ...ataTables-Database-Driver-OracleQuery.html | 2310 +++++++++++++ ...taTables-Database-Driver-OracleResult.html | 523 +++ ...aTables-Database-Driver-PostgresQuery.html | 2269 +++++++++++++ ...Tables-Database-Driver-PostgresResult.html | 515 +++ ...ataTables-Database-Driver-SqliteQuery.html | 2227 ++++++++++++ ...taTables-Database-Driver-SqliteResult.html | 515 +++ ...Tables-Database-Driver-SqlserverQuery.html | 2227 ++++++++++++ ...ables-Database-Driver-SqlserverResult.html | 515 +++ .../classes/DataTables-Database-Query.html | 2145 ++++++++++++ .../classes/DataTables-Database-Result.html | 457 +++ .../docs/classes/DataTables-Database.html | 1476 ++++++++ .../docs/classes/DataTables-Editor-Field.html | 2105 ++++++++++++ .../classes/DataTables-Editor-Format.html | 1112 ++++++ .../docs/classes/DataTables-Editor-Join.html | 2087 ++++++++++++ .../docs/classes/DataTables-Editor-Mjoin.html | 2038 +++++++++++ .../classes/DataTables-Editor-Options.html | 1299 +++++++ ...ataTables-Editor-SearchBuilderOptions.html | 1182 +++++++ .../DataTables-Editor-SearchPaneOptions.html | 1182 +++++++ .../classes/DataTables-Editor-Upload.html | 1681 +++++++++ .../classes/DataTables-Editor-Validate.html | 2108 ++++++++++++ .../DataTables-Editor-ValidateOptions.html | 922 +++++ .../docs/classes/DataTables-Editor.html | 2989 +++++++++++++++++ .../docs/classes/DataTables-Ext.html | 698 ++++ .../classes/DataTables-HtmLawed-Htmlaw.html | 516 +++ .../DatatablesEditor/docs/css/base.css | 1105 ++++++ .../DatatablesEditor/docs/css/normalize.css | 427 +++ .../DatatablesEditor/docs/css/template.css | 192 ++ .../docs/files/Bootstrap.php.txt | 54 + .../docs/files/DataTables.php.txt | 34 + .../docs/files/Database.php.txt | 473 +++ .../files/Database/Driver/Db2Query.php.txt | 161 + .../files/Database/Driver/Db2Result.php.txt | 82 + .../Database/Driver/FirebirdQuery.php.txt | 137 + .../Database/Driver/FirebirdResult.php.txt | 77 + .../files/Database/Driver/MysqlQuery.php.txt | 121 + .../files/Database/Driver/MysqlResult.php.txt | 73 + .../files/Database/Driver/OracleQuery.php.txt | 203 ++ .../Database/Driver/OracleResult.php.txt | 82 + .../Database/Driver/PostgresQuery.php.txt | 146 + .../Database/Driver/PostgresResult.php.txt | 75 + .../files/Database/Driver/SqliteQuery.php.txt | 112 + .../Database/Driver/SqliteResult.php.txt | 73 + .../Database/Driver/SqlserverQuery.php.txt | 153 + .../Database/Driver/SqlserverResult.php.txt | 71 + .../docs/files/Database/Query.php.txt | 1295 +++++++ .../docs/files/Database/Result.php.txt | 68 + .../docs/files/Editor.php.txt | 2600 ++++++++++++++ .../docs/files/Editor/Field.php.txt | 961 ++++++ .../docs/files/Editor/Format.php.txt | 346 ++ .../docs/files/Editor/Join.php.txt | 1049 ++++++ .../docs/files/Editor/Mjoin.php.txt | 33 + .../docs/files/Editor/Options.php.txt | 341 ++ .../files/Editor/SearchBuilderOptions.php.txt | 335 ++ .../files/Editor/SearchPaneOptions.php.txt | 467 +++ .../docs/files/Editor/Upload.php.txt | 735 ++++ .../docs/files/Editor/Validate.php.txt | 1396 ++++++++ .../docs/files/Editor/ValidateOptions.php.txt | 99 + .../DatatablesEditor/docs/files/Ext.php.txt | 222 ++ .../docs/files/HtmLawed/Htmlaw.php.txt | 112 + .../docs/files/HtmLawed/Htmlawed.php.txt | 0 .../docs/files/bootstrap.html | 167 + .../DatatablesEditor/docs/files/composer.html | 197 ++ .../docs/files/composer.php.txt | 12 + .../DatatablesEditor/docs/files/config.html | 147 + .../docs/files/config.php.txt | 30 + .../docs/files/database-driver-db2query.html | 161 + .../docs/files/database-driver-db2result.html | 179 + .../files/database-driver-firebirdquery.html | 179 + .../files/database-driver-firebirdresult.html | 179 + .../files/database-driver-mysqlquery.html | 179 + .../files/database-driver-mysqlresult.html | 179 + .../files/database-driver-oraclequery.html | 180 + .../files/database-driver-oracleresult.html | 178 + .../files/database-driver-postgresquery.html | 179 + .../files/database-driver-postgresresult.html | 179 + .../files/database-driver-sqlitequery.html | 179 + .../files/database-driver-sqliteresult.html | 179 + .../files/database-driver-sqlserverquery.html | 178 + .../database-driver-sqlserverresult.html | 178 + .../docs/files/database-query.html | 179 + .../docs/files/database-result.html | 179 + .../DatatablesEditor/docs/files/database.html | 179 + .../docs/files/datatables.html | 237 ++ .../docs/files/editor-field.html | 179 + .../docs/files/editor-format.html | 179 + .../docs/files/editor-join.html | 179 + .../docs/files/editor-mjoin.html | 182 + .../docs/files/editor-options.html | 180 + .../files/editor-searchbuilderoptions.html | 180 + .../docs/files/editor-searchpaneoptions.html | 180 + .../docs/files/editor-upload.html | 181 + .../docs/files/editor-validate.html | 179 + .../docs/files/editor-validateoptions.html | 179 + .../DatatablesEditor/docs/files/editor.html | 180 + .../DatatablesEditor/docs/files/ext.html | 179 + .../docs/files/htmlawed-htmlaw.html | 184 + .../docs/files/htmlawed-htmlawed.html | 147 + .../DatatablesEditor/docs/graphs/classes.html | 124 + .../DatatablesEditor/docs/index.html | 258 ++ .../DatatablesEditor/docs/indices/files.html | 206 ++ .../DatatablesEditor/docs/js/search.js | 173 + .../DatatablesEditor/docs/js/searchIndex.js | 1744 ++++++++++ .../datatables-database-driver.html | 179 + .../docs/namespaces/datatables-database.html | 162 + .../docs/namespaces/datatables-editor.html | 178 + .../docs/namespaces/datatables-htmlawed.html | 152 + .../docs/namespaces/datatables.html | 165 + .../docs/namespaces/default.html | 254 ++ .../docs/packages/Application.html | 324 ++ .../docs/packages/default.html | 147 + .../docs/reports/deprecated.html | 155 + .../DatatablesEditor/docs/reports/errors.html | 160 + .../docs/reports/markers.html | 159 + .../DatatablesEditor/phpdoc.dist.xml | 17 + .../DatatablesEditor/phpstan-baseline.neon | 405 +++ .../DatatablesEditor/phpstan.neon.dist | 28 + 159 files changed, 82533 insertions(+) create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Bootstrap.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/DataTables.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Database.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Database/Driver/Db2Query.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Database/Driver/Db2Result.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Database/Driver/FirebirdQuery.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Database/Driver/FirebirdResult.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Database/Driver/MysqlQuery.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Database/Driver/MysqlResult.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Database/Driver/OracleQuery.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Database/Driver/OracleResult.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Database/Driver/PostgresQuery.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Database/Driver/PostgresResult.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Database/Driver/SqliteQuery.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Database/Driver/SqliteResult.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Database/Driver/SqlserverQuery.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Database/Driver/SqlserverResult.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Database/Query.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Database/Result.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Editor.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Editor/Field.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Editor/Format.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Editor/Join.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Editor/Mjoin.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Editor/Options.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Editor/SearchBuilderOptions.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Editor/SearchPaneOptions.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Editor/Upload.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Editor/Validate.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Editor/ValidateOptions.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/Ext.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/HtmLawed/Htmlaw.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/HtmLawed/Htmlawed.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/License.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/composer.json create mode 100644 ci4/app/ThirdParty/DatatablesEditor/composer.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/config.php create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-Db2Query.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-Db2Result.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-FirebirdQuery.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-FirebirdResult.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-MysqlQuery.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-MysqlResult.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-OracleQuery.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-OracleResult.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-PostgresQuery.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-PostgresResult.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-SqliteQuery.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-SqliteResult.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-SqlserverQuery.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-SqlserverResult.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Query.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Result.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Field.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Format.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Join.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Mjoin.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Options.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-SearchBuilderOptions.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-SearchPaneOptions.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Upload.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Validate.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-ValidateOptions.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Ext.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-HtmLawed-Htmlaw.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/css/base.css create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/css/normalize.css create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/css/template.css create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Bootstrap.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/DataTables.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Database.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/Db2Query.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/Db2Result.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/FirebirdQuery.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/FirebirdResult.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/MysqlQuery.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/MysqlResult.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/OracleQuery.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/OracleResult.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/PostgresQuery.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/PostgresResult.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/SqliteQuery.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/SqliteResult.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/SqlserverQuery.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/SqlserverResult.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Query.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Result.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Field.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Format.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Join.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Mjoin.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Options.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/SearchBuilderOptions.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/SearchPaneOptions.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Upload.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Validate.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/ValidateOptions.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/Ext.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/HtmLawed/Htmlaw.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/HtmLawed/Htmlawed.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/bootstrap.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/composer.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/composer.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/config.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/config.php.txt create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-db2query.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-db2result.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-firebirdquery.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-firebirdresult.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-mysqlquery.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-mysqlresult.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-oraclequery.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-oracleresult.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-postgresquery.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-postgresresult.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-sqlitequery.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-sqliteresult.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-sqlserverquery.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-sqlserverresult.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/database-query.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/database-result.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/database.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/datatables.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-field.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-format.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-join.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-mjoin.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-options.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-searchbuilderoptions.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-searchpaneoptions.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-upload.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-validate.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-validateoptions.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/editor.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/ext.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/htmlawed-htmlaw.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/files/htmlawed-htmlawed.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/graphs/classes.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/index.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/indices/files.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/js/search.js create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/js/searchIndex.js create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables-database-driver.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables-database.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables-editor.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables-htmlawed.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/default.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/packages/Application.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/packages/default.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/reports/deprecated.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/reports/errors.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/docs/reports/markers.html create mode 100644 ci4/app/ThirdParty/DatatablesEditor/phpdoc.dist.xml create mode 100644 ci4/app/ThirdParty/DatatablesEditor/phpstan-baseline.neon create mode 100644 ci4/app/ThirdParty/DatatablesEditor/phpstan.neon.dist diff --git a/ci4/app/ThirdParty/DatatablesEditor/Bootstrap.php b/ci4/app/ThirdParty/DatatablesEditor/Bootstrap.php new file mode 100644 index 00000000..fb391b7b --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Bootstrap.php @@ -0,0 +1,54 @@ + "Editor PHP libraries required PHP 5.3 or newer. You are " . + "currently using " . PHP_VERSION . ". PHP 5.3 and newer have a lot of " . + "great new features that the Editor libraries take advantage of to " . + "present an easy to use and flexible API." + )); + exit(0); +} + + +// +// Load the DataTables bootstrap core file and let it register the required +// handlers. +// +include(APPPATH . 'ThirdParty/DatatablesEditor/Bootstrap.php'); + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/Database.php b/ci4/app/ThirdParty/DatatablesEditor/Database.php new file mode 100644 index 00000000..7d86935f --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Database.php @@ -0,0 +1,473 @@ + "", // User name + * "pass" => "", // Password + * "host" => "", // Host name + * "port" => "", // Port + * "db" => "", // Database name + * "type" => "" // Datable type: "Mysql", "Postgres" or "Sqlite" + * ) + * ``` + */ + function __construct( $opts ) + { + $types = array( 'Mysql', 'Oracle', 'Postgres', 'Sqlite', 'Sqlserver', 'Db2', 'Firebird' ); + + if ( ! in_array( $opts['type'], $types ) ) { + throw new \Exception( + "Unknown database driver type. Must be one of ".implode(', ', $types), + 1 + ); + } + + $this->_type = $opts['type']; + $this->query_driver = "DataTables\\Database\\Driver\\".$opts['type'].'Query'; + $this->_dbResource = isset( $opts['pdo'] ) ? + $opts['pdo'] : + call_user_func($this->query_driver.'::connect', $opts ); + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + /** @var resource */ + private $_dbResource = null; + + /** @var callable */ + private $_type = null; + private $_debugCallback = null; + private $query_driver = null; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + /** + * Determine if there is any data in the table that matches the query + * condition + * + * @param string|string[] $table Table name(s) to act upon. + * @param array $where Where condition for what to select - see {@see + * Query->where()}. + * @return boolean Boolean flag - true if there were rows + */ + public function any( $table, $where=null ) + { + $res = $this->query( 'select' ) + ->table( $table ) + ->get( '*' ) + ->where( $where ) + ->limit(1) + ->exec(); + + return $res->count() > 0; + } + + + /** + * Commit a database transaction. + * + * Use with {@see Database->transaction()} and {@see Database->rollback()}. + * @return self + */ + public function commit () + { + call_user_func($this->query_driver.'::commit', $this->_dbResource ); + return $this; + } + + + /** + * Get a count from a table. + * @param string|string[] $table Table name(s) to act upon. + * @param string $field Primary key field name + * @param array $where Where condition for what to select - see {@see + * Query->where()}. + * @return Number + */ + public function count ( $table, $field="id", $where=null ) + { + $res = $this->query( 'count' ) + ->table( $table ) + ->get( $field ) + ->where( $where ) + ->exec(); + + $cnt = $res->fetch(); + return $cnt['cnt']; + } + + + /** + * Get / set debug mode. + * + * @param boolean $_ Debug mode state. If not given, then used as a getter. + * @return boolean|self Debug mode state if no parameter is given, or + * self if used as a setter. + */ + public function debug ( $set=null ) + { + if ( $set === null ) { + return $this->_debugCallback ? true : false; + } + else if ( $set === false ) { + $this->_debugCallback = null; + } + else { + $this->_debugCallback = $set; + } + + return $this; + } + + + /** + * Perform a delete query on a table. + * + * This is a short cut method that creates an update query and then uses + * the query('delete'), table, where and exec methods of the query. + * @param string|string[] $table Table name(s) to act upon. + * @param array $where Where condition for what to delete - see {@see + * Query->where()}. + * @return Result + */ + public function delete ( $table, $where=null ) + { + return $this->query( 'delete' ) + ->table( $table ) + ->where( $where ) + ->exec(); + } + + + /** + * Insert data into a table. + * + * This is a short cut method that creates an update query and then uses + * the query('insert'), table, set and exec methods of the query. + * @param string|string[] $table Table name(s) to act upon. + * @param array $set Field names and values to set - see {@see + * Query->set()}. + * @param array $pkey Primary key column names (this is an array for + * forwards compt, although only the first item in the array is actually + * used). This doesn't need to be set, but it must be if you want to use + * the `Result->insertId()` method. + * @return Result + */ + public function insert ( $table, $set, $pkey='' ) + { + return $this->query( 'insert' ) + ->pkey( $pkey ) + ->table( $table ) + ->set( $set ) + ->exec(); + } + + + /** + * Update or Insert data. When doing an insert, the where condition is + * added as a set field + * @param string|string[] $table Table name(s) to act upon. + * @param array $set Field names and values to set - see {@see + * Query->set()}. + * @param array $where Where condition for what to update - see {@see + * Query->where()}. + * @param array $pkey Primary key column names (this is an array for + * forwards compt, although only the first item in the array is actually + * used). This doesn't need to be set, but it must be if you want to use + * the `Result->insertId()` method. Only used if an insert is performed. + * @return Result + */ + public function push ( $table, $set, $where=null, $pkey='' ) + { + $selectColumn = '*'; + + if ( $pkey ) { + $selectColumn = is_array($pkey) ? + $pkey[0] : + $pkey; + } + + // Update or insert + if ( $this->select( $table, $selectColumn, $where )->count() > 0 ) { + return $this->update( $table, $set, $where ); + } + + // Add the where condition to the values to set + foreach ($where as $key => $value) { + if ( ! isset( $set[ $key ] ) ) { + $set[ $key ] = $value; + } + } + + return $this->insert( $table, $set, $pkey ); + } + + + /** + * Create a query object to build a database query. + * @param string $type Query type - select, insert, update or delete. + * @param string|string[] $table Table name(s) to act upon. + * @return Query + */ + public function query ( $type, $table=null ) + { + return new $this->query_driver( $this, $type, $table ); + } + + + /** + * Quote a string for a quote. Note you should generally use a bind! + * @param string $val Value to quote + * @param string $type Value type + * @return string + */ + public function quote ( $val, $type=\PDO::PARAM_STR ) + { + return $this->_dbResource->quote( $val, $type ); + } + + + /** + * Create a `Query` object that will execute a custom SQL query. This is + * similar to the `sql` method, but in this case you must call the `exec()` + * method of the returned `Query` object manually. This can be useful if you + * wish to bind parameters using the query `bind` method to ensure data is + * properly escaped. + * + * @return Result + * + * @example + * Safely escape user input + * ```php + * $db + * ->raw() + * ->bind( ':date', $_POST['date'] ) + * ->exec( 'SELECT * FROM staff where date < :date' ); + * ``` + */ + public function raw () + { + return $this->query( 'raw' ); + } + + + /** + * Get the database resource connector. This is typically a PDO object. + * @return resource PDO connection resource (driver dependent) + */ + public function resource () + { + return $this->_dbResource; + } + + + /** + * Rollback the database state to the start of the transaction. + * + * Use with {@see Database->transaction()} and {@see Database->commit()}. + * @return self + */ + public function rollback () + { + call_user_func($this->query_driver.'::rollback', $this->_dbResource ); + return $this; + } + + + /** + * Select data from a table. + * + * This is a short cut method that creates an update query and then uses + * the query('select'), table, get, where and exec methods of the query. + * @param string|string[] $table Table name(s) to act upon. + * @param array $field Fields to get from the table(s) - see {@see + * Query->get()}. + * @param array $where Where condition for what to select - see {@see + * Query->where()}. + * @param array $orderBy Order condition - see {@see + * Query->order()}. + * @return Result + */ + public function select ( $table, $field="*", $where=null, $orderBy=null ) + { + return $this->query( 'select' ) + ->table( $table ) + ->get( $field ) + ->where( $where ) + ->order( $orderBy ) + ->exec(); + } + + + /** + * Select distinct data from a table. + * + * This is a short cut method that creates an update query and then uses the + * query('select'), distinct ,table, get, where and exec methods of the + * query. + * @param string|string[] $table Table name(s) to act upon. + * @param array $field Fields to get from the table(s) - see {@see + * Query->get()}. + * @param array $where Where condition for what to select - see {@see + * Query->where()}. + * @param array $orderBy Order condition - see {@see + * Query->order()}. + * @return Result + */ + public function selectDistinct ( $table, $field="*", $where=null, $orderBy=null ) + { + return $this->query( 'select' ) + ->table( $table ) + ->distinct( true ) + ->get( $field ) + ->where( $where ) + ->order( $orderBy ) + ->exec(); + } + + + /** + * Execute an raw SQL query - i.e. give the method your own SQL, rather + * than having the Database classes building it for you. + * + * This method will execute the given SQL immediately. Use the `raw()` + * method if you need the ability to add bound parameters. + * @param string $sql SQL string to execute (only if _type is 'raw'). + * @return Result + * + * @example + * Basic select + * ```php + * $result = $db->sql( 'SELECT * FROM myTable;' ); + * ``` + * + * @example + * Set the character set of the connection + * ```php + * $db->sql("SET character_set_client=utf8"); + * $db->sql("SET character_set_connection=utf8"); + * $db->sql("SET character_set_results=utf8"); + * ``` + */ + public function sql ( $sql ) + { + return $this->query( 'raw' ) + ->exec( $sql ); + } + + + /** + * Start a new database transaction. + * + * Use with {@see Database->commit()} and {@see Database->rollback()}. + * @return self + */ + public function transaction () + { + call_user_func($this->query_driver.'::transaction', $this->_dbResource ); + return $this; + } + + + /** + * Get the database type (e.g. Postgres, Mysql, etc) + */ + public function type () + { + return $this->_type; + } + + + /** + * Update data. + * + * This is a short cut method that creates an update query and then uses + * the query('update'), table, set, where and exec methods of the query. + * @param string|string[] $table Table name(s) to act upon. + * @param array $set Field names and values to set - see {@see + * Query->set()}. + * @param array $where Where condition for what to update - see {@see + * Query->where()}. + * @return Result + */ + public function update ( $table, $set=null, $where=null ) + { + return $this->query( 'update' ) + ->table( $table ) + ->set( $set ) + ->where( $where ) + ->exec(); + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Internal functions + */ + + /** + * Get debug query information. + * + * @return array Information about the queries used. When this method is + * called it will reset the query cache. + * @internal + */ + public function debugInfo ( $query=null, $bindings=null ) + { + $callback = $this->_debugCallback; + + if ( $callback ) { + $callback( array( + "query" => $query, + "bindings" => $bindings + ) ); + } + + return $this; + } +}; + diff --git a/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/Db2Query.php b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/Db2Query.php new file mode 100644 index 00000000..3461491d --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/Db2Query.php @@ -0,0 +1,161 @@ + "An error occurred while connecting to the database ". + "'{$db}'. The error reported by the server was: ".$e + ) ); + exit(0); + } + + return $conn; + } + + public static function transaction ( $conn ) + { + // no op + } + + public static function commit ( $conn ) + { + // no op + } + + public static function rollback ( $conn ) + { + // no op + } + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Protected methods + */ + + protected function _prepare($sql) + { + $this->_sql = $sql; + } + + protected function _exec() + { + $resource = $this->database()->resource(); + $bindings = $this->_bindings; + + $paramSql = preg_replace('/(:[a-zA-Z\-_0-9]*)/', '?', $this->_sql); + //echo $paramSql."\n"; + $this->_stmt = db2_prepare($resource, $paramSql); + $stmt = $this->_stmt; + + //echo $this->_sql."\n"; + + preg_match_all('/(:[a-zA-Z\-_0-9]*)/', $this->_sql, $matches); + + //print_r( $matches ); + //print_r( $bindings); + + //$allanTest = 65; + //db2_bind_param( $stmt, 1, 'allanTest', DB2_PARAM_IN ); + + for ( $i=0, $ien=count($matches[0]) ; $i<$ien ; $i++ ) { + for ( $j=0, $jen=count($bindings) ; $j<$jen ; $j++ ) { + if ( $bindings[$j]['name'] === $matches[0][$i] ) { + $name = str_replace(':', '', $matches[0][$i]); + $$name = $bindings[$j]['value']; + //$_GLOBALS[ $name ] = $bindings[$j]['value']; + + //echo "bind $name as ".$$name."\n"; + + db2_bind_param( $stmt, $i+1, $name, DB2_PARAM_IN ); + } + } + } + + //print_r( get_defined_vars() ); + + $res = db2_execute($stmt); + + if (! $res) { + throw new \Exception('DB2 SQL error = '.db2_stmt_error($this->_stmt)); + + return false; + } + + $resource = $this->database()->resource(); + return new Db2Result($resource, $this->_stmt, $this->_editor_pkey_value); + } + + protected function _build_table() + { + $out = array(); + + for ($i = 0, $ien = count($this->_table); $i < $ien; $i ++) { + $t = $this->_table[$i]; + + if (strpos($t, ' as ')) { + $a = explode(' as ', $t); + $out[] = $a[0] . ' ' . $a[1]; + } else { + $out[] = $t; + } + } + + return ' ' . implode(', ', $out) . ' '; + } +} diff --git a/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/Db2Result.php b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/Db2Result.php new file mode 100644 index 00000000..9885d862 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/Db2Result.php @@ -0,0 +1,82 @@ +_dbh = $dbh; + $this->_stmt = $stmt; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + private $_stmt; + private $_dbh; + private $_allRows = null; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + public function count () + { + $all = $this->_fetchAll(); + return count($all); + } + + + public function fetch ( $fetchType=\PDO::FETCH_ASSOC ) + { + return db2_fetch_assoc( $this->_stmt ); + } + + + public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC ) + { + $all = $this->_fetchAll(); + return $all; + } + + public function insertId () + { + return db2_last_insert_id( $this->_dbh ); + } + + private function _fetchAll () { + $a = array(); + while ( $row = db2_fetch_assoc( $this->_stmt ) ) { + $a[] = $row; + } + return $a; + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/FirebirdQuery.php b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/FirebirdQuery.php new file mode 100644 index 00000000..fa71840e --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/FirebirdQuery.php @@ -0,0 +1,137 @@ + "An error occurred while connecting to the database ". + "'{$db}'. The error reported by the server was: ".$e->getMessage() + ) ); + exit(0); + } + + return $pdo; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Protected methods + */ + + protected function _prepare( $sql ) + { + $this->database()->debugInfo( $sql, $this->_bindings ); + + $resource = $this->database()->resource(); + $pkey = $this->pkey(); + + // If insert, add the pkey column + if ( $this->_type === 'insert' && $pkey ) { + $this->_pkeyInsertedTo = (is_array($pkey) ? $pkey[0] : $pkey); + $sql .= ' RETURNING "'.$this->_pkeyInsertedTo.'"'; + } + + $this->_stmt = $resource->prepare( $sql ); + + // bind values + for ( $i=0 ; $i_bindings) ; $i++ ) { + $binding = $this->_bindings[$i]; + + $this->_stmt->bindValue( + $binding['name'], + $binding['value'], + $binding['type'] ? $binding['type'] : \PDO::PARAM_STR + ); + } + } + + + protected function _exec() + { + try { + $this->_stmt->execute(); + } + catch (\PDOException $e) { + throw new \Exception( "An SQL error occurred: ".$e->getMessage() ); + error_log( "An SQL error occurred: ".$e->getMessage() ); + return false; + } + + $resource = $this->database()->resource(); + return new FirebirdResult( $resource, $this->_stmt, $this->_pkeyInsertedTo ); + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/FirebirdResult.php b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/FirebirdResult.php new file mode 100644 index 00000000..da372542 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/FirebirdResult.php @@ -0,0 +1,77 @@ +_dbh = $dbh; + $this->_stmt = $stmt; + $this->_pkey = $pkey; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + private $_stmt; + private $_dbh; + private $_pkey; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + public function count () + { + return count($this->fetchAll()); + } + + + public function fetch ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetch( $fetchType ); + } + + + public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetchAll( $fetchType ); + } + + + public function insertId () + { + // Only useful after an insert of course... + $rows = $this->_stmt->fetchAll(); + return $rows[0][$this->_pkey]; + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/MysqlQuery.php b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/MysqlQuery.php new file mode 100644 index 00000000..fb21b381 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/MysqlQuery.php @@ -0,0 +1,121 @@ + "An error occurred while connecting to the database ". + "'{$db}'. The error reported by the server was: ".$e->getMessage() + ) ); + exit(0); + } + + return $pdo; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Protected methods + */ + + protected function _prepare( $sql ) + { + $this->database()->debugInfo( $sql, $this->_bindings ); + + $resource = $this->database()->resource(); + $this->_stmt = $resource->prepare( $sql ); + + // bind values + for ( $i=0 ; $i_bindings) ; $i++ ) { + $binding = $this->_bindings[$i]; + + $this->_stmt->bindValue( + $binding['name'], + $binding['value'], + $binding['type'] ? $binding['type'] : \PDO::PARAM_STR + ); + } + } + + + protected function _exec() + { + // $start = hrtime(true); + + try { + $this->_stmt->execute(); + } + catch (\PDOException $e) { + throw new \Exception( "An SQL error occurred: ".$e->getMessage() ); + error_log( "An SQL error occurred: ".$e->getMessage() ); + return false; + } + + // $this->database()->debugInfo( 'Execution complete - duration: '. (hrtime(true) - $start) . ' Time: '. microtime(true), [] ); + + $resource = $this->database()->resource(); + return new MysqlResult( $resource, $this->_stmt ); + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/MysqlResult.php b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/MysqlResult.php new file mode 100644 index 00000000..b044f4ea --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/MysqlResult.php @@ -0,0 +1,73 @@ +_dbh = $dbh; + $this->_stmt = $stmt; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + private $_stmt; + private $_dbh; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + public function count () + { + return count($this->fetchAll()); + } + + + public function fetch ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetch( $fetchType ); + } + + + public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetchAll( $fetchType ); + } + + + public function insertId () + { + return $this->_dbh->lastInsertId(); + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/OracleQuery.php b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/OracleQuery.php new file mode 100644 index 00000000..9d1b448d --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/OracleQuery.php @@ -0,0 +1,203 @@ + "oci methods are not available in this PHP install to connect to Oracle" + ) ); + exit(0); + } + + $conn = @oci_connect($user, $pass, $host.$port.'/'.$db, 'utf8'); + + if ( ! $conn ) { + // If we can't establish a DB connection then we return a DataTables + // error. + $e = oci_error(); + + echo json_encode( array( + "error" => "An error occurred while connecting to the database ". + "'{$db}'. The error reported by the server was: ".$e['message'] + ) ); + exit(0); + } + + // Use ISO date and time styles + $stmt = oci_parse($conn, "ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'" ); + $res = oci_execute( $stmt ); + + $stmt = oci_parse($conn, "ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'" ); + $res = oci_execute( $stmt ); + + return $conn; + } + + + public static function transaction ( $conn ) + { + // no op + } + + public static function commit ( $conn ) + { + oci_commit( $conn ); + } + + public static function rollback ( $conn ) + { + oci_rollback( $conn ); + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Protected methods + */ + + protected function _prepare( $sql ) + { + + $resource = $this->database()->resource(); + $pkey = $this->pkey(); + + // If insert, add the pkey column + if ( $this->_type === 'insert' && $pkey ) { + $sql .= ' RETURNING '.$this->_protect_identifiers(is_array($pkey) ? $pkey[0] : $pkey).' INTO :editor_pkey_value'; + } + else if ( $this->_type === 'select' && $this->_oracle_offset !== null ) { + $sql = ' + select * from (select rownum rnum, a.* + from ('.$sql.') a where rownum <= '.($this->_oracle_offset+$this->_oracle_limit).') + where rnum > '.$this->_oracle_offset; + } + + $this->database()->debugInfo( $sql, $this->_bindings ); + + $this->_stmt = oci_parse( $resource, $sql ); + + // If insert, add a binding for the returned id + if ( $this->_type === 'insert' && $pkey ) { + oci_bind_by_name( + $this->_stmt, + ':editor_pkey_value', + $this->_editor_pkey_value, + 36 + ); + } + + // Bind values + for ( $i=0 ; $i_bindings) ; $i++ ) { + $binding = $this->_bindings[$i]; + + oci_bind_by_name( + $this->_stmt, + $binding['name'], + $binding['value'] + ); + } + } + + + protected function _exec() + { + $res = @oci_execute( $this->_stmt, OCI_NO_AUTO_COMMIT ); + + if ( ! $res ) { + $e = oci_error( $this->_stmt ); + throw new \Exception( "Oracle SQL error: ".$e['message'] ); + + return false; + } + + $resource = $this->database()->resource(); + return new OracleResult( $resource, $this->_stmt, $this->_editor_pkey_value ); + } + + + protected function _build_table() + { + $out = array(); + + for ( $i=0, $ien=count($this->_table) ; $i<$ien ; $i++ ) { + $t = $this->_table[$i]; + + if ( strpos($t, ' as ') ) { + $a = explode( ' as ', $t ); + $out[] = $this->_protect_identifiers($a[0]).' '.$this->_protect_identifiers($a[1]); + } + else { + $out[] = $t; + } + } + + return ' '.implode(', ', $out).' '; + } + + + private $_oracle_offset = null; + private $_oracle_limit = null; + + protected function _build_limit() + { + $this->_oracle_offset = $this->_offset; + $this->_oracle_limit = $this->_limit; + + return ' '; + } +} diff --git a/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/OracleResult.php b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/OracleResult.php new file mode 100644 index 00000000..b8eee5de --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/OracleResult.php @@ -0,0 +1,82 @@ +_dbh = $dbh; + $this->_stmt = $stmt; + $this->_pkey_val = $pkey_val; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + private $_stmt; // Result from oci_parse + private $_dbh; // Result from oci_connect + private $_rows = null; + private $_pkey_val; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + public function count () + { + return count($this->fetchAll()); + } + + + public function fetch ( $fetchType=\PDO::FETCH_ASSOC /* irrelevant for oci8 */ ) + { + return oci_fetch_assoc( $this->_stmt ); + } + + + public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC /* irrelevant for oci8 */ ) + { + if ( ! $this->_rows ) { + $out = array(); + + oci_fetch_all( $this->_stmt, $out, 0, -1, OCI_FETCHSTATEMENT_BY_ROW + OCI_ASSOC ); + + $this->_rows = $out; + } + + return $this->_rows; + } + + + public function insertId () + { + return $this->_pkey_val; + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/PostgresQuery.php b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/PostgresQuery.php new file mode 100644 index 00000000..67c9247a --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/PostgresQuery.php @@ -0,0 +1,146 @@ + "An error occurred while connecting to the database ". + "'{$db}'. The error reported by the server was: ".$e->getMessage() + ) ); + exit(0); + } + + return $pdo; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Protected methods + */ + + protected function _prepare( $sql ) + { + $this->database()->debugInfo( $sql, $this->_bindings ); + + $resource = $this->database()->resource(); + + // Add a RETURNING command to postgres insert queries so we can get the + // pkey value from the query reliably + if ( $this->_type === 'insert' ) { + $table = explode( ' as ', $this->_table[0] ); + + // Get the pkey field name + $pkRes = $resource->prepare( + "SELECT + pg_attribute.attname, + format_type(pg_attribute.atttypid, pg_attribute.atttypmod) + FROM pg_index, pg_class, pg_attribute + WHERE + pg_class.oid = '{$table[0]}'::regclass AND + indrelid = pg_class.oid AND + pg_attribute.attrelid = pg_class.oid AND + pg_attribute.attnum = any(pg_index.indkey) + AND indisprimary" + ); + $pkRes->execute(); + $row = $pkRes->fetch(); + + if ( $row && isset($row['attname'] ) ) { + $sql .= ' RETURNING '.$row['attname'].' as dt_pkey'; + } + } + + $this->_stmt = $resource->prepare( $sql ); + + // bind values + for ( $i=0 ; $i_bindings) ; $i++ ) { + $binding = $this->_bindings[$i]; + + $this->_stmt->bindValue( + $binding['name'], + $binding['value'], + $binding['type'] ? $binding['type'] : \PDO::PARAM_STR + ); + } + } + + + protected function _exec() + { + try { + $this->_stmt->execute(); + } + catch (\PDOException $e) { + throw new \Exception( "An SQL error occurred: ".$e->getMessage() ); + error_log( "An SQL error occurred: ".$e->getMessage() ); + return false; + } + + $resource = $this->database()->resource(); + return new PostgresResult( $resource, $this->_stmt ); + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/PostgresResult.php b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/PostgresResult.php new file mode 100644 index 00000000..eb204efe --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/PostgresResult.php @@ -0,0 +1,75 @@ +_dbh = $dbh; + $this->_stmt = $stmt; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + private $_stmt; + private $_dbh; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + public function count () + { + return count($this->fetchAll()); + } + + + public function fetch ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetch( $fetchType ); + } + + + public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetchAll( $fetchType ); + } + + + public function insertId () + { + // Only useful after an insert of course... + $rows = $this->_stmt->fetchAll(); + return $rows[0]['dt_pkey']; + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/SqliteQuery.php b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/SqliteQuery.php new file mode 100644 index 00000000..9c1ef0bc --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/SqliteQuery.php @@ -0,0 +1,112 @@ + "An error occurred while connecting to the database ". + "'{$db}'. The error reported by the server was: ".$e->getMessage() + ) ); + exit(0); + } + + return $pdo; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Protected methods + */ + + protected function _prepare( $sql ) + { + $this->database()->debugInfo( $sql, $this->_bindings ); + + $resource = $this->database()->resource(); + $this->_stmt = $resource->prepare( $sql ); + + // bind values + for ( $i=0 ; $i_bindings) ; $i++ ) { + $binding = $this->_bindings[$i]; + + $this->_stmt->bindValue( + $binding['name'], + $binding['value'], + $binding['type'] ? $binding['type'] : \PDO::PARAM_STR + ); + } + } + + + protected function _exec() + { + try { + $this->_stmt->execute(); + } + catch (PDOException $e) { + throw new \Exception( "An SQL error occurred: ".$e->getMessage() ); + error_log( "An SQL error occurred: ".$e->getMessage() ); + return false; + } + + $resource = $this->database()->resource(); + return new SqliteResult( $resource, $this->_stmt ); + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/SqliteResult.php b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/SqliteResult.php new file mode 100644 index 00000000..f71964e2 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/SqliteResult.php @@ -0,0 +1,73 @@ +_dbh = $dbh; + $this->_stmt = $stmt; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + private $_stmt; + private $_dbh; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + public function count () + { + return count($this->fetchAll()); + } + + + public function fetch ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetch( $fetchType ); + } + + + public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetchAll( $fetchType ); + } + + + public function insertId () + { + return $this->_dbh->lastInsertId(); + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/SqlserverQuery.php b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/SqlserverQuery.php new file mode 100644 index 00000000..87e62ead --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/SqlserverQuery.php @@ -0,0 +1,153 @@ + "An error occurred while connecting to the database ". + "'{$db}'. The error reported by the server was: ".$e->getMessage() + ) ); + exit(0); + } + + return $pdo; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Protected methods + */ + + protected function _prepare( $sql ) + { + $this->database()->debugInfo( $sql, $this->_bindings ); + + $resource = $this->database()->resource(); + $this->_stmt = $resource->prepare( $sql ); + + // bind values + for ( $i=0 ; $i_bindings) ; $i++ ) { + $binding = $this->_bindings[$i]; + + $this->_stmt->bindValue( + $binding['name'], + $binding['value'], + $binding['type'] ? $binding['type'] : \PDO::PARAM_STR + ); + } + } + + + protected function _exec() + { + try { + $this->_stmt->execute(); + } + catch (PDOException $e) { + throw new \Exception( "An SQL error occurred: ".$e->getMessage() ); + error_log( "An SQL error occurred: ".$e->getMessage() ); + return false; + } + + $resource = $this->database()->resource(); + return new SqlserverResult( $resource, $this->_stmt ); + } + + + // SQL Server 2012+ only + protected function _build_limit() + { + $out = ''; + + if ( $this->_offset ) { + $out .= ' OFFSET '.$this->_offset.' ROWS'; + } + + if ( $this->_limit ) { + if ( ! $this->_offset ) { + $out .= ' OFFSET 0 ROWS'; + } + $out .= ' FETCH NEXT '.$this->_limit. ' ROWS ONLY'; + } + + return $out; + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/SqlserverResult.php b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/SqlserverResult.php new file mode 100644 index 00000000..14773c56 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Database/Driver/SqlserverResult.php @@ -0,0 +1,71 @@ +_dbh = $dbh; + $this->_stmt = $stmt; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + private $_stmt; + private $_dbh; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + public function count () + { + return count($this->fetchAll()); + } + + + public function fetch ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetch( $fetchType ); + } + + + public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetchAll( $fetchType ); + } + + + public function insertId () + { + return $this->_dbh->lastInsertId(); + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/Database/Query.php b/ci4/app/ThirdParty/DatatablesEditor/Database/Query.php new file mode 100644 index 00000000..cd9a60e2 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Database/Query.php @@ -0,0 +1,1295 @@ +query()} method (and it's 'select', etc short-cuts). + * Typically it would not be initialised directly. + * + * Note that this is a stub class that a driver will extend and complete as + * required for individual database types. Individual drivers could add + * additional methods, but this is discouraged to ensure that the API is the + * same for all database types. + */ +abstract class Query { + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Constructor + */ + + /** + * Query instance constructor. + * + * Note that typically instances of this class will be automatically created + * through the {@see \DataTables\Database->query()} method. + * @param Database $db Database instance + * @param string $type Query type - 'select', 'insert', 'update' or 'delete' + * @param string|string[] $table Tables to operate on - see {@see Query->table()}. + */ + public function __construct( $dbHost, $type, $table=null ) + { + $this->_dbHost = $dbHost; + $this->_type = $type; + $this->table( $table ); + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + /** + * @var Database Database connection instance + * @internal + */ + protected $_dbHost; + + /** + * @var string Driver to use + * @internal + */ + protected $_type = ""; + + /** + * @var array + * @internal + */ + protected $_table = array(); + + /** + * @var array + * @internal + */ + protected $_field = array(); + + /** + * @var array + * @internal + */ + protected $_bindings = array(); + + /** + * @var array + * @internal + */ + protected $_where = array(); + + /** + * @var array + * @internal + */ + protected $_join = array(); + + /** + * @var array + * @internal + */ + protected $_order = array(); + + /** + * @var array + * @internal + */ + protected $_noBind = array(); + + /** + * @var int + * @internal + */ + protected $_limit = null; + + /** + * @var int + * @internal + */ + protected $_group_by = null; + + /** + * @var int + * @internal + */ + protected $_offset = null; + + /** + * @var string + * @internal + */ + protected $_distinct = false; + + /** + * @var string + * @internal + */ + protected $_identifier_limiter = array( '`', '`' ); + + /** + * @var string + * @internal + */ + protected $_field_quote = '\''; + + /** + * @var array + * @internal + */ + protected $_pkey = null; + + protected $_supportsAsAlias = true; + + protected $_whereInCnt = 1; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Static methods + */ + + /** + * Commit a transaction. + * @param \PDO $dbh The Database handle (typically a PDO object, but not always). + */ + public static function commit ( $dbh ) + { + $dbh->commit(); + } + + /** + * Database connection - override by the database driver. + * @param string|array $user User name or all parameters in an array + * @param string $pass Password + * @param string $host Host name + * @param string $db Database name + * @return Query + */ + public static function connect ( $user, $pass='', $host='', $port='', $db='', $dsn='' ) { + // noop - PHP <7 can't have an abstract static without causing + // an error in strict mode. This should technically be an + // abstract method however. + } + + + /** + * Start a database transaction + * @param \PDO $dbh The Database handle (typically a PDO object, but not always). + */ + public static function transaction ( $dbh ) + { + $dbh->beginTransaction(); + } + + + /** + * Rollback the database state to the start of the transaction. + * @param \PDO $dbh The Database handle (typically a PDO object, but not always). + */ + public static function rollback ( $dbh ) + { + $dbh->rollBack(); + } + + + /** + * Common helper for the drivers to handle a PDO DSN postfix + * @param string $dsn DSN postfix to use + * @return Query + * @internal + */ + static function dsnPostfix ( $dsn ) + { + if ( ! $dsn ) { + return ''; + } + + // Add a DSN field separator if not given + if ( strpos( $dsn, ';' ) !== 0 ) { + return ';'.$dsn; + } + + return $dsn; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + /** + * Safely bind an input value to a parameter. This is evaluated when the + * query is executed. This allows user input to be safely executed without + * risk of an SQL injection attack. + * + * @param string $name Parameter name. This should include a leading colon + * @param string $value Value to bind + * @param mixed $type Data type. See the PHP PDO documentation: + * http://php.net/manual/en/pdo.constants.php + * @return Query + */ + public function bind ( $name, $value, $type=null ) + { + $this->_bindings[] = array( + "name" => $this->_safe_bind( $name ), + "value" => $value, + "type" => $type + ); + + return $this; + } + + + /** + * Get the Database host for this query instance + * @return DataTable Database class instance + */ + public function database () + { + return $this->_dbHost; + } + + + /** + * Set a distinct flag for a `select` query. Note that this has no effect on + * any of the other query types. + * @param boolean $dis Optional + * @return Query + */ + public function distinct ( $dis ) + { + $this->_distinct = $dis; + return $this; + } + + + /** + * Execute the query. + * @param string $sql SQL string to execute (only if _type is 'raw'). + * @return Result + */ + public function exec ( $sql=null ) + { + $type = strtolower( $this->_type ); + + if ( $type === 'select' ) { + return $this->_select(); + } + else if ( $type === 'insert' ) { + return $this->_insert(); + } + else if ( $type === 'update' ) { + return $this->_update(); + } + else if ( $type === 'delete' ) { + return $this->_delete(); + } + else if ( $type === 'count' ) { + return $this->_count(); + } + else if ( $type === 'raw' ) { + return $this->_raw( $sql ); + } + + throw new \Exception("Unknown database command or not supported: ".$type, 1); + } + + + /** + * Get fields. + * @param string|string[] $get,... Fields to get - can be specified as + * individual fields or an array of fields. + * @return self + */ + public function get ( $get ) + { + $args = func_get_args(); + + if ( $get === null ) { + return $this; + } + + for ( $i=0 ; $iget( $args[$i][$j] ); + } + } + else if ( strpos($args[$i], ',') !== false && strpos($args[$i], '(') === false) { + // Comma delimited set of fields - legacy. Recommended that fields be split into + // an array on input + $a = explode(',', $args[$i]); + + for ( $j=0 ; $jget( $a[$j] ); + } + } + else { + $this->_field[] = trim( $args[$i] ); + } + } + + return $this; + } + + + /** + * Perform a JOIN operation + * @param string $table Table name to do the JOIN on + * @param string $condition JOIN condition + * @param string $type JOIN type + * @return self + */ + public function join ( $table, $condition, $type='', $bind=true ) + { + // Tidy and check we know what the join type is + if ($type !== '') { + $type = strtoupper(trim($type)); + + if ( ! in_array($type, array('LEFT', 'RIGHT', 'INNER', 'OUTER', 'LEFT OUTER', 'RIGHT OUTER'))) { + $type = ''; + } + } + + // Protect the identifiers + if ($bind && preg_match('/([\w\.]+)([\W\s]+)(.+)/', $condition, $match)) + { + $match[1] = $this->_protect_identifiers( $match[1] ); + $match[3] = $this->_protect_identifiers( $match[3] ); + + $condition = $match[1].$match[2].$match[3]; + } + + $this->_join[] = $type .' JOIN '. $this->_protect_identifiers($table) .' ON '. $condition .' '; + + return $this; + } + + /** + * Add a left join, with common logic for handling binding or not + */ + public function left_join( $joins ) + { + // Allow a single associative array + if ($this->_is_assoc($joins)) { + $joins = array( + $joins + ); + } + + for ( $i=0, $ien=count($joins) ; $i<$ien ; $i++ ) { + $join = $joins[$i]; + + if ($join['field2'] === null && $join['operator'] === null) { + $this->join( + $join['table'], + $join['field1'], + 'LEFT', + false + ); + } + else { + $this->join( + $join['table'], + $join['field1'].' '.$join['operator'].' '.$join['field2'], + 'LEFT' + ); + } + } + + return $this; + } + + + /** + * Limit the result set to a certain size. + * @param int $lim The number of records to limit the result to. + * @return self + */ + public function limit ( $lim ) + { + $this->_limit = $lim; + + return $this; + } + + /** + * Group the results by the values in a field + * @param string The field of which the values are to be grouped + * @return self + */ + public function group_by ( $group_by ) + { + $this->_group_by = $group_by; + + return $this; + } + + + /** + * Get / set the primary key column name(s) so they can be easily returned + * after an insert. + * @param string[] $pkey Primary keys + * @return Query|string[] + */ + public function pkey ( $pkey=null ) + { + if ( $pkey === null ) { + return $this->_pkey; + } + + $this->_pkey = $pkey; + + return $this; + } + + + /** + * Set table(s) to perform the query on. + * @param string|string[] $table,... Table(s) to use - can be specified as + * individual names, an array of names, a string of comma separated + * names or any combination of those. + * @return self + */ + public function table ( $table ) + { + if ( $table === null ) { + return $this; + } + + if ( is_array($table) ) { + // Array so loop internally + for ( $i=0 ; $itable( $table[$i] ); + } + } + else { + // String based, explode for multiple tables + $tables = explode(",", $table); + + for ( $i=0 ; $i_table[] = $this->_protect_identifiers( trim($tables[$i]) ); + } + } + + return $this; + } + + + /** + * Offset the return set by a given number of records (useful for paging). + * @param int $off The number of records to offset the result by. + * @return self + */ + public function offset ( $off ) + { + $this->_offset = $off; + + return $this; + } + + + /** + * Order by + * @param string|string[] $order Columns and direction to order by - can + * be specified as individual names, an array of names, a string of comma + * separated names or any combination of those. + * @return self + */ + public function order ( $order ) + { + if ( $order === null ) { + return $this; + } + + if ( !is_array($order) ) { + $order = preg_split('/\,(?![^\(]*\))/',$order); + } + + for ( $i=0 ; $i_order[] = $this->_protect_identifiers( $identifier ).' '.$direction; + } + + return $this; + } + + + /** + * Set fields to a given value. + * + * Can be used in two different ways, as set( field, value ) or as an array of + * fields to set: set( array( 'fieldName' => 'value', ...) ); + * @param string|string[] $set Can be given as a single string, when then $val + * must be set, or as an array of key/value pairs to be set. + * @param string $val When $set is given as a simple string, $set is the field + * name and this is the field's value. + * @param boolean $bind Should the value be bound or not + * @return self + */ + public function set ( $set, $val=null, $bind=true ) + { + if ( $set === null ) { + return $this; + } + + if ( !is_array($set) ) { + $set = array( $set => $val ); + } + + foreach ($set as $key => $value) { + $this->_field[] = $key; + + if ( $bind ) { + $this->bind( ':'.$key, $value ); + } + else { + $this->_noBind[$key] = $value; + } + } + + return $this; + } + + + /** + * Where query - multiple conditions are bound as ANDs. + * + * Can be used in two different ways, as where( field, value ) or as an array of + * conditions to use: where( array('fieldName', ...), array('value', ...) ); + * @param string|string[]|callable $key Single field name, or an array of field names. + * If given as a function (i.e. a closure), the function is called, passing the + * query itself in as the only parameter, so the function can add extra conditions + * with parentheses around the additional parameters. + * @param string|string[] $value Single field value, or an array of + * values. Can be null to search for `IS NULL` or `IS NOT NULL` (depending + * on the value of `$op` which should be `=` or `!=`. + * @param string $op Condition operator: <, >, = etc + * @param boolean $bind Escape the value (true, default) or not (false). + * @return self + * + * @example + * The following will produce + * `'WHERE name='allan' AND ( location='Scotland' OR location='Canada' )`: + * + * ```php + * $query + * ->where( 'name', 'allan' ) + * ->where( function ($q) { + * $q->where( 'location', 'Scotland' ); + * $q->or_where( 'location', 'Canada' ); + * } ); + * ``` + */ + public function where ( $key, $value=null, $op="=", $bind=true ) + { + if ( $key === null ) { + return $this; + } + else if ( is_callable($key) && is_object($key) ) { // is a closure + $this->_where_group( true, 'AND' ); + $key( $this ); + $this->_where_group( false, 'OR' ); + } + else if ( !is_array($key) && is_array($value) ) { + for ( $i=0 ; $iwhere( $key, $value[$i], $op, $bind ); + } + } + else { + $this->_where( $key, $value, 'AND ', $op, $bind ); + } + + return $this; + } + + + /** + * Add addition where conditions to the query with an AND operator. An alias + * of `where` for naming consistency. + * + * Can be used in two different ways, as where( field, value ) or as an array of + * conditions to use: where( array('fieldName', ...), array('value', ...) ); + * @param string|string[]|callable $key Single field name, or an array of field names. + * If given as a function (i.e. a closure), the function is called, passing the + * query itself in as the only parameter, so the function can add extra conditions + * with parentheses around the additional parameters. + * @param string|string[] $value Single field value, or an array of + * values. Can be null to search for `IS NULL` or `IS NOT NULL` (depending + * on the value of `$op` which should be `=` or `!=`. + * @param string $op Condition operator: <, >, = etc + * @param boolean $bind Escape the value (true, default) or not (false). + * @return self + */ + public function and_where ( $key, $value=null, $op="=", $bind=true ) + { + return $this->where( $key, $value, $op, $bind ); + } + + + /** + * Add addition where conditions to the query with an OR operator. + * + * Can be used in two different ways, as where( field, value ) or as an array of + * conditions to use: where( array('fieldName', ...), array('value', ...) ); + * @param string|string[]|callable $key Single field name, or an array of field names. + * If given as a function (i.e. a closure), the function is called, passing the + * query itself in as the only parameter, so the function can add extra conditions + * with parentheses around the additional parameters. + * @param string|string[] $value Single field value, or an array of + * values. Can be null to search for `IS NULL` or `IS NOT NULL` (depending + * on the value of `$op` which should be `=` or `!=`. + * @param string $op Condition operator: <, >, = etc + * @param boolean $bind Escape the value (true, default) or not (false). + * @return self + */ + public function or_where ( $key, $value=null, $op="=", $bind=true ) + { + if ( $key === null ) { + return $this; + } + else if ( is_callable($key) && is_object($key) ) { + $this->_where_group( true, 'OR' ); + $key( $this ); + $this->_where_group( false, 'OR' ); + } + else { + if ( !is_array($key) && is_array($value) ) { + for ( $i=0 ; $ior_where( $key, $value[$i], $op, $bind ); + } + return $this; + } + + $this->_where( $key, $value, 'OR ', $op, $bind ); + } + + return $this; + } + + + /** + * Provide grouping for WHERE conditions. Use it with a callback function to + * automatically group any conditions applied inside the method. + * + * For legacy reasons this method also provides the ability to explicitly + * define if a grouping bracket should be opened or closed in the query. + * This method is not prefer. + * + * @param boolean|callable $inOut If callable it will create the group + * automatically and pass the query into the called function. For + * legacy operations use `true` to open brackets, `false` to close. + * @param string $op Conditional operator to use to join to the + * preceding condition. Default `AND`. + * @return self + * + * @example + * ```php + * $query->where_group( function ($q) { + * $q->where( 'location', 'Edinburgh' ); + * $q->where( 'position', 'Manager' ); + * } ); + * ``` + */ + public function where_group ( $inOut, $op='AND' ) + { + if ( is_callable($inOut) && is_object($inOut) ) { + $this->_where_group( true, $op ); + $inOut( $this ); + $this->_where_group( false, $op ); + } + else { + $this->_where_group( $inOut, $op ); + } + + return $this; + } + + + /** + * Provide a method that can be used to perform a `WHERE ... IN (...)` query + * with bound values and parameters. + * + * Note this is only suitable for local values, not a sub-query. For that use + * `->where()` with an unbound value. + * + * @param string Field name + * @param array Values + * @param string Conditional operator to use to join to the + * preceding condition. Default `AND`. + * @return self + */ + public function where_in ( $field, $arr, $operator="AND" ) + { + if ( count($arr) === 0 ) { + return $this; + } + + $binders = array(); + $prefix = ':wherein'; + + // Need to build an array of the binders (having bound the values) so + // the query can be constructed + for ( $i=0, $ien=count($arr) ; $i<$ien ; $i++ ) { + $binder = $prefix.$this->_whereInCnt; + + $this->bind( $binder, $arr[$i] ); + + $binders[] = $binder; + $this->_whereInCnt++; + } + + $this->_where[] = array( + 'operator' => $operator, + 'group' => null, + 'field' => $this->_protect_identifiers($field), + 'query' => $this->_protect_identifiers($field) .' IN ('.implode(', ', $binders).')' + ); + + return $this; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Protected methods + */ + + /** + * Create a comma separated field list + * @param bool $addAlias Flag to add an alias + * @return string + * @internal + */ + protected function _build_field( $addAlias=false ) + { + $a = array(); + $asAlias = $this->_supportsAsAlias ? + ' as ' : + ' '; + + for ( $i=0 ; $i_field) ; $i++ ) { + $field = $this->_field[$i]; + + // Keep the name when referring to a table + if ( $addAlias && $field !== '*' && strpos($field, '(') === false ) { + $split = preg_split( '/ as (?![^\(]*\))/i', $field ); + + if ( count($split) > 1 ) { + $a[] = $this->_protect_identifiers( $split[0] ).$asAlias. + $this->_field_quote. $split[1] .$this->_field_quote; + } + else { + $a[] = $this->_protect_identifiers( $field ).$asAlias. + $this->_field_quote. $this->_escape_field($field) .$this->_field_quote; + } + } + else if ( $addAlias && strpos($field, '(') !== false && ! strpos($field, ' as ') ) { + $a[] = $this->_protect_identifiers( $field ).$asAlias. + $this->_field_quote. $this->_escape_field($field) .$this->_field_quote; + } + else { + $a[] = $this->_protect_identifiers( $field ); + } + } + + return ' '.implode(', ', $a).' '; + } + + /** + * Create a JOIN statement list + * @return string + * @internal + */ + protected function _build_join() + { + return implode(' ', $this->_join); + } + + /** + * Create the LIMIT / OFFSET string + * + * MySQL and Postgres style - anything else can have the driver override + * @return string + * @internal + */ + protected function _build_limit() + { + $out = ''; + $limit = intval($this->_limit); + $offset = intval($this->_offset); + + if ( $limit ) { + $out .= ' LIMIT '.$limit; + } + + if ( $offset ) { + $out .= ' OFFSET '.$offset; + } + + return $out; + } + + /** + * Create the GROUP BY string + * + * @return string + * @internal + */ + protected function _build_group_by() + { + $out = ''; + + if ( $this->_group_by) { + $out .= ' GROUP BY '.$this->_protect_identifiers( $this->_group_by ); + } + + return $out; + } + + /** + * Create the ORDER BY string + * @return string + * @internal + */ + protected function _build_order() + { + if ( count( $this->_order ) > 0 ) { + return ' ORDER BY '.implode(', ', $this->_order).' '; + } + return ''; + } + + /** + * Create a set list + * @return string + * @internal + */ + protected function _build_set() + { + $a = array(); + + for ( $i=0 ; $i_field) ; $i++ ) { + $field = $this->_field[$i]; + + if ( isset( $this->_noBind[ $field ] ) ) { + $a[] = $this->_protect_identifiers( $field ) .' = '. $this->_noBind[ $field ]; + } + else { + $a[] = $this->_protect_identifiers( $field ) .' = :'. $this->_safe_bind( $field ); + } + } + + return ' '.implode(', ', $a).' '; + } + + /** + * Create the TABLE list + * @return string + * @internal + */ + protected function _build_table() + { + if ( $this->_type === 'insert' ) { + // insert, update and delete statements don't need or want aliases in the table name + $a = array(); + + for ( $i=0, $ien=count($this->_table) ; $i<$ien ; $i++ ) { + $table = str_ireplace( ' as ', ' ', $this->_table[$i] ); + $tableParts = explode( ' ', $table ); + + $a[] = $tableParts[0]; + } + + return ' '.implode(', ', $a).' '; + } + + return ' '.implode(', ', $this->_table).' '; + } + + /** + * Create a bind field value list + * @return string + * @internal + */ + protected function _build_value() + { + $a = array(); + + for ( $i=0, $ien=count($this->_field) ; $i<$ien ; $i++ ) { + $a[] = ' :'.$this->_safe_bind( $this->_field[$i] ); + } + + return ' '.implode(', ', $a).' '; + } + + /** + * Create the WHERE statement + * @return string + * @internal + */ + protected function _build_where() + { + if ( count($this->_where) === 0 ) { + return ""; + } + + $condition = "WHERE "; + + for ( $i=0 ; $i_where) ; $i++ ) { + if ( $i === 0 ) { + // Nothing (simplifies the logic!) + } + else if ( $this->_where[$i]['group'] === ')' ) { + // If a group has been used but no conditions were added inside + // of, we don't want to end up with `()` in the SQL as that is + // invalid, so add a 1. + if ( $this->_where[$i-1]['group'] === '(' ) { + $condition .= '1=1'; + } + // else nothing + } + else if ( $this->_where[$i-1]['group'] === '(' ) { + // Nothing + } + else { + $condition .= $this->_where[$i]['operator'].' '; + } + + if ( $this->_where[$i]['group'] !== null ) { + $condition .= $this->_where[$i]['group']; + } + else { + $condition .= $this->_where[$i]['query'] .' '; + } + } + + return $condition; + } + + /** + * Create a DELETE statement + * @return Result + * @internal + */ + protected function _delete() + { + $this->_prepare( + 'DELETE FROM ' + .$this->_build_table() + .$this->_build_where() + ); + + return $this->_exec(); + } + + /** + * Escape quotes in a field identifier + * @internal + */ + protected function _escape_field( $field ) + { + $quote = $this->_field_quote; + + return str_replace($quote, "\\".$quote, $field); + } + + /** + * Execute the query. Provided by the driver + * @return Result + * @internal + */ + abstract protected function _exec(); + + /** + * Create an INSERT statement + * @return Result + * @internal + */ + protected function _insert() + { + $this->_prepare( + 'INSERT INTO ' + .$this->_build_table().' (' + .$this->_build_field() + .') ' + .'VALUES (' + .$this->_build_value() + .')' + ); + + return $this->_exec(); + } + + /** + * Prepare the SQL query by populating the bound variables. + * Provided by the driver + * @return void + * @internal + */ + abstract protected function _prepare( $sql ); + + /** + * Protect field names + * @param string $identifier String to be protected + * @return string + * @internal + */ + protected function _protect_identifiers( $identifier ) + { + $idl = $this->_identifier_limiter; + + // No escaping character + if ( ! $idl ) { + return $identifier; + } + + $left = $idl[0]; + $right = $idl[1]; + + // Dealing with a function or other expression? Just return immediately + if (strpos($identifier, '(') !== FALSE || strpos($identifier, '*') !== FALSE) + { + return $identifier; + } + + // Going to be operating on the spaces in strings, to simplify the white-space + $identifier = preg_replace('/[\t ]+/', ' ', $identifier); + $identifier = str_replace(' as ', ' ', $identifier); + + // If more that a single space, then return + if (substr_count($identifier, ' ') > 1) { + return $identifier; + } + + // Find if our identifier has an alias, so we don't escape that + if ( strpos($identifier, ' ') !== false ) { + $alias = strstr($identifier, ' '); + $identifier = substr($identifier, 0, - strlen($alias)); + } + else { + $alias = ''; + } + + $a = explode('.', $identifier); + return $left . implode($right.'.'.$left, $a) . $right . $alias; + } + + /** + * Passed in SQL statement + * @return Result + * @internal + */ + protected function _raw( $sql ) + { + $this->_prepare( $sql ); + + return $this->_exec(); + } + + /** + * The characters that can be used for the PDO bindValue name are quite + * limited (`[a-zA-Z0-9_]+`). We need to abstract this out to allow slightly + * more complex expressions including dots for easy aliasing + * @param string $name Field name + * @return string + * @internal + */ + protected function _safe_bind ( $name ) + { + $name = str_replace('.', '_1_', $name); + $name = str_replace('-', '_2_', $name); + $name = str_replace('/', '_3_', $name); + $name = str_replace('\\', '_4_', $name); + $name = str_replace(' ', '_5_', $name); + + return $name; + } + + /** + * Create a SELECT statement + * @return Result + * @internal + */ + protected function _select() + { + $this->_prepare( + 'SELECT '.($this->_distinct ? 'DISTINCT ' : '') + .$this->_build_field( true ) + .'FROM '.$this->_build_table() + .$this->_build_join() + .$this->_build_where() + .$this->_build_group_by() + .$this->_build_order() + .$this->_build_limit() + ); + + return $this->_exec(); + } + + /** + * Create a SELECT COUNT statement + * @return Result + * @internal + */ + protected function _count() + { + $select = $this->_supportsAsAlias ? + 'SELECT COUNT('.$this->_build_field().') as '.$this->_protect_identifiers('cnt') : + 'SELECT COUNT('.$this->_build_field().') '.$this->_protect_identifiers('cnt'); + + $this->_prepare( + $select + .' FROM '.$this->_build_table() + .$this->_build_join() + .$this->_build_where() + .$this->_build_limit() + ); + + return $this->_exec(); + } + + /** + * Create an UPDATE statement + * @return Result + * @internal + */ + protected function _update() + { + $this->_prepare( + 'UPDATE ' + .$this->_build_table() + .'SET '.$this->_build_set() + .$this->_build_where() + ); + + return $this->_exec(); + } + + /** + * Add an individual where condition to the query. + * @internal + * @param $where + * @param null $value + * @param string $type + * @param string $op + * @param bool $bind + */ + protected function _where ( $where, $value=null, $type='AND ', $op="=", $bind=true ) + { + if ( $where === null ) { + return; + } + else if ( !is_array($where) ) { + $where = array( $where => $value ); + } + + foreach ($where as $key => $value) { + $i = count( $this->_where ); + + if ( $value === null ) { + // Null query + $this->_where[] = array( + 'operator' => $type, + 'group' => null, + 'field' => $this->_protect_identifiers($key), + 'query' => $this->_protect_identifiers($key) .( $op === '=' ? + ' IS NULL' : + ' IS NOT NULL') + ); + } + else if ( $bind ) { + // Binding condition (i.e. escape data) + if ( $this->_dbHost->type() === 'Postgres' && $op === 'like' ) { + // Postgres specific a it needs a case for string searching non-text data + $this->_where[] = array( + 'operator' => $type, + 'group' => null, + 'field' => $this->_protect_identifiers($key), + 'query' => $this->_protect_identifiers($key).'::text ilike '.$this->_safe_bind(':where_'.$i) + ); + } + else { + $this->_where[] = array( + 'operator' => $type, + 'group' => null, + 'field' => $this->_protect_identifiers($key), + 'query' => $this->_protect_identifiers($key) .' '.$op.' '.$this->_safe_bind(':where_'.$i) + ); + } + $this->bind( ':where_'.$i, $value ); + } + else { + // Non-binding condition + $this->_where[] = array( + 'operator' => $type, + 'group' => null, + 'field' => null, + 'query' => $this->_protect_identifiers($key) .' '. $op .' '. $this->_protect_identifiers($value) + ); + } + } + } + + /** + * Add parentheses to a where condition + * @return string + * @internal + */ + protected function _where_group ( $inOut, $op ) + { + $this->_where[] = array( + "group" => $inOut ? '(' : ')', + "operator" => $op + ); + } + + /** + * Check if an array is associative or sequential + */ + private function _is_assoc(array $arr) + { + if (array() === $arr) { + return false; + } + + return array_keys($arr) !== range(0, count($arr) - 1); + } +}; + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/Database/Result.php b/ci4/app/ThirdParty/DatatablesEditor/Database/Result.php new file mode 100644 index 00000000..e186b245 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Database/Result.php @@ -0,0 +1,68 @@ +process()} method determines what action DataTables / + * Editor is requesting from the server-side and will correctly action it. + * + * ```php + * Editor::inst( $db, 'browsers' ) + * ->fields( + * Field::inst( 'first_name' )->validator( Validate::required() ), + * Field::inst( 'last_name' )->validator( Validate::required() ), + * Field::inst( 'country' ), + * Field::inst( 'details' ) + * ) + * ->process( $_POST ) + * ->json(); + * ``` + */ +class Editor extends Ext { + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Statics + */ + + /** Request type - read */ + const ACTION_READ = 'read'; + + /** Request type - create */ + const ACTION_CREATE = 'create'; + + /** Request type - edit */ + const ACTION_EDIT = 'edit'; + + /** Request type - delete */ + const ACTION_DELETE = 'remove'; + + /** Request type - upload */ + const ACTION_UPLOAD = 'upload'; + + + /** + * Determine the request type from an HTTP request. + * + * @param array $http Typically $_POST, but can be any array used to carry + * an Editor payload + * @param string $name The parameter name that the action should be read from. + * @return string `Editor::ACTION_READ`, `Editor::ACTION_CREATE`, + * `Editor::ACTION_EDIT` or `Editor::ACTION_DELETE` indicating the request + * type. + */ + static public function action ( $http, $name='action' ) + { + if ( ! isset( $http[$name] ) ) { + return self::ACTION_READ; + } + + switch ( $http[$name] ) { + case 'create': + return self::ACTION_CREATE; + + case 'edit': + return self::ACTION_EDIT; + + case 'remove': + return self::ACTION_DELETE; + + case 'upload': + return self::ACTION_UPLOAD; + + default: + throw new \Exception("Unknown Editor action: ".$http['action']); + } + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Constructor + */ + + /** + * Constructor. + * @param Database $db An instance of the DataTables Database class that we can + * use for the DB connection. Can be given here or with the 'db' method. + * @param string|array $table The table name in the database to read and write + * information from and to. Can be given here or with the 'table' method. + * @param string|array $pkey Primary key column name in the table given in + * the $table parameter. Can be given here or with the 'pkey' method. + */ + function __construct( $db=null, $table=null, $pkey=null ) + { + // Set constructor parameters using the API - note that the get/set will + // ignore null values if they are used (i.e. not passed in) + $this->db( $db ); + $this->table( $table ); + $this->pkey( $pkey ); + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public properties + */ + + /** @var string */ + public $version = '2.1.3'; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + /** @var DataTables\Database */ + private $_db = null; + + /** @var DataTables\Editor\Field[] */ + private $_fields = array(); + + /** @var array */ + private $_formData; + + /** @var array */ + private $_processData; + + /** @var string */ + private $_idPrefix = 'row_'; + + /** @var DataTables\Editor\Join[] */ + private $_join = array(); + + /** @var array */ + private $_pkey = array('id'); + + /** @var string[] */ + private $_table = array(); + + /** @var string[] */ + private $_readTableNames = array(); + + /** @var boolean */ + private $_transaction = true; + + /** @var array */ + private $_where = array(); + + /** @var boolean */ + private $_write = true; + + /** @var array */ + private $_leftJoin = array(); + + /** @var boolean - deprecated */ + private $_whereSet = false; + + /** @var array */ + private $_out = array(); + + /** @var array */ + private $_events = array(); + + /** @var boolean */ + private $_debug = false; + + /** @var array */ + private $_debugInfo = array(); + + /** @var string Log output path */ + private $_debugLog = ''; + + /** @var callback */ + private $_validator = array(); + + /** @var boolean Enable true / catch when processing */ + private $_tryCatch = true; + + /** @var boolean Enable / disable delete on left joined tables */ + private $_leftJoinRemove = false; + + /** @var string Action name allowing for configuration */ + private $_actionName = 'action'; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + /** + * Get / set the action name to read in HTTP parameters. This can be useful + * to set if you are using a framework that uses the default name of `action` + * for something else (e.g. WordPress). + * @param string Value to set. If not given, then used as a getter. + * @return string|self Value, or self if used as a setter. + */ + public function actionName ( $_=null ) + { + return $this->_getSet( $this->_actionName, $_ ); + } + + + /** + * Get the data constructed in this instance. + * + * This will get the PHP array of data that has been constructed for the + * command that has been processed by this instance. Therefore only useful after + * process has been called. + * @return array Processed data array. + */ + public function data () + { + return $this->_out; + } + + + /** + * Get / set the DB connection instance + * @param Database $_ DataTable's Database class instance to use for database + * connectivity. If not given, then used as a getter. + * @return Database|self The Database connection instance if no parameter + * is given, or self if used as a setter. + */ + public function db ( $_=null ) + { + return $this->_getSet( $this->_db, $_ ); + } + + + /** + * Get / set debug mode and set a debug message. + * + * It can be useful to see the SQL statements that Editor is using. This + * method enables that ability. Information about the queries used is + * automatically added to the output data array / JSON under the property + * name `debugSql`. + * + * This method can also be called with a string parameter, which will be + * added to the debug information sent back to the client-side. This can + * be useful when debugging event listeners, etc. + * + * @param boolean|mixed $_ Debug mode state. If not given, then used as a + * getter. If given as anything other than a boolean, it will be added + * to the debug information sent back to the client. + * @param string [$path=null] Set an output path to log debug information + * @return boolean|self Debug mode state if no parameter is given, or + * self if used as a setter or when adding a debug message. + */ + public function debug ( $_=null, $path=null ) + { + if ( ! is_bool( $_ ) ) { + $this->_debugInfo[] = $_; + + return $this; + } + + if ( $path ) { + $this->_debugLog = $path; + } + + return $this->_getSet( $this->_debug, $_ ); + } + + + /** + * Get / set field instance. + * + * The list of fields designates which columns in the table that Editor will work + * with (both get and set). + * @param Field|string $_... This parameter effects the return value of the + * function: + * + * * `null` - Get an array of all fields assigned to the instance + * * `string` - Get a specific field instance whose 'name' matches the + * field passed in + * * {@see Field} - Add a field to the instance's list of fields. This + * can be as many fields as required (i.e. multiple arguments) + * * `array` - An array of {@see Field} instances to add to the list + * of fields. + * @return Field|Field[]|Editor The selected field, an array of fields, or + * the Editor instance for chaining, depending on the input parameter. + * @throws \Exception Unkown field error + * @see {@see Field} for field documentation. + */ + public function field ( $_=null ) + { + $args = func_get_args(); + + if ( is_string( $_ ) ) { + for ( $i=0, $ien=count($this->_fields) ; $i<$ien ; $i++ ) { + if ( $this->_fields[$i]->name() === $_ ) { + return $this->_fields[$i]; + } + } + + throw new \Exception('Unknown field: '.$_); + } + + if ( $_ !== null && !is_array($_) ) { + $_ = $args; + } + return $this->_getSet( $this->_fields, $_, true ); + } + + + /** + * Get / set field instances. + * + * An alias of {@see field}, for convenience. + * @param Field $_... Instances of the {@see Field} class, given as a single + * instance of {@see Field}, an array of {@see Field} instances, or multiple + * {@see Field} instance parameters for the function. + * @return Field[]|self Array of fields, or self if used as a setter. + * @see {@see Field} for field documentation. + */ + public function fields ( $_=null ) + { + $args = func_get_args(); + + if ( $_ !== null && !is_array($_) ) { + $_ = $args; + } + return $this->_getSet( $this->_fields, $_, true ); + } + + + /** + * Get / set the DOM prefix. + * + * Typically primary keys are numeric and this is not a valid ID value in an + * HTML document - is also increases the likelihood of an ID clash if multiple + * tables are used on a single page. As such, a prefix is assigned to the + * primary key value for each row, and this is used as the DOM ID, so Editor + * can track individual rows. + * @param string $_ Primary key's name. If not given, then used as a getter. + * @return string|self Primary key value if no parameter is given, or + * self if used as a setter. + */ + public function idPrefix ( $_=null ) + { + return $this->_getSet( $this->_idPrefix, $_ ); + } + + + /** + * Get the data that is being processed by the Editor instance. This is only + * useful once the `process()` method has been called, and is available for + * use in validation and formatter methods. + * + * @return array Data given to `process()`. + */ + public function inData () + { + return $this->_processData; + } + + /** + * Get / set join instances. Note that for the majority of use cases you + * will want to use the `leftJoin()` method. It is significantly easier + * to use if you are just doing a simple left join! + * + * The list of Join instances that Editor will join the parent table to + * (i.e. the one that the {@see Editor->table()} and {@see Editor->fields} + * methods refer to in this class instance). + * + * @param Join $_,... Instances of the {@see Join} class, given as a + * single instance of {@see Join}, an array of {@see Join} instances, + * or multiple {@see Join} instance parameters for the function. + * @return Join[]|self Array of joins, or self if used as a setter. + */ + public function join ( $_=null ) + { + $args = func_get_args(); + + if ( $_ !== null && !is_array($_) ) { + $_ = $args; + } + return $this->_getSet( $this->_join, $_, true ); + } + + + /** + * Get the JSON for the data constructed in this instance. + * + * Basically the same as the {@see Editor->data()} method, but in this case we echo, or + * return the JSON string of the data. + * @param boolean $print Echo the JSON string out (true, default) or return it + * (false). + * @param int JSON encode option https://www.php.net/manual/en/json.constants.php + * @return string|self self if printing the JSON, or JSON representation of + * the processed data if false is given as the first parameter. + */ + public function json ( $print=true, $options=0 ) + { + if ( $print ) { + $json = json_encode( $this->_out, $options ); + + if ( $json !== false ) { + echo $json; + } + else { + echo json_encode( array( + "error" => "JSON encoding error: ".json_last_error_msg() + ) ); + } + + return $this; + } + return json_encode( $this->_out ); + } + + + /** + * Echo out JSONP for the data constructed and processed in this instance. + * This is basically the same as {@see Editor->json()} but wraps the return in a + * JSONP callback. + * + * @param string $callback The callback function name to use. If not given + * or `null`, then `$_GET['callback']` is used (the jQuery default). + * @return self Self for chaining. + * @throws \Exception JSONP function name validation + */ + public function jsonp ( $callback=null ) + { + if ( ! $callback ) { + $callback = $_GET['callback']; + } + + if ( preg_match('/[^a-zA-Z0-9_]/', $callback) ) { + throw new \Exception("Invalid JSONP callback function name"); + } + + echo $callback.'('.json_encode( $this->_out ).');'; + return $this; + } + + + /** + * Add a left join condition to the Editor instance, allowing it to operate + * over multiple tables. Multiple `leftJoin()` calls can be made for a + * single Editor instance to join multiple tables. + * + * A left join is the most common type of join that is used with Editor + * so this method is provided to make its use very easy to configure. Its + * parameters are basically the same as writing an SQL left join statement, + * but in this case Editor will handle the create, update and remove + * requirements of the join for you: + * + * * Create - On create Editor will insert the data into the primary table + * and then into the joined tables - selecting the required data for each + * table. + * * Edit - On edit Editor will update the main table, and then either + * update the existing rows in the joined table that match the join and + * edit conditions, or insert a new row into the joined table if required. + * * Remove - On delete Editor will remove the main row and then loop over + * each of the joined tables and remove the joined data matching the join + * link from the main table. + * + * Please note that when using join tables, Editor requires that you fully + * qualify each field with the field's table name. SQL can result table + * names for ambiguous field names, but for Editor to provide its full CRUD + * options, the table name must also be given. For example the field + * `first_name` in the table `users` would be given as `users.first_name`. + * + * @param string $table Table name to do a join onto + * @param string $field1 Field from the parent table to use as the join link + * @param string $operator Join condition (`=`, '<`, etc) + * @param string $field2 Field from the child table to use as the join link + * @return self Self for chaining. + * + * @example + * Simple join: + * + * ```php + * ->field( + * Field::inst( 'users.first_name as myField' ), + * Field::inst( 'users.last_name' ), + * Field::inst( 'users.dept_id' ), + * Field::inst( 'dept.name' ) + * ) + * ->leftJoin( 'dept', 'users.dept_id', '=', 'dept.id' ) + * ->process($_POST) + * ->json(); + * `````` + * + * This is basically the same as the following SQL statement: + * + * ```sql + * SELECT users.first_name, users.last_name, user.dept_id, dept.name + * FROM users + * LEFT JOIN dept ON users.dept_id = dept.id + * ``` + */ + public function leftJoin ( $table, $field1, $operator = null, $field2 = null ) + { + $this->_leftJoin[] = array( + "table" => $table, + "field1" => $field1, + "field2" => $field2, + "operator" => $operator + ); + + return $this; + } + + + /** + * Indicate if a remove should be performed on left joined tables when deleting + * from the parent row. Note that this is disabled by default and will be + * removed completely in v2. Use `ON DELETE CASCADE` in your database instead. + * + * @deprecated + * @param boolean $_ Value to set. If not given, then used as a getter. + * @return boolean|self Value if no parameter is given, or + * self if used as a setter. + */ + public function leftJoinRemove ( $_=null ) + { + return $this->_getSet( $this->_leftJoinRemove, $_ ); + } + + + /** + * Add an event listener. The `Editor` class will trigger an number of + * events that some action can be taken on. + * + * @param string $name Event name + * @param callable $callback Callback function to execute when the event + * occurs + * @return self Self for chaining. + */ + public function on ( $name, $callback ) + { + if ( ! isset( $this->_events[ $name ] ) ) { + $this->_events[ $name ] = array(); + } + + $this->_events[ $name ][] = $callback; + + return $this; + } + + + /** + * Get / set the primary key. + * + * The primary key must be known to Editor so it will know which rows are being + * edited / deleted upon those actions. The default value is ['id']. + * + * @param string|array $_ Primary key's name. If not given, then used as a + * getter. An array of column names can be given to allow composite keys to + * be used. + * @return string|self Primary key value if no parameter is given, or + * self if used as a setter. + */ + public function pkey ( $_=null ) + { + if ( is_string( $_ ) ) { + $this->_pkey = array( $_ ); + return $this; + } + return $this->_getSet( $this->_pkey, $_ ); + } + + + /** + * Convert a primary key array of field values to a combined value. + * + * @param string $row The row of data that the primary key value should + * be extracted from. + * @param boolean $flat Flag to indicate if the given array is flat + * (useful for `where` conditions) or nested for join tables. + * @return string The created primary key value. + * @throws \Exception If one of the values that the primary key is made up + * of cannot be found in the data set given, an Exception will be thrown. + */ + public function pkeyToValue ( $row, $flat=false ) + { + $pkey = $this->_pkey; + $id = array(); + + for ( $i=0, $ien=count($pkey) ; $i<$ien ; $i++ ) { + $column = $pkey[ $i ]; + + if ( $flat ) { + if ( isset( $row[ $column ] ) ) { + if ( $row[ $column ] === null ) { + throw new \Exception("Primary key value is null.", 1); + } + $val = $row[ $column ]; + } + else { + $val = null; + } + } + else { + $val = $this->_readProp( $column, $row ); + } + + if ( $val === null ) { + throw new \Exception("Primary key element is not available in data set.", 1); + } + + $id[] = $val; + } + + return implode( $this->_pkey_separator(), $id ); + } + + + /** + * Convert a primary key combined value to an array of field values. + * + * @param string $value The id that should be split apart + * @param boolean $flat Flag to indicate if the returned array should be + * flat (useful for `where` conditions) or nested for join tables. + * @param string[] $pkey The primary key name - will use the instance value + * if not given + * @return array Array of field values that the id was made up of. + * @throws \Exception If the primary key value does not match the expected + * length based on the primary key configuration, an exception will be + * thrown. + */ + public function pkeyToArray ( $value, $flat=false, $pkey=null ) + { + $arr = array(); + $value = str_replace( $this->idPrefix(), '', $value ); + $idParts = explode( $this->_pkey_separator(), $value ); + + if ( $pkey === null ) { + $pkey = $this->_pkey; + } + + if ( count($pkey) !== count($idParts) ) { + throw new \Exception("Primary key data doesn't match submitted data", 1); + } + + for ( $i=0, $ien=count($idParts) ; $i<$ien ; $i++ ) { + if ( $flat ) { + $arr[ $pkey[$i] ] = $idParts[$i]; + } + else { + $this->_writeProp( $arr, $pkey[$i], $idParts[$i] ); + } + } + + return $arr; + } + + + /** + * Process a request from the Editor client-side to get / set data. + * + * @param array $data Typically $_POST or $_GET as required by what is sent + * by Editor + * @return self + */ + public function process ( $data ) + { + if ( $this->_debug ) { + $debugInfo = &$this->_debugInfo; + + $debugInfo[] = 'Editor PHP libraries - version '. $this->version; + $debugVal = $this->_db->debug( function ( $mess ) use ( &$debugInfo ) { + $debugInfo[] = $mess; + } ); + } + + if ( $this->_tryCatch ) { + try { + $this->_process( $data ); + } + catch (\Exception $e) { + // Error feedback + $this->_out['error'] = $e->getMessage(); + + if ( $this->_transaction ) { + $this->_db->rollback(); + } + } + } + else { + $this->_process( $data ); + } + + if ( $this->_debug ) { + $this->_out['debug'] = $this->_debugInfo; + + // Save to a log file + if ( $this->_debugLog ) { + file_put_contents( $this->_debugLog, json_encode( $this->_debugInfo )."\n", FILE_APPEND ); + } + + $this->_db->debug( false ); + } + + return $this; + } + + + /** + * The CRUD read table name. If this method is used, Editor will create from the + * table name(s) given rather than those given by `Editor->table()`. This can be + * a useful distinction to allow a read from a VIEW (which could make use of a + * complex SELECT) while writing to a different table. + * + * @param string|array $_,... Read table names given as a single string, an array + * of strings or multiple string parameters for the function. + * @return string[]|self Array of read tables names, or self if used as a setter. + */ + public function readTable ( $_=null ) + { + $args = func_get_args(); + + if ( $_ !== null && !is_array($_) ) { + $_ = $args; + } + return $this->_getSet( $this->_readTableNames, $_, true ); + } + + + /** + * Get / set the table name. + * + * The table name designated which DB table Editor will use as its data + * source for working with the database. Table names can be given with an + * alias, which can be used to simplify larger table names. The field + * names would also need to reflect the alias, just like an SQL query. For + * example: `users as a`. + * + * @param string|array $_,... Table names given as a single string, an array of + * strings or multiple string parameters for the function. + * @return string[]|self Array of tables names, or self if used as a setter. + */ + public function table ( $_=null ) + { + $args = func_get_args(); + + if ( $_ !== null && !is_array($_) ) { + $_ = $args; + } + return $this->_getSet( $this->_table, $_, true ); + } + + + /** + * Get / set transaction support. + * + * When enabled (which it is by default) Editor will use an SQL transaction + * to ensure data integrity while it is performing operations on the table. + * This can be optionally disabled using this method, if required by your + * database configuration. + * + * @param boolean $_ Enable (`true`) or disabled (`false`) transactions. + * If not given, then used as a getter. + * @return boolean|self Transactions enabled flag, or self if used as a + * setter. + */ + public function transaction ( $_=null ) + { + return $this->_getSet( $this->_transaction, $_ ); + } + + + /** + * Enable / try catch when `process()` is called. Disabling this can be + * useful for debugging, but is not recommended for production. + * + * @param boolean $_ `true` to enable (default), otherwise false to disable + * @return boolean|Editor Value if used as a getter, otherwise `$this` when + * used as a setter. + */ + public function tryCatch ( $_=null ) + { + return $this->_getSet( $this->_tryCatch, $_ ); + } + + + /** + * Perform validation on a data set. + * + * Note that validation is performed on data only when the action is + * `create` or `edit`. Additionally, validation is performed on the _wire + * data_ - i.e. that which is submitted from the client, without formatting. + * Any formatting required by `setFormatter` is performed after the data + * from the client has been validated. + * + * @param array $errors Output array to which field error information will + * be written. Each element in the array represents a field in an error + * condition. These elements are themselves arrays with two properties + * set; `name` and `status`. + * @param array $data The format data to check + * @return boolean `true` if the data is valid, `false` if not. + */ + public function validate ( &$errors, $data ) + { + // Validation is only performed on create and edit + if ( $data[$this->_actionName] != "create" && $data[$this->_actionName] != "edit" ) { + return true; + } + + foreach( $data['data'] as $id => $values ) { + for ( $i=0 ; $i_fields) ; $i++ ) { + $field = $this->_fields[$i]; + $validation = $field->validate( $values, $this, + str_replace( $this->idPrefix(), '', $id ) + ); + + if ( $validation !== true ) { + $errors[] = array( + "name" => $field->name(), + "status" => $validation + ); + } + } + + // MJoin validation + for ( $i=0 ; $i_join) ; $i++ ) { + $this->_join[$i]->validate( $errors, $this, $values, $data[$this->_actionName] ); + } + } + + return count( $errors ) > 0 ? false : true; + } + + + /** + * Get / set a global validator that will be triggered for the create, edit + * and remove actions performed from the client-side. Multiple validators + * can be added. + * + * @param callable $_ Function to execute when validating the input data. + * It is passed three parameters: 1. The editor instance, 2. The action + * and 3. The values. + * @return Editor|callback Editor instance if called as a setter, or the + * validator function if not. + */ + public function validator ( $_=null ) + { + return $this->_getSet( $this->_validator, $_, true ); + } + + + /** + * Where condition to add to the query used to get data from the database. + * + * Can be used in two different ways: + * + * * Simple case: `where( field, value, operator )` + * * Complex: `where( fn )` + * + * The simple case is fairly self explanatory, a condition is applied to the + * data that looks like `field operator value` (e.g. `name = 'Allan'`). The + * complex case allows full control over the query conditions by providing a + * closure function that has access to the database Query that Editor is + * using, so you can use the `where()`, `or_where()`, `and_where()` and + * `where_group()` methods as you require. + * + * Please be very careful when using this method! If an edit made by a user + * using Editor removes the row from the where condition, the result is + * undefined (since Editor expects the row to still be available, but the + * condition removes it from the result set). + * + * @param string|callable $key Single field name or a closure function + * @param string $value Single field value. + * @param string $op Condition operator: <, >, = etc + * @return string[]|self Where condition array, or self if used as a setter. + */ + public function where ( $key=null, $value=null, $op='=' ) + { + if ( $key === null ) { + return $this->_where; + } + + if ( is_callable($key) && is_object($key) ) { + $this->_where[] = $key; + } + else { + $this->_where[] = array( + "key" => $key, + "value" => $value, + "op" => $op + ); + } + + return $this; + } + + + /** + * Get / set if the WHERE conditions should be included in the create and + * edit actions. + * + * @param boolean $_ Include (`true`), or not (`false`) + * @return boolean Current value + * @deprecated Note that `whereSet` is now deprecated and replaced with the + * ability to set values for columns on create and edit. The C# libraries + * do not support this option at all. + */ + public function whereSet ( $_=null ) + { + return $this->_getSet( $this->_whereSet, $_ ); + } + + public function write ($_writeVal=null){ + return $this->_getSet($this->_write, $_writeVal); + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private methods + */ + + /** + * Process a request from the Editor client-side to get / set data. + * + * @param array $data Data to process + * @private + */ + private function _process( $data ) + { + $this->_out = array( + "fieldErrors" => array(), + "error" => "", + "data" => array(), + "ipOpts" => array(), + "cancelled" => array() + ); + + $action = Editor::action($data); + $this->_processData = $data; + $this->_formData = isset($data['data']) ? $data['data'] : null; + $validators = $this->_validator; + + // Sanity check that data isn't getting truncated as that can lead to data corruption + if ( $data && count($data, COUNT_RECURSIVE) >= ini_get('max_input_vars') ) { + $this->_out['error'] = 'Too many rows edited at the same time (tech info: max_input_vars exceeded).'; + } + + if ( ! $this->_out['error'] ) { + if ( $this->_transaction ) { + $this->_db->transaction(); + } + + $this->_prepJoin(); + + if ( $validators ) { + for ( $i=0 ; $i_out['error'] = $ret; + break; + } + } + } + } + + if ( ! $this->_out['error'] ) { + if ( $action === Editor::ACTION_READ ) { + /* Get data */ + $this->_out = array_merge( $this->_out, $this->_get( null, $data ) ); + } + else if ( $action === Editor::ACTION_UPLOAD && $this->_write === true ) { + /* File upload */ + $this->_upload( $data ); + } + else if ( $action === Editor::ACTION_DELETE && $this->_write === true) { + /* Remove rows */ + $this->_remove( $data ); + $this->_fileClean(); + } + else if (($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT ) && $this->_write === true ) { + /* Create or edit row */ + // Pre events so they can occur before the validation + foreach ($data['data'] as $idSrc => &$values) { + $cancel = null; + + if ( $action === Editor::ACTION_CREATE ) { + $cancel = $this->_trigger( 'preCreate', $values ); + } + else { + $id = str_replace( $this->_idPrefix, '', $idSrc ); + $cancel = $this->_trigger( 'preEdit', $id, $values ); + } + + // One of the event handlers returned false - don't continue + if ( $cancel === false ) { + // Remove the data from the data set so it won't be processed + unset( $data['data'][$idSrc] ); + + // Tell the client-side we aren't updating this row + $this->_out['cancelled'][] = $idSrc; + } + } + + // Validation + $valid = $this->validate( $this->_out['fieldErrors'], $data ); + + if ( $valid ) { + foreach ($data['data'] as $id => &$values) { + $d = $action === Editor::ACTION_CREATE ? + $this->_insert( $values ) : + $this->_update( $id, $values ); + + if ( $d !== null ) { + $this->_out['data'][] = $d; + } + } + + $this->_fileClean(); + } + } + } + + if ( $this->_transaction ) { + $this->_db->commit(); + } + + // Tidy up the reply + if ( count( $this->_out['fieldErrors'] ) === 0 ) { + unset( $this->_out['fieldErrors'] ); + } + + if ( $this->_out['error'] === '' ) { + unset( $this->_out['error'] ); + } + + if ( count( $this->_out['ipOpts'] ) === 0 ) { + unset( $this->_out['ipOpts'] ); + } + + if ( count( $this->_out['cancelled'] ) === 0 ) { + unset( $this->_out['cancelled'] ); + } + } + + + /** + * Get an array of objects from the database to be given to DataTables as a + * result of an sAjaxSource request, such that DataTables can display the information + * from the DB in the table. + * + * @param integer|string $id Primary key value to get an individual row + * (after create or update operations). Gets the full set if not given. + * If a compound key is being used, this should be the string + * representation of it (i.e. joined together) rather than an array form. + * @param array $http HTTP parameters from GET or POST request (so we can service + * server-side processing requests from DataTables). + * @return array DataTables get information + * @throws \Exception Error on SQL execution + * @private + */ + private function _get( $id=null, $http=null ) + { + $cancel = $this->_trigger( 'preGet', $id ); + if ( $cancel === false ) { + return array(); + } + + // print_r($id); + // print_r($http); + + $query = $this->_db + ->query('select') + ->table( $this->_read_table() ) + ->get( $this->_pkey ); + + // Add all fields that we need to get from the database + foreach ($this->_fields as $field) { + // Don't reselect a pkey column if it was already added + if ( in_array( $field->dbField(), $this->_pkey ) ) { + continue; + } + + if ( $field->apply('get') && $field->getValue() === null ) { + $query->get( $field->dbField() ); + } + } + + $this->_get_where( $query ); + $query->left_join($this->_leftJoin); + $ssp = $this->_ssp_query( $query, $http ); + + if ( $id !== null ) { + $query->where( $this->pkeyToArray( $id, true ) ); + } + + $res = $query->exec(); + if ( ! $res ) { + throw new \Exception('Error executing SQL for data get. Enable SQL debug using `->debug(true)`'); + } + + $out = array(); + while ( $row=$res->fetch() ) { + $inner = array(); + $inner['DT_RowId'] = $this->_idPrefix . $this->pkeyToValue( $row, true ); + + foreach ($this->_fields as $field) { + if ( $field->apply('get') ) { + $field->write( $inner, $row ); + } + } + + $out[] = $inner; + } + + // Field options + $options = array(); + $spOptions = array(); + $sbOptions = array(); + $searchPanes = array(); + + if ( $id === null ) { + foreach ($this->_fields as $field) { + $opts = $field->optionsExec( $this->_db ); + + if ( $opts !== false ) { + $options[ $field->name() ] = $opts; + } + + // SearchPanes options + $spOpts = $field->searchPaneOptionsExec( $field, $this, $http, $this->_fields, $this->_leftJoin); + + if ( $spOpts !== false ) { + $spOptions[ $field->name() ] = $spOpts; + } + + $sbOpts = $field->searchBuilderOptionsExec($field, $this, $http, $this->_fields, $this->_leftJoin); + + if ( $sbOpts !== false) { + $sbOptions[ $field->name() ] = $sbOpts; + } + } + } + + $searchPanes[ 'options' ] = $spOptions; + $searchBuilder[ 'options' ] = $sbOptions; + + // Row based "joins" + for ( $i=0 ; $i_join) ; $i++ ) { + $this->_join[$i]->data( $this, $out, $options ); + } + + $this->_trigger( 'postGet', $out, $id ); + + if (count($searchPanes['options']) > 0 && count($searchBuilder['options']) > 0) { + return array_merge( + array( + 'data' => $out, + 'options' => $options, + 'files' => $this->_fileData( null, null, $out ), + 'searchBuilder' => $searchBuilder, + 'searchPanes' => $searchPanes + ), + $ssp + ); + } + else if (count($searchBuilder['options']) > 0) { + return array_merge( + array( + 'data' => $out, + 'options' => $options, + 'files' => $this->_fileData( null, null, $out ), + 'searchBuilder' => $searchBuilder + ), + $ssp + ); + } + else if (count($searchPanes['options']) > 0) { + return array_merge( + array( + 'data' => $out, + 'options' => $options, + 'files' => $this->_fileData( null, null, $out ), + 'searchPanes' => $searchPanes + ), + $ssp + ); + } + else { + return array_merge( + array( + 'data' => $out, + 'options' => $options, + 'files' => $this->_fileData( null, null, $out ) + ), + $ssp + ); + } + + } + + + /** + * Insert a new row in the database + * @private + */ + private function _insert( $values ) + { + // Get values to generate the id, including from setValue, not just the + // submitted values + $all = array(); + foreach ($this->_fields as $field) { + if ($field->apply('set', $values)) { + $this->_writeProp($all, $field->name(), $field->val( 'set', $values )); + } + } + + // Only allow a composite insert if the values for the key are + // submitted. This is required because there is no reliable way in MySQL + // to return the newly inserted row, so we can't know any newly + // generated values. + $this->_pkey_validate_insert( $all ); + + $this->_trigger( 'validatedCreate', $values ); + + // Insert the new row + $id = $this->_insert_or_update( null, $values ); + + if ( $id === null ) { + return null; + } + + // Was the primary key altered as part of the edit, if so use the + // submitted values + $id = count( $this->_pkey ) > 1 ? + $this->pkeyToValue( $all ) : + $this->_pkey_submit_merge( $id, $all ); + + // Join tables + for ( $i=0 ; $i_join) ; $i++ ) { + $this->_join[$i]->create( $this, $id, $values ); + } + + $this->_trigger( 'writeCreate', $id, $values ); + + // Full data set for the created row + $row = $this->_get( $id ); + $row = count( $row['data'] ) > 0 ? + $row['data'][0] : + null; + + $this->_trigger( 'postCreate', $id, $values, $row ); + + return $row; + } + + + /** + * Update a row in the database + * @param string $id The DOM ID for the row that is being edited. + * @return array Row's data + * @private + */ + private function _update( $id, $values ) + { + $id = str_replace( $this->_idPrefix, '', $id ); + + $this->_trigger( 'validatedEdit', $id, $values ); + + // Update or insert the rows for the parent table and the left joined + // tables + $this->_insert_or_update( $id, $values ); + + // And the join tables + for ( $i=0 ; $i_join) ; $i++ ) { + $this->_join[$i]->update( $this, $id, $values ); + } + + // Was the primary key altered as part of the edit, if so use the + // submitted values + $getId = $this->_pkey_submit_merge( $id, $values ); + + $this->_trigger( 'writeEdit', $id, $values ); + + // Full data set for the modified row + $row = $this->_get( $getId ); + $row = count( $row['data'] ) > 0 ? + $row['data'][0] : + null; + + $this->_trigger( 'postEdit', $id, $values, $row ); + + return $row; + } + + + /** + * Delete one or more rows from the database + * @private + */ + private function _remove( $data ) + { + $ids = array(); + + // Get the ids to delete from the data source + foreach ($data['data'] as $idSrc => $rowData) { + // Strip the ID prefix that the client-side sends back + $id = str_replace( $this->_idPrefix, "", $idSrc ); + + $res = $this->_trigger( 'preRemove', $id, $rowData ); + + // Allow the event to be cancelled and inform the client-side + if ( $res === false ) { + $this->_out['cancelled'][] = $idSrc; + } + else { + $ids[] = $id; + } + } + + if ( count( $ids ) === 0 ) { + return; + } + + // Row based joins - remove first as the host row will be removed which + // is a dependency + for ( $i=0 ; $i_join) ; $i++ ) { + $this->_join[$i]->remove( $this, $ids ); + } + + // Remove from the left join tables + if ( $this->_leftJoinRemove ) { + for ( $i=0, $ien=count($this->_leftJoin) ; $i<$ien ; $i++ ) { + $join = $this->_leftJoin[$i]; + $table = $this->_alias( $join['table'], 'orig' ); + + // which side of the join refers to the parent table? + if ( strpos( $join['field1'], $join['table'] ) === 0 ) { + $parentLink = $join['field2']; + $childLink = $join['field1']; + } + else { + $parentLink = $join['field1']; + $childLink = $join['field2']; + } + + // Only delete on the primary key, since that is what the ids refer + // to - otherwise we'd be deleting random data! Note that this + // won't work with compound keys since the parent link would be + // over multiple fields. + if ( $parentLink === $this->_pkey[0] && count($this->_pkey) === 1 ) { + $this->_remove_table( $join['table'], $ids, array($childLink) ); + } + } + } + + // Remove from the primary tables + for ( $i=0, $ien=count($this->_table) ; $i<$ien ; $i++ ) { + $this->_remove_table( $this->_table[$i], $ids ); + } + + foreach ($data['data'] as $idSrc => $rowData) { + $id = str_replace( $this->_idPrefix, "", $idSrc ); + + $this->_trigger( 'postRemove', $id, $rowData ); + } + } + + + /** + * File upload + * @param array $data Upload data + * @throws \Exception File upload name error + * @private + */ + private function _upload( $data ) + { + // Search for upload field in local fields + $field = $this->_find_field( $data['uploadField'], 'name' ); + $fieldName = ''; + + if ( ! $field ) { + // Perhaps it is in a join instance + for ( $i=0 ; $i_join) ; $i++ ) { + $join = $this->_join[$i]; + $fields = $join->fields(); + + for ( $j=0, $jen=count($fields) ; $j<$jen ; $j++ ) { + $joinField = $fields[ $j ]; + $name = $join->name().'[].'.$joinField->name(); + + if ( $name === $data['uploadField'] ) { + $field = $joinField; + $fieldName = $name; + } + } + } + } + else { + $fieldName = $field->name(); + } + + if ( ! $field ) { + throw new \Exception("Unknown upload field name submitted"); + } + + $res = $this->_trigger( 'preUpload', $data ); + + // Allow the event to be cancelled and inform the client-side + if ( $res === false ) { + return; + } + + $upload = $field->upload(); + if ( ! $upload ) { + throw new \Exception("File uploaded to a field that does not have upload options configured"); + } + + $res = $upload->exec( $this ); + + if ( $res === false ) { + $this->_out['fieldErrors'][] = array( + "name" => $fieldName, // field name can be just the field's + "status" => $upload->error() // name or a join combination + ); + } + else { + $files = $this->_fileData( $upload->table(), array($res) ); + + $this->_out['files'] = $files; + $this->_out['upload']['id'] = $res; + + $this->_trigger( 'postUpload', $res, $files, $data ); + } + } + + + /** + * Get information about the files that are detailed in the database for + * the fields which have an upload method defined on them. + * + * @param string [$limitTable=null] Limit the data gathering to a single + * table only + * @param number[] [$id=null] Limit to a specific set of ids + * @return array File information + * @private + */ + private function _fileData ( $limitTable=null, $ids=null, $data=null ) + { + $files = array(); + + // The fields in this instance + $this->_fileDataFields( $files, $this->_fields, $limitTable, $ids, $data ); + + // From joined tables + for ( $i=0 ; $i_join) ; $i++ ) { + $joinData = null; + + // If we have data from the get, it is nested from the join, so we need to + // un-nest it (i.e. get the array of joined data for each row) + if ( $data ) { + $joinData = array(); + + for ( $j=0, $jen=count($data) ; $j<$jen ; $j++ ) { + $joinData = array_merge( $joinData, $data[$j][$this->_join[$i]->name()] ); + } + } + + $this->_fileDataFields( $files, $this->_join[$i]->fields(), $limitTable, $ids, $joinData ); + } + + return $files; + } + + + /** + * Common file get method for any array of fields + * @param array &$files File output array + * @param Field[] $fields Fields to get file information about + * @param string[] $limitTable Limit the data gathering to a single table + * only + * @private + */ + private function _fileDataFields ( &$files, $fields, $limitTable, $idsIn=null, $data=null ) + { + foreach ($fields as $field) { + $upload = $field->upload(); + + if ( $upload ) { + $table = $upload->table(); + + if ( ! $table ) { + continue; + } + + if ( $limitTable !== null && $table !== $limitTable ) { + continue; + } + + // Make a collection of the ids used in this data set to get a limited data set + // in return (security and performance) + $ids = $idsIn; + + if ( $ids === null ) { + $ids = array(); + } + + if ( $data !== null ) { + for ( $i=0, $ien=count($data); $i<$ien ; $i++ ) { + $val = $field->val( 'set', $data[$i] ); + + if ( $val && ! in_array($val, $ids) ) { + $ids[] = $val; + } + } + + if ( count($ids) === 0 ) { + // If no data to fetch for this field, so don't bother + continue; + } + else if ( count($ids) > 1000 ) { + // Don't use `where_in` for really large data sets + $ids = array(); + } + } + + $fileData = $upload->data( $this->_db, $ids ); + + if ( $fileData !== null ) { + if ( isset($files[$table]) ) { + $files[$table] = $files[$table] + $fileData; + } + else { + $files[$table] = $fileData; + } + } + } + } + } + + /** + * Run the file clean up + * + * @private + */ + private function _fileClean () + { + foreach ( $this->_fields as $field ) { + $upload = $field->upload(); + + if ( $upload ) { + $upload->dbCleanExec( $this, $field ); + } + } + + for ( $i=0 ; $i_join) ; $i++ ) { + foreach ( $this->_join[$i]->fields() as $field ) { + $upload = $field->upload(); + + if ( $upload ) { + $upload->dbCleanExec( $this, $field ); + } + } + } + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * + * Server-side processing methods + */ + + /** + * When server-side processing is being used, modify the query with // the + * required extra conditions + * + * @param \DataTables\Database\Query $query Query instance to apply the SSP commands to + * @param array $http Parameters from HTTP request + * @return array Server-side processing information array + * @private + */ + private function _ssp_query ( $query, $http ) + { + if ( ! isset( $http['draw'] ) ) { + return array(); + } + + // Add the server-side processing conditions + $this->_ssp_limit( $query, $http ); + $this->_ssp_sort( $query, $http ); + $this->_ssp_filter( $query, $http ); + + // Get the number of rows in the result set + $ssp_set_count = $this->_db + ->query('count') + ->table( $this->_read_table() ) + ->get( $this->_pkey[0] ); + $this->_get_where( $ssp_set_count ); + $this->_ssp_filter( $ssp_set_count, $http ); + $ssp_set_count->left_join($this->_leftJoin); + $ssp_set_count = $ssp_set_count->exec()->fetch(); + + // Get the number of rows in the full set + $ssp_full_count = $this->_db + ->query('count') + ->table( $this->_read_table() ) + ->get( $this->_pkey[0] ); + $this->_get_where( $ssp_full_count ); + if ( count( $this->_where ) ) { // only needed if there is a where condition + $ssp_full_count->left_join($this->_leftJoin); + } + $ssp_full_count = $ssp_full_count->exec()->fetch(); + + return array( + "draw" => intval( $http['draw'] ), + "recordsTotal" => $ssp_full_count['cnt'], + "recordsFiltered" => $ssp_set_count['cnt'] + ); + } + + + /** + * Convert a column index to a database field name - used for server-side + * processing requests. + * @param array $http HTTP variables (i.e. GET or POST) + * @param int $index Index in the DataTables' submitted data + * @returns string DB field name + * @throws \Exception Unknown fields + * @private Note that it is actually public for PHP 5.3 - thread 39810 + */ + public function _ssp_field( $http, $index ) + { + $name = $http['columns'][$index]['data']; + $field = $this->_find_field( $name, 'name' ); + + if ( ! $field ) { + // Is it the primary key? + if ( $name === 'DT_RowId' ) { + return $this->_pkey[0]; + } + + throw new \Exception('Unknown field: '.$name .' (index '.$index.')'); + } + + return $field->dbField(); + } + + + /** + * Sorting requirements to a server-side processing query. + * @param \DataTables\Database\Query $query Query instance to apply sorting to + * @param array $http HTTP variables (i.e. GET or POST) + * @private + */ + private function _ssp_sort ( $query, $http ) + { + if ( isset( $http['order'] ) ) { + for ( $i=0 ; $iorder( + $this->_ssp_field( $http, $order['column'] ) .' '. + ($order['dir']==='asc' ? 'asc' : 'desc') + ); + } + } + } + + private function _constructSearchBuilderConditions($query, $data) { + $first = true; + + if(!isset($data['criteria'])) { + return; + } + // Iterate over every group or criteria in the current group + foreach($data['criteria'] as $crit) { + // If criteria is defined then this must be a group + if(isset($crit['criteria'])) { + // Check if this is the first, or if it is and logic + if($data['logic'] === 'AND' || $first) { + // Call the function for the next group + $query->where_group(function($q) use ($crit) { + $this->_constructSearchBuilderConditions($q, $crit); + }); + // Set first to false so that in future only the logic is checked + $first = false; + } + else { + $query->where_group(function ($q) use ($crit) { + $this->_constructSearchBuilderConditions($q, $crit); + }, 'OR'); + } + } + else if (isset($crit['condition']) && (isset($crit['value1']) || $crit['condition'] === 'null' || $crit['condition'] === '!null')) { + // Sometimes the structure of the object that is passed across is named in a strange way. + // This conditional assignment solves that issue + $val1 = isset($crit['value1']) ? $crit['value1'] : ''; + $val2 = isset($crit['value2']) ? $crit['value2'] : ''; + + if(strlen($val1) === 0 && $crit['condition'] !== 'null' && $crit['condition'] !== '!null') { + continue; + } + if(strlen($val2) === 0 && ($crit['condition'] === 'between' || $crit['condition'] === '!between')) { + continue; + } + + // Switch on the condition that has been passed in + switch($crit['condition']) { + case '=': + // Check if this is the first, or if it is and logic + if($data['logic'] === 'AND' || $first) { + // Call the where function for this condition + $query->where($crit['origData'], $val1, '='); + // Set first to false so that in future only the logic is checked + $first = false; + } + else { + // Call the or_where function - has to be or logic in this block + $query->or_where($crit['origData'], $val1, '='); + } + break; + case '!=': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], $val1, '<>'); + $first = false; + } + else { + $query->or_where($crit['origData'], $val1, '<>'); + } + break; + case 'contains': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], '%'.$val1.'%', 'LIKE'); + $first = false; + } + else { + $query->or_where($crit['origData'], '%'.$val1.'%', 'LIKE'); + } + break; + case '!contains': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], '%'.$val1.'%', 'NOT LIKE'); + $first = false; + } + else { + $query->or_where($crit['origData'], '%'.$val1.'%', 'NOT LIKE'); + } + break; + case 'starts': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], $val1.'%', 'LIKE'); + $first = false; + } + else { + $query->or_where($crit['origData'], $val1.'%', 'LIKE'); + } + break; + case '!starts': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], $val1.'%', 'NOT LIKE'); + $first = false; + } + else { + $query->or_where($crit['origData'], $val1.'%', 'NOT LIKE'); + } + break; + case 'ends': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], '%'.$val1, 'LIKE'); + $first = false; + } + else { + $query->or_where($crit['origData'], '%'.$val1, 'LIKE'); + } + break; + case '!ends': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], '%'.$val1, 'NOT LIKE'); + $first = false; + } + else { + $query->or_where($crit['origData'], '%'.$val1, 'NOT LIKE'); + } + break; + case '<': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], $val1, '<'); + $first = false; + } + else { + $query->or_where($crit['origData'], $val1, '<'); + } + break; + case '<=': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], $val1, '<='); + $first = false; + } + else { + $query->or_where($crit['origData'], $val1, '<='); + } + break; + case '>=': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], $val1, '>='); + $first = false; + } + else { + $query->or_where($crit['origData'], $val1, '>='); + } + break; + case '>': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], $val1, '>'); + $first = false; + } + else { + $query->or_where($crit['origData'], $val1, '>'); + } + break; + case 'between': + if($data['logic'] === 'AND' || $first) { + $query->where_group(function($q) use ($crit, $val1, $val2) { + $q->where($crit['origData'], is_numeric($val1) ? intval($val1) : $val1, '>')->where($crit['origData'], is_numeric($val2) ? intval($val2) : $val2, '<'); + }); + $first = false; + } + else { + $query->or_where($crit['origData'], is_numeric($val1) ? intval($val1) : $val1, '>')->where($crit['origData'], is_numeric($val2) ? intval($val2) : $val2, '<'); + } + break; + case '!between': + if($data['logic'] === 'AND' || $first) { + $query->where_group(function($q) use ($crit, $val1, $val2) { + $q->where($crit['origData'], is_numeric($val1) ? intval($val1) : $val1, '<')->or_where($crit['origData'], is_numeric($val2) ? intval($val2) : $val2, '>'); + }); + $first = false; + } + else { + $query->or_where($crit['origData'], is_numeric($val1) ? intval($val1) : $val1, '<')->or_where($crit['origData'], is_numeric($val2) ? intval($val2) : $val2, '>'); + } + break; + case 'null': + if($data['logic'] === 'AND' || $first) { + $query->where_group(function ($q) use ($crit) { + $q->where($crit['origData'], null, "="); + if (strpos($crit['type'], 'date') === false && strpos($crit['type'], 'moment') === false && strpos($crit['type'], 'luxon') === false) { + $q->or_where($crit['origData'], "", "="); + } + }); + $first = false; + } + else { + $query->where_group(function ($q) use ($crit) { + $q->where($crit['origData'], null, "="); + if (strpos($crit['type'], 'date') === false && strpos($crit['type'], 'moment') === false && strpos($crit['type'], 'luxon') === false) { + $q->or_where($crit['origData'], "", "="); + } + }, 'OR'); + } + break; + case '!null': + if($data['logic'] === 'AND' || $first) { + $query->where_group(function ($q) use ($crit) { + $q->where($crit['origData'], null, "!="); + if (strpos($crit['type'], 'date') === false && strpos($crit['type'], 'moment') === false && strpos($crit['type'], 'luxon') === false) { + $q->where($crit['origData'], "", "!="); + } + }); + $first = false; + } + else { + $query->where_group(function ($q) use ($crit) { + $q->where($crit['origData'], null, "!="); + if (strpos($crit['type'], 'date') === false && strpos($crit['type'], 'moment') === false && strpos($crit['type'], 'luxon') === false) { + $q->where($crit['origData'], "", "!="); + } + }, 'OR'); + + } + break; + default: + break; + } + } + } + return $query; + } + + + /** + * Add DataTables' 'where' condition to a server-side processing query. This + * works for both global and individual column filtering. + * @param \DataTables\Database\Query $query Query instance to apply the WHERE conditions to + * @param array $http HTTP variables (i.e. GET or POST) + * @private + */ + private function _ssp_filter ( $query, $http ) + { + $that = $this; + + // Global filter + $fields = $this->_fields; + + // Global search, add a ( ... or ... ) set of filters for each column + // in the table (not the fields, just the columns submitted) + if ( $http['search']['value'] ) { + $query->where( function ($q) use (&$that, &$fields, $http) { + for ( $i=0 ; $i_ssp_field( $http, $i ); + + if ( $fieldName ) { + $q->or_where( $fieldName, '%'.$http['search']['value'].'%', 'like' ); + } + } + } + } ); + } + + /* + foreach ($this->_fields as $field) { + // Don't reselect a pkey column if it was already added + if ( in_array( $field->dbField(), $this->_pkey ) ) { + continue; + } + + if ( $field->apply('get') && $field->getValue() === null ) { + $query->get( $field->dbField() ); + } + } + */ + + if( isset($http['searchPanes']) ) { + // Set the database from editor + $db = $this->_db; + // For every selection in every column + foreach ($this->_fields as $field) { + if( isset($http['searchPanes'][$field->name()])){ + for($i = 0; $i < count($http['searchPanes'][$field->name()]); $i++) { + // Check the number of rows... + $q = $db + ->query('select') + ->table($this->_table) + ->get('COUNT(*) as cnt'); + + $q->left_join($this->_leftJoin); + + // ... where the selected option is present... + $r = $q + ->where($field->dbField(), $http['searchPanes'][$field->name()][$i], '=') + ->exec() + ->fetchAll(); + + // ... If there are none then don't bother with this selection + if($r[0]['cnt'] == 0) { + array_splice($http['searchPanes'][$field->name()], $i, 1); + $i--; + } + } + + $query->where( function ($q) use ($field, $http) { + + for($j=0 ; $jname()]) ; $j++){ + $q->or_where( + $field->dbField(), + isset($http['searchPanes_null'][$field->name()][$j]) + ? null + : $http['searchPanes'][$field->name()][$j], + '=' + ); + } + }); + } + } + } + + if(isset($http['searchBuilder']) && $http['searchBuilder'] !== 'false') { + $query->where_group(function($q) use ($http) { + $this->_constructSearchBuilderConditions($q, $http['searchBuilder']); + }); + } + + // if ( $http['search']['value'] ) { + // $words = explode(" ", $http['search']['value']); + + // $query->where( function ($q) use (&$that, &$fields, $http, $words) { + // for ( $j=0, $jen=count($words) ; $j<$jen ; $j++ ) { + // if ( $words[$j] ) { + // $q->where_group( true ); + + // for ( $i=0, $ien=count($http['columns']) ; $i<$ien ; $i++ ) { + // if ( $http['columns'][$i]['searchable'] == 'true' ) { + // $field = $that->_ssp_field( $http, $i ); + + // $q->or_where( $field, $words[$j].'%', 'like' ); + // $q->or_where( $field, '% '.$words[$j].'%', 'like' ); + // } + // } + + // $q->where_group( false ); + // } + // } + // } ); + // } + + // Column filters + for ( $i=0, $ien=count($http['columns']) ; $i<$ien ; $i++ ) { + $column = $http['columns'][$i]; + $search = $column['search']['value']; + + if ( $search !== '' && $column['searchable'] == 'true' ) { + $query->where( $this->_ssp_field( $http, $i ), '%'.$search.'%', 'like' ); + } + } + + + } + + + /** + * Add a limit / offset to a server-side processing query + * @param \DataTables\Database\Query $query Query instance to apply the offset / limit to + * @param array $http HTTP variables (i.e. GET or POST) + * @private + */ + private function _ssp_limit ( $query, $http ) + { + if ( $http['length'] != -1 ) { // -1 is 'show all' in DataTables + $query + ->offset( $http['start'] ) + ->limit( $http['length'] ); + } + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * + * Internal helper methods + */ + + /** + * Add local WHERE condition to query + * @param \DataTables\Database\Query $query Query instance to apply the WHERE conditions to + * @private + */ + private function _get_where ( $query ) + { + for ( $i=0 ; $i_where) ; $i++ ) { + if ( is_callable( $this->_where[$i] ) ) { + $this->_where[$i]( $query ); + } + else { + $query->where( + $this->_where[$i]['key'], + $this->_where[$i]['value'], + $this->_where[$i]['op'] + ); + } + } + } + + + /** + * Get a field instance from a known field name + * + * @param string $name Field name + * @param string $type Matching name type + * @return Field Field instance + * @private + */ + private function _find_field ( $name, $type ) + { + for ( $i=0, $ien=count($this->_fields) ; $i<$ien ; $i++ ) { + $field = $this->_fields[ $i ]; + + if ( $type === 'name' && $field->name() === $name ) { + return $field; + } + else if ( $type === 'db' && $field->dbField() === $name ) { + return $field; + } + } + + return null; + } + + + /** + * Insert or update a row for all main tables and left joined tables. + * + * @param int|string $id ID to use to condition the update. If null is + * given, the first query performed is an insert and the inserted id + * used as the value should there be any subsequent tables to operate + * on. Mote that for compound keys, this should be the "joined" value + * (i.e. a single string rather than an array). + * @return \DataTables\Database\Result Result from the query or null if no + * query performed. + * @private + */ + private function _insert_or_update ( $id, $values ) + { + // Loop over all tables in _table, doing the insert or update as needed + for ( $i=0, $ien=count( $this->_table ) ; $i<$ien ; $i++ ) { + $res = $this->_insert_or_update_table( + $this->_table[$i], + $values, + $id !== null ? + $this->pkeyToArray( $id, true ) : + null + ); + + // If we don't have an id yet, then the first insert will return + // the id we want + if ( $res !== null && $id === null ) { + $id = $res->insertId(); + } + } + + // And for the left join tables as well + for ( $i=0, $ien=count( $this->_leftJoin ) ; $i<$ien ; $i++ ) { + $join = $this->_leftJoin[$i]; + + // which side of the join refers to the parent table? + $joinTable = $this->_alias( $join['table'], 'alias' ); + $tablePart = $this->_part( $join['field1'] ); + + if ( $this->_part( $join['field1'], 'db' ) ) { + $tablePart = $this->_part( $join['field1'], 'db' ).'.'.$tablePart; + } + + if ( $tablePart === $joinTable ) { + $parentLink = $join['field2']; + $childLink = $join['field1']; + } + else { + $parentLink = $join['field1']; + $childLink = $join['field2']; + } + + if ( $parentLink === $this->_pkey[0] && count($this->_pkey) === 1 ) { + $whereVal = $id; + } + else { + // We need submitted information about the joined data to be + // submitted as well as the new value. We first check if the + // host field was submitted + $field = $this->_find_field( $parentLink, 'db' ); + + if ( ! $field || ! $field->apply( 'set', $values ) ) { + // If not, then check if the child id was submitted + $field = $this->_find_field( $childLink, 'db' ); + + // No data available, so we can't do anything + if ( ! $field || ! $field->apply( 'set', $values ) ) { + continue; + } + } + + $whereVal = $field->val('set', $values); + } + + $whereName = $this->_part( $childLink, 'field' ); + + $this->_insert_or_update_table( + $join['table'], + $values, + array( $whereName => $whereVal ) + ); + } + + return $id; + } + + + /** + * Insert or update a row in a single database table, based on the data + * given and the fields configured for the instance. + * + * The function will find the fields which are required for this specific + * table, based on the names of fields and use only the appropriate data for + * this table. Therefore the full submitted data set can be passed in. + * + * @param string $table Database table name to use (can include an alias) + * @param array $where Update condition + * @return \DataTables\Database\Result Result from the query or null if no query + * performed. + * @throws \Exception Where set error + * @private + */ + private function _insert_or_update_table ( $table, $values, $where=null ) + { + $set = array(); + $action = ($where === null) ? 'create' : 'edit'; + $tableAlias = $this->_alias( $table, 'alias' ); + + for ( $i=0 ; $i_fields) ; $i++ ) { + $field = $this->_fields[$i]; + $tablePart = $this->_part( $field->dbField() ); + + if ( $this->_part( $field->dbField(), 'db' ) ) { + $tablePart = $this->_part( $field->dbField(), 'db' ).'.'.$tablePart; + } + + // Does this field apply to this table (only check when a join is + // being used) + if ( count($this->_leftJoin) && $tablePart !== $tableAlias ) { + continue; + } + + // Check if this field should be set, based on options and + // submitted data + if ( ! $field->apply( $action, $values ) ) { + continue; + } + + // Some db's (specifically postgres) don't like having the table + // name prefixing the column name. Todo: it might be nicer to have + // the db layer abstract this out? + $fieldPart = $this->_part( $field->dbField(), 'field' ); + $set[ $fieldPart ] = $field->val( 'set', $values ); + } + + // Add where fields if setting where values and required for this + // table + // Note that `whereSet` is now deprecated + if ( $this->_whereSet ) { + for ( $j=0, $jen=count($this->_where) ; $j<$jen ; $j++ ) { + $cond = $this->_where[$j]; + + if ( ! is_callable( $cond ) ) { + // Make sure the value wasn't in the submitted data set, + // otherwise we would be overwriting it + if ( ! isset( $set[ $cond['key'] ] ) ) + { + $whereTablePart = $this->_part( $cond['key'], 'table' ); + + // No table part on the where condition to match against + // or table operating on matches table part from cond. + if ( ! $whereTablePart || $tableAlias == $whereTablePart ) { + $set[ $cond['key'] ] = $cond['value']; + } + } + else { + throw new \Exception( 'Where condition used as a setter, '. + 'but value submitted for field: '.$cond['key'] + ); + } + } + } + } + + // If nothing to do, then do nothing! + if ( ! count( $set ) ) { + return null; + } + + // Use pkey only for the host table + $pkey = in_array( $table, $this->_table ) !== false ? + $this->_pkey : + ''; + + // Insert or update + if ( $action === 'create' ) { + return $this->_db->insert( $table, $set, $pkey ); + } + else { + return $this->_db->push( $table, $set, $where, $pkey ); + } + } + + + /** + * Delete one or more rows from the database for an individual table + * + * @param string $table Database table name to use + * @param array $ids Array of ids to remove + * @param string $pkey Database column name to match the ids on for the + * delete condition. If not given the instance's base primary key is + * used. + * @private + */ + private function _remove_table ( $table, $ids, $pkey=null ) + { + if ( $pkey === null ) { + $pkey = $this->_pkey; + } + + $tableAlias = $this->_alias($table, 'alias'); + $tableOrig = $this->_alias($table, 'orig'); + + // If using an alias we need to replace the alias'ed table name in our pkey + // with the real table name + for ($i=0 ; $i 1 && $a[0] === $tableAlias) { + $a[0] = $tableOrig; + $pkey[$i] = implode('.', $a); + } + } + + // Check there is a field which has a set option for this table + $count = 0; + + foreach ($this->_fields as $field) { + $fieldName = $field->dbField(); + $fieldDots = substr_count( $fieldName, '.' ); + + if ( $fieldDots === 0 ) { + $count++; + } + else if ( $fieldDots === 1 ) { + if ( + $field->set() !== Field::SET_NONE && + $this->_part( $fieldName, 'table' ) === $tableAlias + ) { + $count++; + } + } + else { + // db link + // note that if the table name for the constructor uses a db part, we need to also have + // the fields using the db name as Editor doesn't do any conflict resolution. + $dbTable = $this->_part( $fieldName, 'db' ) .'.'. $this->_part( $fieldName, 'table' ); + + if ( $field->set() !== Field::SET_NONE && $dbTable === $table ) { + $count++; + } + } + } + + if ( $count > 0 ) { + $q = $this->_db + ->query( 'delete' ) + ->table( $tableOrig ); + + for ( $i=0, $ien=count($ids) ; $i<$ien ; $i++ ) { + $cond = $this->pkeyToArray( $ids[$i], true, $pkey ); + + $q->or_where( function ($q2) use ($cond) { + $q2->where( $cond ); + } ); + } + + $q->exec(); + } + } + + + /** + * Check the validity of the set options if we are doing a join, since + * there are some conditions for this state. Will throw an error if not + * valid. + * + * @private + */ + private function _prepJoin () + { + if ( count( $this->_leftJoin ) === 0 ) { + return; + } + + // Check if the primary key has a table identifier - if not - add one + for ( $i=0, $ien=count($this->_pkey) ; $i<$ien ; $i++ ) { + $val = $this->_pkey[$i]; + + if ( strpos( $val, '.' ) === false ) { + $this->_pkey[$i] = $this->_alias( $this->_table[0], 'alias' ).'.'.$val; + } + } + + // Check that all fields have a table selector, otherwise, we'd need to + // know the structure of the tables, to know which fields belong in + // which. This extra requirement on the fields removes that + for ( $i=0, $ien=count($this->_fields) ; $i<$ien ; $i++ ) { + $field = $this->_fields[$i]; + $name = $field->dbField(); + + if ( strpos( $name, '.' ) === false ) { + throw new \Exception( 'Table part of the field "'.$name.'" was not found. '. + 'In Editor instances that use a join, all fields must have the '. + 'database table set explicitly.' + ); + } + } + } + + + /** + * Get one side or the other of an aliased SQL field name. + * + * @param string $name SQL field + * @param string $type Which part to get: `alias` (default) or `orig`. + * @returns string Alias + * @private + */ + private function _alias ( $name, $type='alias' ) + { + if ( stripos( $name, ' as ' ) !== false ) { + $a = preg_split( '/ as /i', $name ); + return $type === 'alias' ? + $a[1] : + $a[0]; + } + + if ( stripos( $name, ' ' ) !== false ) { + $a = preg_split( '/ /i', $name ); + return $type === 'alias' ? + $a[1] : + $a[0]; + } + + return $name; + } + + + /** + * Get part of an SQL field definition regardless of how deeply defined it + * is + * + * @param string $name SQL field + * @param string $type Which part to get: `table` (default) or `db` or + * `column` + * @return string Part name + * @private + */ + private function _part ( $name, $type='table' ) + { + $db = null; + $table = null; + $column = null; + + if ( strpos( $name, '.' ) !== false ) { + $a = explode( '.', $name ); + + if ( count($a) === 3 ) { + $db = $a[0]; + $table = $a[1]; + $column = $a[2]; + } + else if ( count($a) === 2 ) { + $table = $a[0]; + $column = $a[1]; + } + } + else { + $column = $name; + } + + if ( $type === 'db' ) { + return $db; + } + else if ( $type === 'table' ) { + return $table; + } + return $column; + } + + + /** + * Trigger an event + * + * @private + */ + private function _trigger ( $eventName, &$arg1=null, &$arg2=null, &$arg3=null, &$arg4=null, &$arg5=null ) + { + $out = null; + $argc = func_num_args(); + $args = array( $this ); + + // Hack to enable pass by reference with a "variable" number of parameters + for ( $i=1 ; $i<$argc ; $i++ ) { + $name = 'arg'.$i; + $args[] = &$$name; + } + + if ( ! isset( $this->_events[ $eventName ] ) ) { + return; + } + + $events = $this->_events[ $eventName ]; + + for ( $i=0, $ien=count($events) ; $i<$ien ; $i++ ) { + $res = call_user_func_array( $events[$i], $args ); + + if ( $res !== null ) { + $out = $res; + } + } + + return $out; + } + + + /** + * Merge a primary key value with an updated data source. + * + * @param string $pkeyVal Old primary key value to merge into + * @param array $row Data source for update + * @return string Merged value + */ + private function _pkey_submit_merge ( $pkeyVal, $row ) + { + $pkey = $this->_pkey; + $arr = $this->pkeyToArray( $pkeyVal, true ); + + for ( $i=0, $ien=count($pkey) ; $i<$ien ; $i++ ) { + $column = $pkey[ $i ]; + $field = $this->_find_field( $column, 'db' ); + + if ( $field && $field->apply( 'edit', $row ) ) { + $arr[ $column ] = $field->val( 'set', $row ); + } + } + + return $this->pkeyToValue( $arr, true ); + } + + + /** + * Validate that all primary key fields have values for create. + * + * @param array $row Row's data + * @return boolean `true` if valid, `false` otherwise + */ + private function _pkey_validate_insert ( $row ) + { + $pkey = $this->_pkey; + + if ( count( $pkey ) === 1 ) { + return true; + } + + for ( $i=0, $ien=count($pkey) ; $i<$ien ; $i++ ) { + $column = $pkey[ $i ]; + $field = $this->_find_field( $column, 'db' ); + + if ( ! $field || ! $field->apply("create", $row) ) { + throw new \Exception( "When inserting into a compound key table, ". + "all fields that are part of the compound key must be ". + "submitted with a specific value.", 1 + ); + } + } + + return true; + } + + + /** + * Create the separator value for a compound primary key. + * + * @return string Calculated separator + */ + private function _pkey_separator () + { + $str = implode(',', $this->_pkey); + + return hash( 'crc32', $str ); + } + + private function _read_table () + { + return count($this->_readTableNames) ? + $this->_readTableNames : + $this->_table; + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/Editor/Field.php b/ci4/app/ThirdParty/DatatablesEditor/Editor/Field.php new file mode 100644 index 00000000..5a023f6d --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Editor/Field.php @@ -0,0 +1,961 @@ +field()} and + * {@see Join->field()} methods to describe what fields should be interacted + * with by the editable table. + * + * @example + * Simply get a column with the name "city". No validation is performed. + * ```php + * Field::inst( 'city' ) + * ``` + * + * @example + * Get a column with the name "first_name" - when edited a value must + * be given due to the "required" validation from the {@see Validate} class. + * ```php + * Field::inst( 'first_name' )->validator( 'Validate::required' ) + * ``` + * + * @example + * Working with a date field, which is validated, and also has *get* and + * *set* formatters. + * ```php + * Field::inst( 'registered_date' ) + * ->validator( 'Validate::dateFormat', 'D, d M y' ) + * ->getFormatter( 'Format::date_sql_to_format', 'D, d M y' ) + * ->setFormatter( 'Format::date_format_to_sql', 'D, d M y' ) + * ``` + * + * @example + * Using an alias in the first parameter + * ```php + * Field::inst( 'name.first as first_name' ) + * ``` + */ +class Field extends DataTables\Ext { + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Statics + */ + + /** Set option flag (`set()`) - do not set data */ + const SET_NONE = 'none'; + + /** Set option flag (`set()`) - write to database on both create and edit */ + const SET_BOTH = 'both'; + + /** Set option flag (`set()`) - write to database only on create */ + const SET_CREATE = 'create'; + + /** Set option flag (`set()`) - write to database only on edit */ + const SET_EDIT = 'edit'; + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Constructor + */ + + /** + * Field instance constructor. + * @param string $dbField Name of the database column + * @param string $name Name to use in the JSON output from Editor and the + * HTTP submit from the client-side when editing. If not given then the + * $dbField name is used. + */ + function __construct( $dbField=null, $name=null ) + { + if ( $dbField !== null && $name === null ) { + // Allow just a single parameter to be passed - each can be + // overridden if needed later using the API. + $this->name( $dbField ); + $this->dbField( $dbField ); + } + else { + $this->name( $name ); + $this->dbField( $dbField ); + } + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private parameters + */ + + /** @var string */ + private $_dbField = null; + + /** @var boolean */ + private $_get = true; + + /** @var mixed */ + private $_getFormatter = null; + + /** @var mixed */ + private $_getFormatterOpts = null; + + /** @var mixed */ + private $_getValue = null; + + /** @var Options */ + private $_opts = null; + + /** @var SearchPaneOptions */ + private $_spopts = null; + + /** @var SearchBuilderOptions */ + private $_sbopts = null; + + /** @var callable */ + private $_optsFn = null; + + /** @var callable */ + private $_spoptsFn = null; + + /** @var callable */ + private $_sboptsFn = null; + + /** @var string */ + private $_name = null; + + /** @var string */ + private $_set = Field::SET_BOTH; + + /** @var mixed */ + private $_setFormatter = null; + + /** @var mixed */ + private $_setFormatterOpts = null; + + /** @var mixed */ + private $_setValue = null; + + /** @var mixed */ + private $_validator = array(); + + /** @var Upload */ + private $_upload = null; + + /** @var callable */ + private $_xss = null; + + /** @var boolean */ + private $_xssFormat = true; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + + /** + * Get / set the DB field name. + * + * Note that when used as a setter, an alias can be given for the field + * using the SQL `as` keyword - for example: `firstName as name`. In this + * situation the dbField is set to the field name before the `as`, and the + * field's name (`name()`) is set to the name after the ` as `. + * + * As a result of this, the following constructs have identical + * functionality: + * + * Field::inst( 'firstName as name' ); + * Field::inst( 'firstName', 'name' ); + * + * @param string $_ Value to set if using as a setter. + * @return string|self The name of the db field if no parameter is given, + * or self if used as a setter. + */ + public function dbField ( $_=null ) + { + if ( $_ === null ) { + return $this->_dbField; + } + + // Don't split on an `as` inside paraenthesis + $a = preg_split( '/ as (?![^\(]*\))/i', $_ ); + if ( count($a) > 1 ) { + $this->_dbField = trim( $a[0] ); + $this->_name = trim( $a[1] ); + } + else { + $this->_dbField = $_; + } + + return $this; + } + + + /** + * Get / set the 'get' property of the field. + * + * A field can be marked as write only when setting the get property to false + * here. + * @param boolean $_ Value to set if using as a setter. + * @return boolean|self The get property if no parameter is given, or self + * if used as a setter. + */ + public function get ( $_=null ) + { + return $this->_getSet( $this->_get, $_ ); + } + + + /** + * Get formatter for the field's data. + * + * When the data has been retrieved from the server, it can be passed through + * a formatter here, which will manipulate (format) the data as required. This + * can be useful when, for example, working with dates and a particular format + * is required on the client-side. + * + * Editor has a number of formatters available with the {@see Format} class + * which can be used directly with this method. + * @param callable|string $_ Value to set if using as a setter. Can be given as + * a closure function or a string with a reference to a function that will + * be called with call_user_func(). + * @param mixed $opts Variable that is passed through to the get formatting + * function - can be useful for passing through extra information such as + * date formatting string, or a required flag. The actual options available + * depend upon the formatter used. + * @return callable|string|self The get formatter if no parameter is given, or + * self if used as a setter. + */ + public function getFormatter ( $_=null, $opts=null ) + { + if ( $opts !== null ) { + $this->_getFormatterOpts = $opts; + } + return $this->_getSet( $this->_getFormatter, $_ ); + } + + + /** + * Get / set a get value. If given, then this value is used to send to the + * client-side, regardless of what value is held by the database. + * + * @param callable|string|number $_ Value to set, or no value to use as a + * getter + * @return callable|string|self Value if used as a getter, or self if used + * as a setter. + */ + public function getValue ( $_=null ) + { + return $this->_getSet( $this->_getValue, $_ ); + } + + + /** + * Get / set the 'name' property of the field. + * + * The name is typically the same as the dbField name, since it makes things + * less confusing(!), but it is possible to set a different name for the data + * which is used in the JSON returned to DataTables in a 'get' operation and + * the field name used in a 'set' operation. + * @param string $_ Value to set if using as a setter. + * @return string|self The name property if no parameter is given, or self + * if used as a setter. + */ + public function name ( $_=null ) + { + return $this->_getSet( $this->_name, $_ ); + } + + + /** + * Get a list of values that can be used for the options list in radio, + * select and checkbox inputs from the database for this field. + * + * Note that this is for simple 'label / value' pairs only. For more complex + * data, including pairs that require joins and where conditions, use a + * closure to provide a query + * + * @param string|callable $table Database table name to use to get the + * paired data from, or a closure function if providing a method + * @param string $value Table column name that contains the pair's + * value. Not used if the first parameter is given as a closure + * @param string $label Table column name that contains the pair's + * label. Not used if the first parameter is given as a closure + * @param callable $condition Function that will add `where` + * conditions to the query + * @param callable $format Function will render each label + * @param string $order SQL ordering + * @return Field Self for chaining + */ + public function options ( $table=null, $value=null, $label=null, $condition=null, $format=null, $order=null ) + { + if ( $table === null ) { + return $this->_opts; + } + + // Overloads for backwards compatibility + if ( is_a( $table, '\DataTables\Editor\Options' ) ) { + // Options class + $this->_optsFn = null; + $this->_opts = $table; + } + else if ( is_callable($table) && is_object($table) ) { + // Function + $this->_opts = null; + $this->_optsFn = $table; + } + else { + $this->_optsFn = null; + $this->_opts = Options::inst() + ->table( $table ) + ->value( $value ) + ->label( $label ); + + if ( $condition ) { + $this->_opts->where( $condition ); + } + + if ( $format ) { + $this->_opts->render( $format ); + } + + if ( $order ) { + $this->_opts->order( $order ); + } + } + + return $this; + } + + /** + * Get a list of values that can be used for the options list in SearchPanes + * + * @param SearchPaneOptions|callable $spInput SearchPaneOptions instance or a closure function if providing a method + * @return self + */ + public function searchPaneOptions ( $spInput=null ) + { + if ( $spInput === null ) { + return $this->_spopts; + } + + // Overloads for backwards compatibility + if ( is_a( $spInput, '\DataTables\Editor\SearchPaneOptions' ) ) { + // Options class + $this->_spoptsFn = null; + $this->_spopts = $spInput; + } + else if ( is_callable($spInput) && is_object($spInput) ) { + // Function + $this->_spopts = null; + $this->_spoptsFn = $spInput; + } + + return $this; + } + + /** + * Get a list of values that can be used for the options list in SearchBuilder + * + * @param SearchBuilderOptions|callable $sbInput SearchBuilderOptions instance or a closure function if providing a method + * @return self + */ + public function searchBuilderOptions ( $sbInput=null ) + { + if ( $sbInput === null ) { + return $this->_sbopts; + } + + // Overloads for backwards compatibility + if ( is_a( $sbInput, '\DataTables\Editor\SearchBuilderOptions' ) ) { + // Options class + $this->_sboptsFn = null; + $this->_sbopts = $sbInput; + } + else if ( is_callable($sbInput) && is_object($sbInput) ) { + // Function + $this->_sbopts = null; + $this->_sboptsFn = $sbInput; + } + + return $this; + } + + + + /** + * Get / set the 'set' property of the field. + * + * A field can be marked as read only using this option, to be set only + * during an create or edit action or to be set during both actions. This + * provides the ability to have fields that are only set when a new row is + * created (for example a "created" time stamp). + * @param string|boolean $_ Value to set when the method is being used as a + * setter (leave as undefined to use as a getter). This can take the + * value of: + * + * * `true` - Same as `Field::SET_BOTH` + * * `false` - Same as `Field::SET_NONE` + * * `Field::SET_BOTH` - Set the database value on both create and edit commands + * * `Field::SET_NONE` - Never set the database value + * * `Field::SET_CREATE` - Set the database value only on create + * * `Field::SET_EDIT` - Set the database value only on edit + * @return string|self The set property if no parameter is given, or self + * if used as a setter. + */ + public function set ( $_=null ) + { + if ( $_ === true ) { + $_ = Field::SET_BOTH; + } + else if ( $_ === false ) { + $_ = Field::SET_NONE; + } + + return $this->_getSet( $this->_set, $_ ); + } + + + /** + * Set formatter for the field's data. + * + * When the data has been retrieved from the server, it can be passed through + * a formatter here, which will manipulate (format) the data as required. This + * can be useful when, for example, working with dates and a particular format + * is required on the client-side. + * + * Editor has a number of formatters available with the {@see Format} class + * which can be used directly with this method. + * @param callable|string $_ Value to set if using as a setter. Can be given as + * a closure function or a string with a reference to a function that will + * be called with call_user_func(). + * @param mixed $opts Variable that is passed through to the get formatting + * function - can be useful for passing through extra information such as + * date formatting string, or a required flag. The actual options available + * depend upon the formatter used. + * @return callable|string|self The set formatter if no parameter is given, or + * self if used as a setter. + */ + public function setFormatter ( $_=null, $opts=null ) + { + if ( $opts !== null ) { + $this->_setFormatterOpts = $opts; + } + return $this->_getSet( $this->_setFormatter, $_ ); + } + + + /** + * Get / set a set value. If given, then this value is used to write to the + * database regardless of what data is sent from the client-side. + * + * @param callable|string|number $_ Value to set, or no value to use as a + * getter + * @return callable|string|self Value if used as a getter, or self if used + * as a setter. + */ + public function setValue ( $_=null ) + { + return $this->_getSet( $this->_setValue, $_ ); + } + + + /** + * Get / set the upload class for this field. + * @param Upload $_ Upload class if used as a setter + * @return Upload|self Value if used as a getter, or self if used + * as a setter. + */ + public function upload ( $_=null ) + { + return $this->_getSet( $this->_upload, $_ ); + } + + + /** + * Get / set the 'validator' of the field. + * + * The validator can be used to check if any abstract piece of data is valid + * or not according to the given rules of the validation function used. + * + * Multiple validation options can be applied to a field instance by calling + * this method multiple times. For example, it would be possible to have a + * 'required' validation and a 'maxLength' validation with multiple calls. + * + * Editor has a number of validation available with the {@see Validate} class + * which can be used directly with this method. + * @param callable|string $_ Value to set if using as the validation method. + * Can be given as a closure function or a string with a reference to a + * function that will be called with call_user_func(). + * @param mixed $opts Variable that is passed through to the validation + * function - can be useful for passing through extra information such as + * date formatting string, or a required flag. The actual options available + * depend upon the validation function used. + * @return callable|string|self The validation method if no parameter is given, + * or self if used as a setter. + */ + public function validator ( $_=null, $opts=null ) + { + if ( $_ === null ) { + return $this->_validator; + } + else { + $this->_validator[] = array( + "func" => $_, + "opts" => $opts + ); + } + + return $this; + } + + + /** + * Set a formatting method that will be used for XSS checking / removal. + * This should be a function that takes a single argument (the value to be + * cleaned) and returns the cleaned value. + * + * Editor will use HtmLawed by default for this operation, which is built + * into the software and no additional configuration is required, but a + * custom function can be used if you wish to use a different formatter such + * as HTMLPurifier. + * + * If you wish to disable this option (which you would only do if you are + * absolutely confident that your validation will pick up on any XSS inputs) + * simply provide a closure function that returns the value given to the + * function. This is _not_ recommended. + * + * @param callable|false $xssFormatter XSS cleaner function, use `false` or + * `null` to disable XSS cleaning. + * @return Field Self for chaining. + */ + public function xss ( $xssFormatter ) + { + if ( $xssFormatter === true || $xssFormatter === false || $xssFormatter === null ) { + $this->_xssFormat = $xssFormatter; + } + else { + $this->_xss = $xssFormatter; + } + + return $this; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Internal methods + * Used by the Editor class and not generally for public use + */ + + /** + * Check to see if a field should be used for a particular action (get or set). + * + * Called by the Editor / Join class instances - not expected for general + * consumption - internal. + * @param string $action Direction that the data is travelling - 'get' is + * reading DB data, `create` and `edit` for writing to the DB + * @param array $data Data submitted from the client-side when setting. + * @return boolean true if the field should be used in the get / set. + * @internal + */ + public function apply ( $action, $data=null ) + { + if ( $action === 'get' ) { + // Get action - can we get this field + return $this->_get; + } + else { + // Note that validation must be done on input data before we get here + + // Create or edit action, are we configured to use this field + if ( $action === 'create' && + ($this->_set === Field::SET_NONE || $this->_set === Field::SET_EDIT) + ) { + return false; + } + else if ( $action === 'edit' && + ($this->_set === Field::SET_NONE || $this->_set === Field::SET_CREATE) + ) { + return false; + } + + // Check it was in the submitted data. If not, then not required + // (validation would have failed if it was) and therefore we don't + // set it. Check for a value as well, as it can format data from + // some other source + if ( $this->_setValue === null && ! $this->_inData( $this->name(), $data ) ) { + return false; + } + + // In the data set, so use it + return true; + } + } + + + /** + * Execute the ipOpts to get the list of options to return to the client- + * side + * + * @param \DataTables\Database $db Database instance + * @return Array Array of value / label options for the list + * @internal + */ + public function optionsExec ( $db ) + { + if ( $this->_optsFn ) { + $fn = $this->_optsFn; + return $fn($db); + } + else if ( $this->_opts ) { + return $this->_opts->exec( $db ); + } + + return false; + } + + /** + * Execute the spopts to get the list of options for SearchPanes to return + * to the client-side + * + * @param DataTables\Field $field The field to retrieve the data from + * @param DataTables\Editor $editor The editor instance + * @param DataTables\DTRequest $http The http request sent to the server + * @param DataTables\Field[] $fields All of the fields + * @param any $leftJoin Info for a leftJoin if required + * @return Promise | boolean + * @internal + */ + public function searchPaneOptionsExec ( $field, $editor, $http, $fields, $leftJoin) + { + if ( $this->_spoptsFn ) { + $fn = $this->_spoptsFn; + return $fn($editor->db(), $editor); + } + else if ( $this->_spopts ) { + return $this->_spopts->exec( $field, $editor, $http, $fields, $leftJoin ); + } + + return false; + } + + /** + * Execute the spopts to get the list of options for SearchBuilder to return + * to the client-side + * + * @param DataTables\Field $field The field to retrieve the data from + * @param DataTables\Editor $editor The editor instance + * @param DataTables\DTRequest $http The http request sent to the server + * @param DataTables\Field[] $fields All of the fields + * @param any $leftJoin Info for a leftJoin if required + * @return Promise | boolean + * @internal + */ + public function searchBuilderOptionsExec ( $field, $editor, $http, $fields, $leftJoin) + { + if ( $this->_sboptsFn ) { + $fn = $this->_sboptsFn; + return $fn($editor->db(), $editor); + } + else if ( $this->_sbopts ) { + return $this->_sbopts->exec( $field, $editor, $http, $fields, $leftJoin ); + } + + return false; + } + + + /** + * Get the value of the field, taking into account if it is coming from the + * DB or from a POST. If formatting has been specified for this field, it + * will be applied here. + * + * Called by the Editor / Join class instances - not expected for general + * consumption - internal. + * @param string $direction Direction that the data is travelling - 'get' is + * reading data, and 'set' is writing it to the DB. + * @param array $data Data submitted from the client-side when setting or the + * data for the row when getting data from the DB. + * @return string Value for the field + * @internal + */ + public function val ( $direction, $data ) + { + if ( $direction === 'get' ) { + if ( $this->_getValue !== null ) { + $val = $this->_getAssignedValue( $this->_getValue ); + } + else { + // Getting data, so the db field name + $val = isset( $data[ $this->_dbField ] ) ? + $data[ $this->_dbField ] : + null; + } + + return $this->_format( + $val, $data, $this->_getFormatter, $this->_getFormatterOpts + ); + } + else { + // Sanity check that we aren't operating on a function + if ( strpos( $this->dbField(), '(' ) !== false ) { + throw new \Exception('Cannot set the value for an SQL function field. These fields are read only: ' . $this->name()); + } + + // Setting data, so using from the payload (POST usually) and thus + // use the 'name' + $val = $this->_setValue !== null ? + $this->_getAssignedValue( $this->_setValue ) : + $this->_readProp( $this->name(), $data ); + + // XSS removal / checker + if ( $this->_xssFormat && $val ) { + $val = $this->xssSafety( $val ); + } + + return $this->_format( + $val, $data, $this->_setFormatter, $this->_setFormatterOpts + ); + } + } + + + /** + * Check the validity of the field based on the data submitted. Note that + * this validation is performed on the wire data - i.e. that which is + * submitted, before any setFormatter is run + * + * Called by the Editor / Join class instances - not expected for general + * consumption - internal. + * + * @param array $data Data submitted from the client-side + * @param Editor $editor Editor instance + * @param mixed $id Row id that is being validated + * @return boolean|string `true` if valid, string with error message if not + * @internal + */ + public function validate ( $data, $editor, $id=null ) + { + // Three cases for the validator - closure, string or null + if ( ! count( $this->_validator ) ) { + return true; + } + + // Value could be from user data, or setValue might take priority + $val = $this->_setValue !== null ? + $this->_getAssignedValue( $this->_setValue ) : + $this->_readProp( $this->name(), $data ); + + $processData = $editor->inData(); + $instances = array( + 'action' => $processData['action'], + 'id' => $id, + 'field' => $this, + 'editor' => $editor, + 'db' => $editor->db() + ); + + for ( $i=0, $ien=count( $this->_validator ) ; $i<$ien ; $i++ ) { + $validator = $this->_validator[$i]; + + // Backwards compatibility + if ( is_string( $validator['func'] ) ) { + if ( strpos($validator['func'], "Validate::") === 0 ) { + $a = explode("::", $validator['func']); + + // Validate class static methods - they have `Legacy` counter parts that + // convert from the old style to the new so the old style options still work. + if ( method_exists( "\\DataTables\\Editor\\".$a[0], $a[1].'Legacy' ) ) { + $func = call_user_func( "\\DataTables\\Editor\\".$validator['func'].'Legacy', $validator['opts'] ); + $res = call_user_func( $func, $val, $data, $this, $instances ); + } + else { + // User style legacy function. Call it directly + $func = "\\DataTables\\Editor\\".$validator['func']; + $res = call_user_func( $func, $val, $data, $this, $instances ); + } + } + else { + // And for cases where a string was used to point to a function, + // which was not in the Validate class + $res = call_user_func( $validator['func'], $val, $data, $validator['opts'], $instances ); + } + } + else { + $func = $validator['func']; + $res = $func( $val, $data, $this, $instances ); + } + + // Check if there was a validation error and if so, return it + if ( $res !== true ) { + return $res; + } + } + + // Validation methods all run, must be valid + return true; + } + + + /** + * Write the value for this field to the output array for a read operation + * + * @param array $out Row output data (to the JSON) + * @param mixed $srcData Row input data (raw, from the database) + * @internal + */ + public function write( &$out, $srcData ) + { + $this->_writeProp( $out, $this->name(), $this->val('get', $srcData) ); + } + + + /** + * Perform XSS prevention on an input. + * + * @param mixed $val Value to be escaped + * @return string Safe value + */ + public function xssSafety ( $val ) { + $xss = $this->_xss; + + if ( is_array( $val ) ) { + $res = array(); + + foreach ( $val as $individual ) { + $res[] = $xss ? + $xss( $individual ) : + Htmlaw::filter( $individual ); + } + + return $res; + } + + return $xss ? + $xss( $val ) : + Htmlaw::filter( $val ); + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private methods + */ + + /** + * Apply a formatter to data. The caller will decide what formatter to apply + * (get or set) + * + * @param mixed $val Value to be formatted + * @param mixed $data Full row data + * @param callable $formatter Formatting function to be called + * @param array $opts Array of options to be passed to the formatter + * @return mixed Formatted value + */ + private function _format( $val, $data, $formatter, $opts ) + { + // Three cases for the formatter - closure, string or null + if ( ! $formatter ) { + return $val; + } + + if ( ! is_string( $formatter ) ) { + return $formatter( $val, $data, $opts ); + } + + // Backwards compatibility - strings will not be supported in v2 + if ( strpos($formatter, "Format::") === 0 ) { + $a = explode( '::', $formatter ); + + // Old style Editor formatter - use the legacy functions to + // convert to the new style + if ( method_exists( "\\DataTables\\Editor\\".$a[0], $a[1].'Legacy' ) ) { + $func = call_user_func( "\\DataTables\\Editor\\".$formatter.'Legacy', $opts ); + + return $func( $val, $data ); + } + else { + // User added old style methods + return call_user_func( "\\DataTables\\Editor\\".$formatter, $val, $data, $opts ); + } + } + + // User function (string identifier) + return call_user_func( $formatter, $val, $data, $opts ); + } + + /** + * Get the value from `_[gs]etValue` - taking into account if it is callable + * function or not + * + * @param mixed $val Value to be evaluated + * @return mixed Value assigned, or returned from the function + */ + private function _getAssignedValue ( $val ) + { + return is_callable($val) && is_object($val) ? + $val() : + $val; + } + + /** + * Check is a parameter is in the submitted data set. This is functionally + * the same as the `_readProp()` method, but in this case a binary value + * is required to indicate if the value is present or not. + * + * @param string $name Javascript dotted object name to write to + * @param array $data Data source array to read from + * @return boolean `true` if present, `false` otherwise + * @private + */ + private function _inData ( $name, $data ) + { + if ( strpos($name, '.') === false ) { + return isset( $data[ $name ] ) ? + true : + false; + } + + $names = explode( '.', $name ); + $inner = $data; + + for ( $i=0 ; $ijoin()} to allow Editor to + * obtain joined information from the database. + * + * For an overview of how Join tables work, please refer to the + * {@link https://editor.datatables.net/manual/php/ Editor manual} as it is + * useful to understand how this class represents the links between tables, + * before fully getting to grips with it's API. + * + * @example + * Join the parent table (the one specified in the {@see Editor->table()} + * method) with the table *access*, with a link table *user__access*, which + * allows multiple properties to be found for each row in the parent table. + * ```php + * Join::inst( 'access', 'array' ) + * ->link( 'users.id', 'user_access.user_id' ) + * ->link( 'access.id', 'user_access.access_id' ) + * ->field( + * Field::inst( 'id' )->validator( 'Validate::required' ), + * Field::inst( 'name' ) + * ) + * ``` + * + * @example + * Single row join - here we join the parent table with a single row in + * the child table, without an intermediate link table. In this case the + * child table is called *extra* and the two fields give the columns that + * Editor will read from that table. + * ```php + * Join::inst( 'extra', 'object' ) + * ->link( 'user.id', 'extra.user_id' ) + * ->field( + * Field::inst( 'comments' ), + * Field::inst( 'review' ) + * ) + * ``` + */ +class Join extends DataTables\Ext { + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Constructor + */ + + /** + * Join instance constructor. + * @param string $table Table name to get the joined data from. + * @param string $type Work with a single result ('object') or an array of + * results ('array') for the join. + */ + function __construct( $table=null, $type='object' ) + { + $this->table( $table ); + $this->type( $type ); + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + /** @var DataTables\Editor\Field[] */ + private $_fields = array(); + + /** @var array */ + private $_join = array( + "parent" => null, + "child" => null, + "table" => null + ); + + /** @var array */ + private $_leftJoin = array(); + + /** @var string */ + private $_table = null; + + /** @var string */ + private $_type = null; + + /** @var string */ + private $_name = null; + + /** @var boolean */ + private $_get = true; + + /** @var boolean */ + private $_set = true; + + /** @var string */ + private $_aliasParentTable = null; + + /** @var array */ + private $_where = array(); + + /** @var boolean */ + private $_whereSet = false; + + /** @var array */ + private $_links = array(); + + /** @var string */ + private $_customOrder = null; + + /** @var callable[] */ + private $_validators = array(); + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + /** + * Get / set parent table alias. + * + * When working with a self referencing table (i.e. a column in the table contains + * a primary key value from its own table) it can be useful to set an alias on the + * parent table's name, allowing a self referencing Join. For example: + * ``` + * SELECT p2.publisher + * FROM publisher as p2 + * JOIN publisher on (publisher.idPublisher = p2.idPublisher) + * ``` + * Where, in this case, `publisher` is the table that is used by the Editor instance, + * and you want to use `Join` to link back to the table (resolving a name for example). + * This method allows that alias to be set. Fields can then use standard SQL notation + * to select a field, for example `p2.publisher` or `publisher.publisher`. + * @param string $_ Table alias to use + * @return string|self Table alias set (which is null by default), or self if used as + * a setter. + */ + public function aliasParentTable ( $_=null ) + { + return $this->_getSet( $this->_aliasParentTable, $_ ); + } + + + /** + * Get / set field instances. + * + * The list of fields designates which columns in the table that will be read + * from the joined table. + * @param Field $_... Instances of the {@see Field} class, given as a single + * instance of {@see Field}, an array of {@see Field} instances, or multiple + * {@see Field} instance parameters for the function. + * @return Field[]|self Array of fields, or self if used as a setter. + * @see {@see Field} for field documentation. + */ + public function field ( $_=null ) + { + $args = func_get_args(); + + if ( $_ !== null && !is_array($_) ) { + $_ = $args; + } + return $this->_getSet( $this->_fields, $_, true ); + } + + + /** + * Get / set field instances. + * + * An alias of {@see field}, for convenience. + * @param Field $_... Instances of the {@see Field} class, given as a single + * instance of {@see Field}, an array of {@see Field} instances, or multiple + * {@see Field} instance parameters for the function. + * @return Field[]|self Array of fields, or self if used as a setter. + * @see {@see Field} for field documentation. + */ + public function fields ( $_=null ) + { + $args = func_get_args(); + + if ( $_ !== null && !is_array($_) ) { + $_ = $args; + } + return $this->_getSet( $this->_fields, $_, true ); + } + + + /** + * Get / set get attribute. + * + * When set to false no read operations will occur on the join tables. + * @param boolean $_ Value + * @return boolean|self Name + */ + public function get ( $_=null ) + { + return $this->_getSet( $this->_get, $_ ); + } + + + /** + * Get / set join properties. + * + * Define how the SQL will be performed, on what columns. There are + * basically two types of join that are supported by Editor here, a direct + * foreign key reference in the join table to the parent table's primary + * key, or a link table that contains just primary keys for the parent and + * child tables (this approach is usually used with a {@see Join->type()} of + * 'array' since you can often have multiple links between the two tables, + * while a direct foreign key reference will typically use a type of + * 'object' (i.e. a single entry). + * + * @param string|string[] $parent Parent table's primary key names. If used + * with a link table (i.e. third parameter to this method is given, then + * an array should be used, with the first element being the pkey's name + * in the parent table, and the second element being the key's name in + * the link table. + * @param string|string[] $child Child table's primary key names. If used + * with a link table (i.e. third parameter to this method is given, then + * an array should be used, with the first element being the pkey's name + * in the child table, and the second element being the key's name in the + * link table. + * @param string $table Join table name, if using a link table + * @returns Join This for chaining + * @deprecated 1.5 Please use the {@see Join->link()} method rather than this + * method now. + */ + public function join ( $parent=null, $child=null, $table=null ) + { + if ( $parent === null && $child === null ) { + return $this->_join; + } + + $this->_join['parent'] = $parent; + $this->_join['child'] = $child; + $this->_join['table'] = $table; + return $this; + } + + + /** + * Set up a left join operation for the Mjoined data + * + * @param string $table to get the information from + * @param string $field1 the first field to get the information from + * @param string $operator the operation to perform on the two fields + * @param string $field2 the second field to get the information from + * @return self + */ + public function leftJoin ( $table, $field1, $operator, $field2 ) + { + $this->_leftJoin[] = array( + "table" => $table, + "field1" => $field1, + "field2" => $field2, + "operator" => $operator + ); + + return $this; + } + + + /** + * Create a join link between two tables. The order of the fields does not + * matter, but each field must contain the table name as well as the field + * name. + * + * This method can be called a maximum of two times for an Mjoin instance: + * + * * First time, creates a link between the Editor host table and a join + * table + * * Second time creates the links required for a link table. + * + * Please refer to the Editor Mjoin documentation for further details: + * https://editor.datatables.net/manual/php + * + * @param string $field1 Table and field name + * @param string $field2 Table and field name + * @return Join Self for chaining + * @throws \Exception Link limitations + */ + public function link ( $field1, $field2 ) + { + if ( strpos($field1, '.') === false || strpos($field2, '.') === false ) { + throw new \Exception("Link fields must contain both the table name and the column name"); + } + + if ( count( $this->_links ) >= 4 ) { + throw new \Exception("Link method cannot be called more than twice for a single instance"); + } + + $this->_links[] = $field1; + $this->_links[] = $field2; + + return $this; + } + + + /** + * Specify the property that the data will be sorted by. + * + * @param string $order SQL column name to order the data by + * @return Join Self for chaining + */ + public function order ( $_=null ) + { + // How this works is by setting the SQL order by clause, and since the + // join that is done in PHP is always done sequentially, the order is + // retained. + return $this->_getSet( $this->_customOrder, $_ ); + } + + + /** + * Get / set name. + * + * The `name` of the Join is the JSON property key that is used when + * 'getting' the data, and the HTTP property key (in a JSON style) when + * 'setting' data. Typically the name of the db table will be used here, + * but this method allows that to be overridden. + * @param string $_ Field name + * @return String|self Name + */ + public function name ( $_=null ) + { + return $this->_getSet( $this->_name, $_ ); + } + + + /** + * Get / set set attribute. + * + * When set to false no write operations will occur on the join tables. + * This can be useful when you want to display information which is joined, + * but want to only perform write operations on the parent table. + * @param boolean $_ Value + * @return boolean|self Name + */ + public function set ( $_=null ) + { + return $this->_getSet( $this->_set, $_ ); + } + + + /** + * Get / set join table name. + * + * Please note that this will also set the {@see Join->name()} used by the Join + * as well. This is for convenience as the JSON output / HTTP input will + * typically use the same name as the database name. If you want to set a + * custom name, the {@see Join->name()} method must be called ***after*** this one. + * @param string $_ Name of the table to read the join data from + * @return String|self Name of the join table, or self if used as a setter. + */ + public function table ( $_=null ) + { + if ( $_ !== null ) { + $this->_name = $_; + } + return $this->_getSet( $this->_table, $_ ); + } + + + /** + * Get / set the join type. + * + * The join type allows the data that is returned from the join to be given + * as an array (i.e. working with multiple possibly results for each record from + * the parent table), or as an object (i.e. working which one and only one result + * for each record form the parent table). + * @param string $_ Join type ('object') or an array of + * results ('array') for the join. + * @return String|self Join type, or self if used as a setter. + */ + public function type ( $_=null ) + { + return $this->_getSet( $this->_type, $_ ); + } + + + /** + * Set a validator for the array of data (not on a field basis) + * + * @param string $fieldName Name of the field that any error should be shown + * against on the client-side + * @param callable $fn Callback function for validation + * @return self Chainable + */ + public function validator ( $fieldName, $fn ) + { + $this->_validators[] = array( + 'fieldName' => $fieldName, + 'fn' => $fn + ); + + return $this; + } + + + /** + * Where condition to add to the query used to get data from the database. + * Note that this is applied to the child table. + * + * Can be used in two different ways: + * + * * Simple case: `where( field, value, operator )` + * * Complex: `where( fn )` + * + * @param string|callable $key Single field name or a closure function + * @param string|string[] $value Single field value, or an array of values. + * @param string $op Condition operator: <, >, = etc + * @return string[]|self Where condition array, or self if used as a setter. + */ + public function where ( $key=null, $value=null, $op='=' ) + { + if ( $key === null ) { + return $this->_where; + } + + if ( is_callable($key) && is_object($key) ) { + $this->_where[] = $key; + } + else { + $this->_where[] = array( + "key" => $key, + "value" => $value, + "op" => $op + ); + } + + return $this; + } + + + /** + * Get / set if the WHERE conditions should be included in the create and + * edit actions. + * + * This means that the fields which have been used as part of the 'get' + * WHERE condition (using the `where()` method) will be set as the values + * given. + * + * This is default false (i.e. they are not included). + * + * @param boolean $_ Include (`true`), or not (`false`) + * @return boolean Current value + */ + public function whereSet ( $_=null ) + { + return $this->_getSet( $this->_whereSet, $_ ); + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Internal methods + */ + + /** + * Get data + * @param Editor $editor Host Editor instance + * @param string[] $data Data from the parent table's get and were we need + * to add out output. + * @param array $options options array for fields + * @internal + */ + public function data( $editor, &$data, &$options ) + { + if ( ! $this->_get ) { + return; + } + + $this->_prep( $editor ); + $db = $editor->db(); + $dteTable = $editor->table(); + $pkey = $editor->pkey(); + $idPrefix = $editor->idPrefix(); + + $dteTable = $dteTable[0]; + if ( strpos($dteTable, ' as ') !== false ) { + $arr = explode(' as ', $dteTable); + $dteTable = $arr[0]; + $this->_aliasParentTable = $arr[1]; + } + + $dteTableLocal = $this->_aliasParentTable ? // Can be aliased to allow a self join + $this->_aliasParentTable : + $dteTable; + $joinField = isset($this->_join['table']) ? + $this->_join['parent'][0] : + $this->_join['parent']; + + // This is something that will likely come in a future version, but it + // is a relatively low use feature. Please get in touch if this is + // something you require. + if ( count( $pkey ) > 1 ) { + throw new \Exception("MJoin is not currently supported with a compound primary key for the main table", 1); + } + + if ( count($data) > 0 ) { + $pkey = $pkey[0]; + $pkeyIsJoin = $pkey === $joinField || $pkey === $dteTableLocal.'.'.$joinField; + + // Set up the JOIN query + $stmt = $db + ->query( 'select' ) + ->distinct( true ) + ->get( $dteTableLocal.'.'.$joinField.' as dteditor_pkey' ) + ->get( $this->_fields('get') ) + ->table( $dteTable .' as '. $dteTableLocal ); + + if ( $this->order() ) { + $stmt->order( $this->order() ); + } + + $stmt->left_join($this->_leftJoin); + $this->_apply_where( $stmt ); + + if ( isset($this->_join['table']) ) { + // Working with a link table + $stmt + ->join( + $this->_join['table'], + $dteTableLocal.'.'.$this->_join['parent'][0] .' = '. $this->_join['table'].'.'.$this->_join['parent'][1] + ) + ->join( + $this->_table, + $this->_table.'.'.$this->_join['child'][0] .' = '. $this->_join['table'].'.'.$this->_join['child'][1] + ); + } + else { + // No link table in the middle + $stmt + ->join( + $this->_table, + $this->_table.'.'.$this->_join['child'] .' = '. $dteTableLocal.'.'.$this->_join['parent'] + ); + } + + // Check that the joining field is available. The joining key can + // come from the Editor instance's primary key, or any other field, + // including a nested value (from a left join). If the instance's + // pkey, then we've got that in the DT_RowId parameter, so we can + // use that. Otherwise, the key must be in the field list. + if ( $this->_propExists( $dteTable.'.'.$joinField, $data[0] ) ) { + $readField = $dteTable.'.'.$joinField; + } + else if ( $this->_propExists( $joinField, $data[0] ) ) { + $readField = $joinField; + } + else if ( ! $pkeyIsJoin ) { + echo json_encode( array( + "sError" => "Join was performed on the field '{$joinField}' which was not " + ."included in the Editor field list. The join field must be included " + ."as a regular field in the Editor instance." + ) ); + exit(0); + } + + // Get list of pkey values and apply as a WHERE IN condition + // This is primarily useful in server-side processing mode and when filtering + // the table as it means only a sub-set will be selected + // This is only applied for "sensible" data sets. It will just complicate + // matters for really large data sets: + // https://stackoverflow.com/questions/21178390/in-clause-limitation-in-sql-server + if ( count($data) < 1000 ) { + $whereIn = array(); + + for ( $i=0 ; $i_readProp( $readField, $data[$i] ); + } + + $stmt->where_in( $dteTableLocal.'.'.$joinField, $whereIn ); + } + + // Go! + $res = $stmt->exec(); + if ( ! $res ) { + return; + } + + // Map to primary key for fast lookup + $join = array(); + while ( $row=$res->fetch() ) { + $inner = array(); + + for ( $j=0 ; $j_fields) ; $j++ ) { + $field = $this->_fields[$j]; + if ( $field->apply('get') ) { + $field->write($inner, $row); + } + } + + if ( $this->_type === 'object' ) { + $join[ $row['dteditor_pkey'] ] = $inner; + } + else { + if ( !isset( $join[ $row['dteditor_pkey'] ] ) ) { + $join[ $row['dteditor_pkey'] ] = array(); + } + $join[ $row['dteditor_pkey'] ][] = $inner; + } + } + + // Loop over the data and do a join based on the data available + for ( $i=0 ; $i_readProp( $readField, $data[$i] ); + + if ( isset( $join[$rowPKey] ) ) { + $data[$i][ $this->_name ] = $join[$rowPKey]; + } + else { + $data[$i][ $this->_name ] = ($this->_type === 'object') ? + (object)array() : array(); + } + } + } + + // Field options + foreach ($this->_fields as $field) { + $opts = $field->optionsExec( $db ); + + if ( $opts !== false ) { + $name = $this->name(). + ($this->_type === 'object' ? '.' : '[].'). + $field->name(); + $options[ $name ] = $opts; + } + } + } + + + /** + * Create a row. + * @param Editor $editor Host Editor instance + * @param int $parentId Parent row's primary key value + * @param string[] $data Data to be set for the join + * @internal + */ + public function create ( $editor, $parentId, $data ) + { + // If not settable, or the many count for the join was not submitted + // there we do nothing + if ( + ! $this->_set || + ! isset($data[$this->_name]) || + ! isset($data[$this->_name.'-many-count']) + ) { + return; + } + + $this->_prep( $editor ); + $db = $editor->db(); + + if ( $this->_type === 'object' ) { + $this->_insert( $db, $parentId, $data[$this->_name] ); + } + else { + for ( $i=0 ; $i_name]) ; $i++ ) { + $this->_insert( $db, $parentId, $data[$this->_name][$i] ); + } + } + } + + + /** + * Update a row. + * @param Editor $editor Host Editor instance + * @param int $parentId Parent row's primary key value + * @param string[] $data Data to be set for the join + * @internal + */ + public function update ( $editor, $parentId, $data ) + { + // If not settable, or the many count for the join was not submitted + // there we do nothing + if ( ! $this->_set || ! isset($data[$this->_name.'-many-count']) ) { + return; + } + + $this->_prep( $editor ); + $db = $editor->db(); + + if ( $this->_type === 'object' ) { + // update or insert + $this->_update_row( $db, $parentId, $data[$this->_name] ); + } + else { + // WARNING - this will remove rows and then readd them. Any + // data not in the field list WILL BE LOST + // todo - is there a better way of doing this? + $this->remove( $editor, array($parentId) ); + $this->create( $editor, $parentId, $data ); + } + } + + + /** + * Delete rows + * @param Editor $editor Host Editor instance + * @param int[] $ids Parent row IDs to delete + * @internal + */ + public function remove ( $editor, $ids ) + { + if ( ! $this->_set ) { + return; + } + + $that = $this; + $this->_prep( $editor ); + $db = $editor->db(); + + if ( isset($this->_join['table']) ) { + $stmt = $db + ->query( 'delete' ) + ->table( $this->_join['table'] ) + ->or_where( $this->_join['parent'][1], $ids ) + ->exec(); + } + else { + $stmt = $db + ->query( 'delete' ) + ->table( $this->_table ) + ->where_group( function ( $q ) use ( $that, $ids ) { + $q->or_where( $that->_join['child'], $ids ); + } ); + + $this->_apply_where( $stmt ); + + $stmt->exec(); + } + } + + + /** + * Validate input data + * + * @param array $errors Errors array + * @param Editor $editor Editor instance + * @param string[] $data Data to validate + * @param string $action `create` or `edit` + * @internal + */ + public function validate ( &$errors, $editor, $data, $action ) + { + if ( ! $this->_set && ! isset($data[$this->_name.'-many-count']) ) { + return; + } + + $this->_prep( $editor ); + + $joinData = isset($data[$this->_name]) ? + $data[$this->_name] : + array(); + + for ( $i=0 ; $i_validators) ; $i++ ) { + $validator = $this->_validators[$i]; + $fn = $validator['fn']; + $res = $fn( $editor, $action, $joinData ); + + if ( is_string($res) ) { + $errors[] = array( + "name" => $validator['fieldName'], + "status" => $res + ); + } + } + + if ( $this->_type === 'object' ) { + $this->_validateFields( $errors, $editor, $joinData, $this->_name.'.' ); + } + else { + for ( $i=0 ; $i_validateFields( $errors, $editor, $joinData[$i], $this->_name.'[].' ); + } + } + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private methods + */ + + /** + * Add local WHERE condition to query + * @param \DataTables\Database\Query $query Query instance to apply the WHERE conditions to + * @private + */ + private function _apply_where ( $query ) + { + for ( $i=0 ; $i_where) ; $i++ ) { + if ( is_callable( $this->_where[$i] ) ) { + $this->_where[$i]( $query ); + } + else { + $query->where( + $this->_where[$i]['key'], + $this->_where[$i]['value'], + $this->_where[$i]['op'] + ); + } + } + } + + + /** + * Create a row. + * @param \DataTables\Database $db Database reference to use + * @param int $parentId Parent row's primary key value + * @param string[] $data Data to be set for the join + * @private + */ + private function _insert( $db, $parentId, $data ) + { + if ( isset($this->_join['table']) ) { + // Insert keys into the join table + $stmt = $db + ->query('insert') + ->table( $this->_join['table'] ) + ->set( $this->_join['parent'][1], $parentId ) + ->set( $this->_join['child'][1], $data[$this->_join['child'][0]] ) + ->exec(); + } + else { + // Insert values into the target table + $stmt = $db + ->query('insert') + ->table( $this->_table ) + ->set( $this->_join['child'], $parentId ); + + for ( $i=0 ; $i_fields) ; $i++ ) { + $field = $this->_fields[$i]; + + if ( $field->apply( 'set', $data ) ) { // TODO should be create or edit + $stmt->set( $field->dbField(), $field->val('set', $data) ); + } + } + + // If the where condition variables should also be added to the database + // Note that `whereSet` is now deprecated + if ( $this->_whereSet ) { + for ( $i=0, $ien=count($this->_where) ; $i<$ien ; $i++ ) { + if ( ! is_callable( $this->_where[$i] ) ) { + $stmt->set( $this->_where[$i]['key'], $this->_where[$i]['value'] ); + } + } + } + + $stmt->exec(); + } + } + + + /** + * Prepare the instance to be run. + * + * @param Editor $editor Editor instance + * @private + */ + private function _prep ( $editor ) + { + $links = $this->_links; + + // Were links used to configure this instance - if so, we need to + // back them onto the join array + if ( $this->_join['parent'] === null && count($links) ) { + $editorTable = $editor->table(); + $editorTable = $editorTable[0]; + $joinTable = $this->table(); + if ( strpos($editorTable, ' as ') !== false ) { + $arr = explode(' as ', $editorTable); + $editorTable = $arr[0]; + $this->_aliasParentTable = $arr[1]; + } + + if ( $this->_aliasParentTable ) { + $editorTable = $this->_aliasParentTable; + } + + if ( count( $links ) === 2 ) { + // No link table + $f1 = explode( '.', $links[0] ); + $f2 = explode( '.', $links[1] ); + + if ( $f1[0] === $editorTable ) { + $this->_join['parent'] = $f1[1]; + $this->_join['child'] = $f2[1]; + } + else { + $this->_join['parent'] = $f2[1]; + $this->_join['child'] = $f1[1]; + } + } + else { + // Link table + $f1 = explode( '.', $links[0] ); + $f2 = explode( '.', $links[1] ); + $f3 = explode( '.', $links[2] ); + $f4 = explode( '.', $links[3] ); + + // Discover the name of the link table + if ( $f1[0] !== $editorTable && $f1[0] !== $joinTable ) { + $this->_join['table'] = $f1[0]; + } + else if ( $f2[0] !== $editorTable && $f2[0] !== $joinTable ) { + $this->_join['table'] = $f2[0]; + } + else if ( $f3[0] !== $editorTable && $f3[0] !== $joinTable ) { + $this->_join['table'] = $f3[0]; + } + else { + $this->_join['table'] = $f4[0]; + } + + $this->_join['parent'] = array( $f1[1], $f2[1] ); + $this->_join['child'] = array( $f3[1], $f4[1] ); + } + } + } + + + /** + * Update a row. + * @param \DataTables\Database $db Database reference to use + * @param int $parentId Parent row's primary key value + * @param string[] $data Data to be set for the join + * @private + */ + private function _update_row ( $db, $parentId, $data ) + { + if ( isset($this->_join['table']) ) { + // Got a link table, just insert the pkey references + $db->push( + $this->_join['table'], + array( + $this->_join['parent'][1] => $parentId, + $this->_join['child'][1] => $data[$this->_join['child'][0]] + ), + array( + $this->_join['parent'][1] => $parentId + ) + ); + } + else { + // No link table, just a direct reference + $set = array( + $this->_join['child'] => $parentId + ); + + for ( $i=0 ; $i_fields) ; $i++ ) { + $field = $this->_fields[$i]; + + if ( $field->apply( 'set', $data ) ) { + $set[ $field->dbField() ] = $field->val('set', $data); + } + } + + // Add WHERE conditions + $where = array($this->_join['child'] => $parentId); + for ( $i=0, $ien=count($this->_where) ; $i<$ien ; $i++ ) { + $where[ $this->_where[$i]['key'] ] = $this->_where[$i]['value']; + + // Is there any point in this? Is there any harm? + // Note that `whereSet` is now deprecated + if ( $this->_whereSet ) { + if ( ! is_callable( $this->_where[$i] ) ) { + $set[ $this->_where[$i]['key'] ] = $this->_where[$i]['value']; + } + } + } + + $db->push( $this->_table, $set, $where ); + } + } + + + /** + * Create an SQL string from the fields that this instance knows about for + * using in queries + * @param string $direction Direction: 'get' or 'set'. + * @returns array Fields to include + * @private + */ + private function _fields ( $direction ) + { + $fields = array(); + + for ( $i=0 ; $i_fields) ; $i++ ) { + $field = $this->_fields[$i]; + + if ( $field->apply( $direction, null ) ) { + if ( strpos( $field->dbField() , "." ) === false ) { + $fields[] = $this->_table.'.'.$field->dbField() ." as ".$field->dbField();; + } + else { + $fields[] = $field->dbField();// ." as ".$field->dbField(); + } + } + } + + return $fields; + } + + + /** + * Validate input data + * + * @param array $errors Errors array + * @param Editor $editor Editor instance + * @param string[] $data Data to validate + * @param string $prefix Field error prefix for client-side to show the + * error message on the appropriate field + * @internal + */ + private function _validateFields ( &$errors, $editor, $data, $prefix ) + { + for ( $i=0 ; $i_fields) ; $i++ ) { + $field = $this->_fields[$i]; + $validation = $field->validate( $data, $editor ); + + if ( $validation !== true ) { + $errors[] = array( + "name" => $prefix.$field->name(), + "status" => $validation + ); + } + } + } +} diff --git a/ci4/app/ThirdParty/DatatablesEditor/Editor/Mjoin.php b/ci4/app/ThirdParty/DatatablesEditor/Editor/Mjoin.php new file mode 100644 index 00000000..cd05eecf --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Editor/Mjoin.php @@ -0,0 +1,33 @@ +leftJoin()` method. The API API is otherwise + * identical. + * + * This class is recommended over the `Join` class. + */ +class Mjoin extends Join +{ + function __construct( $table=null ) + { + parent::__construct( $table, 'array' ); + } +} diff --git a/ci4/app/ThirdParty/DatatablesEditor/Editor/Options.php b/ci4/app/ThirdParty/DatatablesEditor/Editor/Options.php new file mode 100644 index 00000000..738932ee --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Editor/Options.php @@ -0,0 +1,341 @@ +options()} method. + * + * @example + * Get a list of options from the `sites` table + * ```php + * Field::inst( 'users.site' ) + * ->options( Options::inst() + * ->table( 'sites' ) + * ->value( 'id' ) + * ->label( 'name' ) + * ) + * ``` + * + * @example + * Get a list of options with custom ordering + * ```php + * Field::inst( 'users.site' ) + * ->options( Options::inst() + * ->table( 'sites' ) + * ->value( 'id' ) + * ->label( 'name' ) + * ->order( 'name DESC' ) + * ) + * ``` + * + * @example + * Get a list of options showing the id and name in the label + * ```php + * Field::inst( 'users.site' ) + * ->options( Options::inst() + * ->table( 'sites' ) + * ->value( 'id' ) + * ->label( [ 'name', 'id' ] ) + * ->render( function ( $row ) { + * return $row['name'].' ('.$row['id'].')'; + * } ) + * ) + * ``` + */ +class Options extends DataTables\Ext { + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private parameters + */ + + /** @var string Table to get the information from */ + private $_table = null; + + /** @var string Column name containing the value */ + private $_value = null; + + /** @var string[] Column names for the label(s) */ + private $_label = array(); + + /** Information for left join */ + private $_leftJoin = array(); + + /** @var integer Row limit */ + private $_limit = null; + + /** @var callable Callback function to do rendering of labels */ + private $_renderer = null; + + /** @var callback Callback function to add where conditions */ + private $_where = null; + + /** @var string ORDER BY clause */ + private $_order = null; + + private $_manualAdd = array(); + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + /** + * Add extra options to the list, in addition to any obtained from the database + * + * @param string $label The label to use for the option + * @param string|null $value Value for the option. If not given, the label will be used + * @return Options Self for chaining + */ + public function add ( $label, $value=null ) + { + if ( $value === null ) { + $value = $label; + } + + $this->_manualAdd[] = array( + 'label' => $label, + 'value' => $value + ); + + return $this; + } + + /** + * Get / set the column(s) to use as the label value of the options + * + * @param null|string|string[] $_ null to get the current value, string or + * array to get. + * @return Options|string[] Self if setting for chaining, array of values if + * getting. + */ + public function label ( $_=null ) + { + if ( $_ === null ) { + return $this; + } + else if ( is_string($_) ) { + $this->_label = array( $_ ); + } + else { + $this->_label = $_; + } + + return $this; + } + + /** + * Set up a left join operation for the options + * + * @param string $table to get the information from + * @param string $field1 the first field to get the information from + * @param string $operator the operation to perform on the two fields + * @param string $field2 the second field to get the information from + * @return self + */ + public function leftJoin ( $table, $field1, $operator, $field2 ) + { + $this->_leftJoin[] = array( + "table" => $table, + "field1" => $field1, + "field2" => $field2, + "operator" => $operator + ); + + return $this; + } + + /** + * Get / set the LIMIT clause to limit the number of records returned. + * + * @param null|number $_ Number of rows to limit the result to + * @return Options|string[] Self if setting for chaining, limit if getting. + */ + public function limit ( $_=null ) + { + return $this->_getSet( $this->_limit, $_ ); + } + + /** + * Get / set the ORDER BY clause to use in the SQL. If this option is not + * provided the ordering will be based on the rendered output, either + * numerically or alphabetically based on the data returned by the renderer. + * + * @param null|string $_ String to set, null to get current value + * @return Options|string Self if setting for chaining, string if getting. + */ + public function order ( $_=null ) + { + return $this->_getSet( $this->_order, $_ ); + } + + /** + * Get / set the label renderer. The renderer can be used to combine + * multiple database columns into a single string that is shown as the label + * to the end user in the list of options. + * + * @param null|callable $_ Function to set, null to get current value + * @return Options|callable Self if setting for chaining, callable if + * getting. + */ + public function render ( $_=null ) + { + return $this->_getSet( $this->_renderer, $_ ); + } + + /** + * Get / set the database table from which to gather the options for the + * list. + * + * @param null|string $_ String to set, null to get current value + * @return Options|string Self if setting for chaining, string if getting. + */ + public function table ( $_=null ) + { + return $this->_getSet( $this->_table, $_ ); + } + + /** + * Get / set the column name to use for the value in the options list. This + * would normally be the primary key for the table. + * + * @param null|string $_ String to set, null to get current value + * @return Options|string Self if setting for chaining, string if getting. + */ + public function value ( $_=null ) + { + return $this->_getSet( $this->_value, $_ ); + } + + /** + * Get / set the method to use for a WHERE condition if it is to be + * applied to the query to get the options. + * + * @param null|callable $_ Function to set, null to get current value + * @return Options|callable Self if setting for chaining, callable if + * getting. + */ + public function where ( $_=null ) + { + return $this->_getSet( $this->_where, $_ ); + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Internal methods + */ + + /** + * Execute the options (i.e. get them) + * + * @param Database $db Database connection + * @return array List of options + * @internal + */ + public function exec ( $db ) + { + $label = $this->_label; + $value = $this->_value; + $formatter = $this->_renderer; + + // Create a list of the fields that we need to get from the db + $fields = array(); + $fields[] = $value; + $fields = array_merge( $fields, $label ); + + // We need a default formatter if one isn't provided + if ( ! $formatter ) { + $formatter = function ( $row ) use ( $label ) { + $a = array(); + + for ( $i=0, $ien=count($label) ; $i<$ien ; $i++ ) { + $a[] = $row[ $label[$i] ]; + } + + return implode(' ', $a); + }; + } + + // Get the data + $q = $db + ->query('select') + ->distinct( true ) + ->table( $this->_table ) + ->left_join($this->_leftJoin) + ->get( $fields ) + ->where( $this->_where ); + + if ( $this->_order ) { + // For cases where we are ordering by a field which isn't included in the list + // of fields to display, we need to add the ordering field, due to the + // select distinct. + $orderFields = explode( ',', $this->_order ); + + for ( $i=0, $ien=count($orderFields) ; $i<$ien ; $i++ ) { + $field = strtolower( $orderFields[$i] ); + $field = str_replace( ' asc', '', $field ); + $field = str_replace( ' desc', '', $field ); + $field = trim( $field ); + + if ( ! in_array( $field, $fields ) ) { + $q->get( $field ); + } + } + + $q->order( $this->_order ); + } + + if ( $this->_limit !== null ) { + $q->limit( $this->_limit ); + } + + $rows = $q + ->exec() + ->fetchAll(); + + // Create the output array + $out = array(); + + for ( $i=0, $ien=count($rows) ; $i<$ien ; $i++ ) { + $out[] = array( + "label" => $formatter( $rows[$i] ), + "value" => $rows[$i][$value] + ); + } + + // Stick on any extra manually added options + if ( count( $this->_manualAdd ) ) { + $out = array_merge( $out, $this->_manualAdd ); + } + + // Only sort if there was no SQL order field + if ( ! $this->_order ) { + usort( $out, function ( $a, $b ) { + return is_numeric($a['label']) && is_numeric($b['label']) ? + ($a['label']*1) - ($b['label']*1) : + strcmp( $a['label'], $b['label'] ); + } ); + } + + return $out; + } +} + \ No newline at end of file diff --git a/ci4/app/ThirdParty/DatatablesEditor/Editor/SearchBuilderOptions.php b/ci4/app/ThirdParty/DatatablesEditor/Editor/SearchBuilderOptions.php new file mode 100644 index 00000000..d6b0f63e --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Editor/SearchBuilderOptions.php @@ -0,0 +1,335 @@ +options()} method. + * + * @example + * Get a list of options from the `sites` table + * ```php + * Field::inst( 'users.site' ) + * ->options( Options::inst() + * ->table( 'sites' ) + * ->value( 'id' ) + * ->label( 'name' ) + * ) + * ``` + * + * @example + * Get a list of options with custom ordering + * ```php + * Field::inst( 'users.site' ) + * ->options( Options::inst() + * ->table( 'sites' ) + * ->value( 'id' ) + * ->label( 'name' ) + * ->order( 'name DESC' ) + * ) + * ``` + * + * @example + * Get a list of options showing the id and name in the label + * ```php + * Field::inst( 'users.site' ) + * ->options( Options::inst() + * ->table( 'sites' ) + * ->value( 'id' ) + * ->label( [ 'name', 'id' ] ) + * ->render( function ( $row ) { + * return $row['name'].' ('.$row['id'].')'; + * } ) + * ) + * ``` + */ +class SearchBuilderOptions extends DataTables\Ext { + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private parameters + */ + + /** @var string Table to get the information from */ + private $_table = null; + + /** @var string Column name containing the value */ + private $_value = null; + + /** @var string[] Column names for the label(s) */ + private $_label = array(); + + /** @var string[] Column names for left join */ + private $_leftJoin = array(); + + /** @var callable Callback function to do rendering of labels */ + private $_renderer = null; + + /** @var callback Callback function to add where conditions */ + private $_where = null; + + /** @var string ORDER BY clause */ + private $_order = null; + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + /** + * Get / set the column(s) to use as the label value of the options + * + * @param null|string|string[] $_ null to get the current value, string or + * array to get. + * @return Options|string[] Self if setting for chaining, array of values if + * getting. + */ + public function label ( $_=null ) + { + if ( $_ === null ) { + return $this; + } + else if ( is_string($_) ) { + $this->_label = array( $_ ); + } + else { + $this->_label = $_; + } + + return $this; + } + + /** + * Get / set the ORDER BY clause to use in the SQL. If this option is not + * provided the ordering will be based on the rendered output, either + * numerically or alphabetically based on the data returned by the renderer. + * + * @param null|string $_ String to set, null to get current value + * @return Options|string Self if setting for chaining, string if getting. + */ + public function order ( $_=null ) + { + return $this->_getSet( $this->_order, $_ ); + } + + /** + * Get / set the label renderer. The renderer can be used to combine + * multiple database columns into a single string that is shown as the label + * to the end user in the list of options. + * + * @param null|callable $_ Function to set, null to get current value + * @return Options|callable Self if setting for chaining, callable if + * getting. + */ + public function render ( $_=null ) + { + return $this->_getSet( $this->_renderer, $_ ); + } + + /** + * Get / set the database table from which to gather the options for the + * list. + * + * @param null|string $_ String to set, null to get current value + * @return Options|string Self if setting for chaining, string if getting. + */ + public function table ( $_=null ) + { + return $this->_getSet( $this->_table, $_ ); + } + + /** + * Get / set the column name to use for the value in the options list. This + * would normally be the primary key for the table. + * + * @param null|string $_ String to set, null to get current value + * @return Options|string Self if setting for chaining, string if getting. + */ + public function value ( $_=null ) + { + return $this->_getSet( $this->_value, $_ ); + } + + /** + * Get / set the method to use for a WHERE condition if it is to be + * applied to the query to get the options. + * + * @param null|callable $_ Function to set, null to get current value + * @return Options|callable Self if setting for chaining, callable if + * getting. + */ + public function where ( $_=null ) + { + return $this->_getSet( $this->_where, $_ ); + } + + /** + * Get / set the array values used for a leftJoin condition if it is to be + * applied to the query to get the options. + * + * @param string $table to get the information from + * @param string $field1 the first field to get the information from + * @param string $operator the operation to perform on the two fields + * @param string $field2 the second field to get the information from + * @return self + */ + public function leftJoin ( $table, $field1, $operator, $field2 ) + { + $this->_leftJoin[] = array( + "table" => $table, + "field1" => $field1, + "field2" => $field2, + "operator" => $operator + ); + + return $this; + } + + /** + * Adds all of the where conditions to the desired query + * + * @param string $query the query being built + * @return self + */ + private function _get_where ( $query ) + { + for ( $i=0 ; $i_where) ; $i++ ) { + if ( is_callable( $this->_where[$i] ) ) { + $this->_where[$i]( $query ); + } + else { + $query->where( + $this->_where[$i]['key'], + $this->_where[$i]['value'], + $this->_where[$i]['op'] + ); + } + } + return $this; + } + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Internal methods + */ + + /** + * Execute the options (i.e. get them) + * + * @param Database $db Database connection + * @return array List of options + * @internal + */ + public function exec ( $field, $editor, $http, $fields, $leftJoinIn ) + { + // If the value is not yet set then set the variable to be the field name + if ( $this->_value == null) { + $value = $field->dbField(); + } + else { + $value = $this->_value; + } + + $readTable = $editor->readTable(); + + // If the table is not yet set then set the table variable to be the same as editor + // This is not taking a value from the SearchBuilderOptions instance as the table should be defined in value/label. This throws up errors if not. + if($this->_table !== null) { + $table = $this->_table; + } + else if(count($readTable) > 0) { + $table = $readTable; + } + else { + $table = $editor->table(); + } + + // If the label value has not yet been set then just set it to be the same as value + if ( $this->_label == null ) { + $label = $value; + } + else { + $label = $this->_label[0]; + } + + // Set the database from editor + $db = $editor->db(); + + $formatter = $this->_renderer; + + // We need a default formatter if one isn't provided + if ( ! $formatter ) { + $formatter = function ( $str ) { + return $str; + }; + } + + // Set up the join variable so that it will fit nicely later + $leftJoin = gettype($this->_leftJoin) === 'array' ? + $this->_leftJoin : + array($this->_leftJoin); + + foreach($leftJoinIn as $lj) { + $found = false; + foreach($leftJoin as $lje) { + if($lj['table'] === $lje['table']) { + $found = true; + } + } + if(!$found) { + array_push($leftJoin, $lj); + } + } + + // Set the query to get the current counts for viewTotal + $query = $db + ->query('select') + ->table( $table ) + ->left_join($leftJoin); + + if ( $field->apply('get') && $field->getValue() === null ) { + $query->get($value." as value", $label." as label"); + $query->group_by( $value); + } + + $res = $query + ->exec() + ->fetchAll(); + + // Create the output array + $out = array(); + + for( $j=0 ; $j $res[$j]['value'], + "label" => $res[$j]['label'] + ); + } + + // Only sort if there was no SQL order field + if ( ! $this->_order ) { + usort( $out, function ( $a, $b ) { + return is_numeric($a['label']) && is_numeric($b['label']) ? + ($a['label']*1) - ($b['label']*1) : + strcmp( $a['label'], $b['label'] ); + } ); + } + + return $out; + } +} + \ No newline at end of file diff --git a/ci4/app/ThirdParty/DatatablesEditor/Editor/SearchPaneOptions.php b/ci4/app/ThirdParty/DatatablesEditor/Editor/SearchPaneOptions.php new file mode 100644 index 00000000..e209111f --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Editor/SearchPaneOptions.php @@ -0,0 +1,467 @@ +options()} method. + * + * @example + * Get a list of options from the `sites` table + * ```php + * Field::inst( 'users.site' ) + * ->options( Options::inst() + * ->table( 'sites' ) + * ->value( 'id' ) + * ->label( 'name' ) + * ) + * ``` + * + * @example + * Get a list of options with custom ordering + * ```php + * Field::inst( 'users.site' ) + * ->options( Options::inst() + * ->table( 'sites' ) + * ->value( 'id' ) + * ->label( 'name' ) + * ->order( 'name DESC' ) + * ) + * ``` + * + * @example + * Get a list of options showing the id and name in the label + * ```php + * Field::inst( 'users.site' ) + * ->options( Options::inst() + * ->table( 'sites' ) + * ->value( 'id' ) + * ->label( [ 'name', 'id' ] ) + * ->render( function ( $row ) { + * return $row['name'].' ('.$row['id'].')'; + * } ) + * ) + * ``` + */ +class SearchPaneOptions extends DataTables\Ext { + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private parameters + */ + + /** @var string Table to get the information from */ + private $_table = null; + + /** @var string Column name containing the value */ + private $_value = null; + + /** @var string[] Column names for the label(s) */ + private $_label = array(); + + /** @var string[] Column names for left join */ + private $_leftJoin = array(); + + /** @var callable Callback function to do rendering of labels */ + private $_renderer = null; + + /** @var callback Callback function to add where conditions */ + private $_where = null; + + /** @var string ORDER BY clause */ + private $_order = null; + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + /** + * Get / set the column(s) to use as the label value of the options + * + * @param null|string|string[] $_ null to get the current value, string or + * array to get. + * @return Options|string[] Self if setting for chaining, array of values if + * getting. + */ + public function label ( $_=null ) + { + if ( $_ === null ) { + return $this; + } + else if ( is_string($_) ) { + $this->_label = array( $_ ); + } + else { + $this->_label = $_; + } + + return $this; + } + + /** + * Get / set the ORDER BY clause to use in the SQL. If this option is not + * provided the ordering will be based on the rendered output, either + * numerically or alphabetically based on the data returned by the renderer. + * + * @param null|string $_ String to set, null to get current value + * @return Options|string Self if setting for chaining, string if getting. + */ + public function order ( $_=null ) + { + return $this->_getSet( $this->_order, $_ ); + } + + /** + * Get / set the label renderer. The renderer can be used to combine + * multiple database columns into a single string that is shown as the label + * to the end user in the list of options. + * + * @param null|callable $_ Function to set, null to get current value + * @return Options|callable Self if setting for chaining, callable if + * getting. + */ + public function render ( $_=null ) + { + return $this->_getSet( $this->_renderer, $_ ); + } + + /** + * Get / set the database table from which to gather the options for the + * list. + * + * @param null|string $_ String to set, null to get current value + * @return Options|string Self if setting for chaining, string if getting. + */ + public function table ( $_=null ) + { + return $this->_getSet( $this->_table, $_ ); + } + + /** + * Get / set the column name to use for the value in the options list. This + * would normally be the primary key for the table. + * + * @param null|string $_ String to set, null to get current value + * @return Options|string Self if setting for chaining, string if getting. + */ + public function value ( $_=null ) + { + return $this->_getSet( $this->_value, $_ ); + } + + /** + * Get / set the method to use for a WHERE condition if it is to be + * applied to the query to get the options. + * + * @param null|callable $_ Function to set, null to get current value + * @return Options|callable Self if setting for chaining, callable if + * getting. + */ + public function where ( $_=null ) + { + return $this->_getSet( $this->_where, $_ ); + } + + /** + * Get / set the array values used for a leftJoin condition if it is to be + * applied to the query to get the options. + * + * @param string $table to get the information from + * @param string $field1 the first field to get the information from + * @param string $operator the operation to perform on the two fields + * @param string $field2 the second field to get the information from + * @return self + */ + public function leftJoin ( $table, $field1, $operator, $field2 ) + { + $this->_leftJoin[] = array( + "table" => $table, + "field1" => $field1, + "field2" => $field2, + "operator" => $operator + ); + + return $this; + } + + /** + * Adds all of the where conditions to the desired query + * + * @param string $query the query being built + * @return self + */ + private function _get_where ( $query ) + { + for ( $i=0 ; $i_where) ; $i++ ) { + if ( is_callable( $this->_where[$i] ) ) { + $this->_where[$i]( $query ); + } + else { + $query->where( + $this->_where[$i]['key'], + $this->_where[$i]['value'], + $this->_where[$i]['op'] + ); + } + } + return $this; + } + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Internal methods + */ + + /** + * Execute the options (i.e. get them) + * + * @param Database $db Database connection + * @return array List of options + * @internal + */ + public function exec ( $field, $editor, $http, $fields, $leftJoinIn ) + { + $db = $editor->db(); + $readTable = $editor->readTable(); + $filteringActive = isset($http['searchPanes']); + $viewCount = isset($http['searchPanes_options']) + ? filter_var($http['searchPanes_options']['viewCount'], FILTER_VALIDATE_BOOLEAN) + : true; + $viewTotal = isset($http['searchPanes_options']) + ? filter_var($http['searchPanes_options']['viewTotal'], FILTER_VALIDATE_BOOLEAN) + : false; + $cascade = isset($http['searchPanes_options']) + ? filter_var($http['searchPanes_options']['cascade'], FILTER_VALIDATE_BOOLEAN) + : false; + $entries = null; + + // If the value is not yet set then set the variable to be the field name + $value = $this->_value == null + ? $field->dbField() + : $this->_value; + + + // If the table is not yet set then set the table variable to be the same as editor + // This is not taking a value from the SearchPaneOptions instance as the table should be defined in value/label. This throws up errors if not. + if($this->_table !== null) { + $table = $this->_table; + } + else if(count($readTable) > 0) { + $table = $readTable; + } + else { + $table = $editor->table(); + } + + // If the label value has not yet been set then just set it to be the same as value + $label = $this->_label == null + ? $value + : $this->_label[0]; + + $formatter = $this->_renderer + ? $this->_renderer + : function ( $str ) { + return $str; + }; + + // Set up the join variable so that it will fit nicely later + $leftJoin = gettype($this->_leftJoin) === 'array' ? + $this->_leftJoin : + array($this->_leftJoin); + + foreach($leftJoinIn as $lj) { + $found = false; + + foreach($leftJoin as $lje) { + if($lj['table'] === $lje['table']) { + $found = true; + } + } + + if(!$found) { + array_push($leftJoin, $lj); + } + } + + // Get the data for the pane options + $q = $db + ->query('select') + ->distinct(true) + ->table( $table ) + ->get( $label." as label", $value." as value" ) + ->left_join($leftJoin) + ->group_by( $value ) + ->where( $this->_where ); + + // If not cascading, then the total and count must be the same + if ($viewTotal) { + $q->get("COUNT(*) as total"); + } + + if ( $this->_order ) { + // For cases where we are ordering by a field which isn't included in the list + // of fields to display, we need to add the ordering field, due to the + // select distinct. + $orderFields = explode( ',', $this->_order ); + + for ( $i=0, $ien=count($orderFields) ; $i<$ien ; $i++ ) { + $orderField = strtolower( $orderFields[$i] ); + $orderField = str_replace( ' asc', '', $orderField ); + $orderField = str_replace( ' desc', '', $orderField ); + $orderField = trim( $orderField ); + + if ( ! in_array( $orderField, $fields ) ) { + $q->get( $orderField ); + } + } + + $q->order( $this->_order ); + } + + $rows = $q + ->exec() + ->fetchAll(); + + // Remove any filtering entries that don't exist in the database (values might have changed) + if (isset($http['searchPanes'][$field->name()])) { + $values = array_column($rows, 'value'); + $selected = $http['searchPanes'][$field->name()]; + + for ($i=0 ; $iname()], $i, 1); + } + } + } + + // Apply filters to cascade tables + if ($viewCount || $cascade) { + $query = $db + ->query('select') + ->distinct(true) + ->table($table) + ->left_join($leftJoin); + + if ( $field->apply('get') && $field->getValue() === null ) { + $query->get($value." as value"); + $query->group_by($value); + + // We viewTotal is enabled, we need to do a count to get the number of records, + // If it isn't we still need to know it exists, but don't care about the cardinality + if ($viewCount) { + $query->get("COUNT(*) as count"); + } + else { + $query->get("(1) as count"); + } + } + + // Construct the where queries based upon the options selected by the user + foreach ($fields as $fieldOpt) { + $add = false; + $fieldName = $fieldOpt->name(); + + // If there is a last value set then a slightly different set of results is required for cascade + // That panes results are based off of the results when only considering the selections of all of the others + if (isset($http['searchPanesLast']) && $field->name() === $http['searchPanesLast']) { + if (isset($http['searchPanes'][$fieldName]) && $fieldName !== $http['searchPanesLast']) { + $add = true; + } + } + else if (isset($http['searchPanes']) && isset($http['searchPanes'][$fieldName])) { + $add = true; + } + + if ($add) { + $query->where( function ($q) use ($fieldOpt, $http, $fieldName) { + for($j=0, $jen=count($http['searchPanes'][$fieldName]); $j < $jen ; $j++) { + $q->or_where( + $fieldOpt->dbField(), + isset($http['searchPanes_null'][$fieldName][$j]) + ? null + : $http['searchPanes'][$fieldName][$j], + '=' + ); + } + }); + } + } + + $entriesRows = $query + ->exec() + ->fetchAll(); + + // Key by the value for fast lookup + $entriesKeys = array_column($entriesRows, 'value'); + $entries = array_combine($entriesKeys, $entriesRows); + } + + $out = array(); + + for ( $i=0, $ien=count($rows) ; $i<$ien ; $i++ ) { + $row = $rows[$i]; + $value = $row['value']; + $total = isset($row['total']) ? $row['total'] : null; + $count = $total; + + if ($entries !== null) { + $count = isset($entries[$value]) && isset($entries[$value]['count']) + ? $entries[$value]['count'] + : 0; + + // For when viewCount is enabled and viewTotal is not + // the total needs to be the same as the count! + if ($total === null) { + $total = $count; + } + } + + $out[] = array( + "label" => $formatter($row['label']), + "total" => $total, + "value" => $value, + "count" => $count + ); + } + + // Only sort if there was no SQL order field + if ( ! $this->_order ) { + usort( $out, function ( $a, $b ) { + $aLabel = $a['label']; + $bLabel = $b['label']; + + if ($aLabel === null) { + $aLabel = ''; + } + + if ($bLabel === null) { + $bLabel = ''; + } + + return is_numeric($aLabel) && is_numeric($bLabel) ? + ($aLabel*1) - ($bLabel*1) : + strcmp( $aLabel, $bLabel ); + } ); + } + + return $out; + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/Editor/Upload.php b/ci4/app/ThirdParty/DatatablesEditor/Editor/Upload.php new file mode 100644 index 00000000..4862e1dd --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Editor/Upload.php @@ -0,0 +1,735 @@ +upload()} method. When Editor detects a file upload for that file the + * information provided for this instance is executed. + * + * The configuration is primarily driven through the {@see Upload->db()} and + * {@see Upload->action()} methods: + * + * * {@see Upload->db()} Describes how information about the uploaded file is to be + * stored on the database. + * * {@see Upload->action()} Describes where the file should be stored on the file system + * and provides the option of specifying a custom action when a file is + * uploaded. + * + * Both methods are optional - you can store the file on the server using the + * {@see Upload->db()} method only if you want to store the file in the database, or if + * you don't want to store relational data on the database us only + * {@see Upload->action()}. However, the majority of the time it is best to use + * both - store information about the file on the database for fast retrieval (using a + * {@see Editor->leftJoin()} for example) and the file on the file system for direct + * web access. + * + * @example + * Store information about a file in a table called `files` and the actual + * file in an `uploads` directory. + * ``` + * Field::inst( 'imageId' ) + * ->upload( + * Upload::inst( $_SERVER['DOCUMENT_ROOT'].'/uploads/__ID__.__EXTN__' ) + * ->db( 'files', 'id', array( + * 'webPath' => Upload::DB_WEB_PATH, + * 'fileName' => Upload::DB_FILE_NAME, + * 'fileSize' => Upload::DB_FILE_SIZE, + * 'systemPath' => Upload::DB_SYSTEM_PATH + * ) ) + * ->allowedExtensions( array( 'png', 'jpg' ), "Please upload an image file" ) + * ) + * ``` + * + * @example + * As above, but with PHP 5.4 (which allows chaining from new instances of a + * class) + * ``` + * newField( 'imageId' ) + * ->upload( + * new Upload( $_SERVER['DOCUMENT_ROOT'].'/uploads/__ID__.__EXTN__' ) + * ->db( 'files', 'id', array( + * 'webPath' => Upload::DB_WEB_PATH, + * 'fileName' => Upload::DB_FILE_NAME, + * 'fileSize' => Upload::DB_FILE_SIZE, + * 'systemPath' => Upload::DB_SYSTEM_PATH + * ) ) + * ->allowedExtensions( array( 'png', 'jpg' ), "Please upload an image file" ) + * ) + * ``` + */ +class Upload extends DataTables\Ext { + /* * * * * * * * * * * * * * * * * * * * * * * * * + * Constants + */ + + /** Database value option (`Db()`) - File content. This should be written to + * a blob. Typically this should be avoided and the file saved on the file + * system, but there are cases where it can be useful to store the file in + * the database. + */ + const DB_CONTENT = 'editor-content'; + + /** Database value option (`Db()`) - Content type */ + const DB_CONTENT_TYPE = 'editor-contentType'; + + /** Database value option (`Db()`) - File extension */ + const DB_EXTN = 'editor-extn'; + + /** Database value option (`Db()`) - File name (with extension) */ + const DB_FILE_NAME = 'editor-fileName'; + + /** Database value option (`Db()`) - File size (bytes) */ + const DB_FILE_SIZE = 'editor-fileSize'; + + /** Database value option (`Db()`) - MIME type */ + const DB_MIME_TYPE = 'editor-mimeType'; + + /** Database value option (`Db()`) - Full system path to the file */ + const DB_SYSTEM_PATH = 'editor-systemPath'; + + /** Database value option (`Db()`) - HTTP path to the file. This is derived + * from the system path by removing `$_SERVER['DOCUMENT_ROOT']`. If your + * images live outside of the document root a custom value would be to be + * used. + */ + const DB_WEB_PATH = 'editor-webPath'; + + /** Read from the database - don't write to it + */ + const DB_READ_ONLY = 'editor-readOnly'; + + + /* * * * * * * * * * * * * * * * * * * * * * * * * + * Private parameters + */ + + private $_action = null; + private $_dbCleanCallback = null; + private $_dbCleanTableField = null; + private $_dbTable = null; + private $_dbPKey = null; + private $_dbFields = null; + private $_dbFormat = null; + private $_extns = null; + private $_extnError = null; + private $_error = null; + private $_mode = 0644; + private $_validators = array(); + private $_where = array(); + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Constructor + */ + + /** + * Upload instance constructor + * @param string|callable $action Action to take on upload - this is applied + * directly to {@see Upload->action()}. + */ + function __construct( $action=null ) + { + if ( $action ) { + $this->action( $action ); + } + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + /** + * Set the action to take when a file is uploaded. This can be either of: + * + * * A string - the value given is the full system path to where the + * uploaded file is written to. The value given can include three "macros" + * which are replaced by the script dependent on the uploaded file: + * * `__EXTN__` - the file extension + * * `__NAME__` - the uploaded file's name (including the extension) + * * `__ID__` - Database primary key value if the {@see Upload->db()} method is + * used. + * * A closure - if a function is given the responsibility of what to do + * with the uploaded file is transferred to this function. That will + * typically involve writing it to the file system so it can be used + * later. + * + * @param string|callable $action Action to take - see description above. + * @return self Current instance, used for chaining + */ + public function action ( $action ) + { + $this->_action = $action; + + return $this; + } + + + /** + * An array of valid file extensions that can be uploaded. This is for + * simple validation that the file is of the expected type - for example you + * might use `[ 'png', 'jpg', 'jpeg', 'gif' ]` for images. The check is + * case-insensitive. If no extensions are given, no validation is performed + * on the file extension. + * + * @param string[] $extn List of file extensions that are allowable for + * the upload + * @param string $error Error message if a file is uploaded that doesn't + * match the valid list of extensions. + * @return self Current instance, used for chaining + * @deprecated Use Validate::fileExtensions + */ + public function allowedExtensions ( $extn, $error="This file type cannot be uploaded" ) + { + $this->_extns = $extn; + $this->_extnError = $error; + + return $this; + } + + + /** + * Database configuration method. When used, this method will tell Editor + * what information you want written to a database on file upload, should + * you wish to store relational information about your file on the database + * (this is generally recommended). + * + * @param string $table The name of the table where the file information + * should be stored + * @param string $pkey Primary key column name. The `Upload` class + * requires that the database table have a single primary key so each + * row can be uniquely identified. + * @param array $fields A list of the fields to be written to on upload. + * The property names are the database columns and the values can be + * defined by the constants of this class. The value can also be a + * string or a closure function if you wish to send custom information + * to the database. + * @param callable Formatting function that can change the data obtained + * from the database. Only gets a single parameter passed in - the + * database row for the file that is read. + * @return self Current instance, used for chaining + */ + public function db ( $table, $pkey, $fields, $format=null ) + { + $this->_dbTable = $table; + $this->_dbPKey = $pkey; + $this->_dbFields = $fields; + $this->_dbFormat = $format; + + return $this; + } + + + /** + * Set a callback function that is used to remove files which no longer have + * a reference in a source table. + * + * @param callable $callback Function that will be executed on clean. It is + * given an array of information from the database about the orphaned + * rows, and can return true to indicate that the rows should be + * removed from the database. Any other return value (including none) + * will result in the records being retained. + * @return self Current instance, used for chaining + */ + public function dbClean( $tableField, $callback=null ) + { + // Argument swapping + if ( $callback === null ) { + $callback = $tableField; + $tableField = null; + } + + $this->_dbCleanCallback = $callback; + $this->_dbCleanTableField = $tableField; + + return $this; + } + + + /** + * Set the permissions on the file after it has been uploaded using + * chmod. + */ + public function mode( $m ) { + $this->_mode = $m; + + return $this; + } + + + /** + * Add a validation method to check file uploads. Multiple validators can be + * added by calling this method multiple times - they will be executed in + * sequence when a file has been uploaded. + * + * @param callable $fn Validation function. A PHP `$_FILES` parameter is + * passed in for the uploaded file and the return is either a string + * (validation failed and error message), or `null` (validation passed). + * @return self Current instance, used for chaining + */ + public function validator ( $fn ) + { + $this->_validators[] = $fn; + + return $this; + } + + + /** + * Add a condition to the data to be retrieved from the database. This + * must be given as a function to be executed (usually anonymous) and + * will be passed in a single argument, the `Query` object, to which + * conditions can be added. Multiple calls to this method can be made. + * + * @param callable $fn Where function. + * @return self Current instance, used for chaining + */ + public function where ( $fn ) + { + $this->_where[] = $fn; + + return $this; + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * + * Internal methods + */ + + /** + * Get database information data from the table + * + * @param \DataTables\Database $db Database + * @param number[] [$ids=null] Limit to a specific set of ids + * @return array Database information + * @internal + */ + public function data ( $db, $ids=null ) + { + if ( ! $this->_dbTable ) { + return null; + } + + // Select the details requested, for the columns requested + $q = $db + ->query( 'select' ) + ->table( $this->_dbTable ) + ->get( $this->_dbPKey ); + + foreach ( $this->_dbFields as $column => $prop ) { + if ( $prop !== self::DB_CONTENT ) { + $q->get( $column ); + } + } + + if ( $ids !== null ) { + $q->where_in( $this->_dbPKey, $ids ); + } + + for ( $i=0, $ien=count($this->_where) ; $i<$ien ; $i++ ) { + $q->where( $this->_where[$i] ); + } + + $result = $q->exec()->fetchAll(); + $out = array(); + + for ( $i=0, $ien=count($result) ; $i<$ien ; $i++ ) { + if ($this->_dbFormat) { + $this->_dbFormat( $result[$i] ); + } + + $out[ $result[$i][ $this->_dbPKey ] ] = $result[$i]; + } + + return $out; + } + + + /** + * Clean the database + * @param \DataTables\Editor $editor Calling Editor instance + * @param Field $field Host field + * @internal + */ + public function dbCleanExec ( $editor, $field ) + { + // Database and file system clean up BEFORE adding the new file to + // the db, otherwise it will be removed immediately + $tables = $editor->table(); + $this->_dbClean( $editor->db(), $tables[0], $field->dbField() ); + } + + + /** + * Get the set error message + * + * @return string Class error + * @internal + */ + public function error () + { + return $this->_error; + } + + + /** + * Execute an upload + * + * @param \DataTables\Editor $editor Calling Editor instance + * @return int Primary key value + * @internal + */ + public function exec ( $editor ) + { + $id = null; + $upload = $_FILES['upload']; + + // Validation - PHP standard validation + if ( $upload['error'] !== UPLOAD_ERR_OK ) { + if ( $upload['error'] === UPLOAD_ERR_INI_SIZE ) { + $this->_error = "File exceeds maximum file upload size"; + } + else { + $this->_error = "There was an error uploading the file (".$upload['error'].")"; + } + return false; + } + + // Validation - acceptable file extensions + if ( is_array( $this->_extns ) ) { + $extn = pathinfo($upload['name'], PATHINFO_EXTENSION); + + if ( in_array( strtolower($extn), array_map( 'strtolower', $this->_extns ) ) === false ) { + $this->_error = $this->_extnError; + return false; + } + } + + // Validation - custom callback + for ( $i=0, $ien=count($this->_validators) ; $i<$ien ; $i++ ) { + $res = $this->_validators[$i]( $upload ); + + if ( is_string( $res ) ) { + $this->_error = $res; + return false; + } + } + + // Database + if ( $this->_dbTable ) { + foreach ( $this->_dbFields as $column => $prop ) { + // We can't know what the path is, if it has moved into place + // by an external function - throw an error if this does happen + if ( ! is_string( $this->_action ) && + ($prop === self::DB_SYSTEM_PATH || $prop === self::DB_WEB_PATH ) + ) { + $this->_error = "Cannot set path information in database ". + "if a custom method is used to save the file."; + + return false; + } + } + + // Commit to the database + $id = $this->_dbExec( $upload, $editor->db() ); + } + + // Perform file system actions + return $this->_actionExec( $upload, $id ); + } + + + /** + * Get the primary key column for the table + * + * @return string Primary key column name + * @internal + */ + public function pkey () + { + return $this->_dbPKey; + } + + + /** + * Get the db table name + * + * @return string DB table name + * @internal + */ + public function table () + { + return $this->_dbTable; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * + * Private methods + */ + + /** + * Execute the configured action for the upload + * + * @param array $upload $_FILES['upload'] + * @param int $id Primary key value + * @return int File identifier - typically the primary key + */ + private function _actionExec ( $upload, $id ) + { + if ( ! is_string( $this->_action ) ) { + // Custom function + $action = $this->_action; + return $action( $upload, $id ); + } + + // Default action - move the file to the location specified by the + // action string + $to = $this->_path( $upload['name'], $id ); + $res = rename( $upload['tmp_name'], $to ); + + if ( $res === false ) { + $this->_error = "An error occurred while moving the uploaded file."; + return false; + } + + if ($this->_mode) { + chmod($to, $this->_mode); + } + + return $id !== null ? + $id : + $to; + } + + /** + * Perform the database clean by first getting the information about the + * orphaned rows and then calling the callback function. The callback can + * then instruct the rows to be removed through the return value. + * + * @param \DataTables\Database $db Database instance + * @param string $editorTable Editor Editor instance table name + * @param string $fieldName Host field's name + */ + private function _dbClean ( $db, $editorTable, $fieldName ) + { + $callback = $this->_dbCleanCallback; + + if ( ! $this->_dbTable || ! $callback ) { + return; + } + + // If there is a table / field that we should use to check if the value + // is in use, then use that. Otherwise we'll try to use the information + // from the Editor / Field instance. + if ( $this->_dbCleanTableField ) { + $fieldName = $this->_dbCleanTableField; + } + + $a = explode('.', $fieldName); + if ( count($a) === 1 ) { + $table = $editorTable; + $field = $a[0]; + } + else if ( count($a) === 2 ) { + $table = $a[0]; + $field = $a[1]; + } + else { + $table = $a[1]; + $field = $a[2]; + } + + // Select the details requested, for the columns requested + $q = $db + ->query( 'select' ) + ->table( $this->_dbTable ) + ->get( $this->_dbPKey ); + + foreach ( $this->_dbFields as $column => $prop ) { + if ( $prop !== self::DB_CONTENT ) { + $q->get( $column ); + } + } + + $q->where( $this->_dbPKey, '(SELECT '.$field.' FROM '.$table.' WHERE '.$field.' IS NOT NULL)', 'NOT IN', false ); + + $data = $q->exec()->fetchAll(); + + if ( count( $data ) === 0 ) { + return; + } + + $result = $callback( $data ); + + // Delete the selected rows, iff the developer says to do so with the + // returned value (i.e. acknowledge that the files have be removed from + // the file system) + if ( $result === true ) { + $qDelete = $db + ->query( 'delete' ) + ->table( $this->_dbTable ); + + for ( $i=0, $ien=count( $data ) ; $i<$ien ; $i++ ) { + $qDelete->or_where( $this->_dbPKey, $data[$i][ $this->_dbPKey ] ); + } + + $qDelete->exec(); + } + } + + /** + * Add a record to the database for a newly uploaded file + * + * @param array $upload $_FILES['upload'] + * @param \DataTables\Database $db Database instance + * @return int Primary key value for the newly uploaded file + */ + private function _dbExec ( $upload, $db ) + { + $pathFields = array(); + $insertedId = null; + + // Insert the details requested, for the columns requested + $q = $db + ->query( 'insert' ) + ->table( $this->_dbTable ) + ->pkey( $this->_dbPKey ); + + foreach ( $this->_dbFields as $column => $prop ) { + switch ( $prop ) { + case self::DB_READ_ONLY: + break; + + case self::DB_CONTENT: + $q->set( $column, file_get_contents($upload['tmp_name']) ); + break; + + case self::DB_CONTENT_TYPE: + case self::DB_MIME_TYPE: + $finfo = finfo_open(FILEINFO_MIME); + $mime = finfo_file($finfo, $upload['tmp_name']); + finfo_close($finfo); + + $q->set( $column, $mime ); + break; + + case self::DB_EXTN: + $extn = pathinfo($upload['name'], PATHINFO_EXTENSION); + $q->set( $column, $extn ); + break; + + case self::DB_FILE_NAME: + $q->set( $column, $upload['name'] ); + break; + + case self::DB_FILE_SIZE: + $q->set( $column, $upload['size'] ); + break; + + case self::DB_SYSTEM_PATH: + $pathFields[ $column ] = self::DB_SYSTEM_PATH; + $q->set( $column, '-' ); // Use a temporary value to avoid cases + break; // where the db will reject empty values + + case self::DB_WEB_PATH: + $pathFields[ $column ] = self::DB_WEB_PATH; + $q->set( $column, '-' ); // Use a temporary value (as above) + break; + + default: + $val = $prop; + + // Callable function - execute to get the value + if ( is_callable($prop) && is_object($prop) ) { + $val = $prop( $db, $upload ); + } + + // If the primary key value was set - use that + if ( $column === $this->_dbPKey ) { + $insertedId = $val; + } + + if (is_string($val) && ! empty($val)) { + // Allow for replacement of __ID__, etc when the value is a string + $pathFields[ $column ] = $val; + $q->set( $column, '-' ); // Use a temporary value (as above) + } + else { + $q->set( $column, $val ); + } + + break; + } + } + + $res = $q->exec(); + $id = $insertedId !== null + ? $insertedId + : $res->insertId(); + + // Update the newly inserted row with the path information. We have to + // use a second statement here as we don't know in advance what the + // database schema is and don't want to prescribe that certain triggers + // etc be created. It makes it a bit less efficient but much more + // compatible + if ( count( $pathFields ) ) { + // For this to operate the action must be a string, which is + // validated in the `exec` method + $path = $this->_path( $upload['name'], $id ); + $webPath = str_replace($_SERVER['DOCUMENT_ROOT'], '', $path); + $q = $db + ->query( 'update' ) + ->table( $this->_dbTable ) + ->where( $this->_dbPKey, $id ); + + foreach ( $pathFields as $column => $type ) { + $q->set( $column, $type === self::DB_WEB_PATH ? $webPath : $path ); + } + + $q->exec(); + } + + return $id; + } + + + /** + * Apply macros to a user specified path + * + * @param string $name File path + * @param int $id Primary key value for the file + * @return string Resolved path + */ + private function _path ( $name, $id ) + { + $extn = pathinfo( $name, PATHINFO_EXTENSION ); + + $to = $this->_action; + $to = str_replace( "__NAME__", $name, $to ); + $to = str_replace( "__ID__", $id, $to ); + $to = str_replace( "__EXTN__", $extn, $to ); + + return $to; + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/Editor/Validate.php b/ci4/app/ThirdParty/DatatablesEditor/Editor/Validate.php new file mode 100644 index 00000000..c97d749a --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Editor/Validate.php @@ -0,0 +1,1396 @@ +validator( Validate::required() ) + * ``` + * + * @example + * ``` + * // Don't require a field to be submitted, but if it is submitted, it + * // must be non-empty + * Field::inst( 'reg_date' )->validator( Validate::notEmpty() ) + * ``` + * + * @example + * ``` + * // Date validation + * Field::inst( 'reg_date' )->validator( Validate::dateFormat( 'D, d M y' ) ) + * ``` + * + * @example + * ``` + * // Date validation with a custom error message + * Field::inst( 'reg_date' )->validator( Validate::dateFormat( 'D, d M y', + * ValidateOptions::inst() + * ->message( 'Invalid date' ) + * ) ) + * ``` + * + * @example + * ``` + * // Require a non-empty e-mail address + * Field::inst( 'reg_date' )->validator( Validate::email( ValidateOptions::inst() + * ->empty( false ) + * ) ) + * ``` + * + * @example + * ``` + * // Custom validation - closure + * Field::inst( 'engine' )->validator( function($val, $data, $opts) { + * if ( ! preg_match( '/^1/', $val ) ) { + * return "Value must start with a 1"; + * } + * return true; + * } ) + * ``` + */ +class Validate { + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Internal functions + */ + + /** + * "Magic" method to automatically apply the required check to any of the + * static methods simply by adding '_required' or '_empty' to the end of the + * method's name, depending on if you need the field to be submitted or not. + * + * This is retained for backwards compatibility, but the validation options + * are now the recommended way of indicating that a field is required. + * + * @internal + * @param string $name Function name + * @param array $arguments Function arguments + * @return mixed|string + */ + public static function __callStatic( $name, $arguments ) { + if ( preg_match( '/_required$/', $name ) ) { + if ( $arguments[0] === null || $arguments[0] === '' ) { + return 'This field is required'; + } + + return call_user_func_array( + __NAMESPACE__.'\Validate::'.str_replace( '_required', '', $name ), + $arguments + ); + } + } + + + /** + * Extend the options from the user function and the validation function + * with core defaults. + * + * @internal + */ + public static function _extend( $userOpts, $prop, $fnOpts ) { + $cfg = array( + 'message' => 'Input not valid', + 'required' => false, + 'empty' => true, + 'optional' => true + ); + + if ( ! is_array( $userOpts ) ) { + if ( $prop ) { + $cfg[ $prop ] = $userOpts; + } + + // Not an array, but the non-array case has been handled above, so + // just an empty array + $userOpts = array(); + } + + // Merge into a single array - first array gets priority if there is a + // key clash, so user first, then function commands and finally the + // global options + $cfg = $userOpts + $fnOpts + $cfg; + + return $cfg; + } + + + /** + * Perform common validation using the configuration parameters + * + * @internal + */ + public static function _common( $val, $opts ) { + $optional = $opts->optional(); + $empty = $opts->allowEmpty(); + + // Error state tests + if ( ! $optional && $val === null ) { + // Value must be given + return false; + } + else if ( $empty === false && $val === '' ) { + // Value must not be empty + return false; + } + + // Validation passed states + if ( $optional && $val === null ) { + return true; + } + else if ( $empty === true && $val === '' ) { + return true; + } + + // Have the specific validation function perform its tests + return null; + } + + /** + * Convert the old style validation parameters into ValidateOptions + * + * @internal + */ + public static function _commonLegacy( $cfg ) { + $opts = new ValidateOptions(); + + if ( is_array( $cfg ) ) { + // `required` is a legacy shortcut for optional=false, empty=false + if ( isset( $cfg['required'] ) ) { + $opts->optional( false ); + $opts->allowEmpty( false ); + } + + if ( isset( $cfg['empty'] ) ) { + $opts->allowEmpty( $cfg['empty'] ); + } + + if ( isset( $cfg['message'] ) ) { + $opts->message( $cfg['message'] ); + } + + if ( isset( $cfg['optional'] ) ) { + $opts->optional( $cfg['optional'] ); + } + } + + return $opts; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Basic validation + */ + + /** + * No validation - all inputs are valid. + * @return callable Validation function + */ + public static function none() { + return function ( $val, $data, $field, $host ) { + return true; + }; + } + + + /** + * Basic validation - this is used to perform the validation provided by the + * validation options only. If the validation options pass (e.g. `required`, + * `empty` and `optional`) then the validation will pass regardless of the + * actual value. + * + * Note that there are two helper short-cut methods that provide the same + * function as this method, but are slightly shorter: + * + * ``` + * // Required: + * Validate::required() + * + * // is the same as + * Validate::basic( $val, $data, array( + * "required" => true + * ); + * ``` + * + * ``` + * // Optional, but not empty if given: + * Validate::notEmpty() + * + * // is the same as + * Validate::basic( $val, $data, array( + * "empty" => false + * ); + * ``` + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param array $opts Validation options. No additional options are + * available or required for this validation method. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + static function basic( $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts ) { + $common = Validate::_common( $val, $opts ); + + return $common === false ? + $opts->message() : + true; + }; + } + + + /** + * Required field - there must be a value and it must be a non-empty value + * + * This is a helper short-cut method which is the same as: + * + * ``` + * Validate::basic( $val, $data, array( + * "required" => true + * ); + * ``` + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param array $opts Validation options. No additional options are + * available or required for this validation method. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + static function required( $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + $opts->allowEmpty( false ); + $opts->optional( false ); + + return function ( $val, $data, $field, $host ) use ( $opts ) { + $common = Validate::_common( $val, $opts ); + + return $common === false ? + $opts->message() : + true; + }; + } + + + /** + * Optional field, but if given there must be a non-empty value + * + * This is a helper short-cut method which is the same as: + * + * ``` + * Validate::basic( $val, $data, array( + * "empty" => false + * ); + * ``` + * + * @param ValidateOptions $cfg Validation options + * @return callable Validation function + */ + static function notEmpty( $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + $opts->allowEmpty( false ); + + return function ( $val, $data, $field, $host ) use ( $opts ) { + $common = Validate::_common( $val, $opts ); + + return $common === false ? + $opts->message() : + true; + }; + } + + + /** + * Validate an input as a boolean value. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param array $opts Validation options. No additional options are + * available or required for this validation method. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function boolean( $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + if ( filter_var($val, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) === null ) { + return $opts->message(); + } + return true; + }; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Number validation methods + */ + + /** + * Check that any input is numeric. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param array $opts Validation options. Additional options: + * * `decimal`: is available to indicate what character should be used + * as the decimal + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function numeric ( $decimal=".", $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts, $decimal ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + if ( $decimal !== '.' ) { + $val = str_replace( $decimal, '.', $val ); + } + + return ! is_numeric( $val ) ? + $opts->message() : + true; + }; + } + + /** + * Check for a numeric input and that it is greater than a given value. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. Additional options: + * * `min`: indicate the minimum value. If only the default validation + * options are required, this parameter can be given as an integer + * value, which will be used as the minimum value. + * * `decimal`: is available to indicate what character should be used + * as the decimal + * separator (default '.'). + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function minNum ( $min, $decimal=".", $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts, $min, $decimal ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + $fn = Validate::numeric( $decimal, $opts ); + $numeric = $fn( $val, $data, $field, $host ); + + if ( $numeric !== true ) { + return $numeric; + } + + if ( $decimal !== '.' ) { + $val = str_replace( $decimal, '.', $val ); + } + + return $val < $min ? + $opts->message() : + true; + }; + } + + /** + * Check for a numeric input and that it is less than a given value. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. + * * `max`: indicate the maximum value. If only the default validation + * options are required, this parameter can be given as an integer + * value, which will be used as the maximum value. + * * `decimal`: is available to indicate what character should be used + * as the decimal + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function maxNum ( $max, $decimal=".", $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts, $max, $decimal ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + $fn = Validate::numeric( $decimal, $opts ); + $numeric = $fn( $val, $data, $field, $host ); + + if ( $numeric !== true ) { + return $numeric; + } + + if ( $decimal !== '.' ) { + $val = str_replace( $decimal, '.', $val ); + } + + return $val > $max ? + $opts->message() : + true; + }; + } + + + /** + * Check for a numeric input and that it is both greater and smaller than + * given numbers. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. Additional options: + * * `min`: indicate the minimum value. + * * `max`: indicate the maximum value. + * * `decimal`: is available to indicate what character should be used + * as the decimal + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function minMaxNum ( $min, $max, $decimal='.', $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts, $min, $max, $decimal ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + $fn = Validate::numeric( $decimal, $opts ); + $numeric = $fn( $val, $data, $field, $host ); + + if ( $numeric !== true ) { + return $numeric; + } + + $fn = Validate::minNum( $min, $decimal, $opts ); + $numeric = $fn( $val, $data, $field, $host ); + + if ( $numeric !== true ) { + return $numeric; + } + + $fn = Validate::maxNum( $max, $decimal, $opts ); + $numeric = $fn( $val, $data, $field, $host ); + + if ( $numeric !== true ) { + return $numeric; + } + + return true; + }; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * String validation methods + */ + + /** + * Validate an input as an e-mail address. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param array $opts Validation options. No additional options are + * available or required for this validation method. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function email( $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + return filter_var($val, FILTER_VALIDATE_EMAIL) !== false ? + true : + $opts->message(); + }; + } + + + /** + * Validate a string has a minimum length. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. The additional option of + * `min` is available for this method to indicate the minimum string + * length. If only the default validation options are required, this + * parameter can be given as an integer value, which will be used as the + * minimum string length. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function minLen( $min, $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $min, $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + $strlen = is_callable('mb_strlen') ? + 'mb_strlen' : + 'strlen'; + + return $strlen( $val ) < $min ? + $opts->message() : + true; + }; + } + + + /** + * Validate a string does not exceed a maximum length. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. The additional option of + * `max` is available for this method to indicate the maximum string + * length. If only the default validation options are required, this + * parameter can be given as an integer value, which will be used as the + * maximum string length. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function maxLen( $max, $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $max, $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + $strlen = is_callable('mb_strlen') ? + 'mb_strlen' : + 'strlen'; + + return $strlen( $val ) > $max ? + $opts->message() : + true; + }; + } + + /** + * Require a string with a certain minimum or maximum number of characters. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. The additional options of + * `min` and `max` are available for this method to indicate the minimum + * and maximum string lengths, respectively. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function minMaxLen( $min, $max, $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts, $min, $max ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + $fn = Validate::minLen( $min, $opts ); + $res = $fn( $val, $data, $field, $host ); + + if ( $res !== true ) { + return $res; + } + + $fn = Validate::maxLen( $max, $opts ); + $res = $fn( $val, $data, $field, $host ); + + if ( $res !== true ) { + return $res; + } + + return true; + }; + } + + + /** + * Validate as an IP address. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param array $opts Validation options. No additional options are + * available or required for this validation method. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function ip( $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + return filter_var($val, FILTER_VALIDATE_IP) !== false ? + true : + $opts->message(); + }; + } + + + /** + * Validate as an URL address. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param array $opts Validation options. No additional options are + * available or required for this validation method. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function url( $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + return filter_var($val, FILTER_VALIDATE_URL) !== false ? + true : + $opts->message(); + }; + } + + + /** + * Check if string could contain an XSS attack string + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. The additional options of + * `db` - database connection object, `table` - database table to use and + * `column` - the column to check this value against as value, are also + * available. These options are not required and if not given are + * automatically derived from the Editor and Field instances. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function xss ( $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + return $field->xssSafety( $val ) != $val ? + $opts->message() : + true; + }; + } + + + /** + * Confirm that the value submitted is in a list of allowable values + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. The additional options of + * `db` - database connection object, `table` - database table to use and + * `column` - the column to check this value against as value, are also + * available. These options are not required and if not given are + * automatically derived from the Editor and Field instances. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function values( $values, $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $values, $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + return in_array($val, $values) ? + true : + $opts->message(); + }; + } + + + /** + * Check if there are any tags in the submitted value + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. The additional options of + * `db` - database connection object, `table` - database table to use and + * `column` - the column to check this value against as value, are also + * available. These options are not required and if not given are + * automatically derived from the Editor and Field instances. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function noTags ( $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + return strip_tags( $val ) != $val ? + $opts->message() : + true; + }; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Date validation methods + */ + + /** + * Check that a valid date input is given + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param array|string $opts If given as a string, then $opts is the date + * format to check the validity of. If given as an array, then the + * date format is in the 'format' parameter, and the return error + * message in the 'message' parameter. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function dateFormat( $format, $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $format, $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + $formatCreate = substr($format, 0, 1) !== '!' ? + '!'.$format : + $format; + + $date = \DateTime::createFromFormat( $formatCreate, $val ); + + return $date && $date->format( $format ) === $val ? + true : + $opts->message(); + }; + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Database validation methods + */ + + /** + * Check that the given value is unique in the database + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. The additional options of + * `db` - database connection object, `table` - database table to use and + * `column` - the column to check this value against as value, are also + * available. These options are not required and if not given are + * automatically derived from the Editor and Field instances. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function unique( $cfg=null, $column=null, $table=null, $db=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts, $column, $table, $db ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + $editor = $host['editor']; + + if ( ! $db ) { + $db = $host['db']; + } + + if ( ! $table ) { + $table = $editor->table(); // Returns an array, but `select` will take an array + } + + if ( ! $column ) { + $column = $field->dbField(); + } + + $query = $db + ->query( 'select', $table ) + ->get( $column ) + ->where( $column, $val ); + + // If doing an edit, then we need to also discount the current row, + // since it is of course already validly unique + if ( $host['action'] === 'edit' ) { + $cond = $editor->pkeyToArray( $host['id'], true ); + $query->where( $cond, null, '!=' ); + } + + $res = $query->exec(); + + return $res->count() === 0 ? + true : + $opts->message(); + }; + } + + /** + * Check that the given value is a value that is available in a database - + * i.e. a join primary key. This will attempt to automatically use the table + * name and value column from the field's `options` method (under the + * assumption that it will typically be used with a joined field), but the + * table and field can also be specified via the options. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. The additional options of + * `db` - database connection object, `table` - database table to use and + * `column` - the column to check this value against as value, are also + * available. These options are not required and if not given are + * automatically derived from the Editor and Field instances. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function dbValues( $cfg=null, $column=null, $table=null, $db=null, $values=array() ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts, $column, $table, $db, $values ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + // Allow local values to be defined - for example null + if ( in_array($val, $values) ) { + return true; + } + + $editor = $host['editor']; + $options = $field->options(); + + if ( ! $db ) { + $db = $host['db']; + } + + if ( ! $table ) { + $table = $options->table(); // Returns an array, but `select` will take an array + } + + if ( ! $column ) { + $column = $options->value(); + } + + if ( ! $table ) { + throw new \Exception('Table for database value check is not defined for field '.$field->name()); + } + + if ( ! $column ) { + throw new \Exception('Value column for database value check is not defined for field '.$field->name()); + } + + // Try / catch in case the submitted value can't be represented as the + // database type (e.g. an empty string as an integer) + try { + $count = $db + ->query( 'select', $table ) + ->get( $column ) + ->where( $column, $val ) + ->exec() + ->count(); + + return $count === 0 ? + $opts->message() : + true; + } + catch (\Exception $e) { + return $opts->message(); + } + }; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * File validation methods + */ + static function fileExtensions ( $extensions, $msg="This file type cannot be uploaded." ) { + return function ( $file ) use ( $extensions, $msg ) { + $extn = pathinfo($file['name'], PATHINFO_EXTENSION); + + for ( $i=0, $ien=count($extensions) ; $i<$ien ; $i++ ) { + if ( strtolower( $extn ) === strtolower( $extensions[$i] ) ) { + return true; + } + } + + return $msg; + }; + } + + static function fileSize ( $size, $msg="Uploaded file is too large." ) { + return function ( $file ) use ( $size, $msg ) { + return $file['size'] > $size ? + $msg : + true; + }; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Mjoin validation methods + */ + static function mjoinMinCount ( $count, $msg="Too few items." ) { + return function ( $editor, $action, $values ) use ( $count, $msg ) { + if ( $action === 'create' || $action === 'edit' ) { + return count($values) < $count ? + $msg : + true; + } + return true; + }; + } + + static function mjoinMaxCount ( $count, $msg="Too many items." ) { + return function ( $editor, $action, $values ) use ( $count, $msg ) { + if ( $action === 'create' || $action === 'edit' ) { + return count($values) > $count ? + $msg : + true; + } + return true; + }; + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Internal functions + * These legacy methods are for backwards compatibility with the old way of + * using the validation methods. They basically do argument swapping. + */ + + /** + * @internal + */ + static function noneLegacy( $legacyOpts ) { + return Validate::none(); + } + + /** + * @internal + */ + static function basicLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array() ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::required( $opts ); + } + + /** + * @internal + */ + static function requiredLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "This field is required." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::required( $opts ); + } + + /** + * @internal + */ + static function notEmptyLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "This field is required." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::notEmpty( $opts ); + } + + /** + * @internal + */ + static function booleanLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "Please enter true or false." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::notEmpty( $opts ); + } + + /** + * @internal + */ + static function numericLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "This input must be given as a number." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return isset( $legacyOpts['decimal'] ) ? + Validate::numeric( $legacyOpts['decimal'], $opts ) : + Validate::numeric( '.', $opts ); + } + + /** + * @internal + */ + static function minNumLegacy( $legacyOpts ) { + $min = is_array($legacyOpts) ? $legacyOpts['min'] : $legacyOpts; + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "Number is too small, must be ".$min." or larger." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return isset( $legacyOpts['decimal'] ) ? + Validate::minNum( $min, $legacyOpts['decimal'], $opts ) : + Validate::minNum( $min, '.', $opts ); + } + + /** + * @internal + */ + static function maxNumLegacy( $legacyOpts ) { + $max = is_array($legacyOpts) ? $legacyOpts['max'] : $legacyOpts; + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "Number is too large, must be ".$max." or smaller." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return isset( $legacyOpts['decimal'] ) ? + Validate::maxNum( $max, $legacyOpts['decimal'], $opts ) : + Validate::maxNum( $max, '.', $opts ); + } + + /** + * @internal + */ + static function minMaxNumLegacy( $legacyOpts ) { + $min = $legacyOpts['min']; + $max = $legacyOpts['max']; + $cfg = Validate::_extend( $legacyOpts, null, array() ); + $opts = Validate::_commonLegacy( $cfg ); + + return isset( $legacyOpts['decimal'] ) ? + Validate::minMaxNum( $min, $max, $legacyOpts['decimal'], $opts ) : + Validate::minMaxNum( $min, $max, '.', $opts ); + } + + /** + * @internal + */ + static function emailLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "Please enter a valid e-mail address." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::email( $opts ); + } + + /** + * @internal + */ + static function minLenLegacy( $legacyOpts ) { + $min = is_array($legacyOpts) ? $legacyOpts['min'] : $legacyOpts; + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "The input is too short. ".$min." characters required." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::minLen( $min, $opts ); + } + + /** + * @internal + */ + static function maxLenLegacy( $legacyOpts ) { + $max = is_array($legacyOpts) ? $legacyOpts['max'] : $legacyOpts; + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "The input is too long. ".$max." characters maximum." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::maxLen( $max, $opts ); + } + + /** + * @internal + */ + static function minMaxLenLegacy( $legacyOpts ) { + $min = $legacyOpts['min']; + $max = $legacyOpts['max']; + $cfg = Validate::_extend( $legacyOpts, null, array() ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::minMaxLen( $min, $max, $opts ); + } + + /** + * @internal + */ + static function ipLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "Please enter a valid IP address." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::ip( $opts ); + } + + /** + * @internal + */ + static function urlLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "Please enter a valid URL." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::url( $opts ); + } + + /** + * @internal + */ + static function xssLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "This field contains potentially unsafe data." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::xss( $opts ); + } + + /** + * @internal + */ + static function valuesLegacy( $legacyOpts ) { + $values = isset($legacyOpts['valid']) ? $legacyOpts['valid'] : $legacyOpts; + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "This value is not valid." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::values( $values, $opts ); + } + + /** + * @internal + */ + static function noTagsLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "This field may not contain HTML." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::noTags( $opts ); + } + + /** + * @internal + */ + static function dateFormatLegacy( $legacyOpts ) { + $format = is_array($legacyOpts) ? $legacyOpts['format'] : $legacyOpts; + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "Date is not in the expected format." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::dateFormat( $format, $opts ); + } + + /** + * @internal + */ + static function uniqueLegacy( $legacyOpts ) { + $table = isset( $legacyOpts['table'] ) ? $legacyOpts['table'] : null; + $column = isset( $legacyOpts['column'] ) ? $legacyOpts['column'] : null; + $db = isset( $legacyOpts['db'] ) ? $legacyOpts['db'] : null; + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "This field must have a unique value." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::unique( $opts, $column, $table, $db ); + } + + /** + * @internal + */ + static function dbValuesLegacy( $legacyOpts ) { + $table = isset( $legacyOpts['table'] ) ? $legacyOpts['table'] : null; + $column = isset( $legacyOpts['column'] ) ? $legacyOpts['column'] : null; + $db = isset( $legacyOpts['db'] ) ? $legacyOpts['db'] : null; + $values = isset( $legacyOpts['values'] ) ? $legacyOpts['values'] : array(); + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "This value is not valid." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::dbValues( $opts, $column, $table, $db, $values ); + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/Editor/ValidateOptions.php b/ci4/app/ThirdParty/DatatablesEditor/Editor/ValidateOptions.php new file mode 100644 index 00000000..027ddcc8 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Editor/ValidateOptions.php @@ -0,0 +1,99 @@ +allowEmpty( $opts['empty'] ); + } + if ( isset( $opts['message'] ) ) { + $this->message( $opts['message'] ); + } + if ( isset( $opts['optional'] ) ) { + $this->optional( $opts['optional'] ); + } + } + + return $this; + } + + /** + * Get / set the error message to use if validation fails + * @param string $msg Error message to use. If not given, the currently + * set message will be returned. + * @return ValidateOptions|string Self if setting, message if getting. + */ + public function message ( $msg=null ) { + if ( $msg === null ) { + return $this->_message; + } + + $this->_message = $msg; + return $this; + } + + /** + * Get / set the field empty option + * @param boolean $empty `false` if the field is not allowed to be + * empty. `true` if it can be. + * @return ValidateOptions|boolean Self if setting, current value if getting. + */ + public function allowEmpty ( $empty=null ) { + if ( $empty === null ) { + return $this->_empty; + } + + $this->_empty = $empty; + return $this; + } + + /** + * Get / set the field optional option + * @param boolean $optional `false` if the field does not need to be + * submitted. `true` if it must be. + * @return ValidateOptions|boolean Self if setting, current value if getting. + */ + public function optional ( $optional=null ) { + if ( $optional === null ) { + return $this->_optional; + } + + $this->_optional = $optional; + return $this; + } + + + /** + * @internal + */ + static public function select ( $user ) { + if ( $user ) { + return $user; + } + + return new ValidateOptions(); + } +} \ No newline at end of file diff --git a/ci4/app/ThirdParty/DatatablesEditor/Ext.php b/ci4/app/ThirdParty/DatatablesEditor/Ext.php new file mode 100644 index 00000000..4ebf6a67 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/Ext.php @@ -0,0 +1,222 @@ +newInstance() : + $rc->newInstanceArgs( $args ); + } + + /** + * Static method to instantiate a new instance of a class (shorthand of + * 'instantiate'). + * + * This method performs exactly the same actions as the 'instantiate' + * static method, but is simply shorter and easier to type! + * @return \DataTables\Editor|\DataTables\Editor\Field|\DataTables\Editor\Join|\DataTables\Editor\Upload class + * @static + */ + public static function inst () + { + $rc = new \ReflectionClass( get_called_class() ); + $args = func_get_args(); + + return count( $args ) === 0 ? + $rc->newInstance() : + $rc->newInstanceArgs( $args ); + } + + /** + * Common getter / setter function for DataTables classes. + * + * This getter / setter method makes building getter / setting methods + * easier, by abstracting everything to a single function call. + * @param mixed &$prop The property to set + * @param mixed $val The value to set - if given as null, then we assume + * that the function is being used as a getter. + * @param boolean $array Treat the target property as an array or not + * (default false). If used as an array, then values passed in are added + * to the $prop array. + * @return self|mixed Class instance if setting (allowing chaining), or + * the value requested if getting. + */ + protected function _getSet( &$prop, $val, $array=false ) + { + // Get + if ( $val === null ) { + return $prop; + } + + // Set + if ( $array ) { + // Property is an array, merge or add to array + is_array( $val ) ? + $prop = array_merge( $prop, $val ) : + $prop[] = $val; + } + else { + // Property is just a value + $prop = $val; + } + + return $this; + } + + /** + * Determine if a property is available in a data set (allowing `null` to be + * a valid value) + * @param string $name Javascript dotted object name to write to + * @param array $data Data source array to read from + * @return boolean true if present, false otherwise + * @private + */ + protected function _propExists ( $name, $data ) + { + if ( strpos($name, '.') === false ) { + return isset( $data[ $name ] ); + } + + $names = explode( '.', $name ); + $inner = $data; + + for ( $i=0 ; $ixss()` method. The Vanilla forums wrapper is used + * to provide sensible defaults and a clean interface for HtmLawed. + * + * Changes: + * + * * Add `DataTables/HtmLawed` namespace to this and htmLawed - this is to ensure + * that if htmLawed is included by any other aspect of the site it will not + * result in a conflict. + * * Use the OOP version of htmLawed (required a single updated to call it) to + * make the namespacing relatively easy. + * * Change the name of the Vanilla class so it don't conflict with the + * htmLawed OOP class + * * Update all `htmLawed::` references to `\DataTables\HtmLawed\HtmLawed::` in + * the htmLawed file (to allow callbacks to operate correctly) + * * Updated Vanilla wrapper to operate on PHP 5.3 + * + * HtmLawed: + * http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/ + * Copyright: Santosh Patnaik + * License: Dual licensed with LGPL 3 and GPL 2+ + * + * Vanilla wrapper for HtmLawed: + * https://github.com/vanilla/htmlawed/ + * Author: Todd Burry + * Copyright: 2009-2014 Vanilla Forums Inc. + * License: LGPL-3.0 + */ + +namespace DataTables\HtmLawed; + +/** + * A class wrapper for the htmLawed library. + */ +class Htmlaw { + /// Methods /// + + public static $defaultConfig = array( + 'anti_link_spam' => array('`.`', ''), + 'comment' => 1, + 'cdata' => 3, + 'css_expression' => 1, + 'deny_attribute' => 'on*', + 'unique_ids' => 0, + 'elements' => '*-applet-form-input-textarea-iframe-script-style-embed-object', + 'keep_bad' => 1, + 'schemes' => 'classid:clsid; href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; style: nil; *:file, http, https', // clsid allowed in class + 'valid_xhtml' => 0, + 'direct_list_nest' => 1, + 'balance' => 1 + ); + + public static $defaultSpec = array( + 'object=-classid-type, -codebase', + 'embed=type(oneof=application/x-shockwave-flash)' + ); + + /** + * Filters a string of html with the htmLawed library. + * + * @param string $html The text to filter. + * @param array|null $config Config settings for the array. + * @param string|array|null $spec A specification to further limit the allowed attribute values in the html. + * @return string Returns the filtered html. + * @see http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/htmLawed_README.htm + */ + public static function filter($html, array $config = null, $spec = null) { + if ($config === null) { + $config = self::$defaultConfig; + } + + if (isset($config['spec']) && !$spec) { + $spec = $config['spec']; + } + + if ($spec === null) { + $spec = static::$defaultSpec; + } + + return Htmlawed::hl($html, $config, $spec); + } + + + /** + * Filter a string of html so that it can be put into an rss feed. + * + * @param $html The html text to fitlter. + * @return string Returns the filtered html. + * @see Htmlawed::filter(). + */ + public static function filterRSS($html) { + $config = array( + 'anti_link_spam' => array('`.`', ''), + 'comment' => 1, + 'cdata' => 3, + 'css_expression' => 1, + 'deny_attribute' => 'on*,style,class', + 'elements' => '*-applet-form-input-textarea-iframe-script-style-object-embed-comment-link-listing-meta-noscript-plaintext-xmp', + 'keep_bad' => 0, + 'schemes' => 'classid:clsid; href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; style: nil; *:file, http, https', // clsid allowed in class + 'valid_xml' => 2, + 'balance' => 1 + ); + $spec = static::$defaultSpec; + + $result = static::filter($html, $config, $spec); + + return $result; + } +} diff --git a/ci4/app/ThirdParty/DatatablesEditor/HtmLawed/Htmlawed.php b/ci4/app/ThirdParty/DatatablesEditor/HtmLawed/Htmlawed.php new file mode 100644 index 00000000..2d4a7b78 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/HtmLawed/Htmlawed.php @@ -0,0 +1,1587 @@ + + * @copyright (c) 2007-, Santosh Patnaik + * @dependency None + * @license LGPL 3 and GPL 2+ dual license + * @link https://bioinformatics.org/phplabware/internal_utilities/htmLawed + * @package htmLawed + * @php >=4.4 + * @time 2022-11-05 + * @version 1.2.10 + */ + +namespace DataTables\HtmLawed; + +class Htmlawed { + /* + * Main function. + * Calls all other functions (alphabetically ordered further below). + * + * @param string $t HTM. + * @param mixed $C $config configuration option. + * @param mixed $S $spec specification option. + * @return string Filtered/sanitized $t. + */ + public static function hl($t, $C=1, $S=array()) + { + // Standard elements including deprecated. + + $eleAr = array('a'=>1, 'abbr'=>1, 'acronym'=>1, 'address'=>1, 'applet'=>1, 'area'=>1, 'article'=>1, 'aside'=>1, 'audio'=>1, 'b'=>1, 'bdi'=>1, 'bdo'=>1, 'big'=>1, 'blockquote'=>1, 'br'=>1, 'button'=>1, 'canvas'=>1, 'caption'=>1, 'center'=>1, 'cite'=>1, 'code'=>1, 'col'=>1, 'colgroup'=>1, 'command'=>1, 'data'=>1, 'datalist'=>1, 'dd'=>1, 'del'=>1, 'details'=>1, 'dialog'=>1, 'dfn'=>1, 'dir'=>1, 'div'=>1, 'dl'=>1, 'dt'=>1, 'em'=>1, 'embed'=>1, 'fieldset'=>1, 'figcaption'=>1, 'figure'=>1, 'font'=>1, 'footer'=>1, 'form'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'header'=>1, 'hgroup'=>1, 'hr'=>1, 'i'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'ins'=>1, 'isindex'=>1, 'kbd'=>1, 'keygen'=>1, 'label'=>1, 'legend'=>1, 'li'=>1, 'link'=>1, 'main'=>1, 'map'=>1, 'mark'=>1, 'menu'=>1, 'meta'=>1, 'meter'=>1, 'nav'=>1, 'noscript'=>1, 'object'=>1, 'ol'=>1, 'optgroup'=>1, 'option'=>1, 'output'=>1, 'p'=>1, 'param'=>1, 'picture'=>1, 'pre'=>1, 'progress'=>1, 'q'=>1, 'rb'=>1, 'rbc'=>1, 'rp'=>1, 'rt'=>1, 'rtc'=>1, 'ruby'=>1, 's'=>1, 'samp'=>1, 'script'=>1, 'section'=>1, 'select'=>1, 'slot'=>1, 'small'=>1, 'source'=>1, 'span'=>1, 'strike'=>1, 'strong'=>1, 'style'=>1, 'sub'=>1, 'summary'=>1, 'sup'=>1, 'table'=>1, 'tbody'=>1, 'td'=>1, 'template'=>1, 'textarea'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'time'=>1, 'tr'=>1, 'track'=>1, 'tt'=>1, 'u'=>1, 'ul'=>1, 'var'=>1, 'video'=>1, 'wbr'=>1); + + // Set $C array ($config), using default parameters as needed. + + $C = is_array($C) ? $C : array(); + if (!empty($C['valid_xhtml'])) { + $C['elements'] = empty($C['elements']) ? '*-acronym-big-center-dir-font-isindex-s-strike-tt' : $C['elements']; + $C['make_tag_strict'] = isset($C['make_tag_strict']) ? $C['make_tag_strict'] : 2; + $C['xml:lang'] = isset($C['xml:lang']) ? $C['xml:lang'] : 2; + } + + // -- Configure for elements. + + if (!empty($C['safe'])) { + unset($eleAr['applet'], $eleAr['audio'], $eleAr['canvas'], $eleAr['dialog'], $eleAr['embed'], $eleAr['iframe'], $eleAr['object'], $eleAr['script'], $eleAr['video']); + } + $x = !empty($C['elements']) ? str_replace(array("\n", "\r", "\t", ' '), '', strtolower($C['elements'])) : '*'; + if ($x == '-*') { + $eleAr = array(); + } elseif (strpos($x, '*') === false) { + $eleAr = array_flip(explode(',', $x)); + } else { + if (isset($x[1])) { + if (strpos($x, '(')) { // Temporarily replace hyphen of custom element, minus being special character + $x = + preg_replace_callback( + '`\([^()]+\)`', + function ($m) { + return str_replace(array('(', ')', '-'), array('', '', 'A'), $m[0]); + }, + $x); + } + preg_match_all('`(?:^|-|\+)[^\-+]+?(?=-|\+|$)`', $x, $m, PREG_SET_ORDER); + for ($i=count($m); --$i>=0;) { + $m[$i] = $m[$i][0]; + } + foreach ($m as $v) { + $v = str_replace('A', '-', $v); + if ($v[0] == '+') { + $eleAr[substr($v, 1)] = 1; + } elseif ($v[0] == '-') { + if (strpos($v, '-', 1)) { + $eleAr[$v] = 1; + } elseif (isset($eleAr[($v = substr($v, 1))]) && !in_array('+'. $v, $m)) { + unset($eleAr[$v]); + } + } + } + } + } + $C['elements'] =& $eleAr; + + // -- Configure for attributes. + + $x = !empty($C['deny_attribute']) ? strtolower(preg_replace('"\s+-"', '/', trim($C['deny_attribute']))) : ''; + $x = str_replace(array(' ', "\t", "\r", "\n"), '', $x); + $x = + array_flip( + (isset($x[0]) && $x[0] == '*') + ? preg_replace( + '`^[^*]`', + '-'. '\\0', + explode( + '/', + (!empty($C['safe']) ? preg_replace('`/on[^/]+`', '', $x) : $x))) + : array_filter(explode(',', $x. (!empty($C['safe']) ? ',on*' : '')))); + $C['deny_attribute'] = $x; + + // -- Configure URL handling. + + $x = (isset($C['schemes'][2]) && strpos($C['schemes'], ':') + ? strtolower($C['schemes']) + : 'href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, tel, telnet') + . (empty($C['safe']) + ? ', app, javascript; *: data, javascript, ' + : '; *:') + . 'file, http, https'; + $C['schemes'] = array(); + foreach (explode(';', trim(str_replace(array(' ', "\t", "\r", "\n"), '', $x), ';')) as $v) { + if(strpos($v, ':')) { + list($x, $y) = explode(':', $v, 2); + $C['schemes'][$x] = array_flip(explode(',', $y)); + } + } + if (!isset($C['schemes']['*'])) { + $C['schemes']['*'] = array('file'=>1, 'http'=>1, 'https'=>1); + if (empty($C['safe'])) { + $C['schemes']['*'] += array('data'=>1, 'javascript'=>1); + } + } + if (!empty($C['safe']) && empty($C['schemes']['style'])) { + $C['schemes']['style'] = array('!'=>1); + } + $C['abs_url'] = isset($C['abs_url']) ? $C['abs_url'] : 0; + if (!isset($C['base_url']) || !preg_match('`^[a-zA-Z\d.+\-]+://[^/]+/(.+?/)?$`', $C['base_url'])) { + $C['base_url'] = $C['abs_url'] = 0; + } + + // -- Configure other parameters. + + $C['and_mark'] = empty($C['and_mark']) ? 0 : 1; + $C['anti_link_spam'] = + (isset($C['anti_link_spam']) + && is_array($C['anti_link_spam']) + && count($C['anti_link_spam']) == 2 + && (empty($C['anti_link_spam'][0]) + || self::hl_regex($C['anti_link_spam'][0])) + && (empty($C['anti_link_spam'][1]) + || self::hl_regex($C['anti_link_spam'][1]))) + ? $C['anti_link_spam'] + : 0; + $C['anti_mail_spam'] = isset($C['anti_mail_spam']) ? $C['anti_mail_spam'] : 0; + $C['any_custom_element'] = (!isset($C['any_custom_element']) || !empty($C['any_custom_element'])) ? 1 : 0; + $C['balance'] = isset($C['balance']) ? (bool)$C['balance'] : 1; + $C['cdata'] = isset($C['cdata']) ? $C['cdata'] : (empty($C['safe']) ? 3 : 0); + $C['clean_ms_char'] = empty($C['clean_ms_char']) ? 0 : $C['clean_ms_char']; + $C['comment'] = isset($C['comment']) ? $C['comment'] : (empty($C['safe']) ? 3 : 0); + $C['css_expression'] = empty($C['css_expression']) ? 0 : 1; + $C['direct_list_nest'] = empty($C['direct_list_nest']) ? 0 : 1; + $C['hexdec_entity'] = isset($C['hexdec_entity']) ? $C['hexdec_entity'] : 1; + $C['hook'] = (!empty($C['hook']) && is_callable($C['hook'])) ? $C['hook'] : 0; + $C['hook_tag'] = (!empty($C['hook_tag']) && is_callable($C['hook_tag'])) ? $C['hook_tag'] : 0; + $C['keep_bad'] = isset($C['keep_bad']) ? $C['keep_bad'] : 6; + $C['lc_std_val'] = isset($C['lc_std_val']) ? (bool)$C['lc_std_val'] : 1; + $C['make_tag_strict'] = isset($C['make_tag_strict']) ? $C['make_tag_strict'] : 1; + $C['named_entity'] = isset($C['named_entity']) ? (bool)$C['named_entity'] : 1; + $C['no_deprecated_attr'] = isset($C['no_deprecated_attr']) ? $C['no_deprecated_attr'] : 1; + $C['parent'] = isset($C['parent'][0]) ? strtolower($C['parent']) : 'body'; + $C['show_setting'] = !empty($C['show_setting']) ? $C['show_setting'] : 0; + $C['style_pass'] = empty($C['style_pass']) ? 0 : 1; + $C['tidy'] = empty($C['tidy']) ? 0 : $C['tidy']; + $C['unique_ids'] = isset($C['unique_ids']) && (!preg_match('`\W`', $C['unique_ids'])) ? $C['unique_ids'] : 1; + $C['xml:lang'] = isset($C['xml:lang']) ? $C['xml:lang'] : 0; + + if (isset($GLOBALS['C'])) { + $oldC = $GLOBALS['C']; + } + $GLOBALS['C'] = $C; + + // Set $S array ($spec). + + $S = is_array($S) ? $S : self::hl_spec($S); + if (isset($GLOBALS['S'])) { + $oldS = $GLOBALS['S']; + } + $GLOBALS['S'] = $S; + + // Handle characters. + + $t = preg_replace('`[\x00-\x08\x0b-\x0c\x0e-\x1f]`', '', $t); // Remove illegal + if ($C['clean_ms_char']) { // Convert MS Windows CP-1252 + $x = array("\x7f"=>'', "\x80"=>'€', "\x81"=>'', "\x83"=>'ƒ', "\x85"=>'…', "\x86"=>'†', "\x87"=>'‡', "\x88"=>'ˆ', "\x89"=>'‰', "\x8a"=>'Š', "\x8b"=>'‹', "\x8c"=>'Œ', "\x8d"=>'', "\x8e"=>'Ž', "\x8f"=>'', "\x90"=>'', "\x95"=>'•', "\x96"=>'–', "\x97"=>'—', "\x98"=>'˜', "\x99"=>'™', "\x9a"=>'š', "\x9b"=>'›', "\x9c"=>'œ', "\x9d"=>'', "\x9e"=>'ž', "\x9f"=>'Ÿ'); + $x = $x + + ($C['clean_ms_char'] == 1 + ? array("\x82"=>'‚', "\x84"=>'„', "\x91"=>'‘', "\x92"=>'’', "\x93"=>'“', "\x94"=>'”') + : array("\x82"=>'\'', "\x84"=>'"', "\x91"=>'\'', "\x92"=>'\'', "\x93"=>'"', "\x94"=>'"')); + $t = strtr($t, $x); + } + + // Handle CDATA, comments, and entities. + + if ($C['cdata'] || $C['comment']) { + $t = preg_replace_callback('``sm', 'DataTables\HtmLawed\Htmlawed::hl_commentCdata', $t); + } + $t = + preg_replace_callback( + '`&([a-zA-Z][a-zA-Z0-9]{1,30}|#(?:[0-9]{1,8}|[Xx][0-9A-Fa-f]{1,7}));`', + 'DataTables\HtmLawed\Htmlawed::hl_entity', + str_replace('&', '&', $t)); + if ($C['unique_ids'] && !isset($GLOBALS['hl_Ids'])) { + $GLOBALS['hl_Ids'] = array(); + } + + if ($C['hook']) { + $t = call_user_func($C['hook'], $t, $C, $S); + } + + // Handle remaining text. + + $t = preg_replace_callback('`<(?:(?:\s|$)|(?:[^>]*(?:>|$)))|>`m', 'DataTables\HtmLawed\Htmlawed::hl_tag', $t); + $t = $C['balance'] ? self::hl_balance($t, $C['keep_bad'], $C['parent']) : $t; + $t = (($C['cdata'] || $C['comment']) && strpos($t, "\x01") !== false) + ? str_replace(array("\x01", "\x02", "\x03", "\x04", "\x05"), array('', '', '&', '<', '>'), $t) + : $t; + $t = $C['tidy'] ? self::hl_tidy($t, $C['tidy'], $C['parent']) : $t; + + // Cleanup. + + if ($C['show_setting'] && preg_match('`^[a-z][a-z0-9_]*$`i', $C['show_setting'])) { + $GLOBALS[$C['show_setting']] = array('config'=>$C, 'spec'=>$S, 'time'=>microtime(true), 'version'=>self::hl_version()); + } + unset($C, $eleAr); + if (isset($oldC)) { + $GLOBALS['C'] = $oldC; + } + if (isset($oldS)) { + $GLOBALS['S'] = $oldS; + } + return $t; + } + + /** + * Validate attribute value and possibly reset to a default. + * + * @param string $attr Attribute name. + * @param string $value Attribute value. + * @param array $ruleAr Array of rules derived from $spec. + * @param string $ele Element. + * @return mixed 0 if invalid $value, + * or string with validated or default value. + */ + public static function hl_attributeValue($attr, $value, $ruleAr, $ele) + { + static $spacedValsAttrAr = array('accesskey', 'class', 'itemtype', 'rel'); // Some attributes have multiple values + $valSep = + (in_array($attr, $spacedValsAttrAr) || ($attr == 'archive' && $ele == 'object')) + ? ' ' + : (($attr == 'srcset' || ($attr == 'archive' && $ele == 'applet')) + ? ',' + : ''); + $out = array(); + $valAr = !empty($valSep) ? explode($valSep, $value) : array($value); + foreach ($valAr as $v) { + $ok = 1; + $v = trim($v); + $lengthVal = strlen($v); + foreach ($ruleAr as $ruleType=>$ruleVal) { + if (!$lengthVal) { + continue; + } + switch ($ruleType) { + case 'maxlen': if ($lengthVal > $ruleVal) { + $ok = 0; + } + break; case 'minlen': if ($lengthVal < $ruleVal) { + $ok = 0; + } + break; case 'maxval': if ((float)($v) > $ruleVal) { + $ok = 0; + } + break; case 'minval': if ((float)($v) < $ruleVal) { + $ok = 0; + } + break; case 'match': if (!preg_match($ruleVal, $v)) { + $ok = 0; + } + break; case 'nomatch': if (preg_match($ruleVal, $v)) { + $ok = 0; + } + break; case 'oneof': if(!in_array($v, explode('|', $ruleVal))) { + $ok = 0; + } + break; case 'noneof': if(in_array($v, explode('|', $ruleVal))) { + $ok = 0; + } + break; default: + break; + } + if (!$ok) { + break; + } + } + if ($ok) { + $out[] = $v; + } + } + $out = implode($valSep == ',' ? ', ' : ' ', $out); + return (isset($out[0]) ? $out : (isset($ruleAr['default']) ? $ruleAr['default'] : 0)); + } + + /* + * Enforce parent-child validity of elements and balance tags. + * + * @param string $t HTM. Previously partly sanitized/filtered. CDATA + * and comment sections have characters hidden. + * @param int $act $config's keep_bad parameter. + * @param string $parentEle $t's parent element option. + * @return string $t with valid nesting and balanced tags. + */ + public static function hl_balance($t, $act=1, $parentEle='div') + { + // Group elements in different ways. + + $closingTagOmitableEleAr = array('caption'=>1, 'colgroup'=>1, 'dd'=>1, 'dt'=>1, 'li'=>1, 'optgroup'=>1, 'option'=>1, 'p'=>1, 'rp'=>1, 'rt'=>1, 'tbody'=>1, 'td'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'tr'=>1); + + // -- Block, inline, etc. + + $blockEleAr = array('a'=>1, 'address'=>1, 'article'=>1, 'aside'=>1, 'blockquote'=>1, 'center'=>1, 'del'=>1, 'details'=>1, 'dialog'=>1, 'dir'=>1, 'dl'=>1, 'div'=>1, 'fieldset'=>1, 'figure'=>1, 'footer'=>1, 'form'=>1, 'ins'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'header'=>1, 'hr'=>1, 'isindex'=>1, 'main'=>1, 'menu'=>1, 'nav'=>1, 'noscript'=>1, 'ol'=>1, 'p'=>1, 'pre'=>1, 'section'=>1, 'slot'=>1, 'style'=>1, 'table'=>1, 'template'=>1, 'ul'=>1); + $inlineEleAr = array('#pcdata'=>1, 'a'=>1, 'abbr'=>1, 'acronym'=>1, 'applet'=>1, 'audio'=>1, 'b'=>1, 'bdi'=>1, 'bdo'=>1, 'big'=>1, 'br'=>1, 'button'=>1, 'canvas'=>1, 'cite'=>1, 'code'=>1, 'command'=>1, 'data'=>1, 'datalist'=>1, 'del'=>1, 'dfn'=>1, 'em'=>1, 'embed'=>1, 'figcaption'=>1, 'font'=>1, 'i'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'ins'=>1, 'kbd'=>1, 'label'=>1, 'link'=>1, 'map'=>1, 'mark'=>1, 'meta'=>1, 'meter'=>1, 'object'=>1, 'output'=>1, 'picture'=>1, 'progress'=>1, 'q'=>1, 'ruby'=>1, 's'=>1, 'samp'=>1, 'select'=>1, 'script'=>1, 'small'=>1, 'span'=>1, 'strike'=>1, 'strong'=>1, 'sub'=>1, 'summary'=>1, 'sup'=>1, 'textarea'=>1, 'time'=>1, 'tt'=>1, 'u'=>1, 'var'=>1, 'video'=>1, 'wbr'=>1); + $otherEleAr = array('area'=>1, 'caption'=>1, 'col'=>1, 'colgroup'=>1, 'command'=>1, 'dd'=>1, 'dt'=>1, 'hgroup'=>1, 'keygen'=>1, 'legend'=>1, 'li'=>1, 'optgroup'=>1, 'option'=>1, 'param'=>1, 'rb'=>1, 'rbc'=>1, 'rp'=>1, 'rt'=>1, 'rtc'=>1, 'script'=>1, 'source'=>1, 'tbody'=>1, 'td'=>1, 'tfoot'=>1, 'thead'=>1, 'th'=>1, 'tr'=>1, 'track'=>1); + $flowEleAr = $blockEleAr + $inlineEleAr; + + // -- Type of child allowed. + + $blockKidEleAr = array('blockquote'=>1, 'form'=>1, 'map'=>1, 'noscript'=>1); + $flowKidEleAr = array('a'=>1, 'article'=>1, 'aside'=>1, 'audio'=>1, 'button'=>1, 'canvas'=>1, 'del'=>1, 'details'=>1, 'dialog'=>1, 'div'=>1, 'dd'=>1, 'fieldset'=>1, 'figure'=>1, 'footer'=>1, 'header'=>1, 'iframe'=>1, 'ins'=>1, 'li'=>1, 'main'=>1, 'menu'=>1, 'nav'=>1, 'noscript'=>1, 'object'=>1, 'section'=>1, 'slot'=>1, 'style'=>1, 'td'=>1, 'template'=>1, 'th'=>1, 'video'=>1); // Later context-wise dynamic move of ins & del to $inlineKidEleAr + $inlineKidEleAr = array('abbr'=>1, 'acronym'=>1, 'address'=>1, 'b'=>1, 'bdi'=>1, 'bdo'=>1, 'big'=>1, 'caption'=>1, 'cite'=>1, 'code'=>1, 'data'=>1, 'datalist'=>1, 'dfn'=>1, 'dt'=>1, 'em'=>1, 'figcaption'=>1, 'font'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'hgroup'=>1, 'i'=>1, 'kbd'=>1, 'label'=>1, 'legend'=>1, 'mark'=>1, 'meter'=>1, 'output'=>1, 'p'=>1, 'picture'=>1, 'pre'=>1, 'progress'=>1, 'q'=>1, 'rb'=>1, 'rt'=>1, 's'=>1, 'samp'=>1, 'small'=>1, 'span'=>1, 'strike'=>1, 'strong'=>1, 'sub'=>1, 'summary'=>1, 'sup'=>1, 'time'=>1, 'tt'=>1, 'u'=>1, 'var'=>1); + $noKidEleAr = array('area'=>1, 'br'=>1, 'col'=>1, 'command'=>1, 'embed'=>1, 'hr'=>1, 'img'=>1, 'input'=>1, 'isindex'=>1, 'keygen'=>1, 'link'=>1, 'meta'=>1, 'param'=>1, 'source'=>1, 'track'=>1, 'wbr'=>1); + + // Special parent-child relations. + + $invalidMomKidAr = array('a'=>array('a'=>1, 'address'=>1, 'button'=>1, 'details'=>1, 'embed'=>1, 'iframe'=>1, 'keygen'=>1, 'label'=>1, 'select'=>1, 'textarea'=>1), 'address'=>array('address'=>1, 'article'=>1, 'aside'=>1, 'footer'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'header'=>1, 'hgroup'=>1, 'keygen'=>1, 'nav'=>1, 'section'=>1), 'audio'=>array('audio'=>1, 'video'=>1), 'button'=>array('a'=>1, 'address'=>1, 'button'=>1, 'details'=>1, 'embed'=>1, 'iframe'=>1, 'keygen'=>1, 'label'=>1, 'select'=>1, 'textarea'=>1), 'dfn'=>array('dfn'=>1), 'fieldset'=>array('fieldset'=>1), 'footer'=>array('footer'=>1, 'header'=>1), 'form'=>array('form'=>1), 'header'=>array('footer'=>1, 'header'=>1), 'label'=>array('label'=>1), 'main'=>array('main'=>1), 'meter'=>array('meter'=>1), 'noscript'=>array('script'=>1), 'progress'=>array('progress'=>1), 'rb'=>array('ruby'=>1), 'rt'=>array('ruby'=>1), 'time'=>array('time'=>1), 'video'=>array('audio'=>1, 'video'=>1)); + $invalidKidEleAr = array('a'=>1, 'address'=>1, 'article'=>1, 'aside'=>1, 'audio'=>1, 'button'=>1, 'details'=>1, 'dfn'=>1, 'embed'=>1, 'fieldset'=>1, 'footer'=>1, 'form'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'header'=>1, 'hgroup'=>1, 'iframe'=>1, 'keygen'=>1, 'label'=>1, 'main'=>1, 'meter'=>1, 'nav'=>1, 'progress'=>1, 'ruby'=>1, 'script'=>1, 'section'=>1, 'select'=>1, 'textarea'=>1, 'time'=>1, 'video'=>1); // $invalidMomKidAr values + $invalidMomEleAr = array_keys($invalidMomKidAr); + $validMomKidAr = array('colgroup'=>array('col'=>1, 'template'=>1), 'datalist'=>array('option'=>1, 'script'=>1), 'details'=>array('summary'=>1), 'dir'=>array('li'=>1), 'dl'=>array('dd'=>1, 'div'=>1, 'dt'=>1), 'hgroup'=>array('h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1), 'menu'=>array('li'=>1, 'script'=>1, 'template'=>1), 'ol'=>array('li'=>1, 'script'=>1, 'template'=>1), 'optgroup'=>array('option'=>1, 'script'=>1, 'template'=>1), 'option'=>array('#pcdata'=>1), 'picture'=>array('img'=>1, 'script'=>1, 'source'=>1, 'template'=>1), 'rbc'=>array('rb'=>1), 'rp'=>array('#pcdata'=>1), 'rtc'=>array('rp'=>1, 'rt'=>1), 'ruby'=>array('rb'=>1, 'rbc'=>1, 'rp'=>1, 'rt'=>1, 'rtc'=>1), 'select'=>array('optgroup'=>1, 'option'=>1), 'script'=>array('#pcdata'=>1), 'table'=>array('caption'=>1, 'col'=>1, 'colgroup'=>1, 'script'=>1, 'tbody'=>1, 'tfoot'=>1, 'thead'=>1, 'tr'=>1, 'template'=>1), 'tbody'=>array('script'=>1, 'template'=>1, 'tr'=>1), 'tfoot'=>array('tr'=>1), 'textarea'=>array('#pcdata'=>1), 'thead'=>array('script'=>1, 'template'=>1, 'tr'=>1), 'tr'=>array('script'=>1, 'td'=>1, 'template'=>1, 'th'=>1), 'ul'=>array('li'=>1, 'script'=>1, 'template'=>1)); // Immediate parent-child relation + if ($GLOBALS['C']['direct_list_nest']) { + $validMomKidAr['ol'] = $validMomKidAr['ul'] = $validMomKidAr['menu'] += array('menu'=>1, 'ol'=>1, 'ul'=>1); + } + $otherValidMomKidAr = array('address'=>array('p'=>1), 'applet'=>array('param'=>1), 'audio'=>array('source'=>1, 'track'=>1), 'blockquote'=>array('script'=>1), 'details'=>array('summary'=>1), 'fieldset'=>array('legend'=>1, '#pcdata'=>1), 'figure'=>array('figcaption'=>1),'form'=>array('script'=>1), 'map'=>array('area'=>1), 'legend'=>array('h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1), 'object'=>array('param'=>1, 'embed'=>1), 'summary'=>array('h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'hgroup'=>1), 'video'=>array('source'=>1, 'track'=>1)); + + // Valid elements for top-level parent. + + $mom = ((isset($flowEleAr[$parentEle]) && $parentEle != '#pcdata') + || isset($otherEleAr[$parentEle])) + ? $parentEle + : 'div'; + if (isset($noKidEleAr[$mom])) { + return (!$act ? '' : str_replace(array('<', '>'), array('<', '>'), $t)); + } + if (isset($validMomKidAr[$mom])) { + $validInMomEleAr = $validMomKidAr[$mom]; + } elseif (isset($inlineKidEleAr[$mom])) { + $validInMomEleAr = $inlineEleAr; + $inlineKidEleAr['del'] = 1; + $inlineKidEleAr['ins'] = 1; + } elseif (isset($flowKidEleAr[$mom])) { + $validInMomEleAr = $flowEleAr; + unset($inlineKidEleAr['del'], $inlineKidEleAr['ins']); + } elseif (isset($blockKidEleAr[$mom])) { + $validInMomEleAr = $blockEleAr; + unset($inlineKidEleAr['del'], $inlineKidEleAr['ins']); + } + if (isset($otherValidMomKidAr[$mom])) { + $validInMomEleAr = $validInMomEleAr + $otherValidMomKidAr[$mom]; + } + if (isset($invalidMomKidAr[$mom])) { + $validInMomEleAr = array_diff_assoc($validInMomEleAr, $invalidMomKidAr[$mom]); + } + if (strpos($mom, '-')) { // Custom element + $validInMomEleAr = array('*' => 1, '#pcdata' =>1); + } + + // Loop over elements. + + $t = explode('<', $t); + $validKidsOfMom = $openEleQueue = array(); // Queue of opened elements + ob_start(); + for ($i=-1, $eleCount=count($t); ++$i<$eleCount;) { + + // Check element validity as child. Same code as section: Finishing (below). + + if ($queueLength = count($openEleQueue)) { + $eleNow = array_pop($openEleQueue); + $openEleQueue[] = $eleNow; + if (isset($validMomKidAr[$eleNow])) { + $validKidsOfMom = $validMomKidAr[$eleNow]; + } elseif (isset($inlineKidEleAr[$eleNow])) { + $validKidsOfMom = $inlineEleAr; + $inlineKidEleAr['del'] = 1; + $inlineKidEleAr['ins'] = 1; + } elseif (isset($flowKidEleAr[$eleNow])) { + $validKidsOfMom = $flowEleAr; + unset($inlineKidEleAr['del'], $inlineKidEleAr['ins']); + } elseif (isset($blockKidEleAr[$eleNow])) { + $validKidsOfMom = $blockEleAr; + unset($inlineKidEleAr['del'], $inlineKidEleAr['ins']); + } + if (isset($otherValidMomKidAr[$eleNow])) { + $validKidsOfMom = $validKidsOfMom + $otherValidMomKidAr[$eleNow]; + } + if (isset($invalidMomKidAr[$eleNow])) { + $validKidsOfMom = array_diff_assoc($validKidsOfMom, $invalidMomKidAr[$eleNow]); + } + if (strpos($eleNow, '-')) { // Custom element + $validKidsOfMom = array('*'=>1, '#pcdata'=>1); + } + } else { + $validKidsOfMom = $validInMomEleAr; + unset($inlineKidEleAr['del'], $inlineKidEleAr['ins']); + } + if ( + isset($ele) + && ($act == 1 + || (isset($validKidsOfMom['#pcdata']) + && ($act == 3 + || $act == 5))) + ) { + echo '<', $slash, $ele, $attrs, '>'; + } + if (isset($content[0])) { + if (strlen(trim($content)) + && (($queueLength && isset($blockKidEleAr[$eleNow])) + || (isset($blockKidEleAr[$mom]) && !$queueLength)) + ) { + echo '
', $content, '
'; + } elseif ($act < 3 || isset($validKidsOfMom['#pcdata'])) { + echo $content; + } elseif (strpos($content, "\x02\x04")) { + foreach ( + preg_split( + '`(\x01\x02[^\x01\x02]+\x02\x01)`', $content, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY) as $m) { + echo( + substr($m, 0, 2) == "\x01\x02" + ? $m + : ($act > 4 + ? preg_replace('`\S`', '', $m) + : '')); + } + } elseif ($act > 4) { + echo preg_replace('`\S`', '', $content); + } + } // End: Check element validity as child + + // Get parts of element. + + if (!preg_match('`^(/?)([a-z][^ >]*)([^>]*)>(.*)`sm', $t[$i], $m)) { + $content = $t[$i]; + continue; + } + $slash = null; // Closing tag's slash + $ele = null; // Name + $attrs = null; // Attribute string + $content = null; // Content + list($all, $slash, $ele, $attrs, $content) = $m; + + // Handle closing tag. + + if ($slash) { + if (isset($noKidEleAr[$ele]) || !in_array($ele, $openEleQueue)) { // Element empty type or unopened + continue; + } + if ($eleNow == $ele) { // Last open tag + array_pop($openEleQueue); + echo ''; + unset($ele); + continue; + } + $closedTags = ''; // Nesting, so close open elements as necessary + for ($j=-1, $cj=count($openEleQueue); ++$j<$cj;) { + if (($closableEle = array_pop($openEleQueue)) == $ele) { + break; + } else { + $closedTags .= ""; + } + } + echo $closedTags, ''; + unset($ele); + continue; + } + + // Handle opening tag. + + if (isset($blockKidEleAr[$ele]) && strlen(trim($content))) { // $blockKidEleAr element needs $blockEleAr element + $t[$i] = "{$ele}{$attrs}>"; + array_splice($t, $i+1, 0, 'div>'. $content); + unset($ele, $content); + ++$eleCount; + --$i; + continue; + } + if (strpos($ele, '-')) { // Custom element + $validKidsOfMom[$ele] = 1; + } + if ((($queueLength && isset($blockKidEleAr[$eleNow])) + || (isset($blockKidEleAr[$mom]) && !$queueLength)) + && !isset($blockEleAr[$ele]) + && !isset($validKidsOfMom[$ele]) + && !isset($validKidsOfMom['*']) + ) { + array_splice($t, $i, 0, 'div>'); + unset($ele, $content); + ++$eleCount; + --$i; + continue; + } + if ( + !$queueLength + || !isset($invalidKidEleAr[$ele]) + || !array_intersect($openEleQueue, $invalidMomEleAr) + ) { // If no open element; mostly immediate parent-child relation should hold + if (!isset($validKidsOfMom[$ele]) && !isset($validKidsOfMom['*'])) { + if ($queueLength && isset($closingTagOmitableEleAr[$eleNow])) { + echo ''; + unset($ele, $content); + --$i; + } + continue; + } + if (!isset($noKidEleAr[$ele])) { + $openEleQueue[] = $ele; + } + echo '<', $ele, $attrs, '>'; + unset($ele); + continue; + } + if (isset($validMomKidAr[$eleNow][$ele])) { // Specific parent-child relation + if (!isset($noKidEleAr[$ele])) { + $openEleQueue[] = $ele; + } + echo '<', $ele, $attrs, '>'; + unset($ele); + continue; + } + $closedTags = ''; // Nesting, so close open elements as needed + $openEleQueue2 = array(); + for ($k=-1, $kc=count($openEleQueue); ++$k<$kc;) { + $closableEle = $openEleQueue[$k]; + $validKids2 = array(); + if (isset($validMomKidAr[$closableEle])) { + $openEleQueue2[] = $closableEle; + continue; + } + $validKids2 = isset($inlineKidEleAr[$closableEle]) ? $inlineEleAr : $flowEleAr; + if (isset($otherValidMomKidAr[$closableEle])) { + $validKids2 = $validKids2 + $otherValidMomKidAr[$closableEle]; + } + if (isset($invalidMomKidAr[$closableEle])) { + $validKids2 = array_diff_assoc($validKids2, $invalidMomKidAr[$closableEle]); + } + if (!isset($validKids2[$ele]) && !strpos($ele, '-')) { + if (!$k && !isset($validInMomEleAr[$ele]) && !isset($validInMomEleAr['*'])) { + continue 2; + } + $closedTags = ""; + for (;++$k<$kc;) { + $closedTags = "{$closedTags}"; + } + break; + } else { + $openEleQueue2[] = $closableEle; + } + } + $openEleQueue = $openEleQueue2; + if (!isset($noKidEleAr[$ele])) { + $openEleQueue[] = $ele; + } + echo $closedTags, '<', $ele, $attrs, '>'; + unset($ele); + continue; + } // End of For: loop over elements + + // Finishing. Same code as: 'Check element validity as child'. + + if ($queueLength = count($openEleQueue)) { + $eleNow = array_pop($openEleQueue); + $openEleQueue[] = $eleNow; + if (isset($validMomKidAr[$eleNow])) { + $validKidsOfMom = $validMomKidAr[$eleNow]; + } elseif (isset($inlineKidEleAr[$eleNow])) { + $validKidsOfMom = $inlineEleAr; + $inlineKidEleAr['del'] = 1; + $inlineKidEleAr['ins'] = 1; + } elseif (isset($flowKidEleAr[$eleNow])) { + $validKidsOfMom = $flowEleAr; + unset($inlineKidEleAr['del'], $inlineKidEleAr['ins']); + } elseif (isset($blockKidEleAr[$eleNow])) { + $validKidsOfMom = $blockEleAr; + unset($inlineKidEleAr['del'], $inlineKidEleAr['ins']); + } + if (isset($otherValidMomKidAr[$eleNow])) { + $validKidsOfMom = $validKidsOfMom + $otherValidMomKidAr[$eleNow]; + } + if (isset($invalidMomKidAr[$eleNow])) { + $validKidsOfMom = array_diff_assoc($validKidsOfMom, $invalidMomKidAr[$eleNow]); + } + if (strpos($eleNow, '-')) { // Custom element + $validKidsOfMom = array('*'=>1, '#pcdata'=>1); + } + } else { + $validKidsOfMom = $validInMomEleAr; + unset($inlineKidEleAr['del'], $inlineKidEleAr['ins']); + } + if ( + isset($ele) + && ($act == 1 + || (isset($validKidsOfMom['#pcdata']) + && ($act == 3 + || $act == 5))) + ) { + echo '<', $slash, $ele, $attrs, '>'; + } + if (isset($content[0])) { + if ( + strlen(trim($content)) + && (($queueLength && isset($blockKidEleAr[$eleNow])) + || (isset($blockKidEleAr[$mom]) && !$queueLength)) + ) { + echo '
', $content, '
'; + } elseif ($act < 3 || isset($validKidsOfMom['#pcdata'])) { + echo $content; + } elseif (strpos($content, "\x02\x04")) { + foreach ( + preg_split( + '`(\x01\x02[^\x01\x02]+\x02\x01)`', $content, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY) as $m) { + echo( + substr($m, 0, 2) == "\x01\x02" + ? $m + : ($act > 4 + ? preg_replace('`\S`', '', $m) + : '')); + } + } elseif ($act > 4) { + echo preg_replace('`\S`', '', $content); + } + } // End: Finishing + + while (!empty($openEleQueue) && ($ele = array_pop($openEleQueue))) { + echo ''; + } + $o = ob_get_contents(); + ob_end_clean(); + return $o; + } + + /** + * Handle comment/CDATA section. + * + * Filter/sanitize as per $config and disguise special characters. + * + * @param array $t Array result of preg_replace, with potential comment/CDATA. + * @return string Sanitized comment/CDATA with hidden special characters. + */ + public static function hl_commentCdata($t) + { + $t = $t[0]; + global $C; + if (!($rule = $C[$type = $t[3] == '-' ? 'comment' : 'cdata'])) { + return $t; + } + if ($rule == 1) { + return ''; + } + if ($type == 'comment') { + if (substr(($t = preg_replace('`--+`', '-', substr($t, 4, -3))), -1) != ' ') { + $t .= $rule == 4 ? '' : ' '; + } + } else { + $t = substr($t, 1, -1); + } + $t = $rule == 2 ? str_replace(array('&', '<', '>'), array('&', '<', '>'), $t) : $t; + return + str_replace( + array('&', '<', '>'), + array("\x03", "\x04", "\x05"), + ($type == 'comment' ? "\x01\x02\x04!--$t--\x05\x02\x01" : "\x01\x01\x04$t\x05\x01\x01")); + } + + /** + * Transform deprecated element, with any attribute, into a new element. + * + * + * @param string $ele Deprecated element. + * @param string $attrStr Attribute string of element. + * @param int $act No transformation if 2. + * @return mixed New attribute string (may be empty) or 0. + */ + public static function hl_deprecatedElement(&$ele, &$attrStr, $act=1) + { + if ($ele == 'big') { + $ele = 'span'; + return 'font-size: larger;'; + } + if ($ele == 's' || $ele == 'strike') { + $ele = 'span'; + return 'text-decoration: line-through;'; + } + if ($ele == 'tt') { + $ele = 'code'; + return ''; + } + if ($ele == 'center') { + $ele = 'div'; + return 'text-align: center;'; + } + static $fontSizeAr = array('0'=>'xx-small', '1'=>'xx-small', '2'=>'small', '3'=>'medium', '4'=>'large', '5'=>'x-large', '6'=>'xx-large', '7'=>'300%', '-1'=>'smaller', '-2'=>'60%', '+1'=>'larger', '+2'=>'150%', '+3'=>'200%', '+4'=>'300%'); + if ($ele == 'font') { + $attrStrNew = ''; + while (preg_match('`(^|\s)(color|size)\s*=\s*(\'|")?(.+?)(\\3|\s|$)`i', $attrStr, $m)) { + $attrStr = str_replace($m[0], ' ', $attrStr) ; + $attrStrNew .= + strtolower($m[2]) == 'color' + ? ' color: '. str_replace(array('"', ';', ':'), '\'', trim($m[4])). ';' + : (isset($fontSizeAr[($m = trim($m[4]))]) + ? ' font-size: '. $fontSizeAr[$m]. ';' + : ''); + } + while ( + preg_match('`(^|\s)face\s*=\s*(\'|")?([^=]+?)\\2`i', $attrStr, $m) + || preg_match('`(^|\s)face\s*=(\s*)(\S+)`i', $attrStr, $m) + ) { + $attrStr = str_replace($m[0], ' ', $attrStr) ; + $attrStrNew .= ' font-family: '. str_replace(array('"', ';', ':'), '\'', trim($m[3])). ';'; + } + $ele = 'span'; + return ltrim(str_replace('<', '', $attrStrNew)); + } + if ($ele == 'acronym') { + $ele = 'abbr'; + return ''; + } + if ($ele == 'dir') { + $ele = 'ul'; + return ''; + } + if ($act == 2) { + $ele = 0; + return 0; + } + return ''; + } + + /** + * Handle entity. + * + * As needed, convert to named/hexadecimal form, or neutralize '&' as '&'. + * + * @param array $t Array result of preg_replace, with potential entity. + * @return string Neutralized or converted entity. + */ + public static function hl_entity($t) + { + global $C; + $t = $t[1]; + static $reservedEntAr = array('amp'=>1, 'AMP'=>1, 'gt'=>1, 'GT'=>1, 'lt'=>1, 'LT'=>1, 'quot'=>1, 'QUOT'=>1); + static $commonEntNameAr = array('Aacute'=>'193', 'aacute'=>'225', 'Acirc'=>'194', 'acirc'=>'226', 'acute'=>'180', 'AElig'=>'198', 'aelig'=>'230', 'Agrave'=>'192', 'agrave'=>'224', 'alefsym'=>'8501', 'Alpha'=>'913', 'alpha'=>'945', 'and'=>'8743', 'ang'=>'8736', 'apos'=>'39', 'Aring'=>'197', 'aring'=>'229', 'asymp'=>'8776', 'Atilde'=>'195', 'atilde'=>'227', 'Auml'=>'196', 'auml'=>'228', 'bdquo'=>'8222', 'Beta'=>'914', 'beta'=>'946', 'brvbar'=>'166', 'bull'=>'8226', 'cap'=>'8745', 'Ccedil'=>'199', 'ccedil'=>'231', 'cedil'=>'184', 'cent'=>'162', 'Chi'=>'935', 'chi'=>'967', 'circ'=>'710', 'clubs'=>'9827', 'cong'=>'8773', 'copy'=>'169', 'crarr'=>'8629', 'cup'=>'8746', 'curren'=>'164', 'dagger'=>'8224', 'Dagger'=>'8225', 'darr'=>'8595', 'dArr'=>'8659', 'deg'=>'176', 'Delta'=>'916', 'delta'=>'948', 'diams'=>'9830', 'divide'=>'247', 'Eacute'=>'201', 'eacute'=>'233', 'Ecirc'=>'202', 'ecirc'=>'234', 'Egrave'=>'200', 'egrave'=>'232', 'empty'=>'8709', 'emsp'=>'8195', 'ensp'=>'8194', 'Epsilon'=>'917', 'epsilon'=>'949', 'equiv'=>'8801', 'Eta'=>'919', 'eta'=>'951', 'ETH'=>'208', 'eth'=>'240', 'Euml'=>'203', 'euml'=>'235', 'euro'=>'8364', 'exist'=>'8707', 'fnof'=>'402', 'forall'=>'8704', 'frac12'=>'189', 'frac14'=>'188', 'frac34'=>'190', 'frasl'=>'8260', 'Gamma'=>'915', 'gamma'=>'947', 'ge'=>'8805', 'harr'=>'8596', 'hArr'=>'8660', 'hearts'=>'9829', 'hellip'=>'8230', 'Iacute'=>'205', 'iacute'=>'237', 'Icirc'=>'206', 'icirc'=>'238', 'iexcl'=>'161', 'Igrave'=>'204', 'igrave'=>'236', 'image'=>'8465', 'infin'=>'8734', 'int'=>'8747', 'Iota'=>'921', 'iota'=>'953', 'iquest'=>'191', 'isin'=>'8712', 'Iuml'=>'207', 'iuml'=>'239', 'Kappa'=>'922', 'kappa'=>'954', 'Lambda'=>'923', 'lambda'=>'955', 'laquo'=>'171', 'larr'=>'8592', 'lArr'=>'8656', 'lceil'=>'8968', 'ldquo'=>'8220', 'le'=>'8804', 'lfloor'=>'8970', 'lowast'=>'8727', 'loz'=>'9674', 'lrm'=>'8206', 'lsaquo'=>'8249', 'lsquo'=>'8216', 'macr'=>'175', 'mdash'=>'8212', 'micro'=>'181', 'middot'=>'183', 'minus'=>'8722', 'Mu'=>'924', 'mu'=>'956', 'nabla'=>'8711', 'nbsp'=>'160', 'ndash'=>'8211', 'ne'=>'8800', 'ni'=>'8715', 'not'=>'172', 'notin'=>'8713', 'nsub'=>'8836', 'Ntilde'=>'209', 'ntilde'=>'241', 'Nu'=>'925', 'nu'=>'957', 'Oacute'=>'211', 'oacute'=>'243', 'Ocirc'=>'212', 'ocirc'=>'244', 'OElig'=>'338', 'oelig'=>'339', 'Ograve'=>'210', 'ograve'=>'242', 'oline'=>'8254', 'Omega'=>'937', 'omega'=>'969', 'Omicron'=>'927', 'omicron'=>'959', 'oplus'=>'8853', 'or'=>'8744', 'ordf'=>'170', 'ordm'=>'186', 'Oslash'=>'216', 'oslash'=>'248', 'Otilde'=>'213', 'otilde'=>'245', 'otimes'=>'8855', 'Ouml'=>'214', 'ouml'=>'246', 'para'=>'182', 'part'=>'8706', 'permil'=>'8240', 'perp'=>'8869', 'Phi'=>'934', 'phi'=>'966', 'Pi'=>'928', 'pi'=>'960', 'piv'=>'982', 'plusmn'=>'177', 'pound'=>'163', 'prime'=>'8242', 'Prime'=>'8243', 'prod'=>'8719', 'prop'=>'8733', 'Psi'=>'936', 'psi'=>'968', 'radic'=>'8730', 'raquo'=>'187', 'rarr'=>'8594', 'rArr'=>'8658', 'rceil'=>'8969', 'rdquo'=>'8221', 'real'=>'8476', 'reg'=>'174', 'rfloor'=>'8971', 'Rho'=>'929', 'rho'=>'961', 'rlm'=>'8207', 'rsaquo'=>'8250', 'rsquo'=>'8217', 'sbquo'=>'8218', 'Scaron'=>'352', 'scaron'=>'353', 'sdot'=>'8901', 'sect'=>'167', 'shy'=>'173', 'Sigma'=>'931', 'sigma'=>'963', 'sigmaf'=>'962', 'sim'=>'8764', 'spades'=>'9824', 'sub'=>'8834', 'sube'=>'8838', 'sum'=>'8721', 'sup'=>'8835', 'sup1'=>'185', 'sup2'=>'178', 'sup3'=>'179', 'supe'=>'8839', 'szlig'=>'223', 'Tau'=>'932', 'tau'=>'964', 'there4'=>'8756', 'Theta'=>'920', 'theta'=>'952', 'thetasym'=>'977', 'thinsp'=>'8201', 'THORN'=>'222', 'thorn'=>'254', 'tilde'=>'732', 'times'=>'215', 'trade'=>'8482', 'Uacute'=>'218', 'uacute'=>'250', 'uarr'=>'8593', 'uArr'=>'8657', 'Ucirc'=>'219', 'ucirc'=>'251', 'Ugrave'=>'217', 'ugrave'=>'249', 'uml'=>'168', 'upsih'=>'978', 'Upsilon'=>'933', 'upsilon'=>'965', 'Uuml'=>'220', 'uuml'=>'252', 'weierp'=>'8472', 'Xi'=>'926', 'xi'=>'958', 'Yacute'=>'221', 'yacute'=>'253', 'yen'=>'165', 'yuml'=>'255', 'Yuml'=>'376', 'Zeta'=>'918', 'zeta'=>'950', 'zwj'=>'8205', 'zwnj'=>'8204'); + static $rareEntNameAr = array('Abreve'=>'258', 'abreve'=>'259', 'ac'=>'8766', 'acd'=>'8767', 'Acy'=>'1040', 'acy'=>'1072', 'af'=>'8289', 'Afr'=>'120068', 'afr'=>'120094', 'aleph'=>'8501', 'Amacr'=>'256', 'amacr'=>'257', 'amalg'=>'10815', 'And'=>'10835', 'andand'=>'10837', 'andd'=>'10844', 'andslope'=>'10840', 'andv'=>'10842', 'ange'=>'10660', 'angle'=>'8736', 'angmsd'=>'8737', 'angmsdaa'=>'10664', 'angmsdab'=>'10665', 'angmsdac'=>'10666', 'angmsdad'=>'10667', 'angmsdae'=>'10668', 'angmsdaf'=>'10669', 'angmsdag'=>'10670', 'angmsdah'=>'10671', 'angrt'=>'8735', 'angrtvb'=>'8894', 'angrtvbd'=>'10653', 'angsph'=>'8738', 'angst'=>'197', 'angzarr'=>'9084', 'Aogon'=>'260', 'aogon'=>'261', 'Aopf'=>'120120', 'aopf'=>'120146', 'ap'=>'8776', 'apacir'=>'10863', 'apE'=>'10864', 'ape'=>'8778', 'apid'=>'8779', 'ApplyFunction'=>'8289', 'approx'=>'8776', 'approxeq'=>'8778', 'Ascr'=>'119964', 'ascr'=>'119990', 'Assign'=>'8788', 'ast'=>'42', 'asympeq'=>'8781', 'awconint'=>'8755', 'awint'=>'10769', 'backcong'=>'8780', 'backepsilon'=>'1014', 'backprime'=>'8245', 'backsim'=>'8765', 'backsimeq'=>'8909', 'Backslash'=>'8726', 'Barv'=>'10983', 'barvee'=>'8893', 'barwed'=>'8965', 'Barwed'=>'8966', 'barwedge'=>'8965', 'bbrk'=>'9141', 'bbrktbrk'=>'9142', 'bcong'=>'8780', 'Bcy'=>'1041', 'bcy'=>'1073', 'becaus'=>'8757', 'because'=>'8757', 'Because'=>'8757', 'bemptyv'=>'10672', 'bepsi'=>'1014', 'bernou'=>'8492', 'Bernoullis'=>'8492', 'beth'=>'8502', 'between'=>'8812', 'Bfr'=>'120069', 'bfr'=>'120095', 'bigcap'=>'8898', 'bigcirc'=>'9711', 'bigcup'=>'8899', 'bigodot'=>'10752', 'bigoplus'=>'10753', 'bigotimes'=>'10754', 'bigsqcup'=>'10758', 'bigstar'=>'9733', 'bigtriangledown'=>'9661', 'bigtriangleup'=>'9651', 'biguplus'=>'10756', 'bigvee'=>'8897', 'bigwedge'=>'8896', 'bkarow'=>'10509', 'blacklozenge'=>'10731', 'blacksquare'=>'9642', 'blacktriangle'=>'9652', 'blacktriangledown'=>'9662', 'blacktriangleleft'=>'9666', 'blacktriangleright'=>'9656', 'blank'=>'9251', 'blk12'=>'9618', 'blk14'=>'9617', 'blk34'=>'9619', 'block'=>'9608', 'bNot'=>'10989', 'bnot'=>'8976', 'Bopf'=>'120121', 'bopf'=>'120147', 'bot'=>'8869', 'bottom'=>'8869', 'bowtie'=>'8904', 'boxbox'=>'10697', 'boxdl'=>'9488', 'boxdL'=>'9557', 'boxDl'=>'9558', 'boxDL'=>'9559', 'boxdr'=>'9484', 'boxdR'=>'9554', 'boxDr'=>'9555', 'boxDR'=>'9556', 'boxh'=>'9472', 'boxH'=>'9552', 'boxhd'=>'9516', 'boxHd'=>'9572', 'boxhD'=>'9573', 'boxHD'=>'9574', 'boxhu'=>'9524', 'boxHu'=>'9575', 'boxhU'=>'9576', 'boxHU'=>'9577', 'boxminus'=>'8863', 'boxplus'=>'8862', 'boxtimes'=>'8864', 'boxul'=>'9496', 'boxuL'=>'9563', 'boxUl'=>'9564', 'boxUL'=>'9565', 'boxur'=>'9492', 'boxuR'=>'9560', 'boxUr'=>'9561', 'boxUR'=>'9562', 'boxv'=>'9474', 'boxV'=>'9553', 'boxvh'=>'9532', 'boxvH'=>'9578', 'boxVh'=>'9579', 'boxVH'=>'9580', 'boxvl'=>'9508', 'boxvL'=>'9569', 'boxVl'=>'9570', 'boxVL'=>'9571', 'boxvr'=>'9500', 'boxvR'=>'9566', 'boxVr'=>'9567', 'boxVR'=>'9568', 'bprime'=>'8245', 'breve'=>'728', 'Breve'=>'728', 'bscr'=>'119991', 'Bscr'=>'8492', 'bsemi'=>'8271', 'bsim'=>'8765', 'bsime'=>'8909', 'bsol'=>'92', 'bsolb'=>'10693', 'bsolhsub'=>'10184', 'bullet'=>'8226', 'bump'=>'8782', 'bumpE'=>'10926', 'bumpe'=>'8783', 'Bumpeq'=>'8782', 'bumpeq'=>'8783', 'Cacute'=>'262', 'cacute'=>'263', 'Cap'=>'8914', 'capand'=>'10820', 'capbrcup'=>'10825', 'capcap'=>'10827', 'capcup'=>'10823', 'capdot'=>'10816', 'CapitalDifferentialD'=>'8517', 'caret'=>'8257', 'caron'=>'711', 'Cayleys'=>'8493', 'ccaps'=>'10829', 'Ccaron'=>'268', 'ccaron'=>'269', 'Ccirc'=>'264', 'ccirc'=>'265', 'Cconint'=>'8752', 'ccups'=>'10828', 'ccupssm'=>'10832', 'Cdot'=>'266', 'cdot'=>'267', 'Cedilla'=>'184', 'cemptyv'=>'10674', 'centerdot'=>'183', 'CenterDot'=>'183', 'cfr'=>'120096', 'Cfr'=>'8493', 'CHcy'=>'1063', 'chcy'=>'1095', 'check'=>'10003', 'checkmark'=>'10003', 'cir'=>'9675', 'circeq'=>'8791', 'circlearrowleft'=>'8634', 'circlearrowright'=>'8635', 'circledast'=>'8859', 'circledcirc'=>'8858', 'circleddash'=>'8861', 'CircleDot'=>'8857', 'circledR'=>'174', 'circledS'=>'9416', 'CircleMinus'=>'8854', 'CirclePlus'=>'8853', 'CircleTimes'=>'8855', 'cirE'=>'10691', 'cire'=>'8791', 'cirfnint'=>'10768', 'cirmid'=>'10991', 'cirscir'=>'10690', 'ClockwiseContourIntegral'=>'8754', 'CloseCurlyDoubleQuote'=>'8221', 'CloseCurlyQuote'=>'8217', 'clubsuit'=>'9827', 'colon'=>'58', 'Colon'=>'8759', 'Colone'=>'10868', 'colone'=>'8788', 'coloneq'=>'8788', 'comma'=>'44', 'commat'=>'64', 'comp'=>'8705', 'compfn'=>'8728', 'complement'=>'8705', 'complexes'=>'8450', 'congdot'=>'10861', 'Congruent'=>'8801', 'conint'=>'8750', 'Conint'=>'8751', 'ContourIntegral'=>'8750', 'copf'=>'120148', 'Copf'=>'8450', 'coprod'=>'8720', 'Coproduct'=>'8720', 'COPY'=>'169', 'copysr'=>'8471', 'CounterClockwiseContourIntegral'=>'8755', 'cross'=>'10007', 'Cross'=>'10799', 'Cscr'=>'119966', 'cscr'=>'119992', 'csub'=>'10959', 'csube'=>'10961', 'csup'=>'10960', 'csupe'=>'10962', 'ctdot'=>'8943', 'cudarrl'=>'10552', 'cudarrr'=>'10549', 'cuepr'=>'8926', 'cuesc'=>'8927', 'cularr'=>'8630', 'cularrp'=>'10557', 'Cup'=>'8915', 'cupbrcap'=>'10824', 'cupcap'=>'10822', 'CupCap'=>'8781', 'cupcup'=>'10826', 'cupdot'=>'8845', 'cupor'=>'10821', 'curarr'=>'8631', 'curarrm'=>'10556', 'curlyeqprec'=>'8926', 'curlyeqsucc'=>'8927', 'curlyvee'=>'8910', 'curlywedge'=>'8911', 'curvearrowleft'=>'8630', 'curvearrowright'=>'8631', 'cuvee'=>'8910', 'cuwed'=>'8911', 'cwconint'=>'8754', 'cwint'=>'8753', 'cylcty'=>'9005', 'daleth'=>'8504', 'Darr'=>'8609', 'dash'=>'8208', 'Dashv'=>'10980', 'dashv'=>'8867', 'dbkarow'=>'10511', 'dblac'=>'733', 'Dcaron'=>'270', 'dcaron'=>'271', 'Dcy'=>'1044', 'dcy'=>'1076', 'DD'=>'8517', 'dd'=>'8518', 'ddagger'=>'8225', 'ddarr'=>'8650', 'DDotrahd'=>'10513', 'ddotseq'=>'10871', 'Del'=>'8711', 'demptyv'=>'10673', 'dfisht'=>'10623', 'Dfr'=>'120071', 'dfr'=>'120097', 'dHar'=>'10597', 'dharl'=>'8643', 'dharr'=>'8642', 'DiacriticalAcute'=>'180', 'DiacriticalDot'=>'729', 'DiacriticalDoubleAcute'=>'733', 'DiacriticalGrave'=>'96', 'DiacriticalTilde'=>'732', 'diam'=>'8900', 'diamond'=>'8900', 'Diamond'=>'8900', 'diamondsuit'=>'9830', 'die'=>'168', 'DifferentialD'=>'8518', 'digamma'=>'989', 'disin'=>'8946', 'div'=>'247', 'divideontimes'=>'8903', 'divonx'=>'8903', 'DJcy'=>'1026', 'djcy'=>'1106', 'dlcorn'=>'8990', 'dlcrop'=>'8973', 'dollar'=>'36', 'Dopf'=>'120123', 'dopf'=>'120149', 'Dot'=>'168', 'dot'=>'729', 'DotDot'=>'8412', 'doteq'=>'8784', 'doteqdot'=>'8785', 'DotEqual'=>'8784', 'dotminus'=>'8760', 'dotplus'=>'8724', 'dotsquare'=>'8865', 'doublebarwedge'=>'8966', 'DoubleContourIntegral'=>'8751', 'DoubleDot'=>'168', 'DoubleDownArrow'=>'8659', 'DoubleLeftArrow'=>'8656', 'DoubleLeftRightArrow'=>'8660', 'DoubleLeftTee'=>'10980', 'DoubleLongLeftArrow'=>'10232', 'DoubleLongLeftRightArrow'=>'10234', 'DoubleLongRightArrow'=>'10233', 'DoubleRightArrow'=>'8658', 'DoubleRightTee'=>'8872', 'DoubleUpArrow'=>'8657', 'DoubleUpDownArrow'=>'8661', 'DoubleVerticalBar'=>'8741', 'downarrow'=>'8595', 'DownArrow'=>'8595', 'Downarrow'=>'8659', 'DownArrowBar'=>'10515', 'DownArrowUpArrow'=>'8693', 'DownBreve'=>'785', 'downdownarrows'=>'8650', 'downharpoonleft'=>'8643', 'downharpoonright'=>'8642', 'DownLeftRightVector'=>'10576', 'DownLeftTeeVector'=>'10590', 'DownLeftVector'=>'8637', 'DownLeftVectorBar'=>'10582', 'DownRightTeeVector'=>'10591', 'DownRightVector'=>'8641', 'DownRightVectorBar'=>'10583', 'DownTee'=>'8868', 'DownTeeArrow'=>'8615', 'drbkarow'=>'10512', 'drcorn'=>'8991', 'drcrop'=>'8972', 'Dscr'=>'119967', 'dscr'=>'119993', 'DScy'=>'1029', 'dscy'=>'1109', 'dsol'=>'10742', 'Dstrok'=>'272', 'dstrok'=>'273', 'dtdot'=>'8945', 'dtri'=>'9663', 'dtrif'=>'9662', 'duarr'=>'8693', 'duhar'=>'10607', 'dwangle'=>'10662', 'DZcy'=>'1039', 'dzcy'=>'1119', 'dzigrarr'=>'10239', 'easter'=>'10862', 'Ecaron'=>'282', 'ecaron'=>'283', 'ecir'=>'8790', 'ecolon'=>'8789', 'Ecy'=>'1069', 'ecy'=>'1101', 'eDDot'=>'10871', 'Edot'=>'278', 'edot'=>'279', 'eDot'=>'8785', 'ee'=>'8519', 'efDot'=>'8786', 'Efr'=>'120072', 'efr'=>'120098', 'eg'=>'10906', 'egs'=>'10902', 'egsdot'=>'10904', 'el'=>'10905', 'Element'=>'8712', 'elinters'=>'9191', 'ell'=>'8467', 'els'=>'10901', 'elsdot'=>'10903', 'Emacr'=>'274', 'emacr'=>'275', 'emptyset'=>'8709', 'EmptySmallSquare'=>'9723', 'emptyv'=>'8709', 'EmptyVerySmallSquare'=>'9643', 'emsp13'=>'8196', 'emsp14'=>'8197', 'ENG'=>'330', 'eng'=>'331', 'Eogon'=>'280', 'eogon'=>'281', 'Eopf'=>'120124', 'eopf'=>'120150', 'epar'=>'8917', 'eparsl'=>'10723', 'eplus'=>'10865', 'epsi'=>'949', 'epsiv'=>'1013', 'eqcirc'=>'8790', 'eqcolon'=>'8789', 'eqsim'=>'8770', 'eqslantgtr'=>'10902', 'eqslantless'=>'10901', 'Equal'=>'10869', 'equals'=>'61', 'EqualTilde'=>'8770', 'equest'=>'8799', 'Equilibrium'=>'8652', 'equivDD'=>'10872', 'eqvparsl'=>'10725', 'erarr'=>'10609', 'erDot'=>'8787', 'escr'=>'8495', 'Escr'=>'8496', 'esdot'=>'8784', 'Esim'=>'10867', 'esim'=>'8770', 'excl'=>'33', 'Exists'=>'8707', 'expectation'=>'8496', 'exponentiale'=>'8519', 'ExponentialE'=>'8519', 'fallingdotseq'=>'8786', 'Fcy'=>'1060', 'fcy'=>'1092', 'female'=>'9792', 'ffilig'=>'64259', 'fflig'=>'64256', 'ffllig'=>'64260', 'Ffr'=>'120073', 'ffr'=>'120099', 'filig'=>'64257', 'FilledSmallSquare'=>'9724', 'FilledVerySmallSquare'=>'9642', 'flat'=>'9837', 'fllig'=>'64258', 'fltns'=>'9649', 'Fopf'=>'120125', 'fopf'=>'120151', 'ForAll'=>'8704', 'fork'=>'8916', 'forkv'=>'10969', 'Fouriertrf'=>'8497', 'fpartint'=>'10765', 'frac13'=>'8531', 'frac15'=>'8533', 'frac16'=>'8537', 'frac18'=>'8539', 'frac23'=>'8532', 'frac25'=>'8534', 'frac35'=>'8535', 'frac38'=>'8540', 'frac45'=>'8536', 'frac56'=>'8538', 'frac58'=>'8541', 'frac78'=>'8542', 'frown'=>'8994', 'fscr'=>'119995', 'Fscr'=>'8497', 'gacute'=>'501', 'Gammad'=>'988', 'gammad'=>'989', 'gap'=>'10886', 'Gbreve'=>'286', 'gbreve'=>'287', 'Gcedil'=>'290', 'Gcirc'=>'284', 'gcirc'=>'285', 'Gcy'=>'1043', 'gcy'=>'1075', 'Gdot'=>'288', 'gdot'=>'289', 'gE'=>'8807', 'gEl'=>'10892', 'gel'=>'8923', 'geq'=>'8805', 'geqq'=>'8807', 'geqslant'=>'10878', 'ges'=>'10878', 'gescc'=>'10921', 'gesdot'=>'10880', 'gesdoto'=>'10882', 'gesdotol'=>'10884', 'gesles'=>'10900', 'Gfr'=>'120074', 'gfr'=>'120100', 'gg'=>'8811', 'Gg'=>'8921', 'ggg'=>'8921', 'gimel'=>'8503', 'GJcy'=>'1027', 'gjcy'=>'1107', 'gl'=>'8823', 'gla'=>'10917', 'glE'=>'10898', 'glj'=>'10916', 'gnap'=>'10890', 'gnapprox'=>'10890', 'gne'=>'10888', 'gnE'=>'8809', 'gneq'=>'10888', 'gneqq'=>'8809', 'gnsim'=>'8935', 'Gopf'=>'120126', 'gopf'=>'120152', 'grave'=>'96', 'GreaterEqual'=>'8805', 'GreaterEqualLess'=>'8923', 'GreaterFullEqual'=>'8807', 'GreaterGreater'=>'10914', 'GreaterLess'=>'8823', 'GreaterSlantEqual'=>'10878', 'GreaterTilde'=>'8819', 'Gscr'=>'119970', 'gscr'=>'8458', 'gsim'=>'8819', 'gsime'=>'10894', 'gsiml'=>'10896', 'Gt'=>'8811', 'gtcc'=>'10919', 'gtcir'=>'10874', 'gtdot'=>'8919', 'gtlPar'=>'10645', 'gtquest'=>'10876', 'gtrapprox'=>'10886', 'gtrarr'=>'10616', 'gtrdot'=>'8919', 'gtreqless'=>'8923', 'gtreqqless'=>'10892', 'gtrless'=>'8823', 'gtrsim'=>'8819', 'Hacek'=>'711', 'hairsp'=>'8202', 'half'=>'189', 'hamilt'=>'8459', 'HARDcy'=>'1066', 'hardcy'=>'1098', 'harrcir'=>'10568', 'harrw'=>'8621', 'Hat'=>'94', 'hbar'=>'8463', 'Hcirc'=>'292', 'hcirc'=>'293', 'heartsuit'=>'9829', 'hercon'=>'8889', 'hfr'=>'120101', 'Hfr'=>'8460', 'HilbertSpace'=>'8459', 'hksearow'=>'10533', 'hkswarow'=>'10534', 'hoarr'=>'8703', 'homtht'=>'8763', 'hookleftarrow'=>'8617', 'hookrightarrow'=>'8618', 'hopf'=>'120153', 'Hopf'=>'8461', 'horbar'=>'8213', 'HorizontalLine'=>'9472', 'hscr'=>'119997', 'Hscr'=>'8459', 'hslash'=>'8463', 'Hstrok'=>'294', 'hstrok'=>'295', 'HumpDownHump'=>'8782', 'HumpEqual'=>'8783', 'hybull'=>'8259', 'hyphen'=>'8208', 'ic'=>'8291', 'Icy'=>'1048', 'icy'=>'1080', 'Idot'=>'304', 'IEcy'=>'1045', 'iecy'=>'1077', 'iff'=>'8660', 'ifr'=>'120102', 'Ifr'=>'8465', 'ii'=>'8520', 'iiiint'=>'10764', 'iiint'=>'8749', 'iinfin'=>'10716', 'iiota'=>'8489', 'IJlig'=>'306', 'ijlig'=>'307', 'Im'=>'8465', 'Imacr'=>'298', 'imacr'=>'299', 'ImaginaryI'=>'8520', 'imagline'=>'8464', 'imagpart'=>'8465', 'imath'=>'305', 'imof'=>'8887', 'imped'=>'437', 'Implies'=>'8658', 'in'=>'8712', 'incare'=>'8453', 'infintie'=>'10717', 'inodot'=>'305', 'Int'=>'8748', 'intcal'=>'8890', 'integers'=>'8484', 'Integral'=>'8747', 'intercal'=>'8890', 'Intersection'=>'8898', 'intlarhk'=>'10775', 'intprod'=>'10812', 'InvisibleComma'=>'8291', 'InvisibleTimes'=>'8290', 'IOcy'=>'1025', 'iocy'=>'1105', 'Iogon'=>'302', 'iogon'=>'303', 'Iopf'=>'120128', 'iopf'=>'120154', 'iprod'=>'10812', 'iscr'=>'119998', 'Iscr'=>'8464', 'isindot'=>'8949', 'isinE'=>'8953', 'isins'=>'8948', 'isinsv'=>'8947', 'isinv'=>'8712', 'it'=>'8290', 'Itilde'=>'296', 'itilde'=>'297', 'Iukcy'=>'1030', 'iukcy'=>'1110', 'Jcirc'=>'308', 'jcirc'=>'309', 'Jcy'=>'1049', 'jcy'=>'1081', 'Jfr'=>'120077', 'jfr'=>'120103', 'jmath'=>'567', 'Jopf'=>'120129', 'jopf'=>'120155', 'Jscr'=>'119973', 'jscr'=>'119999', 'Jsercy'=>'1032', 'jsercy'=>'1112', 'Jukcy'=>'1028', 'jukcy'=>'1108', 'kappav'=>'1008', 'Kcedil'=>'310', 'kcedil'=>'311', 'Kcy'=>'1050', 'kcy'=>'1082', 'Kfr'=>'120078', 'kfr'=>'120104', 'kgreen'=>'312', 'KHcy'=>'1061', 'khcy'=>'1093', 'KJcy'=>'1036', 'kjcy'=>'1116', 'Kopf'=>'120130', 'kopf'=>'120156', 'Kscr'=>'119974', 'kscr'=>'120000', 'lAarr'=>'8666', 'Lacute'=>'313', 'lacute'=>'314', 'laemptyv'=>'10676', 'lagran'=>'8466', 'lang'=>'10216', 'Lang'=>'10218', 'langd'=>'10641', 'langle'=>'10216', 'lap'=>'10885', 'Laplacetrf'=>'8466', 'Larr'=>'8606', 'larrb'=>'8676', 'larrbfs'=>'10527', 'larrfs'=>'10525', 'larrhk'=>'8617', 'larrlp'=>'8619', 'larrpl'=>'10553', 'larrsim'=>'10611', 'larrtl'=>'8610', 'lat'=>'10923', 'latail'=>'10521', 'lAtail'=>'10523', 'late'=>'10925', 'lbarr'=>'10508', 'lBarr'=>'10510', 'lbbrk'=>'10098', 'lbrace'=>'123', 'lbrack'=>'91', 'lbrke'=>'10635', 'lbrksld'=>'10639', 'lbrkslu'=>'10637', 'Lcaron'=>'317', 'lcaron'=>'318', 'Lcedil'=>'315', 'lcedil'=>'316', 'lcub'=>'123', 'Lcy'=>'1051', 'lcy'=>'1083', 'ldca'=>'10550', 'ldquor'=>'8222', 'ldrdhar'=>'10599', 'ldrushar'=>'10571', 'ldsh'=>'8626', 'lE'=>'8806', 'LeftAngleBracket'=>'10216', 'leftarrow'=>'8592', 'LeftArrow'=>'8592', 'Leftarrow'=>'8656', 'LeftArrowBar'=>'8676', 'LeftArrowRightArrow'=>'8646', 'leftarrowtail'=>'8610', 'LeftCeiling'=>'8968', 'LeftDoubleBracket'=>'10214', 'LeftDownTeeVector'=>'10593', 'LeftDownVector'=>'8643', 'LeftDownVectorBar'=>'10585', 'LeftFloor'=>'8970', 'leftharpoondown'=>'8637', 'leftharpoonup'=>'8636', 'leftleftarrows'=>'8647', 'leftrightarrow'=>'8596', 'LeftRightArrow'=>'8596', 'Leftrightarrow'=>'8660', 'leftrightarrows'=>'8646', 'leftrightharpoons'=>'8651', 'leftrightsquigarrow'=>'8621', 'LeftRightVector'=>'10574', 'LeftTee'=>'8867', 'LeftTeeArrow'=>'8612', 'LeftTeeVector'=>'10586', 'leftthreetimes'=>'8907', 'LeftTriangle'=>'8882', 'LeftTriangleBar'=>'10703', 'LeftTriangleEqual'=>'8884', 'LeftUpDownVector'=>'10577', 'LeftUpTeeVector'=>'10592', 'LeftUpVector'=>'8639', 'LeftUpVectorBar'=>'10584', 'LeftVector'=>'8636', 'LeftVectorBar'=>'10578', 'lEg'=>'10891', 'leg'=>'8922', 'leq'=>'8804', 'leqq'=>'8806', 'leqslant'=>'10877', 'les'=>'10877', 'lescc'=>'10920', 'lesdot'=>'10879', 'lesdoto'=>'10881', 'lesdotor'=>'10883', 'lesges'=>'10899', 'lessapprox'=>'10885', 'lessdot'=>'8918', 'lesseqgtr'=>'8922', 'lesseqqgtr'=>'10891', 'LessEqualGreater'=>'8922', 'LessFullEqual'=>'8806', 'LessGreater'=>'8822', 'lessgtr'=>'8822', 'LessLess'=>'10913', 'lesssim'=>'8818', 'LessSlantEqual'=>'10877', 'LessTilde'=>'8818', 'lfisht'=>'10620', 'Lfr'=>'120079', 'lfr'=>'120105', 'lg'=>'8822', 'lgE'=>'10897', 'lHar'=>'10594', 'lhard'=>'8637', 'lharu'=>'8636', 'lharul'=>'10602', 'lhblk'=>'9604', 'LJcy'=>'1033', 'ljcy'=>'1113', 'll'=>'8810', 'Ll'=>'8920', 'llarr'=>'8647', 'llcorner'=>'8990', 'Lleftarrow'=>'8666', 'llhard'=>'10603', 'lltri'=>'9722', 'Lmidot'=>'319', 'lmidot'=>'320', 'lmoust'=>'9136', 'lmoustache'=>'9136', 'lnap'=>'10889', 'lnapprox'=>'10889', 'lne'=>'10887', 'lnE'=>'8808', 'lneq'=>'10887', 'lneqq'=>'8808', 'lnsim'=>'8934', 'loang'=>'10220', 'loarr'=>'8701', 'lobrk'=>'10214', 'longleftarrow'=>'10229', 'LongLeftArrow'=>'10229', 'Longleftarrow'=>'10232', 'longleftrightarrow'=>'10231', 'LongLeftRightArrow'=>'10231', 'Longleftrightarrow'=>'10234', 'longmapsto'=>'10236', 'longrightarrow'=>'10230', 'LongRightArrow'=>'10230', 'Longrightarrow'=>'10233', 'looparrowleft'=>'8619', 'looparrowright'=>'8620', 'lopar'=>'10629', 'Lopf'=>'120131', 'lopf'=>'120157', 'loplus'=>'10797', 'lotimes'=>'10804', 'lowbar'=>'95', 'LowerLeftArrow'=>'8601', 'LowerRightArrow'=>'8600', 'lozenge'=>'9674', 'lozf'=>'10731', 'lpar'=>'40', 'lparlt'=>'10643', 'lrarr'=>'8646', 'lrcorner'=>'8991', 'lrhar'=>'8651', 'lrhard'=>'10605', 'lrtri'=>'8895', 'lscr'=>'120001', 'Lscr'=>'8466', 'lsh'=>'8624', 'Lsh'=>'8624', 'lsim'=>'8818', 'lsime'=>'10893', 'lsimg'=>'10895', 'lsqb'=>'91', 'lsquor'=>'8218', 'Lstrok'=>'321', 'lstrok'=>'322', 'Lt'=>'8810', 'ltcc'=>'10918', 'ltcir'=>'10873', 'ltdot'=>'8918', 'lthree'=>'8907', 'ltimes'=>'8905', 'ltlarr'=>'10614', 'ltquest'=>'10875', 'ltri'=>'9667', 'ltrie'=>'8884', 'ltrif'=>'9666', 'ltrPar'=>'10646', 'lurdshar'=>'10570', 'luruhar'=>'10598', 'male'=>'9794', 'malt'=>'10016', 'maltese'=>'10016', 'Map'=>'10501', 'map'=>'8614', 'mapsto'=>'8614', 'mapstodown'=>'8615', 'mapstoleft'=>'8612', 'mapstoup'=>'8613', 'marker'=>'9646', 'mcomma'=>'10793', 'Mcy'=>'1052', 'mcy'=>'1084', 'mDDot'=>'8762', 'measuredangle'=>'8737', 'MediumSpace'=>'8287', 'Mellintrf'=>'8499', 'Mfr'=>'120080', 'mfr'=>'120106', 'mho'=>'8487', 'mid'=>'8739', 'midast'=>'42', 'midcir'=>'10992', 'minusb'=>'8863', 'minusd'=>'8760', 'minusdu'=>'10794', 'MinusPlus'=>'8723', 'mlcp'=>'10971', 'mldr'=>'8230', 'mnplus'=>'8723', 'models'=>'8871', 'Mopf'=>'120132', 'mopf'=>'120158', 'mp'=>'8723', 'mscr'=>'120002', 'Mscr'=>'8499', 'mstpos'=>'8766', 'multimap'=>'8888', 'mumap'=>'8888', 'Nacute'=>'323', 'nacute'=>'324', 'nap'=>'8777', 'napos'=>'329', 'napprox'=>'8777', 'natur'=>'9838', 'natural'=>'9838', 'naturals'=>'8469', 'ncap'=>'10819', 'Ncaron'=>'327', 'ncaron'=>'328', 'Ncedil'=>'325', 'ncedil'=>'326', 'ncong'=>'8775', 'ncup'=>'10818', 'Ncy'=>'1053', 'ncy'=>'1085', 'nearhk'=>'10532', 'nearr'=>'8599', 'neArr'=>'8663', 'nearrow'=>'8599', 'NegativeMediumSpace'=>'8203', 'NegativeThickSpace'=>'8203', 'NegativeThinSpace'=>'8203', 'NegativeVeryThinSpace'=>'8203', 'nequiv'=>'8802', 'nesear'=>'10536', 'NestedGreaterGreater'=>'8811', 'NestedLessLess'=>'8810', 'NewLine'=>'10', 'nexist'=>'8708', 'nexists'=>'8708', 'Nfr'=>'120081', 'nfr'=>'120107', 'nge'=>'8817', 'ngeq'=>'8817', 'ngsim'=>'8821', 'ngt'=>'8815', 'ngtr'=>'8815', 'nharr'=>'8622', 'nhArr'=>'8654', 'nhpar'=>'10994', 'nis'=>'8956', 'nisd'=>'8954', 'niv'=>'8715', 'NJcy'=>'1034', 'njcy'=>'1114', 'nlarr'=>'8602', 'nlArr'=>'8653', 'nldr'=>'8229', 'nle'=>'8816', 'nleftarrow'=>'8602', 'nLeftarrow'=>'8653', 'nleftrightarrow'=>'8622', 'nLeftrightarrow'=>'8654', 'nleq'=>'8816', 'nless'=>'8814', 'nlsim'=>'8820', 'nlt'=>'8814', 'nltri'=>'8938', 'nltrie'=>'8940', 'nmid'=>'8740', 'NoBreak'=>'8288', 'NonBreakingSpace'=>'160', 'nopf'=>'120159', 'Nopf'=>'8469', 'Not'=>'10988', 'NotCongruent'=>'8802', 'NotCupCap'=>'8813', 'NotDoubleVerticalBar'=>'8742', 'NotElement'=>'8713', 'NotEqual'=>'8800', 'NotExists'=>'8708', 'NotGreater'=>'8815', 'NotGreaterEqual'=>'8817', 'NotGreaterLess'=>'8825', 'NotGreaterTilde'=>'8821', 'notinva'=>'8713', 'notinvb'=>'8951', 'notinvc'=>'8950', 'NotLeftTriangle'=>'8938', 'NotLeftTriangleEqual'=>'8940', 'NotLess'=>'8814', 'NotLessEqual'=>'8816', 'NotLessGreater'=>'8824', 'NotLessTilde'=>'8820', 'notni'=>'8716', 'notniva'=>'8716', 'notnivb'=>'8958', 'notnivc'=>'8957', 'NotPrecedes'=>'8832', 'NotPrecedesSlantEqual'=>'8928', 'NotReverseElement'=>'8716', 'NotRightTriangle'=>'8939', 'NotRightTriangleEqual'=>'8941', 'NotSquareSubsetEqual'=>'8930', 'NotSquareSupersetEqual'=>'8931', 'NotSubsetEqual'=>'8840', 'NotSucceeds'=>'8833', 'NotSucceedsSlantEqual'=>'8929', 'NotSupersetEqual'=>'8841', 'NotTilde'=>'8769', 'NotTildeEqual'=>'8772', 'NotTildeFullEqual'=>'8775', 'NotTildeTilde'=>'8777', 'NotVerticalBar'=>'8740', 'npar'=>'8742', 'nparallel'=>'8742', 'npolint'=>'10772', 'npr'=>'8832', 'nprcue'=>'8928', 'nprec'=>'8832', 'nrarr'=>'8603', 'nrArr'=>'8655', 'nrightarrow'=>'8603', 'nRightarrow'=>'8655', 'nrtri'=>'8939', 'nrtrie'=>'8941', 'nsc'=>'8833', 'nsccue'=>'8929', 'Nscr'=>'119977', 'nscr'=>'120003', 'nshortmid'=>'8740', 'nshortparallel'=>'8742', 'nsim'=>'8769', 'nsime'=>'8772', 'nsimeq'=>'8772', 'nsmid'=>'8740', 'nspar'=>'8742', 'nsqsube'=>'8930', 'nsqsupe'=>'8931', 'nsube'=>'8840', 'nsubseteq'=>'8840', 'nsucc'=>'8833', 'nsup'=>'8837', 'nsupe'=>'8841', 'nsupseteq'=>'8841', 'ntgl'=>'8825', 'ntlg'=>'8824', 'ntriangleleft'=>'8938', 'ntrianglelefteq'=>'8940', 'ntriangleright'=>'8939', 'ntrianglerighteq'=>'8941', 'num'=>'35', 'numero'=>'8470', 'numsp'=>'8199', 'nvdash'=>'8876', 'nvDash'=>'8877', 'nVdash'=>'8878', 'nVDash'=>'8879', 'nvHarr'=>'10500', 'nvinfin'=>'10718', 'nvlArr'=>'10498', 'nvrArr'=>'10499', 'nwarhk'=>'10531', 'nwarr'=>'8598', 'nwArr'=>'8662', 'nwarrow'=>'8598', 'nwnear'=>'10535', 'oast'=>'8859', 'ocir'=>'8858', 'Ocy'=>'1054', 'ocy'=>'1086', 'odash'=>'8861', 'Odblac'=>'336', 'odblac'=>'337', 'odiv'=>'10808', 'odot'=>'8857', 'odsold'=>'10684', 'ofcir'=>'10687', 'Ofr'=>'120082', 'ofr'=>'120108', 'ogon'=>'731', 'ogt'=>'10689', 'ohbar'=>'10677', 'ohm'=>'937', 'oint'=>'8750', 'olarr'=>'8634', 'olcir'=>'10686', 'olcross'=>'10683', 'olt'=>'10688', 'Omacr'=>'332', 'omacr'=>'333', 'omid'=>'10678', 'ominus'=>'8854', 'Oopf'=>'120134', 'oopf'=>'120160', 'opar'=>'10679', 'OpenCurlyDoubleQuote'=>'8220', 'OpenCurlyQuote'=>'8216', 'operp'=>'10681', 'Or'=>'10836', 'orarr'=>'8635', 'ord'=>'10845', 'order'=>'8500', 'orderof'=>'8500', 'origof'=>'8886', 'oror'=>'10838', 'orslope'=>'10839', 'orv'=>'10843', 'oS'=>'9416', 'Oscr'=>'119978', 'oscr'=>'8500', 'osol'=>'8856', 'Otimes'=>'10807', 'otimesas'=>'10806', 'ovbar'=>'9021', 'OverBar'=>'8254', 'OverBrace'=>'9182', 'OverBracket'=>'9140', 'OverParenthesis'=>'9180', 'par'=>'8741', 'parallel'=>'8741', 'parsim'=>'10995', 'parsl'=>'11005', 'PartialD'=>'8706', 'Pcy'=>'1055', 'pcy'=>'1087', 'percnt'=>'37', 'period'=>'46', 'pertenk'=>'8241', 'Pfr'=>'120083', 'pfr'=>'120109', 'phiv'=>'981', 'phmmat'=>'8499', 'phone'=>'9742', 'pitchfork'=>'8916', 'planck'=>'8463', 'planckh'=>'8462', 'plankv'=>'8463', 'plus'=>'43', 'plusacir'=>'10787', 'plusb'=>'8862', 'pluscir'=>'10786', 'plusdo'=>'8724', 'plusdu'=>'10789', 'pluse'=>'10866', 'PlusMinus'=>'177', 'plussim'=>'10790', 'plustwo'=>'10791', 'pm'=>'177', 'Poincareplane'=>'8460', 'pointint'=>'10773', 'popf'=>'120161', 'Popf'=>'8473', 'Pr'=>'10939', 'pr'=>'8826', 'prap'=>'10935', 'prcue'=>'8828', 'pre'=>'10927', 'prE'=>'10931', 'prec'=>'8826', 'precapprox'=>'10935', 'preccurlyeq'=>'8828', 'Precedes'=>'8826', 'PrecedesEqual'=>'10927', 'PrecedesSlantEqual'=>'8828', 'PrecedesTilde'=>'8830', 'preceq'=>'10927', 'precnapprox'=>'10937', 'precneqq'=>'10933', 'precnsim'=>'8936', 'precsim'=>'8830', 'primes'=>'8473', 'prnap'=>'10937', 'prnE'=>'10933', 'prnsim'=>'8936', 'Product'=>'8719', 'profalar'=>'9006', 'profline'=>'8978', 'profsurf'=>'8979', 'Proportion'=>'8759', 'Proportional'=>'8733', 'propto'=>'8733', 'prsim'=>'8830', 'prurel'=>'8880', 'Pscr'=>'119979', 'pscr'=>'120005', 'puncsp'=>'8200', 'Qfr'=>'120084', 'qfr'=>'120110', 'qint'=>'10764', 'qopf'=>'120162', 'Qopf'=>'8474', 'qprime'=>'8279', 'Qscr'=>'119980', 'qscr'=>'120006', 'quaternions'=>'8461', 'quatint'=>'10774', 'quest'=>'63', 'questeq'=>'8799', 'rAarr'=>'8667', 'Racute'=>'340', 'racute'=>'341', 'raemptyv'=>'10675', 'rang'=>'10217', 'Rang'=>'10219', 'rangd'=>'10642', 'range'=>'10661', 'rangle'=>'10217', 'Rarr'=>'8608', 'rarrap'=>'10613', 'rarrb'=>'8677', 'rarrbfs'=>'10528', 'rarrc'=>'10547', 'rarrfs'=>'10526', 'rarrhk'=>'8618', 'rarrlp'=>'8620', 'rarrpl'=>'10565', 'rarrsim'=>'10612', 'Rarrtl'=>'10518', 'rarrtl'=>'8611', 'rarrw'=>'8605', 'ratail'=>'10522', 'rAtail'=>'10524', 'ratio'=>'8758', 'rationals'=>'8474', 'rbarr'=>'10509', 'rBarr'=>'10511', 'RBarr'=>'10512', 'rbbrk'=>'10099', 'rbrace'=>'125', 'rbrack'=>'93', 'rbrke'=>'10636', 'rbrksld'=>'10638', 'rbrkslu'=>'10640', 'Rcaron'=>'344', 'rcaron'=>'345', 'Rcedil'=>'342', 'rcedil'=>'343', 'rcub'=>'125', 'Rcy'=>'1056', 'rcy'=>'1088', 'rdca'=>'10551', 'rdldhar'=>'10601', 'rdquor'=>'8221', 'rdsh'=>'8627', 'Re'=>'8476', 'realine'=>'8475', 'realpart'=>'8476', 'reals'=>'8477', 'rect'=>'9645', 'REG'=>'174', 'ReverseElement'=>'8715', 'ReverseEquilibrium'=>'8651', 'ReverseUpEquilibrium'=>'10607', 'rfisht'=>'10621', 'rfr'=>'120111', 'Rfr'=>'8476', 'rHar'=>'10596', 'rhard'=>'8641', 'rharu'=>'8640', 'rharul'=>'10604', 'rhov'=>'1009', 'RightAngleBracket'=>'10217', 'rightarrow'=>'8594', 'RightArrow'=>'8594', 'Rightarrow'=>'8658', 'RightArrowBar'=>'8677', 'RightArrowLeftArrow'=>'8644', 'rightarrowtail'=>'8611', 'RightCeiling'=>'8969', 'RightDoubleBracket'=>'10215', 'RightDownTeeVector'=>'10589', 'RightDownVector'=>'8642', 'RightDownVectorBar'=>'10581', 'RightFloor'=>'8971', 'rightharpoondown'=>'8641', 'rightharpoonup'=>'8640', 'rightleftarrows'=>'8644', 'rightleftharpoons'=>'8652', 'rightrightarrows'=>'8649', 'rightsquigarrow'=>'8605', 'RightTee'=>'8866', 'RightTeeArrow'=>'8614', 'RightTeeVector'=>'10587', 'rightthreetimes'=>'8908', 'RightTriangle'=>'8883', 'RightTriangleBar'=>'10704', 'RightTriangleEqual'=>'8885', 'RightUpDownVector'=>'10575', 'RightUpTeeVector'=>'10588', 'RightUpVector'=>'8638', 'RightUpVectorBar'=>'10580', 'RightVector'=>'8640', 'RightVectorBar'=>'10579', 'ring'=>'730', 'risingdotseq'=>'8787', 'rlarr'=>'8644', 'rlhar'=>'8652', 'rmoust'=>'9137', 'rmoustache'=>'9137', 'rnmid'=>'10990', 'roang'=>'10221', 'roarr'=>'8702', 'robrk'=>'10215', 'ropar'=>'10630', 'ropf'=>'120163', 'Ropf'=>'8477', 'roplus'=>'10798', 'rotimes'=>'10805', 'RoundImplies'=>'10608', 'rpar'=>'41', 'rpargt'=>'10644', 'rppolint'=>'10770', 'rrarr'=>'8649', 'Rrightarrow'=>'8667', 'rscr'=>'120007', 'Rscr'=>'8475', 'rsh'=>'8625', 'Rsh'=>'8625', 'rsqb'=>'93', 'rsquor'=>'8217', 'rthree'=>'8908', 'rtimes'=>'8906', 'rtri'=>'9657', 'rtrie'=>'8885', 'rtrif'=>'9656', 'rtriltri'=>'10702', 'RuleDelayed'=>'10740', 'ruluhar'=>'10600', 'rx'=>'8478', 'Sacute'=>'346', 'sacute'=>'347', 'Sc'=>'10940', 'sc'=>'8827', 'scap'=>'10936', 'sccue'=>'8829', 'sce'=>'10928', 'scE'=>'10932', 'Scedil'=>'350', 'scedil'=>'351', 'Scirc'=>'348', 'scirc'=>'349', 'scnap'=>'10938', 'scnE'=>'10934', 'scnsim'=>'8937', 'scpolint'=>'10771', 'scsim'=>'8831', 'Scy'=>'1057', 'scy'=>'1089', 'sdotb'=>'8865', 'sdote'=>'10854', 'searhk'=>'10533', 'searr'=>'8600', 'seArr'=>'8664', 'searrow'=>'8600', 'semi'=>'59', 'seswar'=>'10537', 'setminus'=>'8726', 'setmn'=>'8726', 'sext'=>'10038', 'Sfr'=>'120086', 'sfr'=>'120112', 'sfrown'=>'8994', 'sharp'=>'9839', 'SHCHcy'=>'1065', 'shchcy'=>'1097', 'SHcy'=>'1064', 'shcy'=>'1096', 'ShortDownArrow'=>'8595', 'ShortLeftArrow'=>'8592', 'shortmid'=>'8739', 'shortparallel'=>'8741', 'ShortRightArrow'=>'8594', 'ShortUpArrow'=>'8593', 'sigmav'=>'962', 'simdot'=>'10858', 'sime'=>'8771', 'simeq'=>'8771', 'simg'=>'10910', 'simgE'=>'10912', 'siml'=>'10909', 'simlE'=>'10911', 'simne'=>'8774', 'simplus'=>'10788', 'simrarr'=>'10610', 'slarr'=>'8592', 'SmallCircle'=>'8728', 'smallsetminus'=>'8726', 'smashp'=>'10803', 'smeparsl'=>'10724', 'smid'=>'8739', 'smile'=>'8995', 'smt'=>'10922', 'smte'=>'10924', 'SOFTcy'=>'1068', 'softcy'=>'1100', 'sol'=>'47', 'solb'=>'10692', 'solbar'=>'9023', 'Sopf'=>'120138', 'sopf'=>'120164', 'spadesuit'=>'9824', 'spar'=>'8741', 'sqcap'=>'8851', 'sqcup'=>'8852', 'Sqrt'=>'8730', 'sqsub'=>'8847', 'sqsube'=>'8849', 'sqsubset'=>'8847', 'sqsubseteq'=>'8849', 'sqsup'=>'8848', 'sqsupe'=>'8850', 'sqsupset'=>'8848', 'sqsupseteq'=>'8850', 'squ'=>'9633', 'square'=>'9633', 'Square'=>'9633', 'SquareIntersection'=>'8851', 'SquareSubset'=>'8847', 'SquareSubsetEqual'=>'8849', 'SquareSuperset'=>'8848', 'SquareSupersetEqual'=>'8850', 'SquareUnion'=>'8852', 'squarf'=>'9642', 'squf'=>'9642', 'srarr'=>'8594', 'Sscr'=>'119982', 'sscr'=>'120008', 'ssetmn'=>'8726', 'ssmile'=>'8995', 'sstarf'=>'8902', 'Star'=>'8902', 'star'=>'9734', 'starf'=>'9733', 'straightepsilon'=>'1013', 'straightphi'=>'981', 'strns'=>'175', 'Sub'=>'8912', 'subdot'=>'10941', 'subE'=>'10949', 'subedot'=>'10947', 'submult'=>'10945', 'subnE'=>'10955', 'subne'=>'8842', 'subplus'=>'10943', 'subrarr'=>'10617', 'subset'=>'8834', 'Subset'=>'8912', 'subseteq'=>'8838', 'subseteqq'=>'10949', 'SubsetEqual'=>'8838', 'subsetneq'=>'8842', 'subsetneqq'=>'10955', 'subsim'=>'10951', 'subsub'=>'10965', 'subsup'=>'10963', 'succ'=>'8827', 'succapprox'=>'10936', 'succcurlyeq'=>'8829', 'Succeeds'=>'8827', 'SucceedsEqual'=>'10928', 'SucceedsSlantEqual'=>'8829', 'SucceedsTilde'=>'8831', 'succeq'=>'10928', 'succnapprox'=>'10938', 'succneqq'=>'10934', 'succnsim'=>'8937', 'succsim'=>'8831', 'SuchThat'=>'8715', 'Sum'=>'8721', 'sung'=>'9834', 'Sup'=>'8913', 'supdot'=>'10942', 'supdsub'=>'10968', 'supE'=>'10950', 'supedot'=>'10948', 'Superset'=>'8835', 'SupersetEqual'=>'8839', 'suphsol'=>'10185', 'suphsub'=>'10967', 'suplarr'=>'10619', 'supmult'=>'10946', 'supnE'=>'10956', 'supne'=>'8843', 'supplus'=>'10944', 'supset'=>'8835', 'Supset'=>'8913', 'supseteq'=>'8839', 'supseteqq'=>'10950', 'supsetneq'=>'8843', 'supsetneqq'=>'10956', 'supsim'=>'10952', 'supsub'=>'10964', 'supsup'=>'10966', 'swarhk'=>'10534', 'swarr'=>'8601', 'swArr'=>'8665', 'swarrow'=>'8601', 'swnwar'=>'10538', 'Tab'=>'9', 'target'=>'8982', 'tbrk'=>'9140', 'Tcaron'=>'356', 'tcaron'=>'357', 'Tcedil'=>'354', 'tcedil'=>'355', 'Tcy'=>'1058', 'tcy'=>'1090', 'tdot'=>'8411', 'telrec'=>'8981', 'Tfr'=>'120087', 'tfr'=>'120113', 'therefore'=>'8756', 'Therefore'=>'8756', 'thetav'=>'977', 'thickapprox'=>'8776', 'thicksim'=>'8764', 'ThinSpace'=>'8201', 'thkap'=>'8776', 'thksim'=>'8764', 'Tilde'=>'8764', 'TildeEqual'=>'8771', 'TildeFullEqual'=>'8773', 'TildeTilde'=>'8776', 'timesb'=>'8864', 'timesbar'=>'10801', 'timesd'=>'10800', 'tint'=>'8749', 'toea'=>'10536', 'top'=>'8868', 'topbot'=>'9014', 'topcir'=>'10993', 'Topf'=>'120139', 'topf'=>'120165', 'topfork'=>'10970', 'tosa'=>'10537', 'tprime'=>'8244', 'TRADE'=>'8482', 'triangle'=>'9653', 'triangledown'=>'9663', 'triangleleft'=>'9667', 'trianglelefteq'=>'8884', 'triangleq'=>'8796', 'triangleright'=>'9657', 'trianglerighteq'=>'8885', 'tridot'=>'9708', 'trie'=>'8796', 'triminus'=>'10810', 'TripleDot'=>'8411', 'triplus'=>'10809', 'trisb'=>'10701', 'tritime'=>'10811', 'trpezium'=>'9186', 'Tscr'=>'119983', 'tscr'=>'120009', 'TScy'=>'1062', 'tscy'=>'1094', 'TSHcy'=>'1035', 'tshcy'=>'1115', 'Tstrok'=>'358', 'tstrok'=>'359', 'twixt'=>'8812', 'twoheadleftarrow'=>'8606', 'twoheadrightarrow'=>'8608', 'Uarr'=>'8607', 'Uarrocir'=>'10569', 'Ubrcy'=>'1038', 'ubrcy'=>'1118', 'Ubreve'=>'364', 'ubreve'=>'365', 'Ucy'=>'1059', 'ucy'=>'1091', 'udarr'=>'8645', 'Udblac'=>'368', 'udblac'=>'369', 'udhar'=>'10606', 'ufisht'=>'10622', 'Ufr'=>'120088', 'ufr'=>'120114', 'uHar'=>'10595', 'uharl'=>'8639', 'uharr'=>'8638', 'uhblk'=>'9600', 'ulcorn'=>'8988', 'ulcorner'=>'8988', 'ulcrop'=>'8975', 'ultri'=>'9720', 'Umacr'=>'362', 'umacr'=>'363', 'UnderBar'=>'95', 'UnderBrace'=>'9183', 'UnderBracket'=>'9141', 'UnderParenthesis'=>'9181', 'Union'=>'8899', 'UnionPlus'=>'8846', 'Uogon'=>'370', 'uogon'=>'371', 'Uopf'=>'120140', 'uopf'=>'120166', 'uparrow'=>'8593', 'UpArrow'=>'8593', 'Uparrow'=>'8657', 'UpArrowBar'=>'10514', 'UpArrowDownArrow'=>'8645', 'updownarrow'=>'8597', 'UpDownArrow'=>'8597', 'Updownarrow'=>'8661', 'UpEquilibrium'=>'10606', 'upharpoonleft'=>'8639', 'upharpoonright'=>'8638', 'uplus'=>'8846', 'UpperLeftArrow'=>'8598', 'UpperRightArrow'=>'8599', 'upsi'=>'965', 'Upsi'=>'978', 'UpTee'=>'8869', 'UpTeeArrow'=>'8613', 'upuparrows'=>'8648', 'urcorn'=>'8989', 'urcorner'=>'8989', 'urcrop'=>'8974', 'Uring'=>'366', 'uring'=>'367', 'urtri'=>'9721', 'Uscr'=>'119984', 'uscr'=>'120010', 'utdot'=>'8944', 'Utilde'=>'360', 'utilde'=>'361', 'utri'=>'9653', 'utrif'=>'9652', 'uuarr'=>'8648', 'uwangle'=>'10663', 'vangrt'=>'10652', 'varepsilon'=>'1013', 'varkappa'=>'1008', 'varnothing'=>'8709', 'varphi'=>'981', 'varpi'=>'982', 'varpropto'=>'8733', 'varr'=>'8597', 'vArr'=>'8661', 'varrho'=>'1009', 'varsigma'=>'962', 'vartheta'=>'977', 'vartriangleleft'=>'8882', 'vartriangleright'=>'8883', 'vBar'=>'10984', 'Vbar'=>'10987', 'vBarv'=>'10985', 'Vcy'=>'1042', 'vcy'=>'1074', 'vdash'=>'8866', 'vDash'=>'8872', 'Vdash'=>'8873', 'VDash'=>'8875', 'Vdashl'=>'10982', 'vee'=>'8744', 'Vee'=>'8897', 'veebar'=>'8891', 'veeeq'=>'8794', 'vellip'=>'8942', 'verbar'=>'124', 'Verbar'=>'8214', 'vert'=>'124', 'Vert'=>'8214', 'VerticalBar'=>'8739', 'VerticalLine'=>'124', 'VerticalSeparator'=>'10072', 'VerticalTilde'=>'8768', 'VeryThinSpace'=>'8202', 'Vfr'=>'120089', 'vfr'=>'120115', 'vltri'=>'8882', 'Vopf'=>'120141', 'vopf'=>'120167', 'vprop'=>'8733', 'vrtri'=>'8883', 'Vscr'=>'119985', 'vscr'=>'120011', 'Vvdash'=>'8874', 'vzigzag'=>'10650', 'Wcirc'=>'372', 'wcirc'=>'373', 'wedbar'=>'10847', 'wedge'=>'8743', 'Wedge'=>'8896', 'wedgeq'=>'8793', 'Wfr'=>'120090', 'wfr'=>'120116', 'Wopf'=>'120142', 'wopf'=>'120168', 'wp'=>'8472', 'wr'=>'8768', 'wreath'=>'8768', 'Wscr'=>'119986', 'wscr'=>'120012', 'xcap'=>'8898', 'xcirc'=>'9711', 'xcup'=>'8899', 'xdtri'=>'9661', 'Xfr'=>'120091', 'xfr'=>'120117', 'xharr'=>'10231', 'xhArr'=>'10234', 'xlarr'=>'10229', 'xlArr'=>'10232', 'xmap'=>'10236', 'xnis'=>'8955', 'xodot'=>'10752', 'Xopf'=>'120143', 'xopf'=>'120169', 'xoplus'=>'10753', 'xotime'=>'10754', 'xrarr'=>'10230', 'xrArr'=>'10233', 'Xscr'=>'119987', 'xscr'=>'120013', 'xsqcup'=>'10758', 'xuplus'=>'10756', 'xutri'=>'9651', 'xvee'=>'8897', 'xwedge'=>'8896', 'YAcy'=>'1071', 'yacy'=>'1103', 'Ycirc'=>'374', 'ycirc'=>'375', 'Ycy'=>'1067', 'ycy'=>'1099', 'Yfr'=>'120092', 'yfr'=>'120118', 'YIcy'=>'1031', 'yicy'=>'1111', 'Yopf'=>'120144', 'yopf'=>'120170', 'Yscr'=>'119988', 'yscr'=>'120014', 'YUcy'=>'1070', 'yucy'=>'1102', 'Zacute'=>'377', 'zacute'=>'378', 'Zcaron'=>'381', 'zcaron'=>'382', 'Zcy'=>'1047', 'zcy'=>'1079', 'Zdot'=>'379', 'zdot'=>'380', 'zeetrf'=>'8488', 'ZeroWidthSpace'=>'8203', 'zfr'=>'120119', 'Zfr'=>'8488', 'ZHcy'=>'1046', 'zhcy'=>'1078', 'zigrarr'=>'8669', 'zopf'=>'120171', 'Zopf'=>'8484', 'Zscr'=>'119989', 'zscr'=>'120015'); + if ($t[0] != '#') { + return + ($C['and_mark'] ? "\x06" : '&') + . (isset($reservedEntAr[$t]) + ? $t + : (isset($commonEntNameAr[$t]) + ? (!$C['named_entity'] + ? '#'. ($C['hexdec_entity'] > 1 + ? 'x'. dechex($commonEntNameAr[$t]) + : $commonEntNameAr[$t]) + : $t) + : (isset($rareEntNameAr[$t]) + ? (!$C['named_entity'] + ? '#'. ($C['hexdec_entity'] > 1 + ? 'x'. dechex($rareEntNameAr[$t]) + : $rareEntNameAr[$t]) + : $t) + : 'amp;'. $t))) + . ';'; + } + if ( + ($n = ctype_digit($t = substr($t, 1)) ? intval($t) : hexdec(substr($t, 1))) < 9 + || ($n > 13 && $n < 32) + || $n == 11 + || $n == 12 + || ($n > 126 && $n < 160 && $n != 133) + || ($n > 55295 + && ($n < 57344 + || ($n > 64975 && $n < 64992) + || $n == 65534 + || $n == 65535 + || $n > 1114111)) + ) { + return ($C['and_mark'] ? "\x06" : '&'). "amp;#{$t};"; + } + return + ($C['and_mark'] ? "\x06" : '&') + . '#' + . (((ctype_digit($t) && $C['hexdec_entity'] < 2) + || !$C['hexdec_entity']) + ? $n + : 'x'. dechex($n)) + . ';'; + } + + /** + * Check regex pattern for PHP error. + * + * @param string $t Pattern including limiters/modifiers. + * @return int 0 or 1 if pattern is invalid or valid, respectively. + */ + public static function hl_regex($t) + { + if (empty($t) || !is_string($t)) { + return 0; + } + if ($funcsExist = function_exists('error_clear_last') && function_exists('error_get_last')) { + error_clear_last(); + } else { + if ($valTrackErr = ini_get('track_errors')) { + $valMsgErr = isset($php_errormsg) ? $php_errormsg : null; + } else { + ini_set('track_errors', '1'); + } + unset($php_errormsg); + } + if (($valShowErr = ini_get('display_errors'))) { + ini_set('display_errors', '0'); + } + preg_match($t, ''); + if ($funcsExist) { + $out = error_get_last() == null ? 1 : 0; + } else { + $out = isset($php_errormsg) ? 0 : 1; + if ($valTrackErr) { + $php_errormsg = isset($valMsgErr) ? $valMsgErr : null; + } else { + ini_set('track_errors', '0'); + } + } + if ($valShowErr) { + ini_set('display_errors', '1'); + } + return $out; + } + + /** + * Parse $spec htmLawed argument as array. + * + * @param string $t Value of $spec. + * @return array Multidimensional array of form: tag -> attribute -> rule. + */ + public static function hl_spec($t) + { + $out = array(); + + // Hide special characters used for rules. + + if (!function_exists('hl_aux1')) { + function hl_aux1($x) { + return + substr( + str_replace( + array(";", "|", "~", " ", ",", "/", "(", ")", '`"'), + array("\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", '"'), + $x[0]), + 1, -1); + } + } + $t = + str_replace( + array("\t", "\r", "\n", ' '), + '', + preg_replace_callback('/"(?>(`.|[^"])*)"/sm', 'hl_aux1', trim($t))); + + // Tag, attribute, and rule separators: semi-colon, comma, and slash respectively. + + for ($i = count(($t = explode(';', $t))); --$i>=0;) { + $ele = $t[$i]; + if ( + empty($ele) + || ($tagPos = strpos($ele, '=')) === false + || !strlen(($tagSpec = substr($ele, $tagPos + 1))) + ) { + continue; + } + $ruleAr = $denyAttrAr = array(); + foreach (explode(',', $tagSpec) as $v) { + if (!preg_match('`^(-?data-[^:=]+|[a-z:\-\*]+)(?:\((.*?)\))?`i', $v, $m) + || preg_match('`^-?data-xml`i', $m[1])) { + continue; + } + if (($attr = strtolower($m[1])) == '-*') { + $denyAttrAr['*'] = 1; + continue; + } + if ($attr[0] == '-') { + $denyAttrAr[substr($attr, 1)] = 1; + continue; + } + if (!isset($m[2])) { + $ruleAr[$attr] = 1; + continue; + } + foreach (explode('/', $m[2]) as $m) { + if (empty($m) + || ($rulePos = strpos($m, '=')) === 0 + || $rulePos < 5 // Shortest rule: oneof + ) { + $ruleAr[$attr] = 1; + continue; + } + $rule = strtolower(substr($m, 0, $rulePos)); + $ruleAr[$attr][$rule] = + str_replace( + array("\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08"), + array(";", "|", "~", " ", ",", "/", "(", ")"), + substr($m, $rulePos + 1)); + } + if (isset($ruleAr[$attr]['match']) && !self::hl_regex($ruleAr[$attr]['match'])) { + unset($ruleAr[$attr]['match']); + } + if (isset($ruleAr[$attr]['nomatch']) && !self::hl_regex($ruleAr[$attr]['nomatch'])) { + unset($ruleAr[$attr]['nomatch']); + } + } + + if (!count($ruleAr) && !count($denyAttrAr)) { + continue; + } + foreach (explode(',', substr($ele, 0, $tagPos)) as $tag) { + if (!strlen(($tag = strtolower($tag)))) { + continue; + } + if (count($ruleAr)) { + $out[$tag] = !isset($out[$tag]) ? $ruleAr : array_merge($out[$tag], $ruleAr); + } + if (count($denyAttrAr)) { + $out[$tag]['deny'] = !isset($out[$tag]['deny']) ? $denyAttrAr : array_merge($out[$tag]['deny'], $denyAttrAr); + } + } + } + + return $out; + } + + /** + * Handle tag text with limiters, and attributes in opening tags. + * + * @param array $t Array from preg_replace call. + * @return string Tag with any attribute, + * or text with neutralized into entities, or empty. + */ + public static function hl_tag($t) + { + $t = $t[0]; + global $C; + + // Check if character not in tag. + + if ($t == '< ') { + return '< '; + } + if ($t == '>') { + return '>'; + } + if (!preg_match('`^<(/?)([a-zA-Z][^\s>]*)([^>]*?)\s?>$`m', $t, $m)) { // Get tag with element name and attributes + return str_replace(array('<', '>'), array('<', '>'), $t); + } + + // Check if element not permitted. Custom element names have certain requirements. + + $ele = strtolower($m[2]); + static $invalidCustomEleAr = array('annotation-xml'=>1, 'color-profile'=>1, 'font-face'=>1, 'font-face-src'=>1, 'font-face-uri'=>1, 'font-face-format'=>1, 'font-face-name'=>1, 'missing-glyph'=>1); + if ( + (!strpos($ele, '-') + && !isset($C['elements'][$ele])) // Not custom element + || (strpos($ele, '-') + && (isset($C['elements']['-' . $ele]) + || (!$C['any_custom_element'] + && !isset($C['elements'][$ele])) + || isset($invalidCustomEleAr[$ele]) + || preg_match( + '`[^-._0-9a-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\x{2ff}' + . '\x{370}-\x{37d}\x{37f}-\x{1fff}\x{200c}-\x{200d}\x{2070}-\x{218f}' + . '\x{2c00}-\x{2fef}\x{3001}-\x{d7ff}\x{f900}-\x{fdcf}\x{fdf0}-\x{fffd}\x{10000}-\x{effff}]`u' + , $ele))) + ) { + return (($C['keep_bad']%2) ? str_replace(array('<', '>'), array('<', '>'), $t) : ''); + } + + // Attribute string. + + $attrStr = str_replace(array("\n", "\r", "\t"), ' ', trim($m[3])); + + // Transform deprecated element. + + static $deprecatedEleAr = array('acronym'=>1, 'applet'=>1, 'big'=>1, 'center'=>1, 'dir'=>1, 'font'=>1, 'isindex'=>1, 's'=>1, 'strike'=>1, 'tt'=>1); + if ($C['make_tag_strict'] && isset($deprecatedEleAr[$ele])) { + $eleTransformed = self::hl_deprecatedElement($ele, $attrStr, $C['make_tag_strict']); // hl_deprecatedElement uses referencing + if (!$ele) { + return (($C['keep_bad'] % 2) ? str_replace(array('<', '>'), array('<', '>'), $t) : ''); + } + } + + // Handle closing tag. + + static $emptyEleAr = array('area'=>1, 'br'=>1, 'col'=>1, 'command'=>1, 'embed'=>1, 'hr'=>1, 'img'=>1, 'input'=>1, 'isindex'=>1, 'keygen'=>1, 'link'=>1, 'meta'=>1, 'param'=>1, 'source'=>1, 'track'=>1, 'wbr'=>1); + if (!empty($m[1])) { + return( + !isset($emptyEleAr[$ele]) + ? (empty($C['hook_tag']) + ? "" + : call_user_func($C['hook_tag'], $ele, 0)) + : ($C['keep_bad'] % 2 + ? str_replace(array('<', '>'), array('<', '>'), $t) + : '')); + } + + // Handle opening tag. + + // -- Sets of possible attributes. + + // .. Element-specific non-global. + + static $attrEleAr = array('abbr'=>array('td'=>1, 'th'=>1), 'accept'=>array('form'=>1, 'input'=>1), 'accept-charset'=>array('form'=>1), 'action'=>array('form'=>1), 'align'=>array('applet'=>1, 'caption'=>1, 'col'=>1, 'colgroup'=>1, 'div'=>1, 'embed'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'hr'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'legend'=>1, 'object'=>1, 'p'=>1, 'table'=>1, 'tbody'=>1, 'td'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'tr'=>1), 'allowfullscreen'=>array('iframe'=>1), 'alt'=>array('applet'=>1, 'area'=>1, 'img'=>1, 'input'=>1), 'archive'=>array('applet'=>1, 'object'=>1), 'async'=>array('script'=>1), 'autocomplete'=>array('form'=>1, 'input'=>1), 'autofocus'=>array('button'=>1, 'input'=>1, 'keygen'=>1, 'select'=>1, 'textarea'=>1), 'autoplay'=>array('audio'=>1, 'video'=>1), 'axis'=>array('td'=>1, 'th'=>1), 'bgcolor'=>array('embed'=>1, 'table'=>1, 'td'=>1, 'th'=>1, 'tr'=>1), 'border'=>array('img'=>1, 'object'=>1, 'table'=>1), 'bordercolor'=>array('table'=>1, 'td'=>1, 'tr'=>1), 'cellpadding'=>array('table'=>1), 'cellspacing'=>array('table'=>1), 'challenge'=>array('keygen'=>1), 'char'=>array('col'=>1, 'colgroup'=>1, 'tbody'=>1, 'td'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'tr'=>1), 'charoff'=>array('col'=>1, 'colgroup'=>1, 'tbody'=>1, 'td'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'tr'=>1), 'charset'=>array('a'=>1, 'script'=>1), 'checked'=>array('command'=>1, 'input'=>1), 'cite'=>array('blockquote'=>1, 'del'=>1, 'ins'=>1, 'q'=>1), 'classid'=>array('object'=>1), 'clear'=>array('br'=>1), 'code'=>array('applet'=>1), 'codebase'=>array('applet'=>1, 'object'=>1), 'codetype'=>array('object'=>1), 'color'=>array('font'=>1), 'cols'=>array('textarea'=>1), 'colspan'=>array('td'=>1, 'th'=>1), 'compact'=>array('dir'=>1, 'dl'=>1, 'menu'=>1, 'ol'=>1, 'ul'=>1), 'content'=>array('meta'=>1), 'controls'=>array('audio'=>1, 'video'=>1), 'coords'=>array('a'=>1, 'area'=>1), 'crossorigin'=>array('img'=>1), 'data'=>array('object'=>1), 'datetime'=>array('del'=>1, 'ins'=>1, 'time'=>1), 'declare'=>array('object'=>1), 'default'=>array('track'=>1), 'defer'=>array('script'=>1), 'dirname'=>array('input'=>1, 'textarea'=>1), 'disabled'=>array('button'=>1, 'command'=>1, 'fieldset'=>1, 'input'=>1, 'keygen'=>1, 'optgroup'=>1, 'option'=>1, 'select'=>1, 'textarea'=>1), 'download'=>array('a'=>1), 'enctype'=>array('form'=>1), 'face'=>array('font'=>1), 'flashvars'=>array('embed'=>1), 'for'=>array('label'=>1, 'output'=>1), 'form'=>array('button'=>1, 'fieldset'=>1, 'input'=>1, 'keygen'=>1, 'label'=>1, 'object'=>1, 'output'=>1, 'select'=>1, 'textarea'=>1), 'formaction'=>array('button'=>1, 'input'=>1), 'formenctype'=>array('button'=>1, 'input'=>1), 'formmethod'=>array('button'=>1, 'input'=>1), 'formnovalidate'=>array('button'=>1, 'input'=>1), 'formtarget'=>array('button'=>1, 'input'=>1), 'frame'=>array('table'=>1), 'frameborder'=>array('iframe'=>1), 'headers'=>array('td'=>1, 'th'=>1), 'height'=>array('applet'=>1, 'canvas'=>1, 'embed'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'object'=>1, 'td'=>1, 'th'=>1, 'video'=>1), 'high'=>array('meter'=>1), 'href'=>array('a'=>1, 'area'=>1, 'link'=>1), 'hreflang'=>array('a'=>1, 'area'=>1, 'link'=>1), 'hspace'=>array('applet'=>1, 'embed'=>1, 'img'=>1, 'object'=>1), 'icon'=>array('command'=>1), 'ismap'=>array('img'=>1, 'input'=>1), 'keyparams'=>array('keygen'=>1), 'keytype'=>array('keygen'=>1), 'kind'=>array('track'=>1), 'label'=>array('command'=>1, 'menu'=>1, 'option'=>1, 'optgroup'=>1, 'track'=>1), 'language'=>array('script'=>1), 'list'=>array('input'=>1), 'longdesc'=>array('img'=>1, 'iframe'=>1), 'loop'=>array('audio'=>1, 'video'=>1), 'low'=>array('meter'=>1), 'marginheight'=>array('iframe'=>1), 'marginwidth'=>array('iframe'=>1), 'max'=>array('input'=>1, 'meter'=>1, 'progress'=>1), 'maxlength'=>array('input'=>1, 'textarea'=>1), 'media'=>array('a'=>1, 'area'=>1, 'link'=>1, 'source'=>1, 'style'=>1), 'mediagroup'=>array('audio'=>1, 'video'=>1), 'method'=>array('form'=>1), 'min'=>array('input'=>1, 'meter'=>1), 'model'=>array('embed'=>1), 'multiple'=>array('input'=>1, 'select'=>1), 'muted'=>array('audio'=>1, 'video'=>1), 'name'=>array('a'=>1, 'applet'=>1, 'button'=>1, 'embed'=>1, 'fieldset'=>1, 'form'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'keygen'=>1, 'map'=>1, 'object'=>1, 'output'=>1, 'param'=>1, 'select'=>1, 'slot'=>1, 'textarea'=>1), 'nohref'=>array('area'=>1), 'noshade'=>array('hr'=>1), 'novalidate'=>array('form'=>1), 'nowrap'=>array('td'=>1, 'th'=>1), 'object'=>array('applet'=>1), 'open'=>array('details'=>1, 'dialog'=>1), 'optimum'=>array('meter'=>1), 'pattern'=>array('input'=>1), 'ping'=>array('a'=>1, 'area'=>1), 'placeholder'=>array('input'=>1, 'textarea'=>1), 'pluginspage'=>array('embed'=>1), 'pluginurl'=>array('embed'=>1), 'poster'=>array('video'=>1), 'pqg'=>array('keygen'=>1), 'preload'=>array('audio'=>1, 'video'=>1), 'prompt'=>array('isindex'=>1), 'pubdate'=>array('time'=>1), 'radiogroup'=>array('command'=>1), 'readonly'=>array('input'=>1, 'textarea'=>1), 'rel'=>array('a'=>1, 'area'=>1, 'link'=>1), 'required'=>array('input'=>1, 'select'=>1, 'textarea'=>1), 'rev'=>array('a'=>1), 'reversed'=>array('ol'=>1), 'rows'=>array('textarea'=>1), 'rowspan'=>array('td'=>1, 'th'=>1), 'rules'=>array('table'=>1), 'sandbox'=>array('iframe'=>1), 'scope'=>array('td'=>1, 'th'=>1), 'scoped'=>array('style'=>1), 'scrolling'=>array('iframe'=>1), 'seamless'=>array('iframe'=>1), 'selected'=>array('option'=>1), 'shape'=>array('a'=>1, 'area'=>1), 'size'=>array('font'=>1, 'hr'=>1, 'input'=>1, 'select'=>1), 'sizes'=>array('link'=>1), 'span'=>array('col'=>1, 'colgroup'=>1), 'src'=>array('audio'=>1, 'embed'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'script'=>1, 'source'=>1, 'track'=>1, 'video'=>1), 'srcdoc'=>array('iframe'=>1), 'srclang'=>array('track'=>1), 'srcset'=>array('img'=>1), 'standby'=>array('object'=>1), 'start'=>array('ol'=>1), 'step'=>array('input'=>1), 'summary'=>array('table'=>1), 'target'=>array('a'=>1, 'area'=>1, 'form'=>1), 'type'=>array('a'=>1, 'area'=>1, 'button'=>1, 'command'=>1, 'embed'=>1, 'input'=>1, 'li'=>1, 'link'=>1, 'menu'=>1, 'object'=>1, 'ol'=>1, 'param'=>1, 'script'=>1, 'source'=>1, 'style'=>1, 'ul'=>1), 'typemustmatch'=>array('object'=>1), 'usemap'=>array('img'=>1, 'input'=>1, 'object'=>1), 'valign'=>array('col'=>1, 'colgroup'=>1, 'tbody'=>1, 'td'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'tr'=>1), 'value'=>array('button'=>1, 'data'=>1, 'input'=>1, 'li'=>1, 'meter'=>1, 'option'=>1, 'param'=>1, 'progress'=>1), 'valuetype'=>array('param'=>1), 'vspace'=>array('applet'=>1, 'embed'=>1, 'img'=>1, 'object'=>1), 'width'=>array('applet'=>1, 'canvas'=>1, 'col'=>1, 'colgroup'=>1, 'embed'=>1, 'hr'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'object'=>1, 'pre'=>1, 'table'=>1, 'td'=>1, 'th'=>1, 'video'=>1), 'wmode'=>array('embed'=>1), 'wrap'=>array('textarea'=>1)); + + // .. Empty. + + static $emptyAttrAr = array('allowfullscreen'=>1, 'checkbox'=>1, 'checked'=>1, 'command'=>1, 'compact'=>1, 'declare'=>1, 'defer'=>1, 'default'=>1, 'disabled'=>1, 'hidden'=>1, 'inert'=>1, 'ismap'=>1, 'itemscope'=>1, 'multiple'=>1, 'nohref'=>1, 'noresize'=>1, 'noshade'=>1, 'nowrap'=>1, 'open'=>1, 'radio'=>1, 'readonly'=>1, 'required'=>1, 'reversed'=>1, 'selected'=>1); + + // .. Global. + + static $globalAttrAr = array( + + // .... General. + + 'accesskey'=>1, 'autocapitalize'=>1, 'autofocus'=>1, 'class'=>1, 'contenteditable'=>1, 'contextmenu'=>1, 'dir'=>1, 'draggable'=>1, 'dropzone'=>1, 'enterkeyhint'=>1, 'hidden'=>1, 'id'=>1, 'inert'=>1, 'inputmode'=>1, 'is'=>1, 'itemid'=>1, 'itemprop'=>1, 'itemref'=>1, 'itemscope'=>1, 'itemtype'=>1, 'lang'=>1, 'nonce'=>1, 'role'=>1, 'slot'=>1, 'spellcheck'=>1, 'style'=>1, 'tabindex'=>1, 'title'=>1, 'translate'=>1, 'xmlns'=>1, 'xml:base'=>1, 'xml:lang'=>1, 'xml:space'=>1, + + // .... Event. + + 'onabort'=>1, 'onauxclick'=>1, 'onblur'=>1, 'oncancel'=>1, 'oncanplay'=>1, 'oncanplaythrough'=>1, 'onchange'=>1, 'onclick'=>1, 'onclose'=>1, 'oncontextlost'=>1, 'oncontextmenu'=>1, 'oncontextrestored'=>1, 'oncopy'=>1, 'oncuechange'=>1, 'oncut'=>1, 'ondblclick'=>1, 'ondrag'=>1, 'ondragend'=>1, 'ondragenter'=>1, 'ondragleave'=>1, 'ondragover'=>1, 'ondragstart'=>1, 'ondrop'=>1, 'ondurationchange'=>1, 'onemptied'=>1, 'onended'=>1, 'onerror'=>1, 'onfocus'=>1, 'onformchange'=>1, 'onformdata'=>1, 'onforminput'=>1, 'ongotpointercapture'=>1, 'oninput'=>1, 'oninvalid'=>1, 'onkeydown'=>1, 'onkeypress'=>1, 'onkeyup'=>1, 'onload'=>1, 'onloadeddata'=>1, 'onloadedmetadata'=>1, 'onloadend'=>1, 'onloadstart'=>1, 'onlostpointercapture'=>1, 'onmousedown'=>1, 'onmouseenter'=>1, 'onmouseleave'=>1, 'onmousemove'=>1, 'onmouseout'=>1, 'onmouseover'=>1, 'onmouseup'=>1, 'onmousewheel'=>1, 'onpaste'=>1, 'onpause'=>1, 'onplay'=>1, 'onplaying'=>1, 'onpointercancel'=>1, 'onpointerdown'=>1, 'onpointerenter'=>1, 'onpointerleave'=>1, 'onpointermove'=>1, 'onpointerout'=>1, 'onpointerover'=>1, 'onpointerup'=>1, 'onprogress'=>1, 'onratechange'=>1, 'onreadystatechange'=>1, 'onreset'=>1, 'onresize'=>1, 'onscroll'=>1, 'onsearch'=>1, 'onsecuritypolicyviolation'=>1, 'onseeked'=>1, 'onseeking'=>1, 'onselect'=>1, 'onshow'=>1, 'onslotchange'=>1, 'onstalled'=>1, 'onsubmit'=>1, 'onsuspend'=>1, 'ontimeupdate'=>1, 'ontoggle'=>1, 'ontouchcancel'=>1, 'ontouchend'=>1, 'ontouchmove'=>1, 'ontouchstart'=>1, 'onvolumechange'=>1, 'onwaiting'=>1, 'onwheel'=>1, + + // .... Aria. + + 'aria-activedescendant'=>1, 'aria-atomic'=>1, 'aria-autocomplete'=>1, 'aria-braillelabel'=>1, 'aria-brailleroledescription'=>1, 'aria-busy'=>1, 'aria-checked'=>1, 'aria-colcount'=>1, 'aria-colindex'=>1, 'aria-colindextext'=>1, 'aria-colspan'=>1, 'aria-controls'=>1, 'aria-current'=>1, 'aria-describedby'=>1, 'aria-description'=>1, 'aria-details'=>1, 'aria-disabled'=>1, 'aria-dropeffect'=>1, 'aria-errormessage'=>1, 'aria-expanded'=>1, 'aria-flowto'=>1, 'aria-grabbed'=>1, 'aria-haspopup'=>1, 'aria-hidden'=>1, 'aria-invalid'=>1, 'aria-keyshortcuts'=>1, 'aria-label'=>1, 'aria-labelledby'=>1, 'aria-level'=>1, 'aria-live'=>1, 'aria-multiline'=>1, 'aria-multiselectable'=>1, 'aria-orientation'=>1, 'aria-owns'=>1, 'aria-placeholder'=>1, 'aria-posinset'=>1, 'aria-pressed'=>1, 'aria-readonly'=>1, 'aria-relevant'=>1, 'aria-required'=>1, 'aria-roledescription'=>1, 'aria-rowcount'=>1, 'aria-rowindex'=>1, 'aria-rowindextext'=>1, 'aria-rowspan'=>1, 'aria-selected'=>1, 'aria-setsize'=>1, 'aria-sort'=>1, 'aria-valuemax'=>1, 'aria-valuemin'=>1, 'aria-valuenow'=>1, 'aria-valuetext'=>1); + + static $urlAttrAr = array('action'=>1, 'archive'=>1, 'cite'=>1, 'classid'=>1, 'codebase'=>1, 'data'=>1, 'href'=>1, 'itemtype'=>1, 'longdesc'=>1, 'model'=>1, 'pluginspage'=>1, 'pluginurl'=>1, 'poster'=>1, 'src'=>1, 'srcset'=>1, 'usemap'=>1); // Excludes style and on* + + // .. Deprecated. + + $alterDeprecAttr = 0; + if ($C['no_deprecated_attr']) { + static $deprecAttrEleAr = array('align'=>array('caption'=>1, 'div'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'hr'=>1, 'img'=>1, 'input'=>1, 'legend'=>1, 'object'=>1, 'p'=>1, 'table'=>1), 'bgcolor'=>array('table'=>1, 'td'=>1, 'th'=>1, 'tr'=>1), 'border'=>array('object'=>1), 'bordercolor'=>array('table'=>1, 'td'=>1, 'tr'=>1), 'cellspacing'=>array('table'=>1), 'clear'=>array('br'=>1), 'compact'=>array('dl'=>1, 'ol'=>1, 'ul'=>1), 'height'=>array('td'=>1, 'th'=>1), 'hspace'=>array('img'=>1, 'object'=>1), 'language'=>array('script'=>1), 'name'=>array('a'=>1, 'form'=>1, 'iframe'=>1, 'img'=>1, 'map'=>1), 'noshade'=>array('hr'=>1), 'nowrap'=>array('td'=>1, 'th'=>1), 'size'=>array('hr'=>1), 'vspace'=>array('img'=>1, 'object'=>1), 'width'=>array('hr'=>1, 'pre'=>1, 'table'=>1, 'td'=>1, 'th'=>1)); + static $deprecAttrPossibleEleAr = array('a'=>1, 'br'=>1, 'caption'=>1, 'div'=>1, 'dl'=>1, 'form'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'hr'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'legend'=>1, 'map'=>1, 'object'=>1, 'ol'=>1, 'p'=>1, 'pre'=>1, 'script'=>1, 'table'=>1, 'td'=>1, 'th'=>1, 'tr'=>1, 'ul'=>1); + $alterDeprecAttr = isset($deprecAttrPossibleEleAr[$ele]) ? 1 : 0; + } + + // -- Standard attribute values that may need lowercasing. + + if ($C['lc_std_val']) { + static $lCaseStdAttrValAr = array('all'=>1, 'auto'=>1, 'baseline'=>1, 'bottom'=>1, 'button'=>1, 'captions'=>1, 'center'=>1, 'chapters'=>1, 'char'=>1, 'checkbox'=>1, 'circle'=>1, 'col'=>1, 'colgroup'=>1, 'color'=>1, 'cols'=>1, 'data'=>1, 'date'=>1, 'datetime'=>1, 'datetime-local'=>1, 'default'=>1, 'descriptions'=>1, 'email'=>1, 'file'=>1, 'get'=>1, 'groups'=>1, 'hidden'=>1, 'image'=>1, 'justify'=>1, 'left'=>1, 'ltr'=>1, 'metadata'=>1, 'middle'=>1, 'month'=>1, 'none'=>1, 'number'=>1, 'object'=>1, 'password'=>1, 'poly'=>1, 'post'=>1, 'preserve'=>1, 'radio'=>1, 'range'=>1, 'rect'=>1, 'ref'=>1, 'reset'=>1, 'right'=>1, 'row'=>1, 'rowgroup'=>1, 'rows'=>1, 'rtl'=>1, 'search'=>1, 'submit'=>1, 'subtitles'=>1, 'tel'=>1, 'text'=>1, 'time'=>1, 'top'=>1, 'url'=>1, 'week'=>1); + static $lCaseStdAttrValPossibleEleAr = array('a'=>1, 'area'=>1, 'bdo'=>1, 'button'=>1, 'col'=>1, 'fieldset'=>1, 'form'=>1, 'img'=>1, 'input'=>1, 'object'=>1, 'ol'=>1, 'optgroup'=>1, 'option'=>1, 'param'=>1, 'script'=>1, 'select'=>1, 'table'=>1, 'td'=>1, 'textarea'=>1, 'tfoot'=>1, 'th'=>1, 'thead'=>1, 'tr'=>1, 'track'=>1, 'xml:space'=>1); + $lCaseStdAttrVal = isset($lCaseStdAttrValPossibleEleAr[$ele]) ? 1 : 0; + } + + // -- Get attribute name-value pairs. + + if (strpos($attrStr, "\x01") !== false) { // Remove CDATA/comment + $attrStr = preg_replace('`\x01[^\x01]*\x01`', '', $attrStr); + } + $attrStr = trim($attrStr, ' /'); + $attrAr = array(); + $state = 0; + while (strlen($attrStr)) { + $ok = 0; // For parsing errors, to deal with space, ", and ' characters + switch ($state) { + case 0: if (preg_match('`^[^=\s/\x7f-\x9f]+`', $attrStr, $m)) { // Name + $attr = strtolower($m[0]); + $ok = $state = 1; + $attrStr = ltrim(substr_replace($attrStr, '', 0, strlen($m[0]))); + } + break; case 1: if ($attrStr[0] == '=') { + $ok = 1; + $state = 2; + $attrStr = ltrim($attrStr, '= '); + } else { // No value + $ok = 1; + $state = 0; + $attrStr = ltrim($attrStr); + $attrAr[$attr] = ''; + } + break; case 2: if (preg_match('`^((?:"[^"]*")|(?:\'[^\']*\')|(?:\s*[^\s"\']+))(.*)`', $attrStr, $m)) { // Value + $attrStr = ltrim($m[2]); + $m = $m[1]; + $ok = 1; + $state = 0; + $attrAr[$attr] = + trim( + str_replace('<', '<', + ($m[0] == '"' || $m[0] == '\'') + ? substr($m, 1, -1) + : $m)); + } + break; + } + if (!$ok) { + $attrStr = preg_replace('`^(?:"[^"]*("|$)|\'[^\']*(\'|$)|\S)*\s*`', '', $attrStr); + $state = 0; + } + } + if ($state == 1) { + $attrAr[$attr] = ''; + } + + // -- Clean attributes. + + global $S; + $eleSpec = isset($S[$ele]) ? $S[$ele] : array(); + $filtAttrAr = array(); // Finalized attributes + $deniedAttrAr = $C['deny_attribute']; + + foreach ($attrAr as $attr=>$v) { + + // .. Check if attribute is permitted. + + if ( + + // .... Valid attribute. + + ((isset($attrEleAr[$attr][$ele]) + || isset($globalAttrAr[$attr]) + || preg_match('`data-((?!xml)[^:]+$)`', $attr) + || (strpos($ele, '-') + && strpos($attr, 'data-xml') !== 0)) + + // .... No denial through $spec. + + && (empty($eleSpec) + || (!isset($eleSpec['deny']) + || (!isset($eleSpec['deny']['*']) + && !isset($eleSpec['deny'][$attr]) + && !isset($eleSpec['deny'][preg_replace('`^(on|aria|data).+`', '\\1', $attr). '*'])))) + + // .... No denial through $config. + + && (empty($deniedAttrAr) + || (isset($deniedAttrAr['*']) + ? (isset($deniedAttrAr["-$attr"]) + || isset($deniedAttrAr['-'. preg_replace('`^(on|aria|data)..+`', '\\1', $attr). '*'])) + : (!isset($deniedAttrAr[$attr]) + && !isset($deniedAttrAr[preg_replace('`^(on|aria|data).+`', '\\1', $attr). '*']))))) + + // .... Permit if permission through $spec. + + || (!empty($eleSpec) + && (isset($eleSpec[$attr]) + || (isset($globalAttrAr[$attr]) + && isset($eleSpec[preg_replace('`^(on|aria|data).+`', '\\1', $attr). '*'])))) + ) { + + // .. Attribute with no value or standard value. + + if (isset($emptyAttrAr[$attr])) { + $v = $attr; + } elseif ( + !empty($lCaseStdAttrVal) // ! Rather loose but should be ok + && (($ele != 'button' || $ele != 'input') + || $attr == 'type') + ) { + $v = (isset($lCaseStdAttrValAr[($vNew = strtolower($v))])) ? $vNew : $v; + } + + // .. URLs and CSS expressions in style attribute. + + if ($attr == 'style' && !$C['style_pass']) { + if (false !== strpos($v, '&#')) { // Change any entity to character + static $entityAr = array(' '=>' ', ' '=>' ', ':'=>':', ':'=>':', '"'=>'"', '"'=>'"', '('=>'(', '('=>'(', ')'=>')', ')'=>')', '*'=>'*', '*'=>'*', '/'=>'/', '/'=>'/', '\'=>'\\', '\'=>'\\', 'e'=>'e', 'E'=>'e', 'E'=>'e', 'e'=>'e', 'i'=>'i', 'I'=>'i', 'I'=>'i', 'i'=>'i', 'l'=>'l', 'L'=>'l', 'L'=>'l', 'l'=>'l', 'n'=>'n', 'N'=>'n', 'N'=>'n', 'n'=>'n', 'o'=>'o', 'O'=>'o', 'O'=>'o', 'o'=>'o', 'p'=>'p', 'P'=>'p', 'P'=>'p', 'p'=>'p', 'r'=>'r', 'R'=>'r', 'R'=>'r', 'r'=>'r', 's'=>'s', 'S'=>'s', 'S'=>'s', 's'=>'s', 'u'=>'u', 'U'=>'u', 'U'=>'u', 'u'=>'u', 'x'=>'x', 'X'=>'x', 'X'=>'x', 'x'=>'x', '''=>"'", '''=>"'"); + $v = strtr($v, $entityAr); + } + $v = + preg_replace_callback( + '`(url(?:\()(?: )*(?:\'|"|&(?:quot|apos);)?)(.+?)((?:\'|"|&(?:quot|apos);)?(?: )*(?:\)))`iS', + 'DataTables\HtmLawed\Htmlawed::hl_url', + $v); + $v = !$C['css_expression'] + ? preg_replace('`expression`i', ' ', preg_replace('`\\\\\S|(/|(%2f))(\*|(%2a))`i', ' ', $v)) + : $v; + + // .. URLs in other attributes. + + } elseif (isset($urlAttrAr[$attr]) || (isset($globalAttrAr[$attr]) && strpos($attr, 'on') === 0)) { + $v = + str_replace("­", ' ', + (strpos($v, '&') !== false // ! Double-quoted character = soft-hyphen + ? str_replace(array('­', '­', '­'), ' ', $v) + : $v)); + if ($attr == 'srcset' || ($attr == 'archive' && $ele == 'applet')) { + $vNew = ''; + foreach (explode(',', $v) as $k=>$x) { + $x = explode(' ', ltrim($x), 2); + $k = isset($x[1]) ? trim($x[1]) : ''; + $x = trim($x[0]); + if (isset($x[0])) { + $vNew .= self::hl_url($x, $attr). (empty($k) ? '' : ' '. $k). ', '; + } + } + $v = trim($vNew, ', '); + } + if ($attr == 'itemtype' || ($attr == 'archive' && $ele == 'object')) { + $vNew = ''; + foreach (explode(' ', $v) as $x) { + if (isset($x[0])) { + $vNew .= self::hl_url($x, $attr). ' '; + } + } + $v = trim($vNew, ' '); + } else { + $v = self::hl_url($v, $attr); + } + + // Anti-spam measure. + + if ($attr == 'href') { + if ($C['anti_mail_spam'] && strpos($v, 'mailto:') === 0) { + $v = str_replace('@', htmlspecialchars($C['anti_mail_spam']), $v); + } elseif ($C['anti_link_spam']) { + $x = $C['anti_link_spam'][1]; + if (!empty($x) && preg_match($x, $v)) { + continue; + } + $x = $C['anti_link_spam'][0]; + if (!empty($x) && preg_match($x, $v)) { + if (isset($filtAttrAr['rel'])) { + if (!preg_match('`\bnofollow\b`i', $filtAttrAr['rel'])) { + $filtAttrAr['rel'] .= ' nofollow'; + } + } elseif (isset($attrAr['rel'])) { + if (!preg_match('`\bnofollow\b`i', $attrAr['rel'])) { + $addNofollow = 1; + } + } else { + $filtAttrAr['rel'] = 'nofollow'; + } + } + } + } + } + + // .. Check attribute value against any $spec rule. + + if (isset($eleSpec[$attr]) + && is_array($eleSpec[$attr]) + && ($v = self::hl_attributeValue($attr, $v, $eleSpec[$attr], $ele)) === 0) { + continue; + } + + $filtAttrAr[$attr] = str_replace('"', '"', $v); + } + } + + // -- Add nofollow. + + if (isset($addNofollow)) { + $filtAttrAr['rel'] = isset($filtAttrAr['rel']) ? $filtAttrAr['rel']. ' nofollow' : 'nofollow'; + } + + // -- Add required attributes. + + static $requiredAttrAr = array('area'=>array('alt'=>'area'), 'bdo'=>array('dir'=>'ltr'), 'command'=>array('label'=>''), 'form'=>array('action'=>''), 'img'=>array('src'=>'', 'alt'=>'image'), 'map'=>array('name'=>''), 'optgroup'=>array('label'=>''), 'param'=>array('name'=>''), 'style'=>array('scoped'=>''), 'textarea'=>array('rows'=>'10', 'cols'=>'50')); + if (isset($requiredAttrAr[$ele])) { + foreach ($requiredAttrAr[$ele] as $k=>$v) { + if (!isset($filtAttrAr[$k])) { + $filtAttrAr[$k] = isset($v[0]) ? $v : $k; + } + } + } + + // -- Transform deprecated attributes into CSS declarations in style attribute. + + if ($alterDeprecAttr) { + $css = array(); + foreach ($filtAttrAr as $name=>$val) { + if ($name == 'style' || !isset($deprecAttrEleAr[$name][$ele])) { + continue; + } + $val = str_replace(array('\\', ':', ';', '&#'), '', $val); + if ($name == 'align') { + unset($filtAttrAr['align']); + if ($ele == 'img' && ($val == 'left' || $val == 'right')) { + $css[] = 'float: '. $val; + } elseif (($ele == 'div' || $ele == 'table') && $val == 'center') { + $css[] = 'margin: auto'; + } else { + $css[] = 'text-align: '. $val; + } + } elseif ($name == 'bgcolor') { + unset($filtAttrAr['bgcolor']); + $css[] = 'background-color: '. $val; + } elseif ($name == 'border') { + unset($filtAttrAr['border']); + $css[] = "border: {$val}px"; + } elseif ($name == 'bordercolor') { + unset($filtAttrAr['bordercolor']); + $css[] = 'border-color: '. $val; + } elseif ($name == 'cellspacing') { + unset($filtAttrAr['cellspacing']); + $css[] = "border-spacing: {$val}px"; + } elseif ($name == 'clear') { + unset($filtAttrAr['clear']); + $css[] = 'clear: '. ($val != 'all' ? $val : 'both'); + } elseif ($name == 'compact') { + unset($filtAttrAr['compact']); + $css[] = 'font-size: 85%'; + } elseif ($name == 'height' || $name == 'width') { + unset($filtAttrAr[$name]); + $css[] = + $name + . ': ' + . ((isset($val[0]) && $val[0] != '*') + ? $val. (ctype_digit($val) ? 'px' : '') + : 'auto'); + } elseif ($name == 'hspace') { + unset($filtAttrAr['hspace']); + $css[] = "margin-left: {$val}px; margin-right: {$val}px"; + } elseif ($name == 'language' && !isset($filtAttrAr['type'])) { + unset($filtAttrAr['language']); + $filtAttrAr['type'] = 'text/'. strtolower($val); + } elseif ($name == 'name') { + if ($C['no_deprecated_attr'] == 2 || ($ele != 'a' && $ele != 'map')) { + unset($filtAttrAr['name']); + } + if (!isset($filtAttrAr['id']) && !preg_match('`\W`', $val)) { + $filtAttrAr['id'] = $val; + } + } elseif ($name == 'noshade') { + unset($filtAttrAr['noshade']); + $css[] = 'border-style: none; border: 0; background-color: gray; color: gray'; + } elseif ($name == 'nowrap') { + unset($filtAttrAr['nowrap']); + $css[] = 'white-space: nowrap'; + } elseif ($name == 'size') { + unset($filtAttrAr['size']); + $css[] = 'size: '. $val. 'px'; + } elseif ($name == 'vspace') { + unset($filtAttrAr['vspace']); + $css[] = "margin-top: {$val}px; margin-bottom: {$val}px"; + } + } + if (count($css)) { + $css = implode('; ', $css); + $filtAttrAr['style'] = + isset($filtAttrAr['style']) + ? rtrim($filtAttrAr['style'], ' ;'). '; '. $css. ';' + : $css. ';'; + } + } + + // -- Enforce unique id attribute values. + + if ($C['unique_ids'] && isset($filtAttrAr['id'])) { + if (preg_match('`\s`', ($id = $filtAttrAr['id'])) || (isset($GLOBALS['hl_Ids'][$id]) && $C['unique_ids'] == 1)) { + unset($filtAttrAr['id']); + } else { + while (isset($GLOBALS['hl_Ids'][$id])) { + $id = $C['unique_ids']. $id; + } + $GLOBALS['hl_Ids'][($filtAttrAr['id'] = $id)] = 1; + } + } + + // -- Handle lang attributes. + + if ($C['xml:lang'] && isset($filtAttrAr['lang'])) { + $filtAttrAr['xml:lang'] = isset($filtAttrAr['xml:lang']) ? $filtAttrAr['xml:lang'] : $filtAttrAr['lang']; + if ($C['xml:lang'] == 2) { + unset($filtAttrAr['lang']); + } + } + + // -- If transformed element, modify style attribute. + + if (!empty($eleTransformed)) { + $filtAttrAr['style'] = + isset($filtAttrAr['style']) + ? rtrim($filtAttrAr['style'], ' ;'). '; '. $eleTransformed + : $eleTransformed; + } + + // -- Return opening tag with attributes. + + if (empty($C['hook_tag'])) { + $attrStr = ''; + foreach ($filtAttrAr as $k=>$v) { + $attrStr .= " {$k}=\"{$v}\""; + } + return "<{$ele}{$attrStr}". (isset($emptyEleAr[$ele]) ? ' /' : ''). '>'; + } else { + return call_user_func($C['hook_tag'], $ele, $filtAttrAr); + } + } + + /** + * Tidy/beautify HTM by adding newline and other spaces (padding), + * or compact by removing unnecessary spaces. + * + * @param string $t HTM. + * @param mixed $format -1 (compact) or string (type of padding). + * @param string $parentEle Parent element of $t. + * @return mixed Transformed attribute string (may be empty) or 0. + */ + public static function hl_tidy($t, $format, $parentEle) + { + if (strpos(' pre,script,textarea', "$parentEle,")) { + return $t; + } + + // Hide CDATA/comment. + + if (!function_exists('hl_aux2')) { + function hl_aux2($x) { + return + $x[1] + . str_replace( + array("<", ">", "\n", "\r", "\t", ' '), + array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), + $x[3]) + . $x[4]; + } + } + $t = + preg_replace( + array('`(<\w[^>]*(?)\s+`', '`\s+`', '`(<\w[^>]*(?) `'), + array(' $1', ' ', '$1'), + preg_replace_callback( + array('`(<(!\[CDATA\[))(.+?)(\]\]>)`sm', '`(<(!--))(.+?)(-->)`sm', '`(<(pre|script|textarea)[^>]*?>)(.+?)()`sm'), + 'hl_aux2', + $t)); + + if (($format = strtolower($format)) == -1) { + return + str_replace(array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), array('<', '>', "\n", "\r", "\t", ' '), $t); + } + $padChar = strpos(" $format", 't') ? "\t" : ' '; + $padStr = + preg_match('`\d`', $format, $m) + ? str_repeat($padChar, intval($m[0])) + : str_repeat($padChar, ($padChar == "\t" ? 1 : 2)); + $leadN = preg_match('`[ts]([1-9])`', $format, $m) ? intval($m[1]) : 0; + + // Group elements by line-break requirement. + + $postCloseEleAr = array('br'=>1); // After closing + $preEleAr = array('button'=>1, 'command'=>1, 'input'=>1, 'option'=>1, 'param'=>1, 'track'=>1); // Before opening or closing + $preOpenPostCloseEleAr = array('audio'=>1, 'canvas'=>1, 'caption'=>1, 'dd'=>1, 'dt'=>1, 'figcaption'=>1, 'h1'=>1, 'h2'=>1, 'h3'=>1, 'h4'=>1, 'h5'=>1, 'h6'=>1, 'isindex'=>1, 'label'=>1, 'legend'=>1, 'li'=>1, 'object'=>1, 'p'=>1, 'pre'=>1, 'style'=>1, 'summary'=>1, 'td'=>1, 'textarea'=>1, 'th'=>1, 'video'=>1); // Before opening and after closing + $prePostEleAr = array('address'=>1, 'article'=>1, 'aside'=>1, 'blockquote'=>1, 'center'=>1, 'colgroup'=>1, 'datalist'=>1, 'details'=>1, 'dialog'=>1, 'dir'=>1, 'div'=>1, 'dl'=>1, 'fieldset'=>1, 'figure'=>1, 'footer'=>1, 'form'=>1, 'header'=>1, 'hgroup'=>1, 'hr'=>1, 'iframe'=>1, 'main'=>1, 'map'=>1, 'menu'=>1, 'nav'=>1, 'noscript'=>1, 'ol'=>1, 'optgroup'=>1, 'picture'=>1, 'rbc'=>1, 'rtc'=>1, 'ruby'=>1, 'script'=>1, 'section'=>1, 'select'=>1, 'table'=>1, 'tbody'=>1, 'template'=>1, 'tfoot'=>1, 'thead'=>1, 'tr'=>1, 'ul'=>1); // Before and after opening and closing + + $doPad = 1; + $t = explode('<', $t); + while ($doPad) { + $n = $leadN; + $eleAr = $t; + ob_start(); + if (isset($prePostEleAr[$parentEle])) { + echo str_repeat($padStr, ++$n); + } + echo ltrim(array_shift($eleAr)); + for ($i=-1, $j=count($eleAr); ++$i<$j;) { + $rest = ''; + list($tag, $rest) = explode('>', $eleAr[$i]); + $open = $tag[0] == '/' ? 0 : (substr($tag, -1) == '/' ? 1 : ($tag[0] != '!' ? 2 : -1)); + $ele = !$open ? ltrim($tag, '/') : ($open > 0 ? substr($tag, 0, strcspn($tag, ' ')) : 0); + $tag = "<$tag>"; + if (isset($prePostEleAr[$ele])) { + if (!$open) { + if ($n) { + echo "\n", str_repeat($padStr, --$n), "$tag\n", str_repeat($padStr, $n); + } else { + ++$leadN; + ob_end_clean(); + continue 2; + } + } else { + echo "\n", str_repeat($padStr, $n), "$tag\n", str_repeat($padStr, ($open != 1 ? ++$n : $n)); + } + echo $rest; + continue; + } + $pad = "\n". str_repeat($padStr, $n); + if (isset($preOpenPostCloseEleAr[$ele])) { + if (!$open) { + echo $tag, $pad, $rest; + } else { + echo $pad, $tag, $rest; + } + } elseif (isset($preEleAr[$ele])) { + echo $pad, $tag, $rest; + } elseif (isset($postCloseEleAr[$ele])) { + echo $tag, $pad, $rest; + } elseif (!$ele) { + echo $pad, $tag, $pad, $rest; + } else { + echo $tag, $rest; + } + } + $doPad = 0; + } + $t = str_replace(array("\n ", " \n"), "\n", preg_replace('`[\n]\s*?[\n]+`', "\n", ob_get_contents())); + ob_end_clean(); + if (($newline = strpos(" $format", 'r') ? (strpos(" $format", 'n') ? "\r\n" : "\r") : 0)) { + $t = str_replace("\n", $newline, $t); + } + return str_replace(array("\x01", "\x02", "\x03", "\x04", "\x05", "\x07"), array('<', '>', "\n", "\r", "\t", ' '), $t); + } + + /** + * Handle URL to convert to relative/absolute type, + * block scheme, or add anti-spam text. + * + * @param mixed $url URL string, or array with URL value (if $attr is null). + * @param mixed $attr Attribute name string, or null (if $url is array). + * @return string With URL after any conversion/obfuscation. + */ + public static function hl_url($url, $attr=null) + { + global $C; + $preUrl = $postUrl = ''; + static $blocker = 'denied:'; + if ($attr == null) { // style attribute value + $attr = 'style'; + $preUrl = $url[1]; + $postUrl = $url[3]; + $url = trim($url[2]); + } + $okSchemeAr = isset($C['schemes'][$attr]) ? $C['schemes'][$attr] : $C['schemes']['*']; + if (isset($okSchemeAr['!']) && substr($url, 0, 7) != $blocker) { + $url = "{$blocker}{$url}"; + } + if (isset($okSchemeAr['*']) + || !strcspn($url, '#?;') + || substr($url, 0, strlen($blocker)) == $blocker + ) { + return "{$preUrl}{$url}{$postUrl}"; + } + if (preg_match('`^([^:?[@!$()*,=/\'\]]+?)(:|&#(58|x3a);|%3a|\\\\0{0,4}3a).`i', $url, $m) + && !isset($okSchemeAr[strtolower($m[1])]) // Special crafting suggests malice + ) { + return "{$preUrl}{$blocker}{$url}{$postUrl}"; + } + if ($C['abs_url']) { + if ($C['abs_url'] == -1 && strpos($url, $C['base_url']) === 0) { // Make URL relative + $url = substr($url, strlen($C['base_url'])); + } elseif (empty($m[1])) { // Make URL absolute + if (substr($url, 0, 2) == '//') { + $url = substr($C['base_url'], 0, strpos($C['base_url'], ':') + 1). $url; + } elseif ($url[0] == '/') { + $url = preg_replace('`(^.+?://[^/]+)(.*)`', '$1', $C['base_url']). $url; + } elseif (strcspn($url, './')) { + $url = $C['base_url']. $url; + } else { + preg_match('`^([a-zA-Z\d\-+.]+://[^/]+)(.*)`', $C['base_url'], $m); + $url = preg_replace('`(?<=/)\./`', '', $m[2]. $url); + while (preg_match('`(?<=/)([^/]{3,}|[^/.]+?|\.[^/.]|[^/.]\.)/\.\./`', $url)) { + $url = preg_replace('`(?<=/)([^/]{3,}|[^/.]+?|\.[^/.]|[^/.]\.)/\.\./`', '', $url); + } + $url = $m[1]. $url; + } + } + } + return "{$preUrl}{$url}{$postUrl}"; + } + + /** + * Report version. + * + * @return string Version. + */ + public static function hl_version() + { + return '1.2.10'; + } +} diff --git a/ci4/app/ThirdParty/DatatablesEditor/License.txt b/ci4/app/ThirdParty/DatatablesEditor/License.txt new file mode 100644 index 00000000..403b0266 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/License.txt @@ -0,0 +1,22 @@ +PHP libraries for DataTables Editor + +Copyright (c) 2018 SpryMedia Limited and other contributors +http://datatables.net + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/ci4/app/ThirdParty/DatatablesEditor/composer.json b/ci4/app/ThirdParty/DatatablesEditor/composer.json new file mode 100644 index 00000000..1488a6c3 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/composer.json @@ -0,0 +1,36 @@ +{ + "name": "datatables.net/editor-php", + "description": "PHP server-side libraries for Editor", + "type": "library", + "require": { + "php": ">=5.3.0" + }, + "keywords": ["DataTables","jQuery","Editor"], + "homepage": "https://editor.datatables.net", + "authors": [ + { + "name": "SpryMedia Ltd", + "homepage": "https://datatables.net" + } + ], + "require-dev": { + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "1.4.5", + "phpstan/phpstan-deprecation-rules": "^1.0" + }, + "autoload": { + "psr-4": { + "DataTables\\": "" + }, + "files": [ + "composer.php" + ] + }, + "license": "MIT", + "config": { + "allow-plugins": { + "phpstan/extension-installer": true + }, + "sort-packages": true + } +} diff --git a/ci4/app/ThirdParty/DatatablesEditor/composer.php b/ci4/app/ThirdParty/DatatablesEditor/composer.php new file mode 100644 index 00000000..e5916e1f --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/composer.php @@ -0,0 +1,12 @@ + "Mysql", // Database type: "Mysql", "Postgres", "Sqlserver", "Sqlite" or "Oracle" + "user" => "sk-misc", // Database user name + "pass" => "Itd27y^86", // Database password + "host" => "localhost", // Database host + "port" => "", // Database connection port (can be left empty for default) + "db" => "sk-misc", // Database name + "dsn" => "", // PHP DSN extra information. Set as `charset=utf8mb4` if you are using MySQL + "pdoAttr" => array() // PHP PDO attributes array. See the PHP documentation for all options +); + + +// This is included for the development and deploy environment used on the DataTables +// server. You can delete this block - it just includes my own user/pass without making +// them public! +if ( is_file($_SERVER['DOCUMENT_ROOT']."/datatables/pdo.php") ) { + include( $_SERVER['DOCUMENT_ROOT']."/datatables/pdo.php" ); +} +// /End development include + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-Db2Query.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-Db2Query.html new file mode 100644 index 00000000..fb70e91f --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-Db2Query.html @@ -0,0 +1,2310 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
+

Editor PHP 2.1.3

+ + + + + +
+ +
+
+ + + + +
+ + +
+

+ Db2Query + + + extends Query + + +
+ in package + +
+ + +

+ + + +

DB2 driver for DataTables Database Query class

+ +

@internal

+
+ + + + + + + + +

+ Table of Contents + +

+ +
+
+ $_field_quote + +  : mixed +
+
+ +
+ $_identifier_limiter + +  : mixed +
+
+ +
+ $_supportsAsAlias + +  : mixed +
+
+ +
+ $_whereInCnt + +  : mixed +
+
+ +
+ __construct() + +  : mixed +
+
Query instance constructor.
+ +
+ and_where() + +  : mixed +
+
Add addition where conditions to the query with an AND operator. An alias +of `where` for naming consistency.
+ +
+ bind() + +  : Query +
+
Safely bind an input value to a parameter. This is evaluated when the +query is executed. This allows user input to be safely executed without +risk of an SQL injection attack.
+ +
+ commit() + +  : mixed +
+
Commit a transaction.
+ +
+ connect() + +  : mixed +
+
Database connection - override by the database driver.
+ +
+ database() + +  : DataTable +
+
Get the Database host for this query instance
+ +
+ distinct() + +  : Query +
+
Set a distinct flag for a `select` query. Note that this has no effect on +any of the other query types.
+ +
+ dsnPostfix() + +  : Query +
+
Common helper for the drivers to handle a PDO DSN postfix
+ +
+ exec() + +  : Result +
+
Execute the query.
+ +
+ get() + +  : self +
+
Get fields.
+ +
+ group_by() + +  : self +
+
Group the results by the values in a field
+ +
+ join() + +  : mixed +
+
Perform a JOIN operation
+ +
+ left_join() + +  : mixed +
+
Add a left join, with common logic for handling binding or not
+ +
+ limit() + +  : self +
+
Limit the result set to a certain size.
+ +
+ offset() + +  : self +
+
Offset the return set by a given number of records (useful for paging).
+ +
+ or_where() + +  : mixed +
+
Add addition where conditions to the query with an OR operator.
+ +
+ order() + +  : self +
+
Order by
+ +
+ pkey() + +  : Query|array<string|int, string> +
+
Get / set the primary key column name(s) so they can be easily returned +after an insert.
+ +
+ rollback() + +  : mixed +
+
Rollback the database state to the start of the transaction.
+ +
+ set() + +  : mixed +
+
Set fields to a given value.
+ +
+ table() + +  : self +
+
Set table(s) to perform the query on.
+ +
+ transaction() + +  : mixed +
+
Start a database transaction
+ +
+ where() + +  : mixed +
+
Where query - multiple conditions are bound as ANDs.
+ +
+ where_group() + +  : mixed +
+
Provide grouping for WHERE conditions. Use it with a callback function to +automatically group any conditions applied inside the method.
+ +
+ where_in() + +  : mixed +
+
Provide a method that can be used to perform a `WHERE ... IN (...)` query +with bound values and parameters.
+ +
+ _build_limit() + +  : string +
+
Create the LIMIT / OFFSET string
+ +
+ _build_table() + +  : mixed +
+
+ +
+ _escape_field() + +  : mixed +
+
Escape quotes in a field identifier
+ +
+ _exec() + +  : mixed +
+
+ +
+ _prepare() + +  : void +
+
Prepare the SQL query by populating the bound variables.
+ +
+ + + + + + +
+

+ Properties + +

+
+

+ $_field_quote + + + +

+ + + + + protected + mixed + $_field_quote + = '"' + +
+ +
+ + + +
+
+

+ $_identifier_limiter + + + +

+ + + + + protected + mixed + $_identifier_limiter + = null + +
+ +
+ + + +
+
+

+ $_supportsAsAlias + + + +

+ + + + + protected + mixed + $_supportsAsAlias + = true + +
+ +
+ + + +
+
+

+ $_whereInCnt + + + +

+ + + + + protected + mixed + $_whereInCnt + = 1 + +
+ +
+ + + +
+
+ +
+

+ Methods + +

+
+

+ __construct() + +

+ + +

Query instance constructor.

+ + + public + __construct(mixed $dbHost, mixed $type[, mixed $table = null ]) : mixed + +

Note that typically instances of this class will be automatically created +through the \DataTables\Database->query() method.

+
+ +
Parameters
+
+
+ $dbHost + : mixed +
+
+
+ +
+
+ $type + : mixed +
+
+
+ +
+
+ $table + : mixed + = null
+
+
+ +
+
+ + + +
Return values
+ mixed + — + + +
+
+

+ and_where() + +

+ + +

Add addition where conditions to the query with an AND operator. An alias +of `where` for naming consistency.

+ + + public + and_where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

+
+ +
Parameters
+
+
+ $key + : string|array<string|int, string>|callable +
+
+

Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

+
+ +
+
+ $value + : mixed + = null
+
+
+ +
+
+ $op + : mixed + = "="
+
+
+ +
+
+ $bind + : mixed + = true
+
+
+ +
+
+ + + +
Return values
+ mixed + — + + +
+
+

+ bind() + +

+ + +

Safely bind an input value to a parameter. This is evaluated when the +query is executed. This allows user input to be safely executed without +risk of an SQL injection attack.

+ + + public + bind(string $name, string $value[, mixed $type = null ]) : Query + + +
Parameters
+
+
+ $name + : string +
+
+

Parameter name. This should include a leading colon

+
+ +
+
+ $value + : string +
+
+

Value to bind

+
+ +
+
+ $type + : mixed + = null
+
+

Data type. See the PHP PDO documentation: +http://php.net/manual/en/pdo.constants.php

+
+ +
+
+ + + +
Return values
+ Query + — + + +
+
+

+ commit() + +

+ + +

Commit a transaction.

+ + + public + static commit(mixed $conn) : mixed + +

@param \PDO $dbh The Database handle (typically a PDO object, but not always).

+
+ +
Parameters
+
+
+ $conn + : mixed +
+
+
+ +
+
+ + + +
Return values
+ mixed + — + + +
+
+

+ connect() + +

+ + +

Database connection - override by the database driver.

+ + + public + static connect(mixed $user[, mixed $pass = '' ][, mixed $host = '' ][, mixed $port = '' ][, mixed $db = '' ][, mixed $dsn = '' ]) : mixed + +

@param string|array $user User name or all parameters in an array

+
+ +
Parameters
+
+
+ $user + : mixed +
+
+
+ +
+
+ $pass + : mixed + = ''
+
+

Password +@param string $host Host name +@param string $db Database name +@return Query

+
+ +
+
+ $host + : mixed + = ''
+
+
+ +
+
+ $port + : mixed + = ''
+
+
+ +
+
+ $db + : mixed + = ''
+
+
+ +
+
+ $dsn + : mixed + = ''
+
+
+ +
+
+ + + +
Return values
+ mixed + — + + +
+
+

+ database() + +

+ + +

Get the Database host for this query instance

+ + + public + database() : DataTable + + + + + +
Return values
+ DataTable + — +

Database class instance

+
+ + +
+
+

+ distinct() + +

+ + +

Set a distinct flag for a `select` query. Note that this has no effect on +any of the other query types.

+ + + public + distinct(mixed $dis) : Query + +

@param boolean $dis Optional

+
+ +
Parameters
+
+
+ $dis + : mixed +
+
+
+ +
+
+ + + +
Return values
+ Query + — + + +
+
+

+ dsnPostfix() + +

+ + +

Common helper for the drivers to handle a PDO DSN postfix

+ + + public + static dsnPostfix(mixed $dsn) : Query + +

@param string $dsn DSN postfix to use

+
+ +
Parameters
+
+
+ $dsn + : mixed +
+
+
+ +
+
+ + + +
Return values
+ Query + — +

@internal

+
+ + +
+
+

+ exec() + +

+ + +

Execute the query.

+ + + public + exec([mixed $sql = null ]) : Result + +

@param string $sql SQL string to execute (only if _type is 'raw').

+
+ +
Parameters
+
+
+ $sql + : mixed + = null
+
+
+ +
+
+ + + +
Return values
+ Result + — + + +
+
+

+ get() + +

+ + +

Get fields.

+ + + public + get(mixed $get) : self + +

@param string|string[] $get,... Fields to get - can be specified as +individual fields or an array of fields.

+
+ +
Parameters
+
+
+ $get + : mixed +
+
+
+ +
+
+ + + +
Return values
+ self + — + + +
+
+

+ group_by() + +

+ + +

Group the results by the values in a field

+ + + public + group_by(mixed $group_by) : self + + +
Parameters
+
+
+ $group_by + : mixed +
+
+
+ +
+
+ + + +
Return values
+ self + — + + +
+
+

+ join() + +

+ + +

Perform a JOIN operation

+ + + public + join(mixed $table, string $condition[, mixed $type = '' ][, mixed $bind = true ]) : mixed + +

@param string $table Table name to do the JOIN on

+
+ +
Parameters
+
+
+ $table + : mixed +
+
+
+ +
+
+ $condition + : string +
+
+

JOIN condition +@param string $type JOIN type +@return self

+
+ +
+
+ $type + : mixed + = ''
+
+
+ +
+
+ $bind + : mixed + = true
+
+
+ +
+
+ + + +
Return values
+ mixed + — + + +
+
+

+ left_join() + +

+ + +

Add a left join, with common logic for handling binding or not

+ + + public + left_join(mixed $joins) : mixed + + +
Parameters
+
+
+ $joins + : mixed +
+
+
+ +
+
+ + + +
Return values
+ mixed + — + + +
+
+

+ limit() + +

+ + +

Limit the result set to a certain size.

+ + + public + limit(mixed $lim) : self + +

@param int $lim The number of records to limit the result to.

+
+ +
Parameters
+
+
+ $lim + : mixed +
+
+
+ +
+
+ + + +
Return values
+ self + — + + +
+
+

+ offset() + +

+ + +

Offset the return set by a given number of records (useful for paging).

+ + + public + offset(mixed $off) : self + +

@param int $off The number of records to offset the result by.

+
+ +
Parameters
+
+
+ $off + : mixed +
+
+
+ +
+
+ + + +
Return values
+ self + — + + +
+
+

+ or_where() + +

+ + +

Add addition where conditions to the query with an OR operator.

+ + + public + or_where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

+
+ +
Parameters
+
+
+ $key + : string|array<string|int, string>|callable +
+
+

Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

+
+ +
+
+ $value + : mixed + = null
+
+
+ +
+
+ $op + : mixed + = "="
+
+
+ +
+
+ $bind + : mixed + = true
+
+
+ +
+
+ + + +
Return values
+ mixed + — + + +
+
+

+ order() + +

+ + +

Order by

+ + + public + order(mixed $order) : self + +

@param string|string[] $order Columns and direction to order by - can +be specified as individual names, an array of names, a string of comma +separated names or any combination of those.

+
+ +
Parameters
+
+
+ $order + : mixed +
+
+
+ +
+
+ + + +
Return values
+ self + — + + +
+
+

+ pkey() + +

+ + +

Get / set the primary key column name(s) so they can be easily returned +after an insert.

+ + + public + pkey([array<string|int, string> $pkey = null ]) : Query|array<string|int, string> + + +
Parameters
+
+
+ $pkey + : array<string|int, string> + = null
+
+

Primary keys

+
+ +
+
+ + + +
Return values
+ Query|array<string|int, string> + — + + +
+
+

+ rollback() + +

+ + +

Rollback the database state to the start of the transaction.

+ + + public + static rollback(mixed $conn) : mixed + +

@param \PDO $dbh The Database handle (typically a PDO object, but not always).

+
+ +
Parameters
+
+
+ $conn + : mixed +
+
+
+ +
+
+ + + +
Return values
+ mixed + — + + +
+
+

+ set() + +

+ + +

Set fields to a given value.

+ + + public + set(string|array<string|int, string> $set[, mixed $val = null ][, mixed $bind = true ]) : mixed + +

Can be used in two different ways, as set( field, value ) or as an array of +fields to set: set( array( 'fieldName' => 'value', ...) );

+
+ +
Parameters
+
+
+ $set + : string|array<string|int, string> +
+
+

Can be given as a single string, when then $val +must be set, or as an array of key/value pairs to be set. +@param string $val When $set is given as a simple string, $set is the field +name and this is the field's value. +@param boolean $bind Should the value be bound or not +@return self

+
+ +
+
+ $val + : mixed + = null
+
+
+ +
+
+ $bind + : mixed + = true
+
+
+ +
+
+ + + +
Return values
+ mixed + — + + +
+
+

+ table() + +

+ + +

Set table(s) to perform the query on.

+ + + public + table(mixed $table) : self + +

@param string|string[] $table,... Table(s) to use - can be specified as +individual names, an array of names, a string of comma separated +names or any combination of those.

+
+ +
Parameters
+
+
+ $table + : mixed +
+
+
+ +
+
+ + + +
Return values
+ self + — + + +
+
+

+ transaction() + +

+ + +

Start a database transaction

+ + + public + static transaction(mixed $conn) : mixed + +

@param \PDO $dbh The Database handle (typically a PDO object, but not always).

+
+ +
Parameters
+
+
+ $conn + : mixed +
+
+
+ +
+
+ + + +
Return values
+ mixed + — + + +
+
+

+ where() + +

+ + +

Where query - multiple conditions are bound as ANDs.

+ + + public + where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

+
+ +
Parameters
+
+
+ $key + : string|array<string|int, string>|callable +
+
+

Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

+

@example +The following will produce +'WHERE name='allan' AND ( location='Scotland' OR location='Canada' ):

+
  $query
+    ->where( 'name', 'allan' )
+    ->where( function ($q) {
+      $q->where( 'location', 'Scotland' );
+      $q->or_where( 'location', 'Canada' );
+    } );
+
+
+ +
+
+ $value + : mixed + = null
+
+
+ +
+
+ $op + : mixed + = "="
+
+
+ +
+
+ $bind + : mixed + = true
+
+
+ +
+
+ + + +
Return values
+ mixed + — + + +
+
+

+ where_group() + +

+ + +

Provide grouping for WHERE conditions. Use it with a callback function to +automatically group any conditions applied inside the method.

+ + + public + where_group(bool|callable $inOut[, mixed $op = 'AND' ]) : mixed + +

For legacy reasons this method also provides the ability to explicitly +define if a grouping bracket should be opened or closed in the query. +This method is not prefer.

+
+ +
Parameters
+
+
+ $inOut + : bool|callable +
+
+

If callable it will create the group +automatically and pass the query into the called function. For +legacy operations use true to open brackets, false to close. +@param string $op Conditional operator to use to join to the +preceding condition. Default AND. +@return self

+

@example

+
$query->where_group( function ($q) {
+  $q->where( 'location', 'Edinburgh' );
+  $q->where( 'position', 'Manager' );
+} );
+
+
+ +
+
+ $op + : mixed + = 'AND'
+
+
+ +
+
+ + + +
Return values
+ mixed + — + + +
+
+

+ where_in() + +

+ + +

Provide a method that can be used to perform a `WHERE ... IN (...)` query +with bound values and parameters.

+ + + public + where_in(mixed $field, mixed $arr[, mixed $operator = "AND" ]) : mixed + +

Note this is only suitable for local values, not a sub-query. For that use +->where() with an unbound value.

+
+ +
Parameters
+
+
+ $field + : mixed +
+
+
+ +
+
+ $arr + : mixed +
+
+
+ +
+
+ $operator + : mixed + = "AND"
+
+
+ +
+
+ + + +
Return values
+ mixed + — + + +
+
+

+ _build_limit() + +

+ + +

Create the LIMIT / OFFSET string

+ + + protected + _build_limit() : string + +

MySQL and Postgres style - anything else can have the driver override

+
+ + + + +
Return values
+ string + — +

@internal

+
+ + +
+
+

+ _build_table() + +

+ + + + + protected + _build_table() : mixed + +
+ + + + +
Return values
+ mixed + — + + +
+
+

+ _escape_field() + +

+ + +

Escape quotes in a field identifier

+ + + protected + _escape_field(mixed $field) : mixed + +

@internal

+
+ +
Parameters
+
+
+ $field + : mixed +
+
+
+ +
+
+ + + +
Return values
+ mixed + — + + +
+
+

+ _exec() + +

+ + + + + protected + _exec() : mixed + +
+ + + + +
Return values
+ mixed + — + + +
+
+

+ _prepare() + +

+ + +

Prepare the SQL query by populating the bound variables.

+ + + protected + _prepare(mixed $sql) : void + +

Provided by the driver

+
+ +
Parameters
+
+
+ $sql + : mixed +
+
+
+ +
+
+ + + +
Return values
+ void + — +

@internal

+
+ + +
+
+ +
+
+
+
+

+        
+ +
+
+ + + +
+
+
+
+

Search results

+ +
+
+
    +
    +
    +
    +
    +
    + + +
    + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-Db2Result.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-Db2Result.html new file mode 100644 index 00000000..c58c95be --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-Db2Result.html @@ -0,0 +1,515 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
    +

    Editor PHP 2.1.3

    + + + + + +
    + +
    +
    + + + + +
    + + +
    +

    + Db2Result + + + extends Result + + +
    + in package + +
    + + +

    + + + +

    SQL Server driver for DataTables Database Result class

    + +

    @internal

    +
    + + + + + + + + +

    + Table of Contents + +

    + +
    +
    + __construct() + +  : mixed +
    +
    + +
    + count() + +  : mixed +
    +
    Count the number of rows in the result set.
    + +
    + fetch() + +  : array<string|int, mixed> +
    +
    Get the next row in a result set
    + +
    + fetchAll() + +  : array<string|int, mixed> +
    +
    Get all rows in the result set
    + +
    + insertId() + +  : mixed +
    +
    After an INSERT query, get the ID that was inserted.
    + +
    + + + + + + + +
    +

    + Methods + +

    +
    +

    + __construct() + +

    + + + + + public + __construct(mixed $dbh, mixed $stmt) : mixed + +
    + +
    Parameters
    +
    +
    + $dbh + : mixed +
    +
    +
    + +
    +
    + $stmt + : mixed +
    +
    +
    + +
    +
    + + + +
    Return values
    + mixed + — + + +
    +
    +

    + count() + +

    + + +

    Count the number of rows in the result set.

    + + + public + count() : mixed + +

    @return int

    +
    + + + + +
    Return values
    + mixed + — + + +
    +
    +

    + fetch() + +

    + + +

    Get the next row in a result set

    + + + public + fetch([mixed $fetchType = PDO::FETCH_ASSOC ]) : array<string|int, mixed> + +

    @param int PDO row fetch style - PDO::FETCH_ASSOC is the default

    +
    + +
    Parameters
    +
    +
    + $fetchType + : mixed + = PDO::FETCH_ASSOC
    +
    +
    + +
    +
    + + + +
    Return values
    + array<string|int, mixed> + — + + +
    +
    +

    + fetchAll() + +

    + + +

    Get all rows in the result set

    + + + public + fetchAll([mixed $fetchType = PDO::FETCH_ASSOC ]) : array<string|int, mixed> + +

    @param int PDO row fetch style - PDO::FETCH_ASSOC is the default

    +
    + +
    Parameters
    +
    +
    + $fetchType + : mixed + = PDO::FETCH_ASSOC
    +
    +
    + +
    +
    + + + +
    Return values
    + array<string|int, mixed> + — + + +
    +
    +

    + insertId() + +

    + + +

    After an INSERT query, get the ID that was inserted.

    + + + public + insertId() : mixed + +

    @return int

    +
    + + + + +
    Return values
    + mixed + — + + +
    +
    + +
    +
    +
    +
    +
    
    +        
    + +
    +
    + + + +
    +
    +
    +
    +

    Search results

    + +
    +
    +
      +
      +
      +
      +
      +
      + + +
      + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-FirebirdQuery.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-FirebirdQuery.html new file mode 100644 index 00000000..86299234 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-FirebirdQuery.html @@ -0,0 +1,2311 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
      +

      Editor PHP 2.1.3

      + + + + + +
      + +
      +
      + + + + +
      + + +
      +

      + FirebirdQuery + + + extends Query + + +
      + in package + +
      + + +

      + + + +

      Firebird driver for DataTables Database Query class

      + +

      @internal

      +
      + + + + + + + + +

      + Table of Contents + +

      + +
      +
      + $_pkeyInsertedTo + +  : mixed +
      +
      + +
      + $_field_quote + +  : mixed +
      +
      + +
      + $_identifier_limiter + +  : mixed +
      +
      + +
      + $_supportsAsAlias + +  : mixed +
      +
      + +
      + $_whereInCnt + +  : mixed +
      +
      + +
      + __construct() + +  : mixed +
      +
      Query instance constructor.
      + +
      + and_where() + +  : mixed +
      +
      Add addition where conditions to the query with an AND operator. An alias +of `where` for naming consistency.
      + +
      + bind() + +  : Query +
      +
      Safely bind an input value to a parameter. This is evaluated when the +query is executed. This allows user input to be safely executed without +risk of an SQL injection attack.
      + +
      + commit() + +  : mixed +
      +
      Commit a transaction.
      + +
      + connect() + +  : mixed +
      +
      Database connection - override by the database driver.
      + +
      + database() + +  : DataTable +
      +
      Get the Database host for this query instance
      + +
      + distinct() + +  : Query +
      +
      Set a distinct flag for a `select` query. Note that this has no effect on +any of the other query types.
      + +
      + dsnPostfix() + +  : Query +
      +
      Common helper for the drivers to handle a PDO DSN postfix
      + +
      + exec() + +  : Result +
      +
      Execute the query.
      + +
      + get() + +  : self +
      +
      Get fields.
      + +
      + group_by() + +  : self +
      +
      Group the results by the values in a field
      + +
      + join() + +  : mixed +
      +
      Perform a JOIN operation
      + +
      + left_join() + +  : mixed +
      +
      Add a left join, with common logic for handling binding or not
      + +
      + limit() + +  : self +
      +
      Limit the result set to a certain size.
      + +
      + offset() + +  : self +
      +
      Offset the return set by a given number of records (useful for paging).
      + +
      + or_where() + +  : mixed +
      +
      Add addition where conditions to the query with an OR operator.
      + +
      + order() + +  : self +
      +
      Order by
      + +
      + pkey() + +  : Query|array<string|int, string> +
      +
      Get / set the primary key column name(s) so they can be easily returned +after an insert.
      + +
      + rollback() + +  : mixed +
      +
      Rollback the database state to the start of the transaction.
      + +
      + set() + +  : mixed +
      +
      Set fields to a given value.
      + +
      + table() + +  : self +
      +
      Set table(s) to perform the query on.
      + +
      + transaction() + +  : mixed +
      +
      Start a database transaction
      + +
      + where() + +  : mixed +
      +
      Where query - multiple conditions are bound as ANDs.
      + +
      + where_group() + +  : mixed +
      +
      Provide grouping for WHERE conditions. Use it with a callback function to +automatically group any conditions applied inside the method.
      + +
      + where_in() + +  : mixed +
      +
      Provide a method that can be used to perform a `WHERE ... IN (...)` query +with bound values and parameters.
      + +
      + _build_limit() + +  : string +
      +
      Create the LIMIT / OFFSET string
      + +
      + _escape_field() + +  : mixed +
      +
      Escape quotes in a field identifier
      + +
      + _exec() + +  : mixed +
      +
      + +
      + _prepare() + +  : void +
      +
      Prepare the SQL query by populating the bound variables.
      + +
      + + + + + + +
      +

      + Properties + +

      +
      +

      + $_pkeyInsertedTo + + + +

      + + + + + public + mixed + $_pkeyInsertedTo + + +
      + +
      + + + +
      +
      +

      + $_field_quote + + + +

      + + + + + protected + mixed + $_field_quote + = '"' + +
      + +
      + + + +
      +
      +

      + $_identifier_limiter + + + +

      + + + + + protected + mixed + $_identifier_limiter + = ['"', '"'] + +
      + +
      + + + +
      +
      +

      + $_supportsAsAlias + + + +

      + + + + + protected + mixed + $_supportsAsAlias + = false + +
      + +
      + + + +
      +
      +

      + $_whereInCnt + + + +

      + + + + + protected + mixed + $_whereInCnt + = 1 + +
      + +
      + + + +
      +
      + +
      +

      + Methods + +

      +
      +

      + __construct() + +

      + + +

      Query instance constructor.

      + + + public + __construct(mixed $dbHost, mixed $type[, mixed $table = null ]) : mixed + +

      Note that typically instances of this class will be automatically created +through the \DataTables\Database->query() method.

      +
      + +
      Parameters
      +
      +
      + $dbHost + : mixed +
      +
      +
      + +
      +
      + $type + : mixed +
      +
      +
      + +
      +
      + $table + : mixed + = null
      +
      +
      + +
      +
      + + + +
      Return values
      + mixed + — + + +
      +
      +

      + and_where() + +

      + + +

      Add addition where conditions to the query with an AND operator. An alias +of `where` for naming consistency.

      + + + public + and_where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

      Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

      +
      + +
      Parameters
      +
      +
      + $key + : string|array<string|int, string>|callable +
      +
      +

      Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

      +
      + +
      +
      + $value + : mixed + = null
      +
      +
      + +
      +
      + $op + : mixed + = "="
      +
      +
      + +
      +
      + $bind + : mixed + = true
      +
      +
      + +
      +
      + + + +
      Return values
      + mixed + — + + +
      +
      +

      + bind() + +

      + + +

      Safely bind an input value to a parameter. This is evaluated when the +query is executed. This allows user input to be safely executed without +risk of an SQL injection attack.

      + + + public + bind(string $name, string $value[, mixed $type = null ]) : Query + + +
      Parameters
      +
      +
      + $name + : string +
      +
      +

      Parameter name. This should include a leading colon

      +
      + +
      +
      + $value + : string +
      +
      +

      Value to bind

      +
      + +
      +
      + $type + : mixed + = null
      +
      +

      Data type. See the PHP PDO documentation: +http://php.net/manual/en/pdo.constants.php

      +
      + +
      +
      + + + +
      Return values
      + Query + — + + +
      +
      +

      + commit() + +

      + + +

      Commit a transaction.

      + + + public + static commit(mixed $dbh) : mixed + +

      @param \PDO $dbh The Database handle (typically a PDO object, but not always).

      +
      + +
      Parameters
      +
      +
      + $dbh + : mixed +
      +
      +
      + +
      +
      + + + +
      Return values
      + mixed + — + + +
      +
      +

      + connect() + +

      + + +

      Database connection - override by the database driver.

      + + + public + static connect(mixed $user[, mixed $pass = '' ][, mixed $host = '' ][, mixed $port = '' ][, mixed $db = '' ][, mixed $dsn = '' ]) : mixed + +

      @param string|array $user User name or all parameters in an array

      +
      + +
      Parameters
      +
      +
      + $user + : mixed +
      +
      +
      + +
      +
      + $pass + : mixed + = ''
      +
      +

      Password +@param string $host Host name +@param string $db Database name +@return Query

      +
      + +
      +
      + $host + : mixed + = ''
      +
      +
      + +
      +
      + $port + : mixed + = ''
      +
      +
      + +
      +
      + $db + : mixed + = ''
      +
      +
      + +
      +
      + $dsn + : mixed + = ''
      +
      +
      + +
      +
      + + + +
      Return values
      + mixed + — + + +
      +
      +

      + database() + +

      + + +

      Get the Database host for this query instance

      + + + public + database() : DataTable + + + + + +
      Return values
      + DataTable + — +

      Database class instance

      +
      + + +
      +
      +

      + distinct() + +

      + + +

      Set a distinct flag for a `select` query. Note that this has no effect on +any of the other query types.

      + + + public + distinct(mixed $dis) : Query + +

      @param boolean $dis Optional

      +
      + +
      Parameters
      +
      +
      + $dis + : mixed +
      +
      +
      + +
      +
      + + + +
      Return values
      + Query + — + + +
      +
      +

      + dsnPostfix() + +

      + + +

      Common helper for the drivers to handle a PDO DSN postfix

      + + + public + static dsnPostfix(mixed $dsn) : Query + +

      @param string $dsn DSN postfix to use

      +
      + +
      Parameters
      +
      +
      + $dsn + : mixed +
      +
      +
      + +
      +
      + + + +
      Return values
      + Query + — +

      @internal

      +
      + + +
      +
      +

      + exec() + +

      + + +

      Execute the query.

      + + + public + exec([mixed $sql = null ]) : Result + +

      @param string $sql SQL string to execute (only if _type is 'raw').

      +
      + +
      Parameters
      +
      +
      + $sql + : mixed + = null
      +
      +
      + +
      +
      + + + +
      Return values
      + Result + — + + +
      +
      +

      + get() + +

      + + +

      Get fields.

      + + + public + get(mixed $get) : self + +

      @param string|string[] $get,... Fields to get - can be specified as +individual fields or an array of fields.

      +
      + +
      Parameters
      +
      +
      + $get + : mixed +
      +
      +
      + +
      +
      + + + +
      Return values
      + self + — + + +
      +
      +

      + group_by() + +

      + + +

      Group the results by the values in a field

      + + + public + group_by(mixed $group_by) : self + + +
      Parameters
      +
      +
      + $group_by + : mixed +
      +
      +
      + +
      +
      + + + +
      Return values
      + self + — + + +
      +
      +

      + join() + +

      + + +

      Perform a JOIN operation

      + + + public + join(mixed $table, string $condition[, mixed $type = '' ][, mixed $bind = true ]) : mixed + +

      @param string $table Table name to do the JOIN on

      +
      + +
      Parameters
      +
      +
      + $table + : mixed +
      +
      +
      + +
      +
      + $condition + : string +
      +
      +

      JOIN condition +@param string $type JOIN type +@return self

      +
      + +
      +
      + $type + : mixed + = ''
      +
      +
      + +
      +
      + $bind + : mixed + = true
      +
      +
      + +
      +
      + + + +
      Return values
      + mixed + — + + +
      +
      +

      + left_join() + +

      + + +

      Add a left join, with common logic for handling binding or not

      + + + public + left_join(mixed $joins) : mixed + + +
      Parameters
      +
      +
      + $joins + : mixed +
      +
      +
      + +
      +
      + + + +
      Return values
      + mixed + — + + +
      +
      +

      + limit() + +

      + + +

      Limit the result set to a certain size.

      + + + public + limit(mixed $lim) : self + +

      @param int $lim The number of records to limit the result to.

      +
      + +
      Parameters
      +
      +
      + $lim + : mixed +
      +
      +
      + +
      +
      + + + +
      Return values
      + self + — + + +
      +
      +

      + offset() + +

      + + +

      Offset the return set by a given number of records (useful for paging).

      + + + public + offset(mixed $off) : self + +

      @param int $off The number of records to offset the result by.

      +
      + +
      Parameters
      +
      +
      + $off + : mixed +
      +
      +
      + +
      +
      + + + +
      Return values
      + self + — + + +
      +
      +

      + or_where() + +

      + + +

      Add addition where conditions to the query with an OR operator.

      + + + public + or_where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

      Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

      +
      + +
      Parameters
      +
      +
      + $key + : string|array<string|int, string>|callable +
      +
      +

      Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

      +
      + +
      +
      + $value + : mixed + = null
      +
      +
      + +
      +
      + $op + : mixed + = "="
      +
      +
      + +
      +
      + $bind + : mixed + = true
      +
      +
      + +
      +
      + + + +
      Return values
      + mixed + — + + +
      +
      +

      + order() + +

      + + +

      Order by

      + + + public + order(mixed $order) : self + +

      @param string|string[] $order Columns and direction to order by - can +be specified as individual names, an array of names, a string of comma +separated names or any combination of those.

      +
      + +
      Parameters
      +
      +
      + $order + : mixed +
      +
      +
      + +
      +
      + + + +
      Return values
      + self + — + + +
      +
      +

      + pkey() + +

      + + +

      Get / set the primary key column name(s) so they can be easily returned +after an insert.

      + + + public + pkey([array<string|int, string> $pkey = null ]) : Query|array<string|int, string> + + +
      Parameters
      +
      +
      + $pkey + : array<string|int, string> + = null
      +
      +

      Primary keys

      +
      + +
      +
      + + + +
      Return values
      + Query|array<string|int, string> + — + + +
      +
      +

      + rollback() + +

      + + +

      Rollback the database state to the start of the transaction.

      + + + public + static rollback(mixed $dbh) : mixed + +

      @param \PDO $dbh The Database handle (typically a PDO object, but not always).

      +
      + +
      Parameters
      +
      +
      + $dbh + : mixed +
      +
      +
      + +
      +
      + + + +
      Return values
      + mixed + — + + +
      +
      +

      + set() + +

      + + +

      Set fields to a given value.

      + + + public + set(string|array<string|int, string> $set[, mixed $val = null ][, mixed $bind = true ]) : mixed + +

      Can be used in two different ways, as set( field, value ) or as an array of +fields to set: set( array( 'fieldName' => 'value', ...) );

      +
      + +
      Parameters
      +
      +
      + $set + : string|array<string|int, string> +
      +
      +

      Can be given as a single string, when then $val +must be set, or as an array of key/value pairs to be set. +@param string $val When $set is given as a simple string, $set is the field +name and this is the field's value. +@param boolean $bind Should the value be bound or not +@return self

      +
      + +
      +
      + $val + : mixed + = null
      +
      +
      + +
      +
      + $bind + : mixed + = true
      +
      +
      + +
      +
      + + + +
      Return values
      + mixed + — + + +
      +
      +

      + table() + +

      + + +

      Set table(s) to perform the query on.

      + + + public + table(mixed $table) : self + +

      @param string|string[] $table,... Table(s) to use - can be specified as +individual names, an array of names, a string of comma separated +names or any combination of those.

      +
      + +
      Parameters
      +
      +
      + $table + : mixed +
      +
      +
      + +
      +
      + + + +
      Return values
      + self + — + + +
      +
      +

      + transaction() + +

      + + +

      Start a database transaction

      + + + public + static transaction(mixed $dbh) : mixed + +

      @param \PDO $dbh The Database handle (typically a PDO object, but not always).

      +
      + +
      Parameters
      +
      +
      + $dbh + : mixed +
      +
      +
      + +
      +
      + + + +
      Return values
      + mixed + — + + +
      +
      +

      + where() + +

      + + +

      Where query - multiple conditions are bound as ANDs.

      + + + public + where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

      Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

      +
      + +
      Parameters
      +
      +
      + $key + : string|array<string|int, string>|callable +
      +
      +

      Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

      +

      @example +The following will produce +'WHERE name='allan' AND ( location='Scotland' OR location='Canada' ):

      +
        $query
      +    ->where( 'name', 'allan' )
      +    ->where( function ($q) {
      +      $q->where( 'location', 'Scotland' );
      +      $q->or_where( 'location', 'Canada' );
      +    } );
      +
      +
      + +
      +
      + $value + : mixed + = null
      +
      +
      + +
      +
      + $op + : mixed + = "="
      +
      +
      + +
      +
      + $bind + : mixed + = true
      +
      +
      + +
      +
      + + + +
      Return values
      + mixed + — + + +
      +
      +

      + where_group() + +

      + + +

      Provide grouping for WHERE conditions. Use it with a callback function to +automatically group any conditions applied inside the method.

      + + + public + where_group(bool|callable $inOut[, mixed $op = 'AND' ]) : mixed + +

      For legacy reasons this method also provides the ability to explicitly +define if a grouping bracket should be opened or closed in the query. +This method is not prefer.

      +
      + +
      Parameters
      +
      +
      + $inOut + : bool|callable +
      +
      +

      If callable it will create the group +automatically and pass the query into the called function. For +legacy operations use true to open brackets, false to close. +@param string $op Conditional operator to use to join to the +preceding condition. Default AND. +@return self

      +

      @example

      +
      $query->where_group( function ($q) {
      +  $q->where( 'location', 'Edinburgh' );
      +  $q->where( 'position', 'Manager' );
      +} );
      +
      +
      + +
      +
      + $op + : mixed + = 'AND'
      +
      +
      + +
      +
      + + + +
      Return values
      + mixed + — + + +
      +
      +

      + where_in() + +

      + + +

      Provide a method that can be used to perform a `WHERE ... IN (...)` query +with bound values and parameters.

      + + + public + where_in(mixed $field, mixed $arr[, mixed $operator = "AND" ]) : mixed + +

      Note this is only suitable for local values, not a sub-query. For that use +->where() with an unbound value.

      +
      + +
      Parameters
      +
      +
      + $field + : mixed +
      +
      +
      + +
      +
      + $arr + : mixed +
      +
      +
      + +
      +
      + $operator + : mixed + = "AND"
      +
      +
      + +
      +
      + + + +
      Return values
      + mixed + — + + +
      +
      +

      + _build_limit() + +

      + + +

      Create the LIMIT / OFFSET string

      + + + protected + _build_limit() : string + +

      MySQL and Postgres style - anything else can have the driver override

      +
      + + + + +
      Return values
      + string + — +

      @internal

      +
      + + +
      +
      +

      + _escape_field() + +

      + + +

      Escape quotes in a field identifier

      + + + protected + _escape_field(mixed $field) : mixed + +

      @internal

      +
      + +
      Parameters
      +
      +
      + $field + : mixed +
      +
      +
      + +
      +
      + + + +
      Return values
      + mixed + — + + +
      +
      +

      + _exec() + +

      + + + + + protected + _exec() : mixed + +
      + + + + +
      Return values
      + mixed + — + + +
      +
      +

      + _prepare() + +

      + + +

      Prepare the SQL query by populating the bound variables.

      + + + protected + _prepare(mixed $sql) : void + +

      Provided by the driver

      +
      + +
      Parameters
      +
      +
      + $sql + : mixed +
      +
      +
      + +
      +
      + + + +
      Return values
      + void + — +

      @internal

      +
      + + +
      +
      + +
      +
      +
      +
      +
      
      +        
      + +
      +
      + + + +
      +
      +
      +
      +

      Search results

      + +
      +
      +
        +
        +
        +
        +
        +
        + + +
        + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-FirebirdResult.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-FirebirdResult.html new file mode 100644 index 00000000..eb91ca6a --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-FirebirdResult.html @@ -0,0 +1,523 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
        +

        Editor PHP 2.1.3

        + + + + + +
        + +
        +
        + + + + +
        + + +
        +

        + FirebirdResult + + + extends Result + + +
        + in package + +
        + + +

        + + + +

        Firebird driver for DataTables Database Result class

        + +

        @internal

        +
        + + + + + + + + +

        + Table of Contents + +

        + +
        +
        + __construct() + +  : mixed +
        +
        + +
        + count() + +  : mixed +
        +
        Count the number of rows in the result set.
        + +
        + fetch() + +  : array<string|int, mixed> +
        +
        Get the next row in a result set
        + +
        + fetchAll() + +  : array<string|int, mixed> +
        +
        Get all rows in the result set
        + +
        + insertId() + +  : mixed +
        +
        After an INSERT query, get the ID that was inserted.
        + +
        + + + + + + + +
        +

        + Methods + +

        +
        +

        + __construct() + +

        + + + + + public + __construct(mixed $dbh, mixed $stmt, mixed $pkey) : mixed + +
        + +
        Parameters
        +
        +
        + $dbh + : mixed +
        +
        +
        + +
        +
        + $stmt + : mixed +
        +
        +
        + +
        +
        + $pkey + : mixed +
        +
        +
        + +
        +
        + + + +
        Return values
        + mixed + — + + +
        +
        +

        + count() + +

        + + +

        Count the number of rows in the result set.

        + + + public + count() : mixed + +

        @return int

        +
        + + + + +
        Return values
        + mixed + — + + +
        +
        +

        + fetch() + +

        + + +

        Get the next row in a result set

        + + + public + fetch([mixed $fetchType = PDO::FETCH_ASSOC ]) : array<string|int, mixed> + +

        @param int PDO row fetch style - PDO::FETCH_ASSOC is the default

        +
        + +
        Parameters
        +
        +
        + $fetchType + : mixed + = PDO::FETCH_ASSOC
        +
        +
        + +
        +
        + + + +
        Return values
        + array<string|int, mixed> + — + + +
        +
        +

        + fetchAll() + +

        + + +

        Get all rows in the result set

        + + + public + fetchAll([mixed $fetchType = PDO::FETCH_ASSOC ]) : array<string|int, mixed> + +

        @param int PDO row fetch style - PDO::FETCH_ASSOC is the default

        +
        + +
        Parameters
        +
        +
        + $fetchType + : mixed + = PDO::FETCH_ASSOC
        +
        +
        + +
        +
        + + + +
        Return values
        + array<string|int, mixed> + — + + +
        +
        +

        + insertId() + +

        + + +

        After an INSERT query, get the ID that was inserted.

        + + + public + insertId() : mixed + +

        @return int

        +
        + + + + +
        Return values
        + mixed + — + + +
        +
        + +
        +
        +
        +
        +
        
        +        
        + +
        +
        + + + +
        +
        +
        +
        +

        Search results

        + +
        +
        +
          +
          +
          +
          +
          +
          + + +
          + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-MysqlQuery.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-MysqlQuery.html new file mode 100644 index 00000000..12f1400c --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-MysqlQuery.html @@ -0,0 +1,2185 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
          +

          Editor PHP 2.1.3

          + + + + + +
          + +
          +
          + + + + +
          + + +
          +

          + MysqlQuery + + + extends Query + + +
          + in package + +
          + + +

          + + + +

          MySQL driver for DataTables Database Query class

          + +

          @internal

          +
          + + + + + + + + +

          + Table of Contents + +

          + +
          +
          + $_supportsAsAlias + +  : mixed +
          +
          + +
          + $_whereInCnt + +  : mixed +
          +
          + +
          + __construct() + +  : mixed +
          +
          Query instance constructor.
          + +
          + and_where() + +  : mixed +
          +
          Add addition where conditions to the query with an AND operator. An alias +of `where` for naming consistency.
          + +
          + bind() + +  : Query +
          +
          Safely bind an input value to a parameter. This is evaluated when the +query is executed. This allows user input to be safely executed without +risk of an SQL injection attack.
          + +
          + commit() + +  : mixed +
          +
          Commit a transaction.
          + +
          + connect() + +  : mixed +
          +
          Database connection - override by the database driver.
          + +
          + database() + +  : DataTable +
          +
          Get the Database host for this query instance
          + +
          + distinct() + +  : Query +
          +
          Set a distinct flag for a `select` query. Note that this has no effect on +any of the other query types.
          + +
          + dsnPostfix() + +  : Query +
          +
          Common helper for the drivers to handle a PDO DSN postfix
          + +
          + exec() + +  : Result +
          +
          Execute the query.
          + +
          + get() + +  : self +
          +
          Get fields.
          + +
          + group_by() + +  : self +
          +
          Group the results by the values in a field
          + +
          + join() + +  : mixed +
          +
          Perform a JOIN operation
          + +
          + left_join() + +  : mixed +
          +
          Add a left join, with common logic for handling binding or not
          + +
          + limit() + +  : self +
          +
          Limit the result set to a certain size.
          + +
          + offset() + +  : self +
          +
          Offset the return set by a given number of records (useful for paging).
          + +
          + or_where() + +  : mixed +
          +
          Add addition where conditions to the query with an OR operator.
          + +
          + order() + +  : self +
          +
          Order by
          + +
          + pkey() + +  : Query|array<string|int, string> +
          +
          Get / set the primary key column name(s) so they can be easily returned +after an insert.
          + +
          + rollback() + +  : mixed +
          +
          Rollback the database state to the start of the transaction.
          + +
          + set() + +  : mixed +
          +
          Set fields to a given value.
          + +
          + table() + +  : self +
          +
          Set table(s) to perform the query on.
          + +
          + transaction() + +  : mixed +
          +
          Start a database transaction
          + +
          + where() + +  : mixed +
          +
          Where query - multiple conditions are bound as ANDs.
          + +
          + where_group() + +  : mixed +
          +
          Provide grouping for WHERE conditions. Use it with a callback function to +automatically group any conditions applied inside the method.
          + +
          + where_in() + +  : mixed +
          +
          Provide a method that can be used to perform a `WHERE ... IN (...)` query +with bound values and parameters.
          + +
          + _build_limit() + +  : string +
          +
          Create the LIMIT / OFFSET string
          + +
          + _escape_field() + +  : mixed +
          +
          Escape quotes in a field identifier
          + +
          + _exec() + +  : mixed +
          +
          + +
          + _prepare() + +  : void +
          +
          Prepare the SQL query by populating the bound variables.
          + +
          + + + + + + +
          +

          + Properties + +

          +
          +

          + $_supportsAsAlias + + + +

          + + + + + protected + mixed + $_supportsAsAlias + = true + +
          + +
          + + + +
          +
          +

          + $_whereInCnt + + + +

          + + + + + protected + mixed + $_whereInCnt + = 1 + +
          + +
          + + + +
          +
          + +
          +

          + Methods + +

          +
          +

          + __construct() + +

          + + +

          Query instance constructor.

          + + + public + __construct(mixed $dbHost, mixed $type[, mixed $table = null ]) : mixed + +

          Note that typically instances of this class will be automatically created +through the \DataTables\Database->query() method.

          +
          + +
          Parameters
          +
          +
          + $dbHost + : mixed +
          +
          +
          + +
          +
          + $type + : mixed +
          +
          +
          + +
          +
          + $table + : mixed + = null
          +
          +
          + +
          +
          + + + +
          Return values
          + mixed + — + + +
          +
          +

          + and_where() + +

          + + +

          Add addition where conditions to the query with an AND operator. An alias +of `where` for naming consistency.

          + + + public + and_where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

          Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

          +
          + +
          Parameters
          +
          +
          + $key + : string|array<string|int, string>|callable +
          +
          +

          Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

          +
          + +
          +
          + $value + : mixed + = null
          +
          +
          + +
          +
          + $op + : mixed + = "="
          +
          +
          + +
          +
          + $bind + : mixed + = true
          +
          +
          + +
          +
          + + + +
          Return values
          + mixed + — + + +
          +
          +

          + bind() + +

          + + +

          Safely bind an input value to a parameter. This is evaluated when the +query is executed. This allows user input to be safely executed without +risk of an SQL injection attack.

          + + + public + bind(string $name, string $value[, mixed $type = null ]) : Query + + +
          Parameters
          +
          +
          + $name + : string +
          +
          +

          Parameter name. This should include a leading colon

          +
          + +
          +
          + $value + : string +
          +
          +

          Value to bind

          +
          + +
          +
          + $type + : mixed + = null
          +
          +

          Data type. See the PHP PDO documentation: +http://php.net/manual/en/pdo.constants.php

          +
          + +
          +
          + + + +
          Return values
          + Query + — + + +
          +
          +

          + commit() + +

          + + +

          Commit a transaction.

          + + + public + static commit(mixed $dbh) : mixed + +

          @param \PDO $dbh The Database handle (typically a PDO object, but not always).

          +
          + +
          Parameters
          +
          +
          + $dbh + : mixed +
          +
          +
          + +
          +
          + + + +
          Return values
          + mixed + — + + +
          +
          +

          + connect() + +

          + + +

          Database connection - override by the database driver.

          + + + public + static connect(mixed $user[, mixed $pass = '' ][, mixed $host = '' ][, mixed $port = '' ][, mixed $db = '' ][, mixed $dsn = '' ]) : mixed + +

          @param string|array $user User name or all parameters in an array

          +
          + +
          Parameters
          +
          +
          + $user + : mixed +
          +
          +
          + +
          +
          + $pass + : mixed + = ''
          +
          +

          Password +@param string $host Host name +@param string $db Database name +@return Query

          +
          + +
          +
          + $host + : mixed + = ''
          +
          +
          + +
          +
          + $port + : mixed + = ''
          +
          +
          + +
          +
          + $db + : mixed + = ''
          +
          +
          + +
          +
          + $dsn + : mixed + = ''
          +
          +
          + +
          +
          + + + +
          Return values
          + mixed + — + + +
          +
          +

          + database() + +

          + + +

          Get the Database host for this query instance

          + + + public + database() : DataTable + + + + + +
          Return values
          + DataTable + — +

          Database class instance

          +
          + + +
          +
          +

          + distinct() + +

          + + +

          Set a distinct flag for a `select` query. Note that this has no effect on +any of the other query types.

          + + + public + distinct(mixed $dis) : Query + +

          @param boolean $dis Optional

          +
          + +
          Parameters
          +
          +
          + $dis + : mixed +
          +
          +
          + +
          +
          + + + +
          Return values
          + Query + — + + +
          +
          +

          + dsnPostfix() + +

          + + +

          Common helper for the drivers to handle a PDO DSN postfix

          + + + public + static dsnPostfix(mixed $dsn) : Query + +

          @param string $dsn DSN postfix to use

          +
          + +
          Parameters
          +
          +
          + $dsn + : mixed +
          +
          +
          + +
          +
          + + + +
          Return values
          + Query + — +

          @internal

          +
          + + +
          +
          +

          + exec() + +

          + + +

          Execute the query.

          + + + public + exec([mixed $sql = null ]) : Result + +

          @param string $sql SQL string to execute (only if _type is 'raw').

          +
          + +
          Parameters
          +
          +
          + $sql + : mixed + = null
          +
          +
          + +
          +
          + + + +
          Return values
          + Result + — + + +
          +
          +

          + get() + +

          + + +

          Get fields.

          + + + public + get(mixed $get) : self + +

          @param string|string[] $get,... Fields to get - can be specified as +individual fields or an array of fields.

          +
          + +
          Parameters
          +
          +
          + $get + : mixed +
          +
          +
          + +
          +
          + + + +
          Return values
          + self + — + + +
          +
          +

          + group_by() + +

          + + +

          Group the results by the values in a field

          + + + public + group_by(mixed $group_by) : self + + +
          Parameters
          +
          +
          + $group_by + : mixed +
          +
          +
          + +
          +
          + + + +
          Return values
          + self + — + + +
          +
          +

          + join() + +

          + + +

          Perform a JOIN operation

          + + + public + join(mixed $table, string $condition[, mixed $type = '' ][, mixed $bind = true ]) : mixed + +

          @param string $table Table name to do the JOIN on

          +
          + +
          Parameters
          +
          +
          + $table + : mixed +
          +
          +
          + +
          +
          + $condition + : string +
          +
          +

          JOIN condition +@param string $type JOIN type +@return self

          +
          + +
          +
          + $type + : mixed + = ''
          +
          +
          + +
          +
          + $bind + : mixed + = true
          +
          +
          + +
          +
          + + + +
          Return values
          + mixed + — + + +
          +
          +

          + left_join() + +

          + + +

          Add a left join, with common logic for handling binding or not

          + + + public + left_join(mixed $joins) : mixed + + +
          Parameters
          +
          +
          + $joins + : mixed +
          +
          +
          + +
          +
          + + + +
          Return values
          + mixed + — + + +
          +
          +

          + limit() + +

          + + +

          Limit the result set to a certain size.

          + + + public + limit(mixed $lim) : self + +

          @param int $lim The number of records to limit the result to.

          +
          + +
          Parameters
          +
          +
          + $lim + : mixed +
          +
          +
          + +
          +
          + + + +
          Return values
          + self + — + + +
          +
          +

          + offset() + +

          + + +

          Offset the return set by a given number of records (useful for paging).

          + + + public + offset(mixed $off) : self + +

          @param int $off The number of records to offset the result by.

          +
          + +
          Parameters
          +
          +
          + $off + : mixed +
          +
          +
          + +
          +
          + + + +
          Return values
          + self + — + + +
          +
          +

          + or_where() + +

          + + +

          Add addition where conditions to the query with an OR operator.

          + + + public + or_where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

          Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

          +
          + +
          Parameters
          +
          +
          + $key + : string|array<string|int, string>|callable +
          +
          +

          Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

          +
          + +
          +
          + $value + : mixed + = null
          +
          +
          + +
          +
          + $op + : mixed + = "="
          +
          +
          + +
          +
          + $bind + : mixed + = true
          +
          +
          + +
          +
          + + + +
          Return values
          + mixed + — + + +
          +
          +

          + order() + +

          + + +

          Order by

          + + + public + order(mixed $order) : self + +

          @param string|string[] $order Columns and direction to order by - can +be specified as individual names, an array of names, a string of comma +separated names or any combination of those.

          +
          + +
          Parameters
          +
          +
          + $order + : mixed +
          +
          +
          + +
          +
          + + + +
          Return values
          + self + — + + +
          +
          +

          + pkey() + +

          + + +

          Get / set the primary key column name(s) so they can be easily returned +after an insert.

          + + + public + pkey([array<string|int, string> $pkey = null ]) : Query|array<string|int, string> + + +
          Parameters
          +
          +
          + $pkey + : array<string|int, string> + = null
          +
          +

          Primary keys

          +
          + +
          +
          + + + +
          Return values
          + Query|array<string|int, string> + — + + +
          +
          +

          + rollback() + +

          + + +

          Rollback the database state to the start of the transaction.

          + + + public + static rollback(mixed $dbh) : mixed + +

          @param \PDO $dbh The Database handle (typically a PDO object, but not always).

          +
          + +
          Parameters
          +
          +
          + $dbh + : mixed +
          +
          +
          + +
          +
          + + + +
          Return values
          + mixed + — + + +
          +
          +

          + set() + +

          + + +

          Set fields to a given value.

          + + + public + set(string|array<string|int, string> $set[, mixed $val = null ][, mixed $bind = true ]) : mixed + +

          Can be used in two different ways, as set( field, value ) or as an array of +fields to set: set( array( 'fieldName' => 'value', ...) );

          +
          + +
          Parameters
          +
          +
          + $set + : string|array<string|int, string> +
          +
          +

          Can be given as a single string, when then $val +must be set, or as an array of key/value pairs to be set. +@param string $val When $set is given as a simple string, $set is the field +name and this is the field's value. +@param boolean $bind Should the value be bound or not +@return self

          +
          + +
          +
          + $val + : mixed + = null
          +
          +
          + +
          +
          + $bind + : mixed + = true
          +
          +
          + +
          +
          + + + +
          Return values
          + mixed + — + + +
          +
          +

          + table() + +

          + + +

          Set table(s) to perform the query on.

          + + + public + table(mixed $table) : self + +

          @param string|string[] $table,... Table(s) to use - can be specified as +individual names, an array of names, a string of comma separated +names or any combination of those.

          +
          + +
          Parameters
          +
          +
          + $table + : mixed +
          +
          +
          + +
          +
          + + + +
          Return values
          + self + — + + +
          +
          +

          + transaction() + +

          + + +

          Start a database transaction

          + + + public + static transaction(mixed $dbh) : mixed + +

          @param \PDO $dbh The Database handle (typically a PDO object, but not always).

          +
          + +
          Parameters
          +
          +
          + $dbh + : mixed +
          +
          +
          + +
          +
          + + + +
          Return values
          + mixed + — + + +
          +
          +

          + where() + +

          + + +

          Where query - multiple conditions are bound as ANDs.

          + + + public + where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

          Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

          +
          + +
          Parameters
          +
          +
          + $key + : string|array<string|int, string>|callable +
          +
          +

          Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

          +

          @example +The following will produce +'WHERE name='allan' AND ( location='Scotland' OR location='Canada' ):

          +
            $query
          +    ->where( 'name', 'allan' )
          +    ->where( function ($q) {
          +      $q->where( 'location', 'Scotland' );
          +      $q->or_where( 'location', 'Canada' );
          +    } );
          +
          +
          + +
          +
          + $value + : mixed + = null
          +
          +
          + +
          +
          + $op + : mixed + = "="
          +
          +
          + +
          +
          + $bind + : mixed + = true
          +
          +
          + +
          +
          + + + +
          Return values
          + mixed + — + + +
          +
          +

          + where_group() + +

          + + +

          Provide grouping for WHERE conditions. Use it with a callback function to +automatically group any conditions applied inside the method.

          + + + public + where_group(bool|callable $inOut[, mixed $op = 'AND' ]) : mixed + +

          For legacy reasons this method also provides the ability to explicitly +define if a grouping bracket should be opened or closed in the query. +This method is not prefer.

          +
          + +
          Parameters
          +
          +
          + $inOut + : bool|callable +
          +
          +

          If callable it will create the group +automatically and pass the query into the called function. For +legacy operations use true to open brackets, false to close. +@param string $op Conditional operator to use to join to the +preceding condition. Default AND. +@return self

          +

          @example

          +
          $query->where_group( function ($q) {
          +  $q->where( 'location', 'Edinburgh' );
          +  $q->where( 'position', 'Manager' );
          +} );
          +
          +
          + +
          +
          + $op + : mixed + = 'AND'
          +
          +
          + +
          +
          + + + +
          Return values
          + mixed + — + + +
          +
          +

          + where_in() + +

          + + +

          Provide a method that can be used to perform a `WHERE ... IN (...)` query +with bound values and parameters.

          + + + public + where_in(mixed $field, mixed $arr[, mixed $operator = "AND" ]) : mixed + +

          Note this is only suitable for local values, not a sub-query. For that use +->where() with an unbound value.

          +
          + +
          Parameters
          +
          +
          + $field + : mixed +
          +
          +
          + +
          +
          + $arr + : mixed +
          +
          +
          + +
          +
          + $operator + : mixed + = "AND"
          +
          +
          + +
          +
          + + + +
          Return values
          + mixed + — + + +
          +
          +

          + _build_limit() + +

          + + +

          Create the LIMIT / OFFSET string

          + + + protected + _build_limit() : string + +

          MySQL and Postgres style - anything else can have the driver override

          +
          + + + + +
          Return values
          + string + — +

          @internal

          +
          + + +
          +
          +

          + _escape_field() + +

          + + +

          Escape quotes in a field identifier

          + + + protected + _escape_field(mixed $field) : mixed + +

          @internal

          +
          + +
          Parameters
          +
          +
          + $field + : mixed +
          +
          +
          + +
          +
          + + + +
          Return values
          + mixed + — + + +
          +
          +

          + _exec() + +

          + + + + + protected + _exec() : mixed + +
          + + + + +
          Return values
          + mixed + — + + +
          +
          +

          + _prepare() + +

          + + +

          Prepare the SQL query by populating the bound variables.

          + + + protected + _prepare(mixed $sql) : void + +

          Provided by the driver

          +
          + +
          Parameters
          +
          +
          + $sql + : mixed +
          +
          +
          + +
          +
          + + + +
          Return values
          + void + — +

          @internal

          +
          + + +
          +
          + +
          +
          +
          +
          +
          
          +        
          + +
          +
          + + + +
          +
          +
          +
          +

          Search results

          + +
          +
          +
            +
            +
            +
            +
            +
            + + +
            + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-MysqlResult.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-MysqlResult.html new file mode 100644 index 00000000..2f0724f4 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-MysqlResult.html @@ -0,0 +1,515 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
            +

            Editor PHP 2.1.3

            + + + + + +
            + +
            +
            + + + + +
            + + +
            +

            + MysqlResult + + + extends Result + + +
            + in package + +
            + + +

            + + + +

            MySQL driver for DataTables Database Result class

            + +

            @internal

            +
            + + + + + + + + +

            + Table of Contents + +

            + +
            +
            + __construct() + +  : mixed +
            +
            + +
            + count() + +  : mixed +
            +
            Count the number of rows in the result set.
            + +
            + fetch() + +  : array<string|int, mixed> +
            +
            Get the next row in a result set
            + +
            + fetchAll() + +  : array<string|int, mixed> +
            +
            Get all rows in the result set
            + +
            + insertId() + +  : mixed +
            +
            After an INSERT query, get the ID that was inserted.
            + +
            + + + + + + + +
            +

            + Methods + +

            +
            +

            + __construct() + +

            + + + + + public + __construct(mixed $dbh, mixed $stmt) : mixed + +
            + +
            Parameters
            +
            +
            + $dbh + : mixed +
            +
            +
            + +
            +
            + $stmt + : mixed +
            +
            +
            + +
            +
            + + + +
            Return values
            + mixed + — + + +
            +
            +

            + count() + +

            + + +

            Count the number of rows in the result set.

            + + + public + count() : mixed + +

            @return int

            +
            + + + + +
            Return values
            + mixed + — + + +
            +
            +

            + fetch() + +

            + + +

            Get the next row in a result set

            + + + public + fetch([mixed $fetchType = PDO::FETCH_ASSOC ]) : array<string|int, mixed> + +

            @param int PDO row fetch style - PDO::FETCH_ASSOC is the default

            +
            + +
            Parameters
            +
            +
            + $fetchType + : mixed + = PDO::FETCH_ASSOC
            +
            +
            + +
            +
            + + + +
            Return values
            + array<string|int, mixed> + — + + +
            +
            +

            + fetchAll() + +

            + + +

            Get all rows in the result set

            + + + public + fetchAll([mixed $fetchType = PDO::FETCH_ASSOC ]) : array<string|int, mixed> + +

            @param int PDO row fetch style - PDO::FETCH_ASSOC is the default

            +
            + +
            Parameters
            +
            +
            + $fetchType + : mixed + = PDO::FETCH_ASSOC
            +
            +
            + +
            +
            + + + +
            Return values
            + array<string|int, mixed> + — + + +
            +
            +

            + insertId() + +

            + + +

            After an INSERT query, get the ID that was inserted.

            + + + public + insertId() : mixed + +

            @return int

            +
            + + + + +
            Return values
            + mixed + — + + +
            +
            + +
            +
            +
            +
            +
            
            +        
            + +
            +
            + + + +
            +
            +
            +
            +

            Search results

            + +
            +
            +
              +
              +
              +
              +
              +
              + + +
              + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-OracleQuery.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-OracleQuery.html new file mode 100644 index 00000000..eb6fc441 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-OracleQuery.html @@ -0,0 +1,2310 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
              +

              Editor PHP 2.1.3

              + + + + + +
              + +
              +
              + + + + +
              + + +
              +

              + OracleQuery + + + extends Query + + +
              + in package + +
              + + +

              + + + +

              Oracle driver for DataTables Database Query class

              + +

              @internal

              +
              + + + + + + + + +

              + Table of Contents + +

              + +
              +
              + $_field_quote + +  : mixed +
              +
              + +
              + $_identifier_limiter + +  : mixed +
              +
              + +
              + $_supportsAsAlias + +  : mixed +
              +
              + +
              + $_whereInCnt + +  : mixed +
              +
              + +
              + __construct() + +  : mixed +
              +
              Query instance constructor.
              + +
              + and_where() + +  : mixed +
              +
              Add addition where conditions to the query with an AND operator. An alias +of `where` for naming consistency.
              + +
              + bind() + +  : Query +
              +
              Safely bind an input value to a parameter. This is evaluated when the +query is executed. This allows user input to be safely executed without +risk of an SQL injection attack.
              + +
              + commit() + +  : mixed +
              +
              Commit a transaction.
              + +
              + connect() + +  : mixed +
              +
              Database connection - override by the database driver.
              + +
              + database() + +  : DataTable +
              +
              Get the Database host for this query instance
              + +
              + distinct() + +  : Query +
              +
              Set a distinct flag for a `select` query. Note that this has no effect on +any of the other query types.
              + +
              + dsnPostfix() + +  : Query +
              +
              Common helper for the drivers to handle a PDO DSN postfix
              + +
              + exec() + +  : Result +
              +
              Execute the query.
              + +
              + get() + +  : self +
              +
              Get fields.
              + +
              + group_by() + +  : self +
              +
              Group the results by the values in a field
              + +
              + join() + +  : mixed +
              +
              Perform a JOIN operation
              + +
              + left_join() + +  : mixed +
              +
              Add a left join, with common logic for handling binding or not
              + +
              + limit() + +  : self +
              +
              Limit the result set to a certain size.
              + +
              + offset() + +  : self +
              +
              Offset the return set by a given number of records (useful for paging).
              + +
              + or_where() + +  : mixed +
              +
              Add addition where conditions to the query with an OR operator.
              + +
              + order() + +  : self +
              +
              Order by
              + +
              + pkey() + +  : Query|array<string|int, string> +
              +
              Get / set the primary key column name(s) so they can be easily returned +after an insert.
              + +
              + rollback() + +  : mixed +
              +
              Rollback the database state to the start of the transaction.
              + +
              + set() + +  : mixed +
              +
              Set fields to a given value.
              + +
              + table() + +  : self +
              +
              Set table(s) to perform the query on.
              + +
              + transaction() + +  : mixed +
              +
              Start a database transaction
              + +
              + where() + +  : mixed +
              +
              Where query - multiple conditions are bound as ANDs.
              + +
              + where_group() + +  : mixed +
              +
              Provide grouping for WHERE conditions. Use it with a callback function to +automatically group any conditions applied inside the method.
              + +
              + where_in() + +  : mixed +
              +
              Provide a method that can be used to perform a `WHERE ... IN (...)` query +with bound values and parameters.
              + +
              + _build_limit() + +  : string +
              +
              Create the LIMIT / OFFSET string
              + +
              + _build_table() + +  : mixed +
              +
              + +
              + _escape_field() + +  : mixed +
              +
              Escape quotes in a field identifier
              + +
              + _exec() + +  : mixed +
              +
              + +
              + _prepare() + +  : void +
              +
              Prepare the SQL query by populating the bound variables.
              + +
              + + + + + + +
              +

              + Properties + +

              +
              +

              + $_field_quote + + + +

              + + + + + protected + mixed + $_field_quote + = '"' + +
              + +
              + + + +
              +
              +

              + $_identifier_limiter + + + +

              + + + + + protected + mixed + $_identifier_limiter + = array('"', '"') + +
              + +
              + + + +
              +
              +

              + $_supportsAsAlias + + + +

              + + + + + protected + mixed + $_supportsAsAlias + = false + +
              + +
              + + + +
              +
              +

              + $_whereInCnt + + + +

              + + + + + protected + mixed + $_whereInCnt + = 1 + +
              + +
              + + + +
              +
              + +
              +

              + Methods + +

              +
              +

              + __construct() + +

              + + +

              Query instance constructor.

              + + + public + __construct(mixed $dbHost, mixed $type[, mixed $table = null ]) : mixed + +

              Note that typically instances of this class will be automatically created +through the \DataTables\Database->query() method.

              +
              + +
              Parameters
              +
              +
              + $dbHost + : mixed +
              +
              +
              + +
              +
              + $type + : mixed +
              +
              +
              + +
              +
              + $table + : mixed + = null
              +
              +
              + +
              +
              + + + +
              Return values
              + mixed + — + + +
              +
              +

              + and_where() + +

              + + +

              Add addition where conditions to the query with an AND operator. An alias +of `where` for naming consistency.

              + + + public + and_where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

              Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

              +
              + +
              Parameters
              +
              +
              + $key + : string|array<string|int, string>|callable +
              +
              +

              Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

              +
              + +
              +
              + $value + : mixed + = null
              +
              +
              + +
              +
              + $op + : mixed + = "="
              +
              +
              + +
              +
              + $bind + : mixed + = true
              +
              +
              + +
              +
              + + + +
              Return values
              + mixed + — + + +
              +
              +

              + bind() + +

              + + +

              Safely bind an input value to a parameter. This is evaluated when the +query is executed. This allows user input to be safely executed without +risk of an SQL injection attack.

              + + + public + bind(string $name, string $value[, mixed $type = null ]) : Query + + +
              Parameters
              +
              +
              + $name + : string +
              +
              +

              Parameter name. This should include a leading colon

              +
              + +
              +
              + $value + : string +
              +
              +

              Value to bind

              +
              + +
              +
              + $type + : mixed + = null
              +
              +

              Data type. See the PHP PDO documentation: +http://php.net/manual/en/pdo.constants.php

              +
              + +
              +
              + + + +
              Return values
              + Query + — + + +
              +
              +

              + commit() + +

              + + +

              Commit a transaction.

              + + + public + static commit(mixed $conn) : mixed + +

              @param \PDO $dbh The Database handle (typically a PDO object, but not always).

              +
              + +
              Parameters
              +
              +
              + $conn + : mixed +
              +
              +
              + +
              +
              + + + +
              Return values
              + mixed + — + + +
              +
              +

              + connect() + +

              + + +

              Database connection - override by the database driver.

              + + + public + static connect(mixed $user[, mixed $pass = '' ][, mixed $host = '' ][, mixed $port = '' ][, mixed $db = '' ][, mixed $dsn = '' ]) : mixed + +

              @param string|array $user User name or all parameters in an array

              +
              + +
              Parameters
              +
              +
              + $user + : mixed +
              +
              +
              + +
              +
              + $pass + : mixed + = ''
              +
              +

              Password +@param string $host Host name +@param string $db Database name +@return Query

              +
              + +
              +
              + $host + : mixed + = ''
              +
              +
              + +
              +
              + $port + : mixed + = ''
              +
              +
              + +
              +
              + $db + : mixed + = ''
              +
              +
              + +
              +
              + $dsn + : mixed + = ''
              +
              +
              + +
              +
              + + + +
              Return values
              + mixed + — + + +
              +
              +

              + database() + +

              + + +

              Get the Database host for this query instance

              + + + public + database() : DataTable + + + + + +
              Return values
              + DataTable + — +

              Database class instance

              +
              + + +
              +
              +

              + distinct() + +

              + + +

              Set a distinct flag for a `select` query. Note that this has no effect on +any of the other query types.

              + + + public + distinct(mixed $dis) : Query + +

              @param boolean $dis Optional

              +
              + +
              Parameters
              +
              +
              + $dis + : mixed +
              +
              +
              + +
              +
              + + + +
              Return values
              + Query + — + + +
              +
              +

              + dsnPostfix() + +

              + + +

              Common helper for the drivers to handle a PDO DSN postfix

              + + + public + static dsnPostfix(mixed $dsn) : Query + +

              @param string $dsn DSN postfix to use

              +
              + +
              Parameters
              +
              +
              + $dsn + : mixed +
              +
              +
              + +
              +
              + + + +
              Return values
              + Query + — +

              @internal

              +
              + + +
              +
              +

              + exec() + +

              + + +

              Execute the query.

              + + + public + exec([mixed $sql = null ]) : Result + +

              @param string $sql SQL string to execute (only if _type is 'raw').

              +
              + +
              Parameters
              +
              +
              + $sql + : mixed + = null
              +
              +
              + +
              +
              + + + +
              Return values
              + Result + — + + +
              +
              +

              + get() + +

              + + +

              Get fields.

              + + + public + get(mixed $get) : self + +

              @param string|string[] $get,... Fields to get - can be specified as +individual fields or an array of fields.

              +
              + +
              Parameters
              +
              +
              + $get + : mixed +
              +
              +
              + +
              +
              + + + +
              Return values
              + self + — + + +
              +
              +

              + group_by() + +

              + + +

              Group the results by the values in a field

              + + + public + group_by(mixed $group_by) : self + + +
              Parameters
              +
              +
              + $group_by + : mixed +
              +
              +
              + +
              +
              + + + +
              Return values
              + self + — + + +
              +
              +

              + join() + +

              + + +

              Perform a JOIN operation

              + + + public + join(mixed $table, string $condition[, mixed $type = '' ][, mixed $bind = true ]) : mixed + +

              @param string $table Table name to do the JOIN on

              +
              + +
              Parameters
              +
              +
              + $table + : mixed +
              +
              +
              + +
              +
              + $condition + : string +
              +
              +

              JOIN condition +@param string $type JOIN type +@return self

              +
              + +
              +
              + $type + : mixed + = ''
              +
              +
              + +
              +
              + $bind + : mixed + = true
              +
              +
              + +
              +
              + + + +
              Return values
              + mixed + — + + +
              +
              +

              + left_join() + +

              + + +

              Add a left join, with common logic for handling binding or not

              + + + public + left_join(mixed $joins) : mixed + + +
              Parameters
              +
              +
              + $joins + : mixed +
              +
              +
              + +
              +
              + + + +
              Return values
              + mixed + — + + +
              +
              +

              + limit() + +

              + + +

              Limit the result set to a certain size.

              + + + public + limit(mixed $lim) : self + +

              @param int $lim The number of records to limit the result to.

              +
              + +
              Parameters
              +
              +
              + $lim + : mixed +
              +
              +
              + +
              +
              + + + +
              Return values
              + self + — + + +
              +
              +

              + offset() + +

              + + +

              Offset the return set by a given number of records (useful for paging).

              + + + public + offset(mixed $off) : self + +

              @param int $off The number of records to offset the result by.

              +
              + +
              Parameters
              +
              +
              + $off + : mixed +
              +
              +
              + +
              +
              + + + +
              Return values
              + self + — + + +
              +
              +

              + or_where() + +

              + + +

              Add addition where conditions to the query with an OR operator.

              + + + public + or_where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

              Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

              +
              + +
              Parameters
              +
              +
              + $key + : string|array<string|int, string>|callable +
              +
              +

              Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

              +
              + +
              +
              + $value + : mixed + = null
              +
              +
              + +
              +
              + $op + : mixed + = "="
              +
              +
              + +
              +
              + $bind + : mixed + = true
              +
              +
              + +
              +
              + + + +
              Return values
              + mixed + — + + +
              +
              +

              + order() + +

              + + +

              Order by

              + + + public + order(mixed $order) : self + +

              @param string|string[] $order Columns and direction to order by - can +be specified as individual names, an array of names, a string of comma +separated names or any combination of those.

              +
              + +
              Parameters
              +
              +
              + $order + : mixed +
              +
              +
              + +
              +
              + + + +
              Return values
              + self + — + + +
              +
              +

              + pkey() + +

              + + +

              Get / set the primary key column name(s) so they can be easily returned +after an insert.

              + + + public + pkey([array<string|int, string> $pkey = null ]) : Query|array<string|int, string> + + +
              Parameters
              +
              +
              + $pkey + : array<string|int, string> + = null
              +
              +

              Primary keys

              +
              + +
              +
              + + + +
              Return values
              + Query|array<string|int, string> + — + + +
              +
              +

              + rollback() + +

              + + +

              Rollback the database state to the start of the transaction.

              + + + public + static rollback(mixed $conn) : mixed + +

              @param \PDO $dbh The Database handle (typically a PDO object, but not always).

              +
              + +
              Parameters
              +
              +
              + $conn + : mixed +
              +
              +
              + +
              +
              + + + +
              Return values
              + mixed + — + + +
              +
              +

              + set() + +

              + + +

              Set fields to a given value.

              + + + public + set(string|array<string|int, string> $set[, mixed $val = null ][, mixed $bind = true ]) : mixed + +

              Can be used in two different ways, as set( field, value ) or as an array of +fields to set: set( array( 'fieldName' => 'value', ...) );

              +
              + +
              Parameters
              +
              +
              + $set + : string|array<string|int, string> +
              +
              +

              Can be given as a single string, when then $val +must be set, or as an array of key/value pairs to be set. +@param string $val When $set is given as a simple string, $set is the field +name and this is the field's value. +@param boolean $bind Should the value be bound or not +@return self

              +
              + +
              +
              + $val + : mixed + = null
              +
              +
              + +
              +
              + $bind + : mixed + = true
              +
              +
              + +
              +
              + + + +
              Return values
              + mixed + — + + +
              +
              +

              + table() + +

              + + +

              Set table(s) to perform the query on.

              + + + public + table(mixed $table) : self + +

              @param string|string[] $table,... Table(s) to use - can be specified as +individual names, an array of names, a string of comma separated +names or any combination of those.

              +
              + +
              Parameters
              +
              +
              + $table + : mixed +
              +
              +
              + +
              +
              + + + +
              Return values
              + self + — + + +
              +
              +

              + transaction() + +

              + + +

              Start a database transaction

              + + + public + static transaction(mixed $conn) : mixed + +

              @param \PDO $dbh The Database handle (typically a PDO object, but not always).

              +
              + +
              Parameters
              +
              +
              + $conn + : mixed +
              +
              +
              + +
              +
              + + + +
              Return values
              + mixed + — + + +
              +
              +

              + where() + +

              + + +

              Where query - multiple conditions are bound as ANDs.

              + + + public + where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

              Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

              +
              + +
              Parameters
              +
              +
              + $key + : string|array<string|int, string>|callable +
              +
              +

              Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

              +

              @example +The following will produce +'WHERE name='allan' AND ( location='Scotland' OR location='Canada' ):

              +
                $query
              +    ->where( 'name', 'allan' )
              +    ->where( function ($q) {
              +      $q->where( 'location', 'Scotland' );
              +      $q->or_where( 'location', 'Canada' );
              +    } );
              +
              +
              + +
              +
              + $value + : mixed + = null
              +
              +
              + +
              +
              + $op + : mixed + = "="
              +
              +
              + +
              +
              + $bind + : mixed + = true
              +
              +
              + +
              +
              + + + +
              Return values
              + mixed + — + + +
              +
              +

              + where_group() + +

              + + +

              Provide grouping for WHERE conditions. Use it with a callback function to +automatically group any conditions applied inside the method.

              + + + public + where_group(bool|callable $inOut[, mixed $op = 'AND' ]) : mixed + +

              For legacy reasons this method also provides the ability to explicitly +define if a grouping bracket should be opened or closed in the query. +This method is not prefer.

              +
              + +
              Parameters
              +
              +
              + $inOut + : bool|callable +
              +
              +

              If callable it will create the group +automatically and pass the query into the called function. For +legacy operations use true to open brackets, false to close. +@param string $op Conditional operator to use to join to the +preceding condition. Default AND. +@return self

              +

              @example

              +
              $query->where_group( function ($q) {
              +  $q->where( 'location', 'Edinburgh' );
              +  $q->where( 'position', 'Manager' );
              +} );
              +
              +
              + +
              +
              + $op + : mixed + = 'AND'
              +
              +
              + +
              +
              + + + +
              Return values
              + mixed + — + + +
              +
              +

              + where_in() + +

              + + +

              Provide a method that can be used to perform a `WHERE ... IN (...)` query +with bound values and parameters.

              + + + public + where_in(mixed $field, mixed $arr[, mixed $operator = "AND" ]) : mixed + +

              Note this is only suitable for local values, not a sub-query. For that use +->where() with an unbound value.

              +
              + +
              Parameters
              +
              +
              + $field + : mixed +
              +
              +
              + +
              +
              + $arr + : mixed +
              +
              +
              + +
              +
              + $operator + : mixed + = "AND"
              +
              +
              + +
              +
              + + + +
              Return values
              + mixed + — + + +
              +
              +

              + _build_limit() + +

              + + +

              Create the LIMIT / OFFSET string

              + + + protected + _build_limit() : string + +

              MySQL and Postgres style - anything else can have the driver override

              +
              + + + + +
              Return values
              + string + — +

              @internal

              +
              + + +
              +
              +

              + _build_table() + +

              + + + + + protected + _build_table() : mixed + +
              + + + + +
              Return values
              + mixed + — + + +
              +
              +

              + _escape_field() + +

              + + +

              Escape quotes in a field identifier

              + + + protected + _escape_field(mixed $field) : mixed + +

              @internal

              +
              + +
              Parameters
              +
              +
              + $field + : mixed +
              +
              +
              + +
              +
              + + + +
              Return values
              + mixed + — + + +
              +
              +

              + _exec() + +

              + + + + + protected + _exec() : mixed + +
              + + + + +
              Return values
              + mixed + — + + +
              +
              +

              + _prepare() + +

              + + +

              Prepare the SQL query by populating the bound variables.

              + + + protected + _prepare(mixed $sql) : void + +

              Provided by the driver

              +
              + +
              Parameters
              +
              +
              + $sql + : mixed +
              +
              +
              + +
              +
              + + + +
              Return values
              + void + — +

              @internal

              +
              + + +
              +
              + +
              +
              +
              +
              +
              
              +        
              + +
              +
              + + + +
              +
              +
              +
              +

              Search results

              + +
              +
              +
                +
                +
                +
                +
                +
                + + +
                + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-OracleResult.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-OracleResult.html new file mode 100644 index 00000000..7085fb2a --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-OracleResult.html @@ -0,0 +1,523 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                +

                Editor PHP 2.1.3

                + + + + + +
                + +
                +
                + + + + +
                + + +
                +

                + OracleResult + + + extends Result + + +
                + in package + +
                + + +

                + + + +

                MySQL driver for DataTables Database Result class

                + +

                @internal

                +
                + + + + + + + + +

                + Table of Contents + +

                + +
                +
                + __construct() + +  : mixed +
                +
                + +
                + count() + +  : mixed +
                +
                Count the number of rows in the result set.
                + +
                + fetch() + +  : array<string|int, mixed> +
                +
                Get the next row in a result set
                + +
                + fetchAll() + +  : array<string|int, mixed> +
                +
                Get all rows in the result set
                + +
                + insertId() + +  : mixed +
                +
                After an INSERT query, get the ID that was inserted.
                + +
                + + + + + + + +
                +

                + Methods + +

                +
                +

                + __construct() + +

                + + + + + public + __construct(mixed $dbh, mixed $stmt, mixed $pkey_val) : mixed + +
                + +
                Parameters
                +
                +
                + $dbh + : mixed +
                +
                +
                + +
                +
                + $stmt + : mixed +
                +
                +
                + +
                +
                + $pkey_val + : mixed +
                +
                +
                + +
                +
                + + + +
                Return values
                + mixed + — + + +
                +
                +

                + count() + +

                + + +

                Count the number of rows in the result set.

                + + + public + count() : mixed + +

                @return int

                +
                + + + + +
                Return values
                + mixed + — + + +
                +
                +

                + fetch() + +

                + + +

                Get the next row in a result set

                + + + public + fetch([mixed $fetchType = PDO::FETCH_ASSOC ]) : array<string|int, mixed> + +

                @param int PDO row fetch style - PDO::FETCH_ASSOC is the default

                +
                + +
                Parameters
                +
                +
                + $fetchType + : mixed + = PDO::FETCH_ASSOC
                +
                +
                + +
                +
                + + + +
                Return values
                + array<string|int, mixed> + — + + +
                +
                +

                + fetchAll() + +

                + + +

                Get all rows in the result set

                + + + public + fetchAll([mixed $fetchType = PDO::FETCH_ASSOC ]) : array<string|int, mixed> + +

                @param int PDO row fetch style - PDO::FETCH_ASSOC is the default

                +
                + +
                Parameters
                +
                +
                + $fetchType + : mixed + = PDO::FETCH_ASSOC
                +
                +
                + +
                +
                + + + +
                Return values
                + array<string|int, mixed> + — + + +
                +
                +

                + insertId() + +

                + + +

                After an INSERT query, get the ID that was inserted.

                + + + public + insertId() : mixed + +

                @return int

                +
                + + + + +
                Return values
                + mixed + — + + +
                +
                + +
                +
                +
                +
                +
                
                +        
                + +
                +
                + + + +
                +
                +
                +
                +

                Search results

                + +
                +
                +
                  +
                  +
                  +
                  +
                  +
                  + + +
                  + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-PostgresQuery.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-PostgresQuery.html new file mode 100644 index 00000000..23206d08 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-PostgresQuery.html @@ -0,0 +1,2269 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                  +

                  Editor PHP 2.1.3

                  + + + + + +
                  + +
                  +
                  + + + + +
                  + + +
                  +

                  + PostgresQuery + + + extends Query + + +
                  + in package + +
                  + + +

                  + + + +

                  Postgres driver for DataTables Database Query class

                  + +

                  @internal

                  +
                  + + + + + + + + +

                  + Table of Contents + +

                  + +
                  +
                  + $_field_quote + +  : mixed +
                  +
                  + +
                  + $_identifier_limiter + +  : mixed +
                  +
                  + +
                  + $_supportsAsAlias + +  : mixed +
                  +
                  + +
                  + $_whereInCnt + +  : mixed +
                  +
                  + +
                  + __construct() + +  : mixed +
                  +
                  Query instance constructor.
                  + +
                  + and_where() + +  : mixed +
                  +
                  Add addition where conditions to the query with an AND operator. An alias +of `where` for naming consistency.
                  + +
                  + bind() + +  : Query +
                  +
                  Safely bind an input value to a parameter. This is evaluated when the +query is executed. This allows user input to be safely executed without +risk of an SQL injection attack.
                  + +
                  + commit() + +  : mixed +
                  +
                  Commit a transaction.
                  + +
                  + connect() + +  : mixed +
                  +
                  Database connection - override by the database driver.
                  + +
                  + database() + +  : DataTable +
                  +
                  Get the Database host for this query instance
                  + +
                  + distinct() + +  : Query +
                  +
                  Set a distinct flag for a `select` query. Note that this has no effect on +any of the other query types.
                  + +
                  + dsnPostfix() + +  : Query +
                  +
                  Common helper for the drivers to handle a PDO DSN postfix
                  + +
                  + exec() + +  : Result +
                  +
                  Execute the query.
                  + +
                  + get() + +  : self +
                  +
                  Get fields.
                  + +
                  + group_by() + +  : self +
                  +
                  Group the results by the values in a field
                  + +
                  + join() + +  : mixed +
                  +
                  Perform a JOIN operation
                  + +
                  + left_join() + +  : mixed +
                  +
                  Add a left join, with common logic for handling binding or not
                  + +
                  + limit() + +  : self +
                  +
                  Limit the result set to a certain size.
                  + +
                  + offset() + +  : self +
                  +
                  Offset the return set by a given number of records (useful for paging).
                  + +
                  + or_where() + +  : mixed +
                  +
                  Add addition where conditions to the query with an OR operator.
                  + +
                  + order() + +  : self +
                  +
                  Order by
                  + +
                  + pkey() + +  : Query|array<string|int, string> +
                  +
                  Get / set the primary key column name(s) so they can be easily returned +after an insert.
                  + +
                  + rollback() + +  : mixed +
                  +
                  Rollback the database state to the start of the transaction.
                  + +
                  + set() + +  : mixed +
                  +
                  Set fields to a given value.
                  + +
                  + table() + +  : self +
                  +
                  Set table(s) to perform the query on.
                  + +
                  + transaction() + +  : mixed +
                  +
                  Start a database transaction
                  + +
                  + where() + +  : mixed +
                  +
                  Where query - multiple conditions are bound as ANDs.
                  + +
                  + where_group() + +  : mixed +
                  +
                  Provide grouping for WHERE conditions. Use it with a callback function to +automatically group any conditions applied inside the method.
                  + +
                  + where_in() + +  : mixed +
                  +
                  Provide a method that can be used to perform a `WHERE ... IN (...)` query +with bound values and parameters.
                  + +
                  + _build_limit() + +  : string +
                  +
                  Create the LIMIT / OFFSET string
                  + +
                  + _escape_field() + +  : mixed +
                  +
                  Escape quotes in a field identifier
                  + +
                  + _exec() + +  : mixed +
                  +
                  + +
                  + _prepare() + +  : void +
                  +
                  Prepare the SQL query by populating the bound variables.
                  + +
                  + + + + + + +
                  +

                  + Properties + +

                  +
                  +

                  + $_field_quote + + + +

                  + + + + + protected + mixed + $_field_quote + = '"' + +
                  + +
                  + + + +
                  +
                  +

                  + $_identifier_limiter + + + +

                  + + + + + protected + mixed + $_identifier_limiter + = array('"', '"') + +
                  + +
                  + + + +
                  +
                  +

                  + $_supportsAsAlias + + + +

                  + + + + + protected + mixed + $_supportsAsAlias + = true + +
                  + +
                  + + + +
                  +
                  +

                  + $_whereInCnt + + + +

                  + + + + + protected + mixed + $_whereInCnt + = 1 + +
                  + +
                  + + + +
                  +
                  + +
                  +

                  + Methods + +

                  +
                  +

                  + __construct() + +

                  + + +

                  Query instance constructor.

                  + + + public + __construct(mixed $dbHost, mixed $type[, mixed $table = null ]) : mixed + +

                  Note that typically instances of this class will be automatically created +through the \DataTables\Database->query() method.

                  +
                  + +
                  Parameters
                  +
                  +
                  + $dbHost + : mixed +
                  +
                  +
                  + +
                  +
                  + $type + : mixed +
                  +
                  +
                  + +
                  +
                  + $table + : mixed + = null
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + mixed + — + + +
                  +
                  +

                  + and_where() + +

                  + + +

                  Add addition where conditions to the query with an AND operator. An alias +of `where` for naming consistency.

                  + + + public + and_where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

                  Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

                  +
                  + +
                  Parameters
                  +
                  +
                  + $key + : string|array<string|int, string>|callable +
                  +
                  +

                  Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

                  +
                  + +
                  +
                  + $value + : mixed + = null
                  +
                  +
                  + +
                  +
                  + $op + : mixed + = "="
                  +
                  +
                  + +
                  +
                  + $bind + : mixed + = true
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + mixed + — + + +
                  +
                  +

                  + bind() + +

                  + + +

                  Safely bind an input value to a parameter. This is evaluated when the +query is executed. This allows user input to be safely executed without +risk of an SQL injection attack.

                  + + + public + bind(string $name, string $value[, mixed $type = null ]) : Query + + +
                  Parameters
                  +
                  +
                  + $name + : string +
                  +
                  +

                  Parameter name. This should include a leading colon

                  +
                  + +
                  +
                  + $value + : string +
                  +
                  +

                  Value to bind

                  +
                  + +
                  +
                  + $type + : mixed + = null
                  +
                  +

                  Data type. See the PHP PDO documentation: +http://php.net/manual/en/pdo.constants.php

                  +
                  + +
                  +
                  + + + +
                  Return values
                  + Query + — + + +
                  +
                  +

                  + commit() + +

                  + + +

                  Commit a transaction.

                  + + + public + static commit(mixed $dbh) : mixed + +

                  @param \PDO $dbh The Database handle (typically a PDO object, but not always).

                  +
                  + +
                  Parameters
                  +
                  +
                  + $dbh + : mixed +
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + mixed + — + + +
                  +
                  +

                  + connect() + +

                  + + +

                  Database connection - override by the database driver.

                  + + + public + static connect(mixed $user[, mixed $pass = '' ][, mixed $host = '' ][, mixed $port = '' ][, mixed $db = '' ][, mixed $dsn = '' ]) : mixed + +

                  @param string|array $user User name or all parameters in an array

                  +
                  + +
                  Parameters
                  +
                  +
                  + $user + : mixed +
                  +
                  +
                  + +
                  +
                  + $pass + : mixed + = ''
                  +
                  +

                  Password +@param string $host Host name +@param string $db Database name +@return Query

                  +
                  + +
                  +
                  + $host + : mixed + = ''
                  +
                  +
                  + +
                  +
                  + $port + : mixed + = ''
                  +
                  +
                  + +
                  +
                  + $db + : mixed + = ''
                  +
                  +
                  + +
                  +
                  + $dsn + : mixed + = ''
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + mixed + — + + +
                  +
                  +

                  + database() + +

                  + + +

                  Get the Database host for this query instance

                  + + + public + database() : DataTable + + + + + +
                  Return values
                  + DataTable + — +

                  Database class instance

                  +
                  + + +
                  +
                  +

                  + distinct() + +

                  + + +

                  Set a distinct flag for a `select` query. Note that this has no effect on +any of the other query types.

                  + + + public + distinct(mixed $dis) : Query + +

                  @param boolean $dis Optional

                  +
                  + +
                  Parameters
                  +
                  +
                  + $dis + : mixed +
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + Query + — + + +
                  +
                  +

                  + dsnPostfix() + +

                  + + +

                  Common helper for the drivers to handle a PDO DSN postfix

                  + + + public + static dsnPostfix(mixed $dsn) : Query + +

                  @param string $dsn DSN postfix to use

                  +
                  + +
                  Parameters
                  +
                  +
                  + $dsn + : mixed +
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + Query + — +

                  @internal

                  +
                  + + +
                  +
                  +

                  + exec() + +

                  + + +

                  Execute the query.

                  + + + public + exec([mixed $sql = null ]) : Result + +

                  @param string $sql SQL string to execute (only if _type is 'raw').

                  +
                  + +
                  Parameters
                  +
                  +
                  + $sql + : mixed + = null
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + Result + — + + +
                  +
                  +

                  + get() + +

                  + + +

                  Get fields.

                  + + + public + get(mixed $get) : self + +

                  @param string|string[] $get,... Fields to get - can be specified as +individual fields or an array of fields.

                  +
                  + +
                  Parameters
                  +
                  +
                  + $get + : mixed +
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + self + — + + +
                  +
                  +

                  + group_by() + +

                  + + +

                  Group the results by the values in a field

                  + + + public + group_by(mixed $group_by) : self + + +
                  Parameters
                  +
                  +
                  + $group_by + : mixed +
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + self + — + + +
                  +
                  +

                  + join() + +

                  + + +

                  Perform a JOIN operation

                  + + + public + join(mixed $table, string $condition[, mixed $type = '' ][, mixed $bind = true ]) : mixed + +

                  @param string $table Table name to do the JOIN on

                  +
                  + +
                  Parameters
                  +
                  +
                  + $table + : mixed +
                  +
                  +
                  + +
                  +
                  + $condition + : string +
                  +
                  +

                  JOIN condition +@param string $type JOIN type +@return self

                  +
                  + +
                  +
                  + $type + : mixed + = ''
                  +
                  +
                  + +
                  +
                  + $bind + : mixed + = true
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + mixed + — + + +
                  +
                  +

                  + left_join() + +

                  + + +

                  Add a left join, with common logic for handling binding or not

                  + + + public + left_join(mixed $joins) : mixed + + +
                  Parameters
                  +
                  +
                  + $joins + : mixed +
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + mixed + — + + +
                  +
                  +

                  + limit() + +

                  + + +

                  Limit the result set to a certain size.

                  + + + public + limit(mixed $lim) : self + +

                  @param int $lim The number of records to limit the result to.

                  +
                  + +
                  Parameters
                  +
                  +
                  + $lim + : mixed +
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + self + — + + +
                  +
                  +

                  + offset() + +

                  + + +

                  Offset the return set by a given number of records (useful for paging).

                  + + + public + offset(mixed $off) : self + +

                  @param int $off The number of records to offset the result by.

                  +
                  + +
                  Parameters
                  +
                  +
                  + $off + : mixed +
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + self + — + + +
                  +
                  +

                  + or_where() + +

                  + + +

                  Add addition where conditions to the query with an OR operator.

                  + + + public + or_where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

                  Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

                  +
                  + +
                  Parameters
                  +
                  +
                  + $key + : string|array<string|int, string>|callable +
                  +
                  +

                  Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

                  +
                  + +
                  +
                  + $value + : mixed + = null
                  +
                  +
                  + +
                  +
                  + $op + : mixed + = "="
                  +
                  +
                  + +
                  +
                  + $bind + : mixed + = true
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + mixed + — + + +
                  +
                  +

                  + order() + +

                  + + +

                  Order by

                  + + + public + order(mixed $order) : self + +

                  @param string|string[] $order Columns and direction to order by - can +be specified as individual names, an array of names, a string of comma +separated names or any combination of those.

                  +
                  + +
                  Parameters
                  +
                  +
                  + $order + : mixed +
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + self + — + + +
                  +
                  +

                  + pkey() + +

                  + + +

                  Get / set the primary key column name(s) so they can be easily returned +after an insert.

                  + + + public + pkey([array<string|int, string> $pkey = null ]) : Query|array<string|int, string> + + +
                  Parameters
                  +
                  +
                  + $pkey + : array<string|int, string> + = null
                  +
                  +

                  Primary keys

                  +
                  + +
                  +
                  + + + +
                  Return values
                  + Query|array<string|int, string> + — + + +
                  +
                  +

                  + rollback() + +

                  + + +

                  Rollback the database state to the start of the transaction.

                  + + + public + static rollback(mixed $dbh) : mixed + +

                  @param \PDO $dbh The Database handle (typically a PDO object, but not always).

                  +
                  + +
                  Parameters
                  +
                  +
                  + $dbh + : mixed +
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + mixed + — + + +
                  +
                  +

                  + set() + +

                  + + +

                  Set fields to a given value.

                  + + + public + set(string|array<string|int, string> $set[, mixed $val = null ][, mixed $bind = true ]) : mixed + +

                  Can be used in two different ways, as set( field, value ) or as an array of +fields to set: set( array( 'fieldName' => 'value', ...) );

                  +
                  + +
                  Parameters
                  +
                  +
                  + $set + : string|array<string|int, string> +
                  +
                  +

                  Can be given as a single string, when then $val +must be set, or as an array of key/value pairs to be set. +@param string $val When $set is given as a simple string, $set is the field +name and this is the field's value. +@param boolean $bind Should the value be bound or not +@return self

                  +
                  + +
                  +
                  + $val + : mixed + = null
                  +
                  +
                  + +
                  +
                  + $bind + : mixed + = true
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + mixed + — + + +
                  +
                  +

                  + table() + +

                  + + +

                  Set table(s) to perform the query on.

                  + + + public + table(mixed $table) : self + +

                  @param string|string[] $table,... Table(s) to use - can be specified as +individual names, an array of names, a string of comma separated +names or any combination of those.

                  +
                  + +
                  Parameters
                  +
                  +
                  + $table + : mixed +
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + self + — + + +
                  +
                  +

                  + transaction() + +

                  + + +

                  Start a database transaction

                  + + + public + static transaction(mixed $dbh) : mixed + +

                  @param \PDO $dbh The Database handle (typically a PDO object, but not always).

                  +
                  + +
                  Parameters
                  +
                  +
                  + $dbh + : mixed +
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + mixed + — + + +
                  +
                  +

                  + where() + +

                  + + +

                  Where query - multiple conditions are bound as ANDs.

                  + + + public + where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

                  Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

                  +
                  + +
                  Parameters
                  +
                  +
                  + $key + : string|array<string|int, string>|callable +
                  +
                  +

                  Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

                  +

                  @example +The following will produce +'WHERE name='allan' AND ( location='Scotland' OR location='Canada' ):

                  +
                    $query
                  +    ->where( 'name', 'allan' )
                  +    ->where( function ($q) {
                  +      $q->where( 'location', 'Scotland' );
                  +      $q->or_where( 'location', 'Canada' );
                  +    } );
                  +
                  +
                  + +
                  +
                  + $value + : mixed + = null
                  +
                  +
                  + +
                  +
                  + $op + : mixed + = "="
                  +
                  +
                  + +
                  +
                  + $bind + : mixed + = true
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + mixed + — + + +
                  +
                  +

                  + where_group() + +

                  + + +

                  Provide grouping for WHERE conditions. Use it with a callback function to +automatically group any conditions applied inside the method.

                  + + + public + where_group(bool|callable $inOut[, mixed $op = 'AND' ]) : mixed + +

                  For legacy reasons this method also provides the ability to explicitly +define if a grouping bracket should be opened or closed in the query. +This method is not prefer.

                  +
                  + +
                  Parameters
                  +
                  +
                  + $inOut + : bool|callable +
                  +
                  +

                  If callable it will create the group +automatically and pass the query into the called function. For +legacy operations use true to open brackets, false to close. +@param string $op Conditional operator to use to join to the +preceding condition. Default AND. +@return self

                  +

                  @example

                  +
                  $query->where_group( function ($q) {
                  +  $q->where( 'location', 'Edinburgh' );
                  +  $q->where( 'position', 'Manager' );
                  +} );
                  +
                  +
                  + +
                  +
                  + $op + : mixed + = 'AND'
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + mixed + — + + +
                  +
                  +

                  + where_in() + +

                  + + +

                  Provide a method that can be used to perform a `WHERE ... IN (...)` query +with bound values and parameters.

                  + + + public + where_in(mixed $field, mixed $arr[, mixed $operator = "AND" ]) : mixed + +

                  Note this is only suitable for local values, not a sub-query. For that use +->where() with an unbound value.

                  +
                  + +
                  Parameters
                  +
                  +
                  + $field + : mixed +
                  +
                  +
                  + +
                  +
                  + $arr + : mixed +
                  +
                  +
                  + +
                  +
                  + $operator + : mixed + = "AND"
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + mixed + — + + +
                  +
                  +

                  + _build_limit() + +

                  + + +

                  Create the LIMIT / OFFSET string

                  + + + protected + _build_limit() : string + +

                  MySQL and Postgres style - anything else can have the driver override

                  +
                  + + + + +
                  Return values
                  + string + — +

                  @internal

                  +
                  + + +
                  +
                  +

                  + _escape_field() + +

                  + + +

                  Escape quotes in a field identifier

                  + + + protected + _escape_field(mixed $field) : mixed + +

                  @internal

                  +
                  + +
                  Parameters
                  +
                  +
                  + $field + : mixed +
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + mixed + — + + +
                  +
                  +

                  + _exec() + +

                  + + + + + protected + _exec() : mixed + +
                  + + + + +
                  Return values
                  + mixed + — + + +
                  +
                  +

                  + _prepare() + +

                  + + +

                  Prepare the SQL query by populating the bound variables.

                  + + + protected + _prepare(mixed $sql) : void + +

                  Provided by the driver

                  +
                  + +
                  Parameters
                  +
                  +
                  + $sql + : mixed +
                  +
                  +
                  + +
                  +
                  + + + +
                  Return values
                  + void + — +

                  @internal

                  +
                  + + +
                  +
                  + +
                  +
                  +
                  +
                  +
                  
                  +        
                  + +
                  +
                  + + + +
                  +
                  +
                  +
                  +

                  Search results

                  + +
                  +
                  +
                    +
                    +
                    +
                    +
                    +
                    + + +
                    + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-PostgresResult.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-PostgresResult.html new file mode 100644 index 00000000..c29d8b11 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-PostgresResult.html @@ -0,0 +1,515 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                    +

                    Editor PHP 2.1.3

                    + + + + + +
                    + +
                    +
                    + + + + +
                    + + +
                    +

                    + PostgresResult + + + extends Result + + +
                    + in package + +
                    + + +

                    + + + +

                    Postgres driver for DataTables Database Result class

                    + +

                    @internal

                    +
                    + + + + + + + + +

                    + Table of Contents + +

                    + +
                    +
                    + __construct() + +  : mixed +
                    +
                    + +
                    + count() + +  : mixed +
                    +
                    Count the number of rows in the result set.
                    + +
                    + fetch() + +  : array<string|int, mixed> +
                    +
                    Get the next row in a result set
                    + +
                    + fetchAll() + +  : array<string|int, mixed> +
                    +
                    Get all rows in the result set
                    + +
                    + insertId() + +  : mixed +
                    +
                    After an INSERT query, get the ID that was inserted.
                    + +
                    + + + + + + + +
                    +

                    + Methods + +

                    +
                    +

                    + __construct() + +

                    + + + + + public + __construct(mixed $dbh, mixed $stmt) : mixed + +
                    + +
                    Parameters
                    +
                    +
                    + $dbh + : mixed +
                    +
                    +
                    + +
                    +
                    + $stmt + : mixed +
                    +
                    +
                    + +
                    +
                    + + + +
                    Return values
                    + mixed + — + + +
                    +
                    +

                    + count() + +

                    + + +

                    Count the number of rows in the result set.

                    + + + public + count() : mixed + +

                    @return int

                    +
                    + + + + +
                    Return values
                    + mixed + — + + +
                    +
                    +

                    + fetch() + +

                    + + +

                    Get the next row in a result set

                    + + + public + fetch([mixed $fetchType = PDO::FETCH_ASSOC ]) : array<string|int, mixed> + +

                    @param int PDO row fetch style - PDO::FETCH_ASSOC is the default

                    +
                    + +
                    Parameters
                    +
                    +
                    + $fetchType + : mixed + = PDO::FETCH_ASSOC
                    +
                    +
                    + +
                    +
                    + + + +
                    Return values
                    + array<string|int, mixed> + — + + +
                    +
                    +

                    + fetchAll() + +

                    + + +

                    Get all rows in the result set

                    + + + public + fetchAll([mixed $fetchType = PDO::FETCH_ASSOC ]) : array<string|int, mixed> + +

                    @param int PDO row fetch style - PDO::FETCH_ASSOC is the default

                    +
                    + +
                    Parameters
                    +
                    +
                    + $fetchType + : mixed + = PDO::FETCH_ASSOC
                    +
                    +
                    + +
                    +
                    + + + +
                    Return values
                    + array<string|int, mixed> + — + + +
                    +
                    +

                    + insertId() + +

                    + + +

                    After an INSERT query, get the ID that was inserted.

                    + + + public + insertId() : mixed + +

                    @return int

                    +
                    + + + + +
                    Return values
                    + mixed + — + + +
                    +
                    + +
                    +
                    +
                    +
                    +
                    
                    +        
                    + +
                    +
                    + + + +
                    +
                    +
                    +
                    +

                    Search results

                    + +
                    +
                    +
                      +
                      +
                      +
                      +
                      +
                      + + +
                      + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-SqliteQuery.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-SqliteQuery.html new file mode 100644 index 00000000..d75cd6d4 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-SqliteQuery.html @@ -0,0 +1,2227 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                      +

                      Editor PHP 2.1.3

                      + + + + + +
                      + +
                      +
                      + + + + +
                      + + +
                      +

                      + SqliteQuery + + + extends Query + + +
                      + in package + +
                      + + +

                      + + + +

                      SQLite3 driver for DataTables Database Query class

                      + +

                      @internal

                      +
                      + + + + + + + + +

                      + Table of Contents + +

                      + +
                      +
                      + $_identifier_limiter + +  : mixed +
                      +
                      + +
                      + $_supportsAsAlias + +  : mixed +
                      +
                      + +
                      + $_whereInCnt + +  : mixed +
                      +
                      + +
                      + __construct() + +  : mixed +
                      +
                      Query instance constructor.
                      + +
                      + and_where() + +  : mixed +
                      +
                      Add addition where conditions to the query with an AND operator. An alias +of `where` for naming consistency.
                      + +
                      + bind() + +  : Query +
                      +
                      Safely bind an input value to a parameter. This is evaluated when the +query is executed. This allows user input to be safely executed without +risk of an SQL injection attack.
                      + +
                      + commit() + +  : mixed +
                      +
                      Commit a transaction.
                      + +
                      + connect() + +  : mixed +
                      +
                      Database connection - override by the database driver.
                      + +
                      + database() + +  : DataTable +
                      +
                      Get the Database host for this query instance
                      + +
                      + distinct() + +  : Query +
                      +
                      Set a distinct flag for a `select` query. Note that this has no effect on +any of the other query types.
                      + +
                      + dsnPostfix() + +  : Query +
                      +
                      Common helper for the drivers to handle a PDO DSN postfix
                      + +
                      + exec() + +  : Result +
                      +
                      Execute the query.
                      + +
                      + get() + +  : self +
                      +
                      Get fields.
                      + +
                      + group_by() + +  : self +
                      +
                      Group the results by the values in a field
                      + +
                      + join() + +  : mixed +
                      +
                      Perform a JOIN operation
                      + +
                      + left_join() + +  : mixed +
                      +
                      Add a left join, with common logic for handling binding or not
                      + +
                      + limit() + +  : self +
                      +
                      Limit the result set to a certain size.
                      + +
                      + offset() + +  : self +
                      +
                      Offset the return set by a given number of records (useful for paging).
                      + +
                      + or_where() + +  : mixed +
                      +
                      Add addition where conditions to the query with an OR operator.
                      + +
                      + order() + +  : self +
                      +
                      Order by
                      + +
                      + pkey() + +  : Query|array<string|int, string> +
                      +
                      Get / set the primary key column name(s) so they can be easily returned +after an insert.
                      + +
                      + rollback() + +  : mixed +
                      +
                      Rollback the database state to the start of the transaction.
                      + +
                      + set() + +  : mixed +
                      +
                      Set fields to a given value.
                      + +
                      + table() + +  : self +
                      +
                      Set table(s) to perform the query on.
                      + +
                      + transaction() + +  : mixed +
                      +
                      Start a database transaction
                      + +
                      + where() + +  : mixed +
                      +
                      Where query - multiple conditions are bound as ANDs.
                      + +
                      + where_group() + +  : mixed +
                      +
                      Provide grouping for WHERE conditions. Use it with a callback function to +automatically group any conditions applied inside the method.
                      + +
                      + where_in() + +  : mixed +
                      +
                      Provide a method that can be used to perform a `WHERE ... IN (...)` query +with bound values and parameters.
                      + +
                      + _build_limit() + +  : string +
                      +
                      Create the LIMIT / OFFSET string
                      + +
                      + _escape_field() + +  : mixed +
                      +
                      Escape quotes in a field identifier
                      + +
                      + _exec() + +  : mixed +
                      +
                      + +
                      + _prepare() + +  : void +
                      +
                      Prepare the SQL query by populating the bound variables.
                      + +
                      + + + + + + +
                      +

                      + Properties + +

                      +
                      +

                      + $_identifier_limiter + + + +

                      + + + + + protected + mixed + $_identifier_limiter + = null + +
                      + +
                      + + + +
                      +
                      +

                      + $_supportsAsAlias + + + +

                      + + + + + protected + mixed + $_supportsAsAlias + = true + +
                      + +
                      + + + +
                      +
                      +

                      + $_whereInCnt + + + +

                      + + + + + protected + mixed + $_whereInCnt + = 1 + +
                      + +
                      + + + +
                      +
                      + +
                      +

                      + Methods + +

                      +
                      +

                      + __construct() + +

                      + + +

                      Query instance constructor.

                      + + + public + __construct(mixed $dbHost, mixed $type[, mixed $table = null ]) : mixed + +

                      Note that typically instances of this class will be automatically created +through the \DataTables\Database->query() method.

                      +
                      + +
                      Parameters
                      +
                      +
                      + $dbHost + : mixed +
                      +
                      +
                      + +
                      +
                      + $type + : mixed +
                      +
                      +
                      + +
                      +
                      + $table + : mixed + = null
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + mixed + — + + +
                      +
                      +

                      + and_where() + +

                      + + +

                      Add addition where conditions to the query with an AND operator. An alias +of `where` for naming consistency.

                      + + + public + and_where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

                      Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

                      +
                      + +
                      Parameters
                      +
                      +
                      + $key + : string|array<string|int, string>|callable +
                      +
                      +

                      Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

                      +
                      + +
                      +
                      + $value + : mixed + = null
                      +
                      +
                      + +
                      +
                      + $op + : mixed + = "="
                      +
                      +
                      + +
                      +
                      + $bind + : mixed + = true
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + mixed + — + + +
                      +
                      +

                      + bind() + +

                      + + +

                      Safely bind an input value to a parameter. This is evaluated when the +query is executed. This allows user input to be safely executed without +risk of an SQL injection attack.

                      + + + public + bind(string $name, string $value[, mixed $type = null ]) : Query + + +
                      Parameters
                      +
                      +
                      + $name + : string +
                      +
                      +

                      Parameter name. This should include a leading colon

                      +
                      + +
                      +
                      + $value + : string +
                      +
                      +

                      Value to bind

                      +
                      + +
                      +
                      + $type + : mixed + = null
                      +
                      +

                      Data type. See the PHP PDO documentation: +http://php.net/manual/en/pdo.constants.php

                      +
                      + +
                      +
                      + + + +
                      Return values
                      + Query + — + + +
                      +
                      +

                      + commit() + +

                      + + +

                      Commit a transaction.

                      + + + public + static commit(mixed $dbh) : mixed + +

                      @param \PDO $dbh The Database handle (typically a PDO object, but not always).

                      +
                      + +
                      Parameters
                      +
                      +
                      + $dbh + : mixed +
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + mixed + — + + +
                      +
                      +

                      + connect() + +

                      + + +

                      Database connection - override by the database driver.

                      + + + public + static connect(mixed $user[, mixed $pass = '' ][, mixed $host = '' ][, mixed $port = '' ][, mixed $db = '' ][, mixed $dsn = '' ]) : mixed + +

                      @param string|array $user User name or all parameters in an array

                      +
                      + +
                      Parameters
                      +
                      +
                      + $user + : mixed +
                      +
                      +
                      + +
                      +
                      + $pass + : mixed + = ''
                      +
                      +

                      Password +@param string $host Host name +@param string $db Database name +@return Query

                      +
                      + +
                      +
                      + $host + : mixed + = ''
                      +
                      +
                      + +
                      +
                      + $port + : mixed + = ''
                      +
                      +
                      + +
                      +
                      + $db + : mixed + = ''
                      +
                      +
                      + +
                      +
                      + $dsn + : mixed + = ''
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + mixed + — + + +
                      +
                      +

                      + database() + +

                      + + +

                      Get the Database host for this query instance

                      + + + public + database() : DataTable + + + + + +
                      Return values
                      + DataTable + — +

                      Database class instance

                      +
                      + + +
                      +
                      +

                      + distinct() + +

                      + + +

                      Set a distinct flag for a `select` query. Note that this has no effect on +any of the other query types.

                      + + + public + distinct(mixed $dis) : Query + +

                      @param boolean $dis Optional

                      +
                      + +
                      Parameters
                      +
                      +
                      + $dis + : mixed +
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + Query + — + + +
                      +
                      +

                      + dsnPostfix() + +

                      + + +

                      Common helper for the drivers to handle a PDO DSN postfix

                      + + + public + static dsnPostfix(mixed $dsn) : Query + +

                      @param string $dsn DSN postfix to use

                      +
                      + +
                      Parameters
                      +
                      +
                      + $dsn + : mixed +
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + Query + — +

                      @internal

                      +
                      + + +
                      +
                      +

                      + exec() + +

                      + + +

                      Execute the query.

                      + + + public + exec([mixed $sql = null ]) : Result + +

                      @param string $sql SQL string to execute (only if _type is 'raw').

                      +
                      + +
                      Parameters
                      +
                      +
                      + $sql + : mixed + = null
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + Result + — + + +
                      +
                      +

                      + get() + +

                      + + +

                      Get fields.

                      + + + public + get(mixed $get) : self + +

                      @param string|string[] $get,... Fields to get - can be specified as +individual fields or an array of fields.

                      +
                      + +
                      Parameters
                      +
                      +
                      + $get + : mixed +
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + self + — + + +
                      +
                      +

                      + group_by() + +

                      + + +

                      Group the results by the values in a field

                      + + + public + group_by(mixed $group_by) : self + + +
                      Parameters
                      +
                      +
                      + $group_by + : mixed +
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + self + — + + +
                      +
                      +

                      + join() + +

                      + + +

                      Perform a JOIN operation

                      + + + public + join(mixed $table, string $condition[, mixed $type = '' ][, mixed $bind = true ]) : mixed + +

                      @param string $table Table name to do the JOIN on

                      +
                      + +
                      Parameters
                      +
                      +
                      + $table + : mixed +
                      +
                      +
                      + +
                      +
                      + $condition + : string +
                      +
                      +

                      JOIN condition +@param string $type JOIN type +@return self

                      +
                      + +
                      +
                      + $type + : mixed + = ''
                      +
                      +
                      + +
                      +
                      + $bind + : mixed + = true
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + mixed + — + + +
                      +
                      +

                      + left_join() + +

                      + + +

                      Add a left join, with common logic for handling binding or not

                      + + + public + left_join(mixed $joins) : mixed + + +
                      Parameters
                      +
                      +
                      + $joins + : mixed +
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + mixed + — + + +
                      +
                      +

                      + limit() + +

                      + + +

                      Limit the result set to a certain size.

                      + + + public + limit(mixed $lim) : self + +

                      @param int $lim The number of records to limit the result to.

                      +
                      + +
                      Parameters
                      +
                      +
                      + $lim + : mixed +
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + self + — + + +
                      +
                      +

                      + offset() + +

                      + + +

                      Offset the return set by a given number of records (useful for paging).

                      + + + public + offset(mixed $off) : self + +

                      @param int $off The number of records to offset the result by.

                      +
                      + +
                      Parameters
                      +
                      +
                      + $off + : mixed +
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + self + — + + +
                      +
                      +

                      + or_where() + +

                      + + +

                      Add addition where conditions to the query with an OR operator.

                      + + + public + or_where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

                      Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

                      +
                      + +
                      Parameters
                      +
                      +
                      + $key + : string|array<string|int, string>|callable +
                      +
                      +

                      Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

                      +
                      + +
                      +
                      + $value + : mixed + = null
                      +
                      +
                      + +
                      +
                      + $op + : mixed + = "="
                      +
                      +
                      + +
                      +
                      + $bind + : mixed + = true
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + mixed + — + + +
                      +
                      +

                      + order() + +

                      + + +

                      Order by

                      + + + public + order(mixed $order) : self + +

                      @param string|string[] $order Columns and direction to order by - can +be specified as individual names, an array of names, a string of comma +separated names or any combination of those.

                      +
                      + +
                      Parameters
                      +
                      +
                      + $order + : mixed +
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + self + — + + +
                      +
                      +

                      + pkey() + +

                      + + +

                      Get / set the primary key column name(s) so they can be easily returned +after an insert.

                      + + + public + pkey([array<string|int, string> $pkey = null ]) : Query|array<string|int, string> + + +
                      Parameters
                      +
                      +
                      + $pkey + : array<string|int, string> + = null
                      +
                      +

                      Primary keys

                      +
                      + +
                      +
                      + + + +
                      Return values
                      + Query|array<string|int, string> + — + + +
                      +
                      +

                      + rollback() + +

                      + + +

                      Rollback the database state to the start of the transaction.

                      + + + public + static rollback(mixed $dbh) : mixed + +

                      @param \PDO $dbh The Database handle (typically a PDO object, but not always).

                      +
                      + +
                      Parameters
                      +
                      +
                      + $dbh + : mixed +
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + mixed + — + + +
                      +
                      +

                      + set() + +

                      + + +

                      Set fields to a given value.

                      + + + public + set(string|array<string|int, string> $set[, mixed $val = null ][, mixed $bind = true ]) : mixed + +

                      Can be used in two different ways, as set( field, value ) or as an array of +fields to set: set( array( 'fieldName' => 'value', ...) );

                      +
                      + +
                      Parameters
                      +
                      +
                      + $set + : string|array<string|int, string> +
                      +
                      +

                      Can be given as a single string, when then $val +must be set, or as an array of key/value pairs to be set. +@param string $val When $set is given as a simple string, $set is the field +name and this is the field's value. +@param boolean $bind Should the value be bound or not +@return self

                      +
                      + +
                      +
                      + $val + : mixed + = null
                      +
                      +
                      + +
                      +
                      + $bind + : mixed + = true
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + mixed + — + + +
                      +
                      +

                      + table() + +

                      + + +

                      Set table(s) to perform the query on.

                      + + + public + table(mixed $table) : self + +

                      @param string|string[] $table,... Table(s) to use - can be specified as +individual names, an array of names, a string of comma separated +names or any combination of those.

                      +
                      + +
                      Parameters
                      +
                      +
                      + $table + : mixed +
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + self + — + + +
                      +
                      +

                      + transaction() + +

                      + + +

                      Start a database transaction

                      + + + public + static transaction(mixed $dbh) : mixed + +

                      @param \PDO $dbh The Database handle (typically a PDO object, but not always).

                      +
                      + +
                      Parameters
                      +
                      +
                      + $dbh + : mixed +
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + mixed + — + + +
                      +
                      +

                      + where() + +

                      + + +

                      Where query - multiple conditions are bound as ANDs.

                      + + + public + where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

                      Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

                      +
                      + +
                      Parameters
                      +
                      +
                      + $key + : string|array<string|int, string>|callable +
                      +
                      +

                      Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

                      +

                      @example +The following will produce +'WHERE name='allan' AND ( location='Scotland' OR location='Canada' ):

                      +
                        $query
                      +    ->where( 'name', 'allan' )
                      +    ->where( function ($q) {
                      +      $q->where( 'location', 'Scotland' );
                      +      $q->or_where( 'location', 'Canada' );
                      +    } );
                      +
                      +
                      + +
                      +
                      + $value + : mixed + = null
                      +
                      +
                      + +
                      +
                      + $op + : mixed + = "="
                      +
                      +
                      + +
                      +
                      + $bind + : mixed + = true
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + mixed + — + + +
                      +
                      +

                      + where_group() + +

                      + + +

                      Provide grouping for WHERE conditions. Use it with a callback function to +automatically group any conditions applied inside the method.

                      + + + public + where_group(bool|callable $inOut[, mixed $op = 'AND' ]) : mixed + +

                      For legacy reasons this method also provides the ability to explicitly +define if a grouping bracket should be opened or closed in the query. +This method is not prefer.

                      +
                      + +
                      Parameters
                      +
                      +
                      + $inOut + : bool|callable +
                      +
                      +

                      If callable it will create the group +automatically and pass the query into the called function. For +legacy operations use true to open brackets, false to close. +@param string $op Conditional operator to use to join to the +preceding condition. Default AND. +@return self

                      +

                      @example

                      +
                      $query->where_group( function ($q) {
                      +  $q->where( 'location', 'Edinburgh' );
                      +  $q->where( 'position', 'Manager' );
                      +} );
                      +
                      +
                      + +
                      +
                      + $op + : mixed + = 'AND'
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + mixed + — + + +
                      +
                      +

                      + where_in() + +

                      + + +

                      Provide a method that can be used to perform a `WHERE ... IN (...)` query +with bound values and parameters.

                      + + + public + where_in(mixed $field, mixed $arr[, mixed $operator = "AND" ]) : mixed + +

                      Note this is only suitable for local values, not a sub-query. For that use +->where() with an unbound value.

                      +
                      + +
                      Parameters
                      +
                      +
                      + $field + : mixed +
                      +
                      +
                      + +
                      +
                      + $arr + : mixed +
                      +
                      +
                      + +
                      +
                      + $operator + : mixed + = "AND"
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + mixed + — + + +
                      +
                      +

                      + _build_limit() + +

                      + + +

                      Create the LIMIT / OFFSET string

                      + + + protected + _build_limit() : string + +

                      MySQL and Postgres style - anything else can have the driver override

                      +
                      + + + + +
                      Return values
                      + string + — +

                      @internal

                      +
                      + + +
                      +
                      +

                      + _escape_field() + +

                      + + +

                      Escape quotes in a field identifier

                      + + + protected + _escape_field(mixed $field) : mixed + +

                      @internal

                      +
                      + +
                      Parameters
                      +
                      +
                      + $field + : mixed +
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + mixed + — + + +
                      +
                      +

                      + _exec() + +

                      + + + + + protected + _exec() : mixed + +
                      + + + + +
                      Return values
                      + mixed + — + + +
                      +
                      +

                      + _prepare() + +

                      + + +

                      Prepare the SQL query by populating the bound variables.

                      + + + protected + _prepare(mixed $sql) : void + +

                      Provided by the driver

                      +
                      + +
                      Parameters
                      +
                      +
                      + $sql + : mixed +
                      +
                      +
                      + +
                      +
                      + + + +
                      Return values
                      + void + — +

                      @internal

                      +
                      + + +
                      +
                      + +
                      +
                      +
                      +
                      +
                      
                      +        
                      + +
                      +
                      + + + +
                      +
                      +
                      +
                      +

                      Search results

                      + +
                      +
                      +
                        +
                        +
                        +
                        +
                        +
                        + + +
                        + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-SqliteResult.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-SqliteResult.html new file mode 100644 index 00000000..1170365d --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-SqliteResult.html @@ -0,0 +1,515 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                        +

                        Editor PHP 2.1.3

                        + + + + + +
                        + +
                        +
                        + + + + +
                        + + +
                        +

                        + SqliteResult + + + extends Result + + +
                        + in package + +
                        + + +

                        + + + +

                        Sqlite driver for DataTables Database Result class

                        + +

                        @internal

                        +
                        + + + + + + + + +

                        + Table of Contents + +

                        + +
                        +
                        + __construct() + +  : mixed +
                        +
                        + +
                        + count() + +  : mixed +
                        +
                        Count the number of rows in the result set.
                        + +
                        + fetch() + +  : array<string|int, mixed> +
                        +
                        Get the next row in a result set
                        + +
                        + fetchAll() + +  : array<string|int, mixed> +
                        +
                        Get all rows in the result set
                        + +
                        + insertId() + +  : mixed +
                        +
                        After an INSERT query, get the ID that was inserted.
                        + +
                        + + + + + + + +
                        +

                        + Methods + +

                        +
                        +

                        + __construct() + +

                        + + + + + public + __construct(mixed $dbh, mixed $stmt) : mixed + +
                        + +
                        Parameters
                        +
                        +
                        + $dbh + : mixed +
                        +
                        +
                        + +
                        +
                        + $stmt + : mixed +
                        +
                        +
                        + +
                        +
                        + + + +
                        Return values
                        + mixed + — + + +
                        +
                        +

                        + count() + +

                        + + +

                        Count the number of rows in the result set.

                        + + + public + count() : mixed + +

                        @return int

                        +
                        + + + + +
                        Return values
                        + mixed + — + + +
                        +
                        +

                        + fetch() + +

                        + + +

                        Get the next row in a result set

                        + + + public + fetch([mixed $fetchType = PDO::FETCH_ASSOC ]) : array<string|int, mixed> + +

                        @param int PDO row fetch style - PDO::FETCH_ASSOC is the default

                        +
                        + +
                        Parameters
                        +
                        +
                        + $fetchType + : mixed + = PDO::FETCH_ASSOC
                        +
                        +
                        + +
                        +
                        + + + +
                        Return values
                        + array<string|int, mixed> + — + + +
                        +
                        +

                        + fetchAll() + +

                        + + +

                        Get all rows in the result set

                        + + + public + fetchAll([mixed $fetchType = PDO::FETCH_ASSOC ]) : array<string|int, mixed> + +

                        @param int PDO row fetch style - PDO::FETCH_ASSOC is the default

                        +
                        + +
                        Parameters
                        +
                        +
                        + $fetchType + : mixed + = PDO::FETCH_ASSOC
                        +
                        +
                        + +
                        +
                        + + + +
                        Return values
                        + array<string|int, mixed> + — + + +
                        +
                        +

                        + insertId() + +

                        + + +

                        After an INSERT query, get the ID that was inserted.

                        + + + public + insertId() : mixed + +

                        @return int

                        +
                        + + + + +
                        Return values
                        + mixed + — + + +
                        +
                        + +
                        +
                        +
                        +
                        +
                        
                        +        
                        + +
                        +
                        + + + +
                        +
                        +
                        +
                        +

                        Search results

                        + +
                        +
                        +
                          +
                          +
                          +
                          +
                          +
                          + + +
                          + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-SqlserverQuery.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-SqlserverQuery.html new file mode 100644 index 00000000..b61e5816 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-SqlserverQuery.html @@ -0,0 +1,2227 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                          +

                          Editor PHP 2.1.3

                          + + + + + +
                          + +
                          +
                          + + + + +
                          + + +
                          +

                          + SqlserverQuery + + + extends Query + + +
                          + in package + +
                          + + +

                          + + + +

                          SQL Server driver for DataTables Database Query class

                          + +

                          @internal

                          +
                          + + + + + + + + +

                          + Table of Contents + +

                          + +
                          +
                          + $_identifier_limiter + +  : mixed +
                          +
                          + +
                          + $_supportsAsAlias + +  : mixed +
                          +
                          + +
                          + $_whereInCnt + +  : mixed +
                          +
                          + +
                          + __construct() + +  : mixed +
                          +
                          Query instance constructor.
                          + +
                          + and_where() + +  : mixed +
                          +
                          Add addition where conditions to the query with an AND operator. An alias +of `where` for naming consistency.
                          + +
                          + bind() + +  : Query +
                          +
                          Safely bind an input value to a parameter. This is evaluated when the +query is executed. This allows user input to be safely executed without +risk of an SQL injection attack.
                          + +
                          + commit() + +  : mixed +
                          +
                          Commit a transaction.
                          + +
                          + connect() + +  : mixed +
                          +
                          Database connection - override by the database driver.
                          + +
                          + database() + +  : DataTable +
                          +
                          Get the Database host for this query instance
                          + +
                          + distinct() + +  : Query +
                          +
                          Set a distinct flag for a `select` query. Note that this has no effect on +any of the other query types.
                          + +
                          + dsnPostfix() + +  : Query +
                          +
                          Common helper for the drivers to handle a PDO DSN postfix
                          + +
                          + exec() + +  : Result +
                          +
                          Execute the query.
                          + +
                          + get() + +  : self +
                          +
                          Get fields.
                          + +
                          + group_by() + +  : self +
                          +
                          Group the results by the values in a field
                          + +
                          + join() + +  : mixed +
                          +
                          Perform a JOIN operation
                          + +
                          + left_join() + +  : mixed +
                          +
                          Add a left join, with common logic for handling binding or not
                          + +
                          + limit() + +  : self +
                          +
                          Limit the result set to a certain size.
                          + +
                          + offset() + +  : self +
                          +
                          Offset the return set by a given number of records (useful for paging).
                          + +
                          + or_where() + +  : mixed +
                          +
                          Add addition where conditions to the query with an OR operator.
                          + +
                          + order() + +  : self +
                          +
                          Order by
                          + +
                          + pkey() + +  : Query|array<string|int, string> +
                          +
                          Get / set the primary key column name(s) so they can be easily returned +after an insert.
                          + +
                          + rollback() + +  : mixed +
                          +
                          Rollback the database state to the start of the transaction.
                          + +
                          + set() + +  : mixed +
                          +
                          Set fields to a given value.
                          + +
                          + table() + +  : self +
                          +
                          Set table(s) to perform the query on.
                          + +
                          + transaction() + +  : mixed +
                          +
                          Start a database transaction
                          + +
                          + where() + +  : mixed +
                          +
                          Where query - multiple conditions are bound as ANDs.
                          + +
                          + where_group() + +  : mixed +
                          +
                          Provide grouping for WHERE conditions. Use it with a callback function to +automatically group any conditions applied inside the method.
                          + +
                          + where_in() + +  : mixed +
                          +
                          Provide a method that can be used to perform a `WHERE ... IN (...)` query +with bound values and parameters.
                          + +
                          + _build_limit() + +  : string +
                          +
                          Create the LIMIT / OFFSET string
                          + +
                          + _escape_field() + +  : mixed +
                          +
                          Escape quotes in a field identifier
                          + +
                          + _exec() + +  : mixed +
                          +
                          + +
                          + _prepare() + +  : void +
                          +
                          Prepare the SQL query by populating the bound variables.
                          + +
                          + + + + + + +
                          +

                          + Properties + +

                          +
                          +

                          + $_identifier_limiter + + + +

                          + + + + + protected + mixed + $_identifier_limiter + = array('[', ']') + +
                          + +
                          + + + +
                          +
                          +

                          + $_supportsAsAlias + + + +

                          + + + + + protected + mixed + $_supportsAsAlias + = true + +
                          + +
                          + + + +
                          +
                          +

                          + $_whereInCnt + + + +

                          + + + + + protected + mixed + $_whereInCnt + = 1 + +
                          + +
                          + + + +
                          +
                          + +
                          +

                          + Methods + +

                          +
                          +

                          + __construct() + +

                          + + +

                          Query instance constructor.

                          + + + public + __construct(mixed $dbHost, mixed $type[, mixed $table = null ]) : mixed + +

                          Note that typically instances of this class will be automatically created +through the \DataTables\Database->query() method.

                          +
                          + +
                          Parameters
                          +
                          +
                          + $dbHost + : mixed +
                          +
                          +
                          + +
                          +
                          + $type + : mixed +
                          +
                          +
                          + +
                          +
                          + $table + : mixed + = null
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + mixed + — + + +
                          +
                          +

                          + and_where() + +

                          + + +

                          Add addition where conditions to the query with an AND operator. An alias +of `where` for naming consistency.

                          + + + public + and_where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

                          Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

                          +
                          + +
                          Parameters
                          +
                          +
                          + $key + : string|array<string|int, string>|callable +
                          +
                          +

                          Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

                          +
                          + +
                          +
                          + $value + : mixed + = null
                          +
                          +
                          + +
                          +
                          + $op + : mixed + = "="
                          +
                          +
                          + +
                          +
                          + $bind + : mixed + = true
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + mixed + — + + +
                          +
                          +

                          + bind() + +

                          + + +

                          Safely bind an input value to a parameter. This is evaluated when the +query is executed. This allows user input to be safely executed without +risk of an SQL injection attack.

                          + + + public + bind(string $name, string $value[, mixed $type = null ]) : Query + + +
                          Parameters
                          +
                          +
                          + $name + : string +
                          +
                          +

                          Parameter name. This should include a leading colon

                          +
                          + +
                          +
                          + $value + : string +
                          +
                          +

                          Value to bind

                          +
                          + +
                          +
                          + $type + : mixed + = null
                          +
                          +

                          Data type. See the PHP PDO documentation: +http://php.net/manual/en/pdo.constants.php

                          +
                          + +
                          +
                          + + + +
                          Return values
                          + Query + — + + +
                          +
                          +

                          + commit() + +

                          + + +

                          Commit a transaction.

                          + + + public + static commit(mixed $dbh) : mixed + +

                          @param \PDO $dbh The Database handle (typically a PDO object, but not always).

                          +
                          + +
                          Parameters
                          +
                          +
                          + $dbh + : mixed +
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + mixed + — + + +
                          +
                          +

                          + connect() + +

                          + + +

                          Database connection - override by the database driver.

                          + + + public + static connect(mixed $user[, mixed $pass = '' ][, mixed $host = '' ][, mixed $port = '' ][, mixed $db = '' ][, mixed $dsn = '' ]) : mixed + +

                          @param string|array $user User name or all parameters in an array

                          +
                          + +
                          Parameters
                          +
                          +
                          + $user + : mixed +
                          +
                          +
                          + +
                          +
                          + $pass + : mixed + = ''
                          +
                          +

                          Password +@param string $host Host name +@param string $db Database name +@return Query

                          +
                          + +
                          +
                          + $host + : mixed + = ''
                          +
                          +
                          + +
                          +
                          + $port + : mixed + = ''
                          +
                          +
                          + +
                          +
                          + $db + : mixed + = ''
                          +
                          +
                          + +
                          +
                          + $dsn + : mixed + = ''
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + mixed + — + + +
                          +
                          +

                          + database() + +

                          + + +

                          Get the Database host for this query instance

                          + + + public + database() : DataTable + + + + + +
                          Return values
                          + DataTable + — +

                          Database class instance

                          +
                          + + +
                          +
                          +

                          + distinct() + +

                          + + +

                          Set a distinct flag for a `select` query. Note that this has no effect on +any of the other query types.

                          + + + public + distinct(mixed $dis) : Query + +

                          @param boolean $dis Optional

                          +
                          + +
                          Parameters
                          +
                          +
                          + $dis + : mixed +
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + Query + — + + +
                          +
                          +

                          + dsnPostfix() + +

                          + + +

                          Common helper for the drivers to handle a PDO DSN postfix

                          + + + public + static dsnPostfix(mixed $dsn) : Query + +

                          @param string $dsn DSN postfix to use

                          +
                          + +
                          Parameters
                          +
                          +
                          + $dsn + : mixed +
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + Query + — +

                          @internal

                          +
                          + + +
                          +
                          +

                          + exec() + +

                          + + +

                          Execute the query.

                          + + + public + exec([mixed $sql = null ]) : Result + +

                          @param string $sql SQL string to execute (only if _type is 'raw').

                          +
                          + +
                          Parameters
                          +
                          +
                          + $sql + : mixed + = null
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + Result + — + + +
                          +
                          +

                          + get() + +

                          + + +

                          Get fields.

                          + + + public + get(mixed $get) : self + +

                          @param string|string[] $get,... Fields to get - can be specified as +individual fields or an array of fields.

                          +
                          + +
                          Parameters
                          +
                          +
                          + $get + : mixed +
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + self + — + + +
                          +
                          +

                          + group_by() + +

                          + + +

                          Group the results by the values in a field

                          + + + public + group_by(mixed $group_by) : self + + +
                          Parameters
                          +
                          +
                          + $group_by + : mixed +
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + self + — + + +
                          +
                          +

                          + join() + +

                          + + +

                          Perform a JOIN operation

                          + + + public + join(mixed $table, string $condition[, mixed $type = '' ][, mixed $bind = true ]) : mixed + +

                          @param string $table Table name to do the JOIN on

                          +
                          + +
                          Parameters
                          +
                          +
                          + $table + : mixed +
                          +
                          +
                          + +
                          +
                          + $condition + : string +
                          +
                          +

                          JOIN condition +@param string $type JOIN type +@return self

                          +
                          + +
                          +
                          + $type + : mixed + = ''
                          +
                          +
                          + +
                          +
                          + $bind + : mixed + = true
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + mixed + — + + +
                          +
                          +

                          + left_join() + +

                          + + +

                          Add a left join, with common logic for handling binding or not

                          + + + public + left_join(mixed $joins) : mixed + + +
                          Parameters
                          +
                          +
                          + $joins + : mixed +
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + mixed + — + + +
                          +
                          +

                          + limit() + +

                          + + +

                          Limit the result set to a certain size.

                          + + + public + limit(mixed $lim) : self + +

                          @param int $lim The number of records to limit the result to.

                          +
                          + +
                          Parameters
                          +
                          +
                          + $lim + : mixed +
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + self + — + + +
                          +
                          +

                          + offset() + +

                          + + +

                          Offset the return set by a given number of records (useful for paging).

                          + + + public + offset(mixed $off) : self + +

                          @param int $off The number of records to offset the result by.

                          +
                          + +
                          Parameters
                          +
                          +
                          + $off + : mixed +
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + self + — + + +
                          +
                          +

                          + or_where() + +

                          + + +

                          Add addition where conditions to the query with an OR operator.

                          + + + public + or_where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

                          Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

                          +
                          + +
                          Parameters
                          +
                          +
                          + $key + : string|array<string|int, string>|callable +
                          +
                          +

                          Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

                          +
                          + +
                          +
                          + $value + : mixed + = null
                          +
                          +
                          + +
                          +
                          + $op + : mixed + = "="
                          +
                          +
                          + +
                          +
                          + $bind + : mixed + = true
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + mixed + — + + +
                          +
                          +

                          + order() + +

                          + + +

                          Order by

                          + + + public + order(mixed $order) : self + +

                          @param string|string[] $order Columns and direction to order by - can +be specified as individual names, an array of names, a string of comma +separated names or any combination of those.

                          +
                          + +
                          Parameters
                          +
                          +
                          + $order + : mixed +
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + self + — + + +
                          +
                          +

                          + pkey() + +

                          + + +

                          Get / set the primary key column name(s) so they can be easily returned +after an insert.

                          + + + public + pkey([array<string|int, string> $pkey = null ]) : Query|array<string|int, string> + + +
                          Parameters
                          +
                          +
                          + $pkey + : array<string|int, string> + = null
                          +
                          +

                          Primary keys

                          +
                          + +
                          +
                          + + + +
                          Return values
                          + Query|array<string|int, string> + — + + +
                          +
                          +

                          + rollback() + +

                          + + +

                          Rollback the database state to the start of the transaction.

                          + + + public + static rollback(mixed $dbh) : mixed + +

                          @param \PDO $dbh The Database handle (typically a PDO object, but not always).

                          +
                          + +
                          Parameters
                          +
                          +
                          + $dbh + : mixed +
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + mixed + — + + +
                          +
                          +

                          + set() + +

                          + + +

                          Set fields to a given value.

                          + + + public + set(string|array<string|int, string> $set[, mixed $val = null ][, mixed $bind = true ]) : mixed + +

                          Can be used in two different ways, as set( field, value ) or as an array of +fields to set: set( array( 'fieldName' => 'value', ...) );

                          +
                          + +
                          Parameters
                          +
                          +
                          + $set + : string|array<string|int, string> +
                          +
                          +

                          Can be given as a single string, when then $val +must be set, or as an array of key/value pairs to be set. +@param string $val When $set is given as a simple string, $set is the field +name and this is the field's value. +@param boolean $bind Should the value be bound or not +@return self

                          +
                          + +
                          +
                          + $val + : mixed + = null
                          +
                          +
                          + +
                          +
                          + $bind + : mixed + = true
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + mixed + — + + +
                          +
                          +

                          + table() + +

                          + + +

                          Set table(s) to perform the query on.

                          + + + public + table(mixed $table) : self + +

                          @param string|string[] $table,... Table(s) to use - can be specified as +individual names, an array of names, a string of comma separated +names or any combination of those.

                          +
                          + +
                          Parameters
                          +
                          +
                          + $table + : mixed +
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + self + — + + +
                          +
                          +

                          + transaction() + +

                          + + +

                          Start a database transaction

                          + + + public + static transaction(mixed $dbh) : mixed + +

                          @param \PDO $dbh The Database handle (typically a PDO object, but not always).

                          +
                          + +
                          Parameters
                          +
                          +
                          + $dbh + : mixed +
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + mixed + — + + +
                          +
                          +

                          + where() + +

                          + + +

                          Where query - multiple conditions are bound as ANDs.

                          + + + public + where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

                          Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

                          +
                          + +
                          Parameters
                          +
                          +
                          + $key + : string|array<string|int, string>|callable +
                          +
                          +

                          Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

                          +

                          @example +The following will produce +'WHERE name='allan' AND ( location='Scotland' OR location='Canada' ):

                          +
                            $query
                          +    ->where( 'name', 'allan' )
                          +    ->where( function ($q) {
                          +      $q->where( 'location', 'Scotland' );
                          +      $q->or_where( 'location', 'Canada' );
                          +    } );
                          +
                          +
                          + +
                          +
                          + $value + : mixed + = null
                          +
                          +
                          + +
                          +
                          + $op + : mixed + = "="
                          +
                          +
                          + +
                          +
                          + $bind + : mixed + = true
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + mixed + — + + +
                          +
                          +

                          + where_group() + +

                          + + +

                          Provide grouping for WHERE conditions. Use it with a callback function to +automatically group any conditions applied inside the method.

                          + + + public + where_group(bool|callable $inOut[, mixed $op = 'AND' ]) : mixed + +

                          For legacy reasons this method also provides the ability to explicitly +define if a grouping bracket should be opened or closed in the query. +This method is not prefer.

                          +
                          + +
                          Parameters
                          +
                          +
                          + $inOut + : bool|callable +
                          +
                          +

                          If callable it will create the group +automatically and pass the query into the called function. For +legacy operations use true to open brackets, false to close. +@param string $op Conditional operator to use to join to the +preceding condition. Default AND. +@return self

                          +

                          @example

                          +
                          $query->where_group( function ($q) {
                          +  $q->where( 'location', 'Edinburgh' );
                          +  $q->where( 'position', 'Manager' );
                          +} );
                          +
                          +
                          + +
                          +
                          + $op + : mixed + = 'AND'
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + mixed + — + + +
                          +
                          +

                          + where_in() + +

                          + + +

                          Provide a method that can be used to perform a `WHERE ... IN (...)` query +with bound values and parameters.

                          + + + public + where_in(mixed $field, mixed $arr[, mixed $operator = "AND" ]) : mixed + +

                          Note this is only suitable for local values, not a sub-query. For that use +->where() with an unbound value.

                          +
                          + +
                          Parameters
                          +
                          +
                          + $field + : mixed +
                          +
                          +
                          + +
                          +
                          + $arr + : mixed +
                          +
                          +
                          + +
                          +
                          + $operator + : mixed + = "AND"
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + mixed + — + + +
                          +
                          +

                          + _build_limit() + +

                          + + +

                          Create the LIMIT / OFFSET string

                          + + + protected + _build_limit() : string + +

                          MySQL and Postgres style - anything else can have the driver override

                          +
                          + + + + +
                          Return values
                          + string + — +

                          @internal

                          +
                          + + +
                          +
                          +

                          + _escape_field() + +

                          + + +

                          Escape quotes in a field identifier

                          + + + protected + _escape_field(mixed $field) : mixed + +

                          @internal

                          +
                          + +
                          Parameters
                          +
                          +
                          + $field + : mixed +
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + mixed + — + + +
                          +
                          +

                          + _exec() + +

                          + + + + + protected + _exec() : mixed + +
                          + + + + +
                          Return values
                          + mixed + — + + +
                          +
                          +

                          + _prepare() + +

                          + + +

                          Prepare the SQL query by populating the bound variables.

                          + + + protected + _prepare(mixed $sql) : void + +

                          Provided by the driver

                          +
                          + +
                          Parameters
                          +
                          +
                          + $sql + : mixed +
                          +
                          +
                          + +
                          +
                          + + + +
                          Return values
                          + void + — +

                          @internal

                          +
                          + + +
                          +
                          + +
                          +
                          +
                          +
                          +
                          
                          +        
                          + +
                          +
                          + + + +
                          +
                          +
                          +
                          +

                          Search results

                          + +
                          +
                          +
                            +
                            +
                            +
                            +
                            +
                            + + +
                            + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-SqlserverResult.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-SqlserverResult.html new file mode 100644 index 00000000..5d47dbf4 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Driver-SqlserverResult.html @@ -0,0 +1,515 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                            +

                            Editor PHP 2.1.3

                            + + + + + +
                            + +
                            +
                            + + + + +
                            + + +
                            +

                            + SqlserverResult + + + extends Result + + +
                            + in package + +
                            + + +

                            + + + +

                            SQL Server driver for DataTables Database Result class

                            + +

                            @internal

                            +
                            + + + + + + + + +

                            + Table of Contents + +

                            + +
                            +
                            + __construct() + +  : mixed +
                            +
                            + +
                            + count() + +  : mixed +
                            +
                            Count the number of rows in the result set.
                            + +
                            + fetch() + +  : array<string|int, mixed> +
                            +
                            Get the next row in a result set
                            + +
                            + fetchAll() + +  : array<string|int, mixed> +
                            +
                            Get all rows in the result set
                            + +
                            + insertId() + +  : mixed +
                            +
                            After an INSERT query, get the ID that was inserted.
                            + +
                            + + + + + + + +
                            +

                            + Methods + +

                            +
                            +

                            + __construct() + +

                            + + + + + public + __construct(mixed $dbh, mixed $stmt) : mixed + +
                            + +
                            Parameters
                            +
                            +
                            + $dbh + : mixed +
                            +
                            +
                            + +
                            +
                            + $stmt + : mixed +
                            +
                            +
                            + +
                            +
                            + + + +
                            Return values
                            + mixed + — + + +
                            +
                            +

                            + count() + +

                            + + +

                            Count the number of rows in the result set.

                            + + + public + count() : mixed + +

                            @return int

                            +
                            + + + + +
                            Return values
                            + mixed + — + + +
                            +
                            +

                            + fetch() + +

                            + + +

                            Get the next row in a result set

                            + + + public + fetch([mixed $fetchType = PDO::FETCH_ASSOC ]) : array<string|int, mixed> + +

                            @param int PDO row fetch style - PDO::FETCH_ASSOC is the default

                            +
                            + +
                            Parameters
                            +
                            +
                            + $fetchType + : mixed + = PDO::FETCH_ASSOC
                            +
                            +
                            + +
                            +
                            + + + +
                            Return values
                            + array<string|int, mixed> + — + + +
                            +
                            +

                            + fetchAll() + +

                            + + +

                            Get all rows in the result set

                            + + + public + fetchAll([mixed $fetchType = PDO::FETCH_ASSOC ]) : array<string|int, mixed> + +

                            @param int PDO row fetch style - PDO::FETCH_ASSOC is the default

                            +
                            + +
                            Parameters
                            +
                            +
                            + $fetchType + : mixed + = PDO::FETCH_ASSOC
                            +
                            +
                            + +
                            +
                            + + + +
                            Return values
                            + array<string|int, mixed> + — + + +
                            +
                            +

                            + insertId() + +

                            + + +

                            After an INSERT query, get the ID that was inserted.

                            + + + public + insertId() : mixed + +

                            @return int

                            +
                            + + + + +
                            Return values
                            + mixed + — + + +
                            +
                            + +
                            +
                            +
                            +
                            +
                            
                            +        
                            + +
                            +
                            + + + +
                            +
                            +
                            +
                            +

                            Search results

                            + +
                            +
                            +
                              +
                              +
                              +
                              +
                              +
                              + + +
                              + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Query.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Query.html new file mode 100644 index 00000000..781019b7 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Query.html @@ -0,0 +1,2145 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                              +

                              Editor PHP 2.1.3

                              + + + + + +
                              + +
                              +
                              + + + + +
                              + + +
                              +

                              + Query + + +
                              + in package + +
                              + + +

                              + + + +

                              Perform an individual query on the database.

                              + +

                              The typical pattern for using this class is through the \DataTables\Database->query() method (and it's 'select', etc short-cuts). +Typically it would not be initialised directly.

                              +

                              Note that this is a stub class that a driver will extend and complete as +required for individual database types. Individual drivers could add +additional methods, but this is discouraged to ensure that the API is the +same for all database types.

                              +
                              + + + + + + + + +

                              + Table of Contents + +

                              + +
                              +
                              + $_supportsAsAlias + +  : mixed +
                              +
                              + +
                              + $_whereInCnt + +  : mixed +
                              +
                              + +
                              + __construct() + +  : mixed +
                              +
                              Query instance constructor.
                              + +
                              + and_where() + +  : mixed +
                              +
                              Add addition where conditions to the query with an AND operator. An alias +of `where` for naming consistency.
                              + +
                              + bind() + +  : Query +
                              +
                              Safely bind an input value to a parameter. This is evaluated when the +query is executed. This allows user input to be safely executed without +risk of an SQL injection attack.
                              + +
                              + commit() + +  : mixed +
                              +
                              Commit a transaction.
                              + +
                              + connect() + +  : mixed +
                              +
                              Database connection - override by the database driver.
                              + +
                              + database() + +  : DataTable +
                              +
                              Get the Database host for this query instance
                              + +
                              + distinct() + +  : Query +
                              +
                              Set a distinct flag for a `select` query. Note that this has no effect on +any of the other query types.
                              + +
                              + dsnPostfix() + +  : Query +
                              +
                              Common helper for the drivers to handle a PDO DSN postfix
                              + +
                              + exec() + +  : Result +
                              +
                              Execute the query.
                              + +
                              + get() + +  : self +
                              +
                              Get fields.
                              + +
                              + group_by() + +  : self +
                              +
                              Group the results by the values in a field
                              + +
                              + join() + +  : mixed +
                              +
                              Perform a JOIN operation
                              + +
                              + left_join() + +  : mixed +
                              +
                              Add a left join, with common logic for handling binding or not
                              + +
                              + limit() + +  : self +
                              +
                              Limit the result set to a certain size.
                              + +
                              + offset() + +  : self +
                              +
                              Offset the return set by a given number of records (useful for paging).
                              + +
                              + or_where() + +  : mixed +
                              +
                              Add addition where conditions to the query with an OR operator.
                              + +
                              + order() + +  : self +
                              +
                              Order by
                              + +
                              + pkey() + +  : Query|array<string|int, string> +
                              +
                              Get / set the primary key column name(s) so they can be easily returned +after an insert.
                              + +
                              + rollback() + +  : mixed +
                              +
                              Rollback the database state to the start of the transaction.
                              + +
                              + set() + +  : mixed +
                              +
                              Set fields to a given value.
                              + +
                              + table() + +  : self +
                              +
                              Set table(s) to perform the query on.
                              + +
                              + transaction() + +  : mixed +
                              +
                              Start a database transaction
                              + +
                              + where() + +  : mixed +
                              +
                              Where query - multiple conditions are bound as ANDs.
                              + +
                              + where_group() + +  : mixed +
                              +
                              Provide grouping for WHERE conditions. Use it with a callback function to +automatically group any conditions applied inside the method.
                              + +
                              + where_in() + +  : mixed +
                              +
                              Provide a method that can be used to perform a `WHERE ... IN (...)` query +with bound values and parameters.
                              + +
                              + _build_limit() + +  : string +
                              +
                              Create the LIMIT / OFFSET string
                              + +
                              + _escape_field() + +  : mixed +
                              +
                              Escape quotes in a field identifier
                              + +
                              + _prepare() + +  : void +
                              +
                              Prepare the SQL query by populating the bound variables.
                              + +
                              + + + + + + +
                              +

                              + Properties + +

                              +
                              +

                              + $_supportsAsAlias + + + +

                              + + + + + protected + mixed + $_supportsAsAlias + = true + +
                              + +
                              + + + +
                              +
                              +

                              + $_whereInCnt + + + +

                              + + + + + protected + mixed + $_whereInCnt + = 1 + +
                              + +
                              + + + +
                              +
                              + +
                              +

                              + Methods + +

                              +
                              +

                              + __construct() + +

                              + + +

                              Query instance constructor.

                              + + + public + __construct(mixed $dbHost, mixed $type[, mixed $table = null ]) : mixed + +

                              Note that typically instances of this class will be automatically created +through the \DataTables\Database->query() method.

                              +
                              + +
                              Parameters
                              +
                              +
                              + $dbHost + : mixed +
                              +
                              +
                              + +
                              +
                              + $type + : mixed +
                              +
                              +
                              + +
                              +
                              + $table + : mixed + = null
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + mixed + — + + +
                              +
                              +

                              + and_where() + +

                              + + +

                              Add addition where conditions to the query with an AND operator. An alias +of `where` for naming consistency.

                              + + + public + and_where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

                              Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

                              +
                              + +
                              Parameters
                              +
                              +
                              + $key + : string|array<string|int, string>|callable +
                              +
                              +

                              Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

                              +
                              + +
                              +
                              + $value + : mixed + = null
                              +
                              +
                              + +
                              +
                              + $op + : mixed + = "="
                              +
                              +
                              + +
                              +
                              + $bind + : mixed + = true
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + mixed + — + + +
                              +
                              +

                              + bind() + +

                              + + +

                              Safely bind an input value to a parameter. This is evaluated when the +query is executed. This allows user input to be safely executed without +risk of an SQL injection attack.

                              + + + public + bind(string $name, string $value[, mixed $type = null ]) : Query + + +
                              Parameters
                              +
                              +
                              + $name + : string +
                              +
                              +

                              Parameter name. This should include a leading colon

                              +
                              + +
                              +
                              + $value + : string +
                              +
                              +

                              Value to bind

                              +
                              + +
                              +
                              + $type + : mixed + = null
                              +
                              +

                              Data type. See the PHP PDO documentation: +http://php.net/manual/en/pdo.constants.php

                              +
                              + +
                              +
                              + + + +
                              Return values
                              + Query + — + + +
                              +
                              +

                              + commit() + +

                              + + +

                              Commit a transaction.

                              + + + public + static commit(mixed $dbh) : mixed + +

                              @param \PDO $dbh The Database handle (typically a PDO object, but not always).

                              +
                              + +
                              Parameters
                              +
                              +
                              + $dbh + : mixed +
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + mixed + — + + +
                              +
                              +

                              + connect() + +

                              + + +

                              Database connection - override by the database driver.

                              + + + public + static connect(mixed $user[, string $pass = '' ][, mixed $host = '' ][, mixed $port = '' ][, mixed $db = '' ][, mixed $dsn = '' ]) : mixed + +

                              @param string|array $user User name or all parameters in an array

                              +
                              + +
                              Parameters
                              +
                              +
                              + $user + : mixed +
                              +
                              +
                              + +
                              +
                              + $pass + : string + = ''
                              +
                              +

                              Password +@param string $host Host name +@param string $db Database name +@return Query

                              +
                              + +
                              +
                              + $host + : mixed + = ''
                              +
                              +
                              + +
                              +
                              + $port + : mixed + = ''
                              +
                              +
                              + +
                              +
                              + $db + : mixed + = ''
                              +
                              +
                              + +
                              +
                              + $dsn + : mixed + = ''
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + mixed + — + + +
                              +
                              +

                              + database() + +

                              + + +

                              Get the Database host for this query instance

                              + + + public + database() : DataTable + + + + + +
                              Return values
                              + DataTable + — +

                              Database class instance

                              +
                              + + +
                              +
                              +

                              + distinct() + +

                              + + +

                              Set a distinct flag for a `select` query. Note that this has no effect on +any of the other query types.

                              + + + public + distinct(mixed $dis) : Query + +

                              @param boolean $dis Optional

                              +
                              + +
                              Parameters
                              +
                              +
                              + $dis + : mixed +
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + Query + — + + +
                              +
                              +

                              + dsnPostfix() + +

                              + + +

                              Common helper for the drivers to handle a PDO DSN postfix

                              + + + public + static dsnPostfix(mixed $dsn) : Query + +

                              @param string $dsn DSN postfix to use

                              +
                              + +
                              Parameters
                              +
                              +
                              + $dsn + : mixed +
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + Query + — +

                              @internal

                              +
                              + + +
                              +
                              +

                              + exec() + +

                              + + +

                              Execute the query.

                              + + + public + exec([mixed $sql = null ]) : Result + +

                              @param string $sql SQL string to execute (only if _type is 'raw').

                              +
                              + +
                              Parameters
                              +
                              +
                              + $sql + : mixed + = null
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + Result + — + + +
                              +
                              +

                              + get() + +

                              + + +

                              Get fields.

                              + + + public + get(mixed $get) : self + +

                              @param string|string[] $get,... Fields to get - can be specified as +individual fields or an array of fields.

                              +
                              + +
                              Parameters
                              +
                              +
                              + $get + : mixed +
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + self + — + + +
                              +
                              +

                              + group_by() + +

                              + + +

                              Group the results by the values in a field

                              + + + public + group_by(mixed $group_by) : self + + +
                              Parameters
                              +
                              +
                              + $group_by + : mixed +
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + self + — + + +
                              +
                              +

                              + join() + +

                              + + +

                              Perform a JOIN operation

                              + + + public + join(mixed $table, string $condition[, mixed $type = '' ][, mixed $bind = true ]) : mixed + +

                              @param string $table Table name to do the JOIN on

                              +
                              + +
                              Parameters
                              +
                              +
                              + $table + : mixed +
                              +
                              +
                              + +
                              +
                              + $condition + : string +
                              +
                              +

                              JOIN condition +@param string $type JOIN type +@return self

                              +
                              + +
                              +
                              + $type + : mixed + = ''
                              +
                              +
                              + +
                              +
                              + $bind + : mixed + = true
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + mixed + — + + +
                              +
                              +

                              + left_join() + +

                              + + +

                              Add a left join, with common logic for handling binding or not

                              + + + public + left_join(mixed $joins) : mixed + + +
                              Parameters
                              +
                              +
                              + $joins + : mixed +
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + mixed + — + + +
                              +
                              +

                              + limit() + +

                              + + +

                              Limit the result set to a certain size.

                              + + + public + limit(mixed $lim) : self + +

                              @param int $lim The number of records to limit the result to.

                              +
                              + +
                              Parameters
                              +
                              +
                              + $lim + : mixed +
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + self + — + + +
                              +
                              +

                              + offset() + +

                              + + +

                              Offset the return set by a given number of records (useful for paging).

                              + + + public + offset(mixed $off) : self + +

                              @param int $off The number of records to offset the result by.

                              +
                              + +
                              Parameters
                              +
                              +
                              + $off + : mixed +
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + self + — + + +
                              +
                              +

                              + or_where() + +

                              + + +

                              Add addition where conditions to the query with an OR operator.

                              + + + public + or_where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

                              Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

                              +
                              + +
                              Parameters
                              +
                              +
                              + $key + : string|array<string|int, string>|callable +
                              +
                              +

                              Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

                              +
                              + +
                              +
                              + $value + : mixed + = null
                              +
                              +
                              + +
                              +
                              + $op + : mixed + = "="
                              +
                              +
                              + +
                              +
                              + $bind + : mixed + = true
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + mixed + — + + +
                              +
                              +

                              + order() + +

                              + + +

                              Order by

                              + + + public + order(mixed $order) : self + +

                              @param string|string[] $order Columns and direction to order by - can +be specified as individual names, an array of names, a string of comma +separated names or any combination of those.

                              +
                              + +
                              Parameters
                              +
                              +
                              + $order + : mixed +
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + self + — + + +
                              +
                              +

                              + pkey() + +

                              + + +

                              Get / set the primary key column name(s) so they can be easily returned +after an insert.

                              + + + public + pkey([array<string|int, string> $pkey = null ]) : Query|array<string|int, string> + + +
                              Parameters
                              +
                              +
                              + $pkey + : array<string|int, string> + = null
                              +
                              +

                              Primary keys

                              +
                              + +
                              +
                              + + + +
                              Return values
                              + Query|array<string|int, string> + — + + +
                              +
                              +

                              + rollback() + +

                              + + +

                              Rollback the database state to the start of the transaction.

                              + + + public + static rollback(mixed $dbh) : mixed + +

                              @param \PDO $dbh The Database handle (typically a PDO object, but not always).

                              +
                              + +
                              Parameters
                              +
                              +
                              + $dbh + : mixed +
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + mixed + — + + +
                              +
                              +

                              + set() + +

                              + + +

                              Set fields to a given value.

                              + + + public + set(string|array<string|int, string> $set[, mixed $val = null ][, mixed $bind = true ]) : mixed + +

                              Can be used in two different ways, as set( field, value ) or as an array of +fields to set: set( array( 'fieldName' => 'value', ...) );

                              +
                              + +
                              Parameters
                              +
                              +
                              + $set + : string|array<string|int, string> +
                              +
                              +

                              Can be given as a single string, when then $val +must be set, or as an array of key/value pairs to be set. +@param string $val When $set is given as a simple string, $set is the field +name and this is the field's value. +@param boolean $bind Should the value be bound or not +@return self

                              +
                              + +
                              +
                              + $val + : mixed + = null
                              +
                              +
                              + +
                              +
                              + $bind + : mixed + = true
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + mixed + — + + +
                              +
                              +

                              + table() + +

                              + + +

                              Set table(s) to perform the query on.

                              + + + public + table(mixed $table) : self + +

                              @param string|string[] $table,... Table(s) to use - can be specified as +individual names, an array of names, a string of comma separated +names or any combination of those.

                              +
                              + +
                              Parameters
                              +
                              +
                              + $table + : mixed +
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + self + — + + +
                              +
                              +

                              + transaction() + +

                              + + +

                              Start a database transaction

                              + + + public + static transaction(mixed $dbh) : mixed + +

                              @param \PDO $dbh The Database handle (typically a PDO object, but not always).

                              +
                              + +
                              Parameters
                              +
                              +
                              + $dbh + : mixed +
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + mixed + — + + +
                              +
                              +

                              + where() + +

                              + + +

                              Where query - multiple conditions are bound as ANDs.

                              + + + public + where(string|array<string|int, string>|callable $key[, mixed $value = null ][, mixed $op = "=" ][, mixed $bind = true ]) : mixed + +

                              Can be used in two different ways, as where( field, value ) or as an array of +conditions to use: where( array('fieldName', ...), array('value', ...) );

                              +
                              + +
                              Parameters
                              +
                              +
                              + $key + : string|array<string|int, string>|callable +
                              +
                              +

                              Single field name, or an array of field names. +If given as a function (i.e. a closure), the function is called, passing the +query itself in as the only parameter, so the function can add extra conditions +with parentheses around the additional parameters. +@param string|string[] $value Single field value, or an array of +values. Can be null to search for IS NULL or IS NOT NULL (depending +on the value of $op which should be = or !=. +@param string $op Condition operator: <, >, = etc +@param boolean $bind Escape the value (true, default) or not (false). +@return self

                              +

                              @example +The following will produce +'WHERE name='allan' AND ( location='Scotland' OR location='Canada' ):

                              +
                                $query
                              +    ->where( 'name', 'allan' )
                              +    ->where( function ($q) {
                              +      $q->where( 'location', 'Scotland' );
                              +      $q->or_where( 'location', 'Canada' );
                              +    } );
                              +
                              +
                              + +
                              +
                              + $value + : mixed + = null
                              +
                              +
                              + +
                              +
                              + $op + : mixed + = "="
                              +
                              +
                              + +
                              +
                              + $bind + : mixed + = true
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + mixed + — + + +
                              +
                              +

                              + where_group() + +

                              + + +

                              Provide grouping for WHERE conditions. Use it with a callback function to +automatically group any conditions applied inside the method.

                              + + + public + where_group(bool|callable $inOut[, mixed $op = 'AND' ]) : mixed + +

                              For legacy reasons this method also provides the ability to explicitly +define if a grouping bracket should be opened or closed in the query. +This method is not prefer.

                              +
                              + +
                              Parameters
                              +
                              +
                              + $inOut + : bool|callable +
                              +
                              +

                              If callable it will create the group +automatically and pass the query into the called function. For +legacy operations use true to open brackets, false to close. +@param string $op Conditional operator to use to join to the +preceding condition. Default AND. +@return self

                              +

                              @example

                              +
                              $query->where_group( function ($q) {
                              +  $q->where( 'location', 'Edinburgh' );
                              +  $q->where( 'position', 'Manager' );
                              +} );
                              +
                              +
                              + +
                              +
                              + $op + : mixed + = 'AND'
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + mixed + — + + +
                              +
                              +

                              + where_in() + +

                              + + +

                              Provide a method that can be used to perform a `WHERE ... IN (...)` query +with bound values and parameters.

                              + + + public + where_in(mixed $field, mixed $arr[, mixed $operator = "AND" ]) : mixed + +

                              Note this is only suitable for local values, not a sub-query. For that use +->where() with an unbound value.

                              +
                              + +
                              Parameters
                              +
                              +
                              + $field + : mixed +
                              +
                              +
                              + +
                              +
                              + $arr + : mixed +
                              +
                              +
                              + +
                              +
                              + $operator + : mixed + = "AND"
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + mixed + — + + +
                              +
                              +

                              + _build_limit() + +

                              + + +

                              Create the LIMIT / OFFSET string

                              + + + protected + _build_limit() : string + +

                              MySQL and Postgres style - anything else can have the driver override

                              +
                              + + + + +
                              Return values
                              + string + — +

                              @internal

                              +
                              + + +
                              +
                              +

                              + _escape_field() + +

                              + + +

                              Escape quotes in a field identifier

                              + + + protected + _escape_field(mixed $field) : mixed + +

                              @internal

                              +
                              + +
                              Parameters
                              +
                              +
                              + $field + : mixed +
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + mixed + — + + +
                              +
                              +

                              + _prepare() + +

                              + + +

                              Prepare the SQL query by populating the bound variables.

                              + + + protected + abstract _prepare(mixed $sql) : void + +

                              Provided by the driver

                              +
                              + +
                              Parameters
                              +
                              +
                              + $sql + : mixed +
                              +
                              +
                              + +
                              +
                              + + + +
                              Return values
                              + void + — +

                              @internal

                              +
                              + + +
                              +
                              + +
                              +
                              +
                              +
                              +
                              
                              +        
                              + +
                              +
                              + + + +
                              +
                              +
                              +
                              +

                              Search results

                              + +
                              +
                              +
                                +
                                +
                                +
                                +
                                +
                                + + +
                                + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Result.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Result.html new file mode 100644 index 00000000..b91e0269 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database-Result.html @@ -0,0 +1,457 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                +

                                Editor PHP 2.1.3

                                + + + + + +
                                + +
                                +
                                + + + + +
                                + + +
                                +

                                + Result + + +
                                + in package + +
                                + + +

                                + + + +

                                Result object given by a {@see Query} performed on a database.

                                + +

                                The typical pattern for using this class is to receive an instance of it as a +result of using the Database and Query class methods that +return a result. This class should not be initialised independently.

                                +

                                Note that this is a stub class that a driver will extend and complete as +required for individual database types. Individual drivers could add +additional methods, but this is discouraged to ensure that the API is the +same for all database types.

                                +
                                + + + + + + + + +

                                + Table of Contents + +

                                + +
                                +
                                + count() + +  : mixed +
                                +
                                Count the number of rows in the result set.
                                + +
                                + fetch() + +  : array<string|int, mixed> +
                                +
                                Get the next row in a result set
                                + +
                                + fetchAll() + +  : array<string|int, mixed> +
                                +
                                Get all rows in the result set
                                + +
                                + insertId() + +  : mixed +
                                +
                                After an INSERT query, get the ID that was inserted.
                                + +
                                + + + + + + + +
                                +

                                + Methods + +

                                +
                                +

                                + count() + +

                                + + +

                                Count the number of rows in the result set.

                                + + + public + abstract count() : mixed + +

                                @return int

                                +
                                + + + + +
                                Return values
                                + mixed + — + + +
                                +
                                +

                                + fetch() + +

                                + + +

                                Get the next row in a result set

                                + + + public + abstract fetch([mixed $fetchType = PDO::FETCH_ASSOC ]) : array<string|int, mixed> + +

                                @param int PDO row fetch style - PDO::FETCH_ASSOC is the default

                                +
                                + +
                                Parameters
                                +
                                +
                                + $fetchType + : mixed + = PDO::FETCH_ASSOC
                                +
                                +
                                + +
                                +
                                + + + +
                                Return values
                                + array<string|int, mixed> + — + + +
                                +
                                +

                                + fetchAll() + +

                                + + +

                                Get all rows in the result set

                                + + + public + abstract fetchAll([mixed $fetchType = PDO::FETCH_ASSOC ]) : array<string|int, mixed> + +

                                @param int PDO row fetch style - PDO::FETCH_ASSOC is the default

                                +
                                + +
                                Parameters
                                +
                                +
                                + $fetchType + : mixed + = PDO::FETCH_ASSOC
                                +
                                +
                                + +
                                +
                                + + + +
                                Return values
                                + array<string|int, mixed> + — + + +
                                +
                                +

                                + insertId() + +

                                + + +

                                After an INSERT query, get the ID that was inserted.

                                + + + public + abstract insertId() : mixed + +

                                @return int

                                +
                                + + + + +
                                Return values
                                + mixed + — + + +
                                +
                                + +
                                +
                                +
                                +
                                +
                                
                                +        
                                + +
                                +
                                + + + +
                                +
                                +
                                +
                                +

                                Search results

                                + +
                                +
                                +
                                  +
                                  +
                                  +
                                  +
                                  +
                                  + + +
                                  + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database.html new file mode 100644 index 00000000..99bbedfa --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Database.html @@ -0,0 +1,1476 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                  +

                                  Editor PHP 2.1.3

                                  + + + + + +
                                  + +
                                  +
                                  + + + + +
                                  + + +
                                  +

                                  + Database + + +
                                  + in package + +
                                  + + +

                                  + + + +

                                  DataTables Database connection object.

                                  + +

                                  Create a database connection which may then have queries performed upon it.

                                  +

                                  This is a database abstraction class that can be used on multiple different +databases. As a result of this, it might not be suitable to perform complex +queries through this interface or vendor specific queries, but everything +required for basic database interaction is provided through the abstracted +methods.

                                  +
                                  + + + + + + + + +

                                  + Table of Contents + +

                                  + +
                                  +
                                  + __construct() + +  : mixed +
                                  +
                                  Database instance constructor.
                                  + +
                                  + any() + +  : bool +
                                  +
                                  Determine if there is any data in the table that matches the query +condition
                                  + +
                                  + commit() + +  : self +
                                  +
                                  Commit a database transaction.
                                  + +
                                  + count() + +  : mixed +
                                  +
                                  Get a count from a table.
                                  + +
                                  + debug() + +  : bool|self +
                                  +
                                  Get / set debug mode.
                                  + +
                                  + delete() + +  : mixed +
                                  +
                                  Perform a delete query on a table.
                                  + +
                                  + insert() + +  : mixed +
                                  +
                                  Insert data into a table.
                                  + +
                                  + push() + +  : mixed +
                                  +
                                  Update or Insert data. When doing an insert, the where condition is +added as a set field
                                  + +
                                  + query() + +  : mixed +
                                  +
                                  Create a query object to build a database query.
                                  + +
                                  + quote() + +  : mixed +
                                  +
                                  Quote a string for a quote. Note you should generally use a bind!
                                  + +
                                  + raw() + +  : mixed +
                                  +
                                  Create a `Query` object that will execute a custom SQL query. This is +similar to the `sql` method, but in this case you must call the `exec()` +method of the returned `Query` object manually. This can be useful if you +wish to bind parameters using the query `bind` method to ensure data is +properly escaped.
                                  + +
                                  + resource() + +  : resource +
                                  +
                                  Get the database resource connector. This is typically a PDO object.
                                  + +
                                  + rollback() + +  : self +
                                  +
                                  Rollback the database state to the start of the transaction.
                                  + +
                                  + select() + +  : mixed +
                                  +
                                  Select data from a table.
                                  + +
                                  + selectDistinct() + +  : mixed +
                                  +
                                  Select distinct data from a table.
                                  + +
                                  + sql() + +  : mixed +
                                  +
                                  Execute an raw SQL query - i.e. give the method your own SQL, rather +than having the Database classes building it for you.
                                  + +
                                  + transaction() + +  : self +
                                  +
                                  Start a new database transaction.
                                  + +
                                  + type() + +  : mixed +
                                  +
                                  Get the database type (e.g. Postgres, Mysql, etc)
                                  + +
                                  + update() + +  : mixed +
                                  +
                                  Update data.
                                  + +
                                  + + + + + + + +
                                  +

                                  + Methods + +

                                  +
                                  +

                                  + __construct() + +

                                  + + +

                                  Database instance constructor.

                                  + + + public + __construct(mixed $opts) : mixed + +

                                  @param string[] $opts Array of connection parameters for the database:

                                  +
                                    array(
                                  +      "user" => "", // User name
                                  +      "pass" => "", // Password
                                  +      "host" => "", // Host name
                                  +      "port" => "", // Port
                                  +      "db"   => "", // Database name
                                  +      "type" => ""  // Datable type: "Mysql", "Postgres" or "Sqlite"
                                  +  )
                                  +
                                  +
                                  + +
                                  Parameters
                                  +
                                  +
                                  + $opts + : mixed +
                                  +
                                  +
                                  + +
                                  +
                                  + + + +
                                  Return values
                                  + mixed + — + + +
                                  +
                                  +

                                  + any() + +

                                  + + +

                                  Determine if there is any data in the table that matches the query +condition

                                  + + + public + any(string|array<string|int, string> $table[, array<string|int, mixed> $where = null ]) : bool + + +
                                  Parameters
                                  +
                                  +
                                  + $table + : string|array<string|int, string> +
                                  +
                                  +

                                  Table name(s) to act upon.

                                  +
                                  + +
                                  +
                                  + $where + : array<string|int, mixed> + = null
                                  +
                                  +

                                  Where condition for what to select - see Query->where().

                                  +
                                  + +
                                  +
                                  + + + +
                                  Return values
                                  + bool + — +

                                  Boolean flag - true if there were rows

                                  +
                                  + + +
                                  +
                                  +

                                  + commit() + +

                                  + + +

                                  Commit a database transaction.

                                  + + + public + commit() : self + +

                                  Use with Database->transaction() and Database->rollback().

                                  +
                                  + + + + +
                                  Return values
                                  + self + — + + +
                                  +
                                  +

                                  + count() + +

                                  + + +

                                  Get a count from a table.

                                  + + + public + count(mixed $table[, string $field = "id" ][, mixed $where = null ]) : mixed + +

                                  @param string|string[] $table Table name(s) to act upon.

                                  +
                                  + +
                                  Parameters
                                  +
                                  +
                                  + $table + : mixed +
                                  +
                                  +
                                  + +
                                  +
                                  + $field + : string + = "id"
                                  +
                                  +

                                  Primary key field name +@param array $where Where condition for what to select - see Query->where(). +@return Number

                                  +
                                  + +
                                  +
                                  + $where + : mixed + = null
                                  +
                                  +
                                  + +
                                  +
                                  + + + +
                                  Return values
                                  + mixed + — + + +
                                  +
                                  +

                                  + debug() + +

                                  + + +

                                  Get / set debug mode.

                                  + + + public + debug([mixed $set = null ]) : bool|self + +

                                  @param boolean $_ Debug mode state. If not given, then used as a getter.

                                  +
                                  + +
                                  Parameters
                                  +
                                  +
                                  + $set + : mixed + = null
                                  +
                                  +
                                  + +
                                  +
                                  + + + +
                                  Return values
                                  + bool|self + — +

                                  Debug mode state if no parameter is given, or +self if used as a setter.

                                  +
                                  + + +
                                  +
                                  +

                                  + delete() + +

                                  + + +

                                  Perform a delete query on a table.

                                  + + + public + delete(string|array<string|int, string> $table[, mixed $where = null ]) : mixed + +

                                  This is a short cut method that creates an update query and then uses +the query('delete'), table, where and exec methods of the query.

                                  +
                                  + +
                                  Parameters
                                  +
                                  +
                                  + $table + : string|array<string|int, string> +
                                  +
                                  +

                                  Table name(s) to act upon. +@param array $where Where condition for what to delete - see Query->where(). +@return Result

                                  +
                                  + +
                                  +
                                  + $where + : mixed + = null
                                  +
                                  +
                                  + +
                                  +
                                  + + + +
                                  Return values
                                  + mixed + — + + +
                                  +
                                  +

                                  + insert() + +

                                  + + +

                                  Insert data into a table.

                                  + + + public + insert(string|array<string|int, string> $table, mixed $set[, mixed $pkey = '' ]) : mixed + +

                                  This is a short cut method that creates an update query and then uses +the query('insert'), table, set and exec methods of the query.

                                  +
                                  + +
                                  Parameters
                                  +
                                  +
                                  + $table + : string|array<string|int, string> +
                                  +
                                  +

                                  Table name(s) to act upon. +@param array $set Field names and values to set - see Query->set(). +@param array $pkey Primary key column names (this is an array for +forwards compt, although only the first item in the array is actually +used). This doesn't need to be set, but it must be if you want to use +the Result->insertId() method. +@return Result

                                  +
                                  + +
                                  +
                                  + $set + : mixed +
                                  +
                                  +
                                  + +
                                  +
                                  + $pkey + : mixed + = ''
                                  +
                                  +
                                  + +
                                  +
                                  + + + +
                                  Return values
                                  + mixed + — + + +
                                  +
                                  +

                                  + push() + +

                                  + + +

                                  Update or Insert data. When doing an insert, the where condition is +added as a set field

                                  + + + public + push(mixed $table, array<string|int, mixed> $set[, mixed $where = null ][, mixed $pkey = '' ]) : mixed + +

                                  @param string|string[] $table Table name(s) to act upon.

                                  +
                                  + +
                                  Parameters
                                  +
                                  +
                                  + $table + : mixed +
                                  +
                                  +
                                  + +
                                  +
                                  + $set + : array<string|int, mixed> +
                                  +
                                  +

                                  Field names and values to set - see Query->set(). +@param array $where Where condition for what to update - see Query->where(). +@param array $pkey Primary key column names (this is an array for +forwards compt, although only the first item in the array is actually +used). This doesn't need to be set, but it must be if you want to use +the Result->insertId() method. Only used if an insert is performed. +@return Result

                                  +
                                  + +
                                  +
                                  + $where + : mixed + = null
                                  +
                                  +
                                  + +
                                  +
                                  + $pkey + : mixed + = ''
                                  +
                                  +
                                  + +
                                  +
                                  + + + +
                                  Return values
                                  + mixed + — + + +
                                  +
                                  +

                                  + query() + +

                                  + + +

                                  Create a query object to build a database query.

                                  + + + public + query(mixed $type[, string|array<string|int, string> $table = null ]) : mixed + +

                                  @param string $type Query type - select, insert, update or delete.

                                  +
                                  + +
                                  Parameters
                                  +
                                  +
                                  + $type + : mixed +
                                  +
                                  +
                                  + +
                                  +
                                  + $table + : string|array<string|int, string> + = null
                                  +
                                  +

                                  Table name(s) to act upon. +@return Query

                                  +
                                  + +
                                  +
                                  + + + +
                                  Return values
                                  + mixed + — + + +
                                  +
                                  +

                                  + quote() + +

                                  + + +

                                  Quote a string for a quote. Note you should generally use a bind!

                                  + + + public + quote(mixed $val[, string $type = PDO::PARAM_STR ]) : mixed + +

                                  @param string $val Value to quote

                                  +
                                  + +
                                  Parameters
                                  +
                                  +
                                  + $val + : mixed +
                                  +
                                  +
                                  + +
                                  +
                                  + $type + : string + = PDO::PARAM_STR
                                  +
                                  +

                                  Value type +@return string

                                  +
                                  + +
                                  +
                                  + + + +
                                  Return values
                                  + mixed + — + + +
                                  +
                                  +

                                  + raw() + +

                                  + + +

                                  Create a `Query` object that will execute a custom SQL query. This is +similar to the `sql` method, but in this case you must call the `exec()` +method of the returned `Query` object manually. This can be useful if you +wish to bind parameters using the query `bind` method to ensure data is +properly escaped.

                                  + + + public + raw() : mixed + +

                                  @return Result

                                  +
                                  + + + +
                                  + Tags + +
                                  +
                                  +
                                  + example +
                                  +
                                  + +

                                  Safely escape user input

                                  +
                                  $db
                                  +  ->raw()
                                  +  ->bind( ':date', $_POST['date'] )
                                  +  ->exec( 'SELECT * FROM staff where date < :date' );
                                  +
                                  +
                                  + +
                                  +
                                  + +
                                  Return values
                                  + mixed + — + + +
                                  +
                                  +

                                  + resource() + +

                                  + + +

                                  Get the database resource connector. This is typically a PDO object.

                                  + + + public + resource() : resource + + + + + +
                                  Return values
                                  + resource + — +

                                  PDO connection resource (driver dependent)

                                  +
                                  + + +
                                  +
                                  +

                                  + rollback() + +

                                  + + +

                                  Rollback the database state to the start of the transaction.

                                  + + + public + rollback() : self + +

                                  Use with Database->transaction() and Database->commit().

                                  +
                                  + + + + +
                                  Return values
                                  + self + — + + +
                                  +
                                  +

                                  + select() + +

                                  + + +

                                  Select data from a table.

                                  + + + public + select(string|array<string|int, string> $table[, mixed $field = "*" ][, mixed $where = null ][, mixed $orderBy = null ]) : mixed + +

                                  This is a short cut method that creates an update query and then uses +the query('select'), table, get, where and exec methods of the query.

                                  +
                                  + +
                                  Parameters
                                  +
                                  +
                                  + $table + : string|array<string|int, string> +
                                  +
                                  +

                                  Table name(s) to act upon. +@param array $field Fields to get from the table(s) - see Query->get(). +@param array $where Where condition for what to select - see Query->where(). +@param array $orderBy Order condition - see Query->order(). +@return Result

                                  +
                                  + +
                                  +
                                  + $field + : mixed + = "*"
                                  +
                                  +
                                  + +
                                  +
                                  + $where + : mixed + = null
                                  +
                                  +
                                  + +
                                  +
                                  + $orderBy + : mixed + = null
                                  +
                                  +
                                  + +
                                  +
                                  + + + +
                                  Return values
                                  + mixed + — + + +
                                  +
                                  +

                                  + selectDistinct() + +

                                  + + +

                                  Select distinct data from a table.

                                  + + + public + selectDistinct(string|array<string|int, string> $table[, mixed $field = "*" ][, mixed $where = null ][, mixed $orderBy = null ]) : mixed + +

                                  This is a short cut method that creates an update query and then uses the +query('select'), distinct ,table, get, where and exec methods of the +query.

                                  +
                                  + +
                                  Parameters
                                  +
                                  +
                                  + $table + : string|array<string|int, string> +
                                  +
                                  +

                                  Table name(s) to act upon. +@param array $field Fields to get from the table(s) - see Query->get(). +@param array $where Where condition for what to select - see Query->where(). +@param array $orderBy Order condition - see Query->order(). +@return Result

                                  +
                                  + +
                                  +
                                  + $field + : mixed + = "*"
                                  +
                                  +
                                  + +
                                  +
                                  + $where + : mixed + = null
                                  +
                                  +
                                  + +
                                  +
                                  + $orderBy + : mixed + = null
                                  +
                                  +
                                  + +
                                  +
                                  + + + +
                                  Return values
                                  + mixed + — + + +
                                  +
                                  +

                                  + sql() + +

                                  + + +

                                  Execute an raw SQL query - i.e. give the method your own SQL, rather +than having the Database classes building it for you.

                                  + + + public + sql(string $sql) : mixed + +

                                  This method will execute the given SQL immediately. Use the raw() +method if you need the ability to add bound parameters.

                                  +
                                  + +
                                  Parameters
                                  +
                                  +
                                  + $sql + : string +
                                  +
                                  +

                                  SQL string to execute (only if _type is 'raw'). +@return Result

                                  +

                                  @example +Basic select

                                  +
                                  $result = $db->sql( 'SELECT * FROM myTable;' );
                                  +
                                  +

                                  @example +Set the character set of the connection

                                  +
                                  $db->sql("SET character_set_client=utf8");
                                  +$db->sql("SET character_set_connection=utf8");
                                  +$db->sql("SET character_set_results=utf8");
                                  +
                                  +
                                  + +
                                  +
                                  + + + +
                                  Return values
                                  + mixed + — + + +
                                  +
                                  +

                                  + transaction() + +

                                  + + +

                                  Start a new database transaction.

                                  + + + public + transaction() : self + +

                                  Use with Database->commit() and Database->rollback().

                                  +
                                  + + + + +
                                  Return values
                                  + self + — + + +
                                  +
                                  +

                                  + type() + +

                                  + + +

                                  Get the database type (e.g. Postgres, Mysql, etc)

                                  + + + public + type() : mixed + + + + + +
                                  Return values
                                  + mixed + — + + +
                                  +
                                  +

                                  + update() + +

                                  + + +

                                  Update data.

                                  + + + public + update(string|array<string|int, string> $table[, mixed $set = null ][, mixed $where = null ]) : mixed + +

                                  This is a short cut method that creates an update query and then uses +the query('update'), table, set, where and exec methods of the query.

                                  +
                                  + +
                                  Parameters
                                  +
                                  +
                                  + $table + : string|array<string|int, string> +
                                  +
                                  +

                                  Table name(s) to act upon. +@param array $set Field names and values to set - see Query->set(). +@param array $where Where condition for what to update - see Query->where(). +@return Result

                                  +
                                  + +
                                  +
                                  + $set + : mixed + = null
                                  +
                                  +
                                  + +
                                  +
                                  + $where + : mixed + = null
                                  +
                                  +
                                  + +
                                  +
                                  + + + +
                                  Return values
                                  + mixed + — + + +
                                  +
                                  + +
                                  +
                                  +
                                  +
                                  +
                                  
                                  +        
                                  + +
                                  +
                                  + + + +
                                  +
                                  +
                                  +
                                  +

                                  Search results

                                  + +
                                  +
                                  +
                                    +
                                    +
                                    +
                                    +
                                    +
                                    + + +
                                    + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Field.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Field.html new file mode 100644 index 00000000..92d6cdbb --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Field.html @@ -0,0 +1,2105 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                    +

                                    Editor PHP 2.1.3

                                    + + + + + +
                                    + +
                                    +
                                    + + + + +
                                    + + +
                                    +

                                    + Field + + + extends Ext + + +
                                    + in package + +
                                    + + +

                                    + + + +

                                    Field definitions for the DataTables Editor.

                                    + +

                                    Each Database column that is used with Editor can be described with this +Field method (both for Editor and Join instances). It basically tells +Editor what table column to use, how to format the data and if you want +to read and/or write this column.

                                    +

                                    Field instances are used with the Editor->field() and +Join->field() methods to describe what fields should be interacted +with by the editable table.

                                    +
                                    + + +
                                    + Tags + +
                                    +
                                    +
                                    + example +
                                    +
                                    + +

                                    Simply get a column with the name "city". No validation is performed.

                                    +
                                      Field::inst( 'city' )
                                    +
                                    +

                                    @example +Get a column with the name "first_name" - when edited a value must +be given due to the "required" validation from the Validate class.

                                    +
                                      Field::inst( 'first_name' )->validator( 'Validate::required' )
                                    +
                                    +

                                    @example +Working with a date field, which is validated, and also has get and +set formatters.

                                    +
                                      Field::inst( 'registered_date' )
                                    +      ->validator( 'Validate::dateFormat', 'D, d M y' )
                                    +      ->getFormatter( 'Format::date_sql_to_format', 'D, d M y' )
                                    +      ->setFormatter( 'Format::date_format_to_sql', 'D, d M y' )
                                    +
                                    +

                                    @example +Using an alias in the first parameter

                                    +
                                      Field::inst( 'name.first as first_name' )
                                    +
                                    +
                                    + +
                                    +
                                    + + + + + + +

                                    + Table of Contents + +

                                    + +
                                    +
                                    + SET_BOTH + +  = 'both' +
                                    +
                                    Set option flag (`set()`) - write to database on both create and edit
                                    + +
                                    + SET_CREATE + +  = 'create' +
                                    +
                                    Set option flag (`set()`) - write to database only on create
                                    + +
                                    + SET_EDIT + +  = 'edit' +
                                    +
                                    Set option flag (`set()`) - write to database only on edit
                                    + +
                                    + SET_NONE + +  = 'none' +
                                    +
                                    Set option flag (`set()`) - do not set data
                                    + +
                                    + __construct() + +  : mixed +
                                    +
                                    Field instance constructor.
                                    + +
                                    + apply() + +  : mixed +
                                    +
                                    Check to see if a field should be used for a particular action (get or set).
                                    + +
                                    + dbField() + +  : mixed +
                                    +
                                    Get / set the DB field name.
                                    + +
                                    + get() + +  : mixed +
                                    +
                                    Get / set the 'get' property of the field.
                                    + +
                                    + getFormatter() + +  : mixed +
                                    +
                                    Get formatter for the field's data.
                                    + +
                                    + getValue() + +  : callable|string|self +
                                    +
                                    Get / set a get value. If given, then this value is used to send to the +client-side, regardless of what value is held by the database.
                                    + +
                                    + inst() + +  : Editor|Field|Join|Upload +
                                    +
                                    Static method to instantiate a new instance of a class (shorthand of +'instantiate').
                                    + +
                                    + instantiate() + +  : Editor|Field|Join|Upload +
                                    +
                                    Static method to instantiate a new instance of a class.
                                    + +
                                    + name() + +  : mixed +
                                    +
                                    Get / set the 'name' property of the field.
                                    + +
                                    + options() + +  : Field +
                                    +
                                    Get a list of values that can be used for the options list in radio, +select and checkbox inputs from the database for this field.
                                    + +
                                    + searchBuilderOptions() + +  : self +
                                    +
                                    Get a list of values that can be used for the options list in SearchBuilder
                                    + +
                                    + searchPaneOptions() + +  : self +
                                    +
                                    Get a list of values that can be used for the options list in SearchPanes
                                    + +
                                    + set() + +  : mixed +
                                    +
                                    Get / set the 'set' property of the field.
                                    + +
                                    + setFormatter() + +  : mixed +
                                    +
                                    Set formatter for the field's data.
                                    + +
                                    + setValue() + +  : callable|string|self +
                                    +
                                    Get / set a set value. If given, then this value is used to write to the +database regardless of what data is sent from the client-side.
                                    + +
                                    + upload() + +  : Upload|self +
                                    +
                                    Get / set the upload class for this field.
                                    + +
                                    + val() + +  : mixed +
                                    +
                                    Get the value of the field, taking into account if it is coming from the +DB or from a POST. If formatting has been specified for this field, it +will be applied here.
                                    + +
                                    + validator() + +  : mixed +
                                    +
                                    Get / set the 'validator' of the field.
                                    + +
                                    + xss() + +  : Field +
                                    +
                                    Set a formatting method that will be used for XSS checking / removal.
                                    + +
                                    + xssSafety() + +  : string +
                                    +
                                    Perform XSS prevention on an input.
                                    + +
                                    + _getSet() + +  : mixed +
                                    +
                                    Common getter / setter function for DataTables classes.
                                    + +
                                    + _propExists() + +  : bool +
                                    +
                                    Determine if a property is available in a data set (allowing `null` to be +a valid value)
                                    + +
                                    + _readProp() + +  : mixed +
                                    +
                                    Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.
                                    + +
                                    + _writeProp() + +  : mixed +
                                    +
                                    Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).
                                    + +
                                    + + + + +
                                    +

                                    + Constants + +

                                    +
                                    +

                                    + SET_BOTH + +

                                    + + + +

                                    Set option flag (`set()`) - write to database on both create and edit

                                    + + + public + mixed + SET_BOTH + = 'both' + + + + +
                                    + + + +
                                    +
                                    +

                                    + SET_CREATE + +

                                    + + + +

                                    Set option flag (`set()`) - write to database only on create

                                    + + + public + mixed + SET_CREATE + = 'create' + + + + +
                                    + + + +
                                    +
                                    +

                                    + SET_EDIT + +

                                    + + + +

                                    Set option flag (`set()`) - write to database only on edit

                                    + + + public + mixed + SET_EDIT + = 'edit' + + + + +
                                    + + + +
                                    +
                                    +

                                    + SET_NONE + +

                                    + + + +

                                    Set option flag (`set()`) - do not set data

                                    + + + public + mixed + SET_NONE + = 'none' + + + + +
                                    + + + +
                                    +
                                    + + + +
                                    +

                                    + Methods + +

                                    +
                                    +

                                    + __construct() + +

                                    + + +

                                    Field instance constructor.

                                    + + + public + __construct([mixed $dbField = null ][, string $name = null ]) : mixed + +

                                    @param string $dbField Name of the database column

                                    +
                                    + +
                                    Parameters
                                    +
                                    +
                                    + $dbField + : mixed + = null
                                    +
                                    +
                                    + +
                                    +
                                    + $name + : string + = null
                                    +
                                    +

                                    Name to use in the JSON output from Editor and the +HTTP submit from the client-side when editing. If not given then the +$dbField name is used.

                                    +
                                    + +
                                    +
                                    + + + +
                                    Return values
                                    + mixed + — + + +
                                    +
                                    +

                                    + apply() + +

                                    + + +

                                    Check to see if a field should be used for a particular action (get or set).

                                    + + + public + apply(string $action[, mixed $data = null ]) : mixed + +

                                    Called by the Editor / Join class instances - not expected for general +consumption - internal.

                                    +
                                    + +
                                    Parameters
                                    +
                                    +
                                    + $action + : string +
                                    +
                                    +

                                    Direction that the data is travelling - 'get' is +reading DB data, create and edit for writing to the DB +@param array $data Data submitted from the client-side when setting. +@return boolean true if the field should be used in the get / set. +@internal

                                    +
                                    + +
                                    +
                                    + $data + : mixed + = null
                                    +
                                    +
                                    + +
                                    +
                                    + + + +
                                    Return values
                                    + mixed + — + + +
                                    +
                                    +

                                    + dbField() + +

                                    + + +

                                    Get / set the DB field name.

                                    + + + public + dbField([string $_ = null ]) : mixed + +

                                    Note that when used as a setter, an alias can be given for the field +using the SQL as keyword - for example: firstName as name. In this +situation the dbField is set to the field name before the as, and the +field's name (name()) is set to the name after the as.

                                    +

                                    As a result of this, the following constructs have identical +functionality:

                                    +

                                    Field::inst( 'firstName as name' ); +Field::inst( 'firstName', 'name' );

                                    +
                                    + +
                                    Parameters
                                    +
                                    +
                                    + $_ + : string + = null
                                    +
                                    +

                                    Value to set if using as a setter. +@return string|self The name of the db field if no parameter is given, +or self if used as a setter.

                                    +
                                    + +
                                    +
                                    + + + +
                                    Return values
                                    + mixed + — + + +
                                    +
                                    +

                                    + get() + +

                                    + + +

                                    Get / set the 'get' property of the field.

                                    + + + public + get([bool $_ = null ]) : mixed + +

                                    A field can be marked as write only when setting the get property to false +here.

                                    +
                                    + +
                                    Parameters
                                    +
                                    +
                                    + $_ + : bool + = null
                                    +
                                    +

                                    Value to set if using as a setter. +@return boolean|self The get property if no parameter is given, or self +if used as a setter.

                                    +
                                    + +
                                    +
                                    + + + +
                                    Return values
                                    + mixed + — + + +
                                    +
                                    +

                                    + getFormatter() + +

                                    + + +

                                    Get formatter for the field's data.

                                    + + + public + getFormatter([callable|string $_ = null ][, mixed $opts = null ]) : mixed + +

                                    When the data has been retrieved from the server, it can be passed through +a formatter here, which will manipulate (format) the data as required. This +can be useful when, for example, working with dates and a particular format +is required on the client-side.

                                    +

                                    Editor has a number of formatters available with the Format class +which can be used directly with this method.

                                    +
                                    + +
                                    Parameters
                                    +
                                    +
                                    + $_ + : callable|string + = null
                                    +
                                    +

                                    Value to set if using as a setter. Can be given as +a closure function or a string with a reference to a function that will +be called with call_user_func(). +@param mixed $opts Variable that is passed through to the get formatting +function - can be useful for passing through extra information such as +date formatting string, or a required flag. The actual options available +depend upon the formatter used. +@return callable|string|self The get formatter if no parameter is given, or +self if used as a setter.

                                    +
                                    + +
                                    +
                                    + $opts + : mixed + = null
                                    +
                                    +
                                    + +
                                    +
                                    + + + +
                                    Return values
                                    + mixed + — + + +
                                    +
                                    +

                                    + getValue() + +

                                    + + +

                                    Get / set a get value. If given, then this value is used to send to the +client-side, regardless of what value is held by the database.

                                    + + + public + getValue([callable|string|number $_ = null ]) : callable|string|self + + +
                                    Parameters
                                    +
                                    +
                                    + $_ + : callable|string|number + = null
                                    +
                                    +

                                    Value to set, or no value to use as a +getter

                                    +
                                    + +
                                    +
                                    + + + +
                                    Return values
                                    + callable|string|self + — +

                                    Value if used as a getter, or self if used +as a setter.

                                    +
                                    + + +
                                    +
                                    +

                                    + inst() + +

                                    + + +

                                    Static method to instantiate a new instance of a class (shorthand of +'instantiate').

                                    + + + public + static inst() : Editor|Field|Join|Upload + +

                                    This method performs exactly the same actions as the 'instantiate' +static method, but is simply shorter and easier to type!

                                    +
                                    + + + + +
                                    Return values
                                    + Editor|Field|Join|Upload + — +

                                    class +@static

                                    +
                                    + + +
                                    +
                                    +

                                    + instantiate() + +

                                    + + +

                                    Static method to instantiate a new instance of a class.

                                    + + + public + static instantiate() : Editor|Field|Join|Upload + +

                                    A factory method that will create a new instance of the class +that has extended 'Ext'. This allows classes to be instantiated +and then chained - which otherwise isn't available until PHP 5.4. +If using PHP 5.4 or later, simply create a 'new' instance of the +target class and chain methods as normal.

                                    +
                                    + + + + +
                                    Return values
                                    + Editor|Field|Join|Upload + — +

                                    Instantiated class +@static

                                    +
                                    + + +
                                    +
                                    +

                                    + name() + +

                                    + + +

                                    Get / set the 'name' property of the field.

                                    + + + public + name([string $_ = null ]) : mixed + +

                                    The name is typically the same as the dbField name, since it makes things +less confusing(!), but it is possible to set a different name for the data +which is used in the JSON returned to DataTables in a 'get' operation and +the field name used in a 'set' operation.

                                    +
                                    + +
                                    Parameters
                                    +
                                    +
                                    + $_ + : string + = null
                                    +
                                    +

                                    Value to set if using as a setter. +@return string|self The name property if no parameter is given, or self +if used as a setter.

                                    +
                                    + +
                                    +
                                    + + + +
                                    Return values
                                    + mixed + — + + +
                                    +
                                    +

                                    + options() + +

                                    + + +

                                    Get a list of values that can be used for the options list in radio, +select and checkbox inputs from the database for this field.

                                    + + + public + options([string|callable $table = null ][, string $value = null ][, string $label = null ][, callable $condition = null ][, callable $format = null ][, string $order = null ]) : Field + +

                                    Note that this is for simple 'label / value' pairs only. For more complex +data, including pairs that require joins and where conditions, use a +closure to provide a query

                                    +
                                    + +
                                    Parameters
                                    +
                                    +
                                    + $table + : string|callable + = null
                                    +
                                    +

                                    Database table name to use to get the +paired data from, or a closure function if providing a method

                                    +
                                    + +
                                    +
                                    + $value + : string + = null
                                    +
                                    +

                                    Table column name that contains the pair's +value. Not used if the first parameter is given as a closure

                                    +
                                    + +
                                    +
                                    + $label + : string + = null
                                    +
                                    +

                                    Table column name that contains the pair's +label. Not used if the first parameter is given as a closure

                                    +
                                    + +
                                    +
                                    + $condition + : callable + = null
                                    +
                                    +

                                    Function that will add where +conditions to the query

                                    +
                                    + +
                                    +
                                    + $format + : callable + = null
                                    +
                                    +

                                    Function will render each label

                                    +
                                    + +
                                    +
                                    + $order + : string + = null
                                    +
                                    +

                                    SQL ordering

                                    +
                                    + +
                                    +
                                    + + + +
                                    Return values
                                    + Field + — +

                                    Self for chaining

                                    +
                                    + + +
                                    +
                                    +

                                    + searchBuilderOptions() + +

                                    + + +

                                    Get a list of values that can be used for the options list in SearchBuilder

                                    + + + public + searchBuilderOptions([SearchBuilderOptions|callable $sbInput = null ]) : self + + +
                                    Parameters
                                    +
                                    +
                                    + $sbInput + : SearchBuilderOptions|callable + = null
                                    +
                                    +

                                    SearchBuilderOptions instance or a closure function if providing a method

                                    +
                                    + +
                                    +
                                    + + + +
                                    Return values
                                    + self + — + + +
                                    +
                                    +

                                    + searchPaneOptions() + +

                                    + + +

                                    Get a list of values that can be used for the options list in SearchPanes

                                    + + + public + searchPaneOptions([SearchPaneOptions|callable $spInput = null ]) : self + + +
                                    Parameters
                                    +
                                    +
                                    + $spInput + : SearchPaneOptions|callable + = null
                                    +
                                    +

                                    SearchPaneOptions instance or a closure function if providing a method

                                    +
                                    + +
                                    +
                                    + + + +
                                    Return values
                                    + self + — + + +
                                    +
                                    +

                                    + set() + +

                                    + + +

                                    Get / set the 'set' property of the field.

                                    + + + public + set([string|bool $_ = null ]) : mixed + +

                                    A field can be marked as read only using this option, to be set only +during an create or edit action or to be set during both actions. This +provides the ability to have fields that are only set when a new row is +created (for example a "created" time stamp).

                                    +
                                    + +
                                    Parameters
                                    +
                                    +
                                    + $_ + : string|bool + = null
                                    +
                                    +

                                    Value to set when the method is being used as a +setter (leave as undefined to use as a getter). This can take the +value of:

                                    +
                                      +
                                    • +true - Same as Field::SET_BOTH +
                                    • +
                                    • +false - Same as Field::SET_NONE +
                                    • +
                                    • +Field::SET_BOTH - Set the database value on both create and edit commands
                                    • +
                                    • +Field::SET_NONE - Never set the database value
                                    • +
                                    • +Field::SET_CREATE - Set the database value only on create
                                    • +
                                    • +Field::SET_EDIT - Set the database value only on edit +@return string|self The set property if no parameter is given, or self +if used as a setter.
                                    • +
                                    +
                                    + +
                                    +
                                    + + + +
                                    Return values
                                    + mixed + — + + +
                                    +
                                    +

                                    + setFormatter() + +

                                    + + +

                                    Set formatter for the field's data.

                                    + + + public + setFormatter([callable|string $_ = null ][, mixed $opts = null ]) : mixed + +

                                    When the data has been retrieved from the server, it can be passed through +a formatter here, which will manipulate (format) the data as required. This +can be useful when, for example, working with dates and a particular format +is required on the client-side.

                                    +

                                    Editor has a number of formatters available with the Format class +which can be used directly with this method.

                                    +
                                    + +
                                    Parameters
                                    +
                                    +
                                    + $_ + : callable|string + = null
                                    +
                                    +

                                    Value to set if using as a setter. Can be given as +a closure function or a string with a reference to a function that will +be called with call_user_func(). +@param mixed $opts Variable that is passed through to the get formatting +function - can be useful for passing through extra information such as +date formatting string, or a required flag. The actual options available +depend upon the formatter used. +@return callable|string|self The set formatter if no parameter is given, or +self if used as a setter.

                                    +
                                    + +
                                    +
                                    + $opts + : mixed + = null
                                    +
                                    +
                                    + +
                                    +
                                    + + + +
                                    Return values
                                    + mixed + — + + +
                                    +
                                    +

                                    + setValue() + +

                                    + + +

                                    Get / set a set value. If given, then this value is used to write to the +database regardless of what data is sent from the client-side.

                                    + + + public + setValue([callable|string|number $_ = null ]) : callable|string|self + + +
                                    Parameters
                                    +
                                    +
                                    + $_ + : callable|string|number + = null
                                    +
                                    +

                                    Value to set, or no value to use as a +getter

                                    +
                                    + +
                                    +
                                    + + + +
                                    Return values
                                    + callable|string|self + — +

                                    Value if used as a getter, or self if used +as a setter.

                                    +
                                    + + +
                                    +
                                    +

                                    + upload() + +

                                    + + +

                                    Get / set the upload class for this field.

                                    + + + public + upload([Upload $_ = null ]) : Upload|self + + +
                                    Parameters
                                    +
                                    +
                                    + $_ + : Upload + = null
                                    +
                                    +

                                    Upload class if used as a setter

                                    +
                                    + +
                                    +
                                    + + + +
                                    Return values
                                    + Upload|self + — +

                                    Value if used as a getter, or self if used +as a setter.

                                    +
                                    + + +
                                    +
                                    +

                                    + val() + +

                                    + + +

                                    Get the value of the field, taking into account if it is coming from the +DB or from a POST. If formatting has been specified for this field, it +will be applied here.

                                    + + + public + val(string $direction, mixed $data) : mixed + +

                                    Called by the Editor / Join class instances - not expected for general +consumption - internal.

                                    +
                                    + +
                                    Parameters
                                    +
                                    +
                                    + $direction + : string +
                                    +
                                    +

                                    Direction that the data is travelling - 'get' is +reading data, and 'set' is writing it to the DB. +@param array $data Data submitted from the client-side when setting or the +data for the row when getting data from the DB. +@return string Value for the field +@internal

                                    +
                                    + +
                                    +
                                    + $data + : mixed +
                                    +
                                    +
                                    + +
                                    +
                                    + + + +
                                    Return values
                                    + mixed + — + + +
                                    +
                                    +

                                    + validator() + +

                                    + + +

                                    Get / set the 'validator' of the field.

                                    + + + public + validator([callable|string $_ = null ][, mixed $opts = null ]) : mixed + +

                                    The validator can be used to check if any abstract piece of data is valid +or not according to the given rules of the validation function used.

                                    +

                                    Multiple validation options can be applied to a field instance by calling +this method multiple times. For example, it would be possible to have a +'required' validation and a 'maxLength' validation with multiple calls.

                                    +

                                    Editor has a number of validation available with the Validate class +which can be used directly with this method.

                                    +
                                    + +
                                    Parameters
                                    +
                                    +
                                    + $_ + : callable|string + = null
                                    +
                                    +

                                    Value to set if using as the validation method. +Can be given as a closure function or a string with a reference to a +function that will be called with call_user_func(). +@param mixed $opts Variable that is passed through to the validation +function - can be useful for passing through extra information such as +date formatting string, or a required flag. The actual options available +depend upon the validation function used. +@return callable|string|self The validation method if no parameter is given, +or self if used as a setter.

                                    +
                                    + +
                                    +
                                    + $opts + : mixed + = null
                                    +
                                    +
                                    + +
                                    +
                                    + + + +
                                    Return values
                                    + mixed + — + + +
                                    +
                                    +

                                    + xss() + +

                                    + + +

                                    Set a formatting method that will be used for XSS checking / removal.

                                    + + + public + xss(callable|false $xssFormatter) : Field + +

                                    This should be a function that takes a single argument (the value to be +cleaned) and returns the cleaned value.

                                    +

                                    Editor will use HtmLawed by default for this operation, which is built +into the software and no additional configuration is required, but a +custom function can be used if you wish to use a different formatter such +as HTMLPurifier.

                                    +

                                    If you wish to disable this option (which you would only do if you are +absolutely confident that your validation will pick up on any XSS inputs) +simply provide a closure function that returns the value given to the +function. This is not recommended.

                                    +
                                    + +
                                    Parameters
                                    +
                                    +
                                    + $xssFormatter + : callable|false +
                                    +
                                    +

                                    XSS cleaner function, use false or +null to disable XSS cleaning.

                                    +
                                    + +
                                    +
                                    + + + +
                                    Return values
                                    + Field + — +

                                    Self for chaining.

                                    +
                                    + + +
                                    +
                                    +

                                    + xssSafety() + +

                                    + + +

                                    Perform XSS prevention on an input.

                                    + + + public + xssSafety(mixed $val) : string + + +
                                    Parameters
                                    +
                                    +
                                    + $val + : mixed +
                                    +
                                    +

                                    Value to be escaped

                                    +
                                    + +
                                    +
                                    + + + +
                                    Return values
                                    + string + — +

                                    Safe value

                                    +
                                    + + +
                                    +
                                    +

                                    + _getSet() + +

                                    + + +

                                    Common getter / setter function for DataTables classes.

                                    + + + protected + _getSet(mixed &$prop, mixed $val[, mixed $array = false ]) : mixed + +

                                    This getter / setter method makes building getter / setting methods +easier, by abstracting everything to a single function call.

                                    +
                                    + +
                                    Parameters
                                    +
                                    +
                                    + $prop + : mixed +
                                    +
                                    +

                                    The property to set +@param mixed $val The value to set - if given as null, then we assume +that the function is being used as a getter. +@param boolean $array Treat the target property as an array or not +(default false). If used as an array, then values passed in are added +to the $prop array. +@return self|mixed Class instance if setting (allowing chaining), or +the value requested if getting.

                                    +
                                    + +
                                    +
                                    + $val + : mixed +
                                    +
                                    +
                                    + +
                                    +
                                    + $array + : mixed + = false
                                    +
                                    +
                                    + +
                                    +
                                    + + + +
                                    Return values
                                    + mixed + — + + +
                                    +
                                    +

                                    + _propExists() + +

                                    + + +

                                    Determine if a property is available in a data set (allowing `null` to be +a valid value)

                                    + + + protected + _propExists(string $name, array<string|int, mixed> $data) : bool + + +
                                    Parameters
                                    +
                                    +
                                    + $name + : string +
                                    +
                                    +

                                    Javascript dotted object name to write to

                                    +
                                    + +
                                    +
                                    + $data + : array<string|int, mixed> +
                                    +
                                    +

                                    Data source array to read from

                                    +
                                    + +
                                    +
                                    + + +
                                    + Tags + +
                                    +
                                    +
                                    + private +
                                    +
                                    + + +
                                    +
                                    + +
                                    Return values
                                    + bool + — +

                                    true if present, false otherwise

                                    +
                                    + + +
                                    +
                                    +

                                    + _readProp() + +

                                    + + +

                                    Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.

                                    + + + protected + _readProp(string $name, array<string|int, mixed> $data) : mixed + + +
                                    Parameters
                                    +
                                    +
                                    + $name + : string +
                                    +
                                    +

                                    Javascript dotted object name to write to

                                    +
                                    + +
                                    +
                                    + $data + : array<string|int, mixed> +
                                    +
                                    +

                                    Data source array to read from

                                    +
                                    + +
                                    +
                                    + + +
                                    + Tags + +
                                    +
                                    +
                                    + private +
                                    +
                                    + + +
                                    +
                                    + +
                                    Return values
                                    + mixed + — +

                                    The read value, or null if no value found.

                                    +
                                    + + +
                                    +
                                    +

                                    + _writeProp() + +

                                    + + +

                                    Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).

                                    + + + protected + _writeProp(array<string|int, mixed> &$out, string $name, mixed $value) : mixed + + +
                                    Parameters
                                    +
                                    +
                                    + $out + : array<string|int, mixed> +
                                    +
                                    +

                                    Array to write the data to

                                    +
                                    + +
                                    +
                                    + $name + : string +
                                    +
                                    +

                                    Javascript dotted object name to write to

                                    +
                                    + +
                                    +
                                    + $value + : mixed +
                                    +
                                    +

                                    Value to write

                                    +
                                    + +
                                    +
                                    + + +
                                    + Tags + +
                                    +
                                    +
                                    + throws +
                                    +
                                    + Exception + +

                                    Information about duplicate properties

                                    +
                                    + +
                                    +
                                    + private +
                                    +
                                    + + +
                                    +
                                    + +
                                    Return values
                                    + mixed + — + + +
                                    +
                                    + +
                                    +
                                    +
                                    +
                                    +
                                    
                                    +        
                                    + +
                                    +
                                    + + + +
                                    +
                                    +
                                    +
                                    +

                                    Search results

                                    + +
                                    +
                                    +
                                      +
                                      +
                                      +
                                      +
                                      +
                                      + + +
                                      + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Format.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Format.html new file mode 100644 index 00000000..5d129d6a --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Format.html @@ -0,0 +1,1112 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                      +

                                      Editor PHP 2.1.3

                                      + + + + + +
                                      + +
                                      +
                                      + + + + +
                                      + + +
                                      +

                                      + Format + + +
                                      + in package + +
                                      + + +

                                      + + + +

                                      Formatter methods for the DataTables Editor

                                      + +

                                      All methods in this class are static with common inputs and returns.

                                      +
                                      + + + + + + + + +

                                      + Table of Contents + +

                                      + +
                                      +
                                      + DATE_EPOCH + +  = "U" +
                                      +
                                      Date format: 1331251200. jQuery UI equivalent format: @
                                      + +
                                      + DATE_ISO_1036 + +  = "D, j M y" +
                                      +
                                      Date format: Fri, 9 Mar 12. jQuery UI equivalent format: D, d M y
                                      + +
                                      + DATE_ISO_1123 + +  = "D, j M Y" +
                                      +
                                      Date format: Fri, 9 Mar 2012. jQuery UI equivalent format: D, d M yy
                                      + +
                                      + DATE_ISO_2822 + +  = "D, j M Y" +
                                      +
                                      Date format: Fri, 9 Mar 2012. jQuery UI equivalent format: D, d M yy
                                      + +
                                      + DATE_ISO_822 + +  = "D, j M y" +
                                      +
                                      Date format: Fri, 9 Mar 12. jQuery UI equivalent format: D, d M y
                                      + +
                                      + DATE_ISO_850 + +  = "l, d-M-y" +
                                      +
                                      Date format: Friday, 09-Mar-12. jQuery UI equivalent format: DD, dd-M-y
                                      + +
                                      + DATE_ISO_8601 + +  = "Y-m-d" +
                                      +
                                      Date format: 2012-03-09. jQuery UI equivalent format: yy-mm-dd
                                      + +
                                      + DATE_TIMESTAMP + +  = "U" +
                                      +
                                      Date format: 1331251200. jQuery UI equivalent format: @
                                      + +
                                      + DATE_USA + +  = "m-d-Y" +
                                      +
                                      Date format: March-. jQuery UI equivalent format: D, d M yy
                                      + +
                                      + dateFormatToSql() + +  : mixed +
                                      +
                                      Convert from a format given by the options parameter to a format that +SQL servers will recognise as a date.
                                      + +
                                      + dateSqlToFormat() + +  : mixed +
                                      +
                                      Convert from SQL date / date time format to a format given by the options +parameter.
                                      + +
                                      + datetime() + +  : mixed +
                                      +
                                      Convert from one date time format to another
                                      + +
                                      + explode() + +  : mixed +
                                      +
                                      Convert a string of values into an array for use with checkboxes.
                                      + +
                                      + fromDecimalChar() + +  : mixed +
                                      +
                                      Convert a number from using any character other than a period (dot) to +one which does use a period. This is useful for allowing numeric user +input in regions where a comma is used as the decimal character. Use with +a set formatter.
                                      + +
                                      + ifEmpty() + +  : mixed +
                                      +
                                      Formatter that can be used to specify what value should be used if an +empty value is submitted by the client-side (e.g. null, 0, 'Not set', +etc)
                                      + +
                                      + implode() + +  : mixed +
                                      +
                                      Convert an array of values from a checkbox into a string which can be +used to store in a text field in a database.
                                      + +
                                      + nullEmpty() + +  : mixed +
                                      +
                                      Convert an empty string to `null`. Null values are very useful in +databases, but HTTP variables have no way of representing `null` as a +value, often leading to an empty string and null overlapping. This method +will check the value to operate on and return null if it is empty.
                                      + +
                                      + toDecimalChar() + +  : mixed +
                                      +
                                      Convert a number with a period (dot) as the decimal character to use +a different character (typically a comma). Use with a get formatter.
                                      + +
                                      + + + + +
                                      +

                                      + Constants + +

                                      +
                                      +

                                      + DATE_EPOCH + +

                                      + + + +

                                      Date format: 1331251200. jQuery UI equivalent format: @

                                      + + + public + mixed + DATE_EPOCH + = "U" + + + + +
                                      + + + +
                                      +
                                      +

                                      + DATE_ISO_1036 + +

                                      + + + +

                                      Date format: Fri, 9 Mar 12. jQuery UI equivalent format: D, d M y

                                      + + + public + mixed + DATE_ISO_1036 + = "D, j M y" + + + + +
                                      + + + +
                                      +
                                      +

                                      + DATE_ISO_1123 + +

                                      + + + +

                                      Date format: Fri, 9 Mar 2012. jQuery UI equivalent format: D, d M yy

                                      + + + public + mixed + DATE_ISO_1123 + = "D, j M Y" + + + + +
                                      + + + +
                                      +
                                      +

                                      + DATE_ISO_2822 + +

                                      + + + +

                                      Date format: Fri, 9 Mar 2012. jQuery UI equivalent format: D, d M yy

                                      + + + public + mixed + DATE_ISO_2822 + = "D, j M Y" + + + + +
                                      + + + +
                                      +
                                      +

                                      + DATE_ISO_822 + +

                                      + + + +

                                      Date format: Fri, 9 Mar 12. jQuery UI equivalent format: D, d M y

                                      + + + public + mixed + DATE_ISO_822 + = "D, j M y" + + + + +
                                      + + + +
                                      +
                                      +

                                      + DATE_ISO_850 + +

                                      + + + +

                                      Date format: Friday, 09-Mar-12. jQuery UI equivalent format: DD, dd-M-y

                                      + + + public + mixed + DATE_ISO_850 + = "l, d-M-y" + + + + +
                                      + + + +
                                      +
                                      +

                                      + DATE_ISO_8601 + +

                                      + + + +

                                      Date format: 2012-03-09. jQuery UI equivalent format: yy-mm-dd

                                      + + + public + mixed + DATE_ISO_8601 + = "Y-m-d" + + + + +
                                      + + + +
                                      +
                                      +

                                      + DATE_TIMESTAMP + +

                                      + + + +

                                      Date format: 1331251200. jQuery UI equivalent format: @

                                      + + + public + mixed + DATE_TIMESTAMP + = "U" + + + + +
                                      + + + +
                                      +
                                      +

                                      + DATE_USA + +

                                      + + + +

                                      Date format: March-. jQuery UI equivalent format: D, d M yy

                                      + + + public + mixed + DATE_USA + = "m-d-Y" + + + + +
                                      + + + +
                                      +
                                      + + + +
                                      +

                                      + Methods + +

                                      +
                                      +

                                      + dateFormatToSql() + +

                                      + + +

                                      Convert from a format given by the options parameter to a format that +SQL servers will recognise as a date.

                                      + + + public + static dateFormatToSql(mixed $format) : mixed + +

                                      Typical use of this method is to use it with the +Field::getFormatter() and Field::setFormatter() methods of +Field where the parameters required for this method will be +automatically satisfied.

                                      +
                                      + +
                                      Parameters
                                      +
                                      +
                                      + $format + : mixed +
                                      +
                                      +
                                      + +
                                      +
                                      + + + +
                                      Return values
                                      + mixed + — + + +
                                      +
                                      +

                                      + dateSqlToFormat() + +

                                      + + +

                                      Convert from SQL date / date time format to a format given by the options +parameter.

                                      + + + public + static dateSqlToFormat(mixed $format) : mixed + +

                                      Typical use of this method is to use it with the +Field::getFormatter() and Field::setFormatter() methods of +Field where the parameters required for this method will be +automatically satisfied.

                                      +
                                      + +
                                      Parameters
                                      +
                                      +
                                      + $format + : mixed +
                                      +
                                      +
                                      + +
                                      +
                                      + + + +
                                      Return values
                                      + mixed + — + + +
                                      +
                                      +

                                      + datetime() + +

                                      + + +

                                      Convert from one date time format to another

                                      + + + public + static datetime(mixed $from, mixed $to) : mixed + +

                                      Typical use of this method is to use it with the +Field::getFormatter() and Field::setFormatter() methods of +Field where the parameters required for this method will be +automatically satisfied.

                                      +
                                      + +
                                      Parameters
                                      +
                                      +
                                      + $from + : mixed +
                                      +
                                      +
                                      + +
                                      +
                                      + $to + : mixed +
                                      +
                                      +
                                      + +
                                      +
                                      + + + +
                                      Return values
                                      + mixed + — + + +
                                      +
                                      +

                                      + explode() + +

                                      + + +

                                      Convert a string of values into an array for use with checkboxes.

                                      + + + public + static explode([mixed $char = '|' ]) : mixed + +

                                      @param string $val Value to convert to from a string to an array

                                      +
                                      + +
                                      Parameters
                                      +
                                      +
                                      + $char + : mixed + = '|'
                                      +
                                      +
                                      + +
                                      +
                                      + + + +
                                      Return values
                                      + mixed + — + + +
                                      +
                                      +

                                      + fromDecimalChar() + +

                                      + + +

                                      Convert a number from using any character other than a period (dot) to +one which does use a period. This is useful for allowing numeric user +input in regions where a comma is used as the decimal character. Use with +a set formatter.

                                      + + + public + static fromDecimalChar([mixed $char = ',' ]) : mixed + +

                                      @param string $val Value to convert to from a string to an array

                                      +
                                      + +
                                      Parameters
                                      +
                                      +
                                      + $char + : mixed + = ','
                                      +
                                      +
                                      + +
                                      +
                                      + + + +
                                      Return values
                                      + mixed + — + + +
                                      +
                                      +

                                      + ifEmpty() + +

                                      + + +

                                      Formatter that can be used to specify what value should be used if an +empty value is submitted by the client-side (e.g. null, 0, 'Not set', +etc)

                                      + + + public + static ifEmpty(mixed $ret) : mixed + +

                                      @param string $val Value to convert to from a string to an array

                                      +
                                      + +
                                      Parameters
                                      +
                                      +
                                      + $ret + : mixed +
                                      +
                                      +
                                      + +
                                      +
                                      + + + +
                                      Return values
                                      + mixed + — + + +
                                      +
                                      +

                                      + implode() + +

                                      + + +

                                      Convert an array of values from a checkbox into a string which can be +used to store in a text field in a database.

                                      + + + public + static implode([mixed $char = '|' ]) : mixed + +

                                      @param string $val Value to convert to from an array to a string

                                      +
                                      + +
                                      Parameters
                                      +
                                      +
                                      + $char + : mixed + = '|'
                                      +
                                      +
                                      + +
                                      +
                                      + + + +
                                      Return values
                                      + mixed + — + + +
                                      +
                                      +

                                      + nullEmpty() + +

                                      + + +

                                      Convert an empty string to `null`. Null values are very useful in +databases, but HTTP variables have no way of representing `null` as a +value, often leading to an empty string and null overlapping. This method +will check the value to operate on and return null if it is empty.

                                      + + + public + static nullEmpty() : mixed + +

                                      @param string $val Value to convert to from a string to an array

                                      +
                                      + + + + +
                                      Return values
                                      + mixed + — + + +
                                      +
                                      +

                                      + toDecimalChar() + +

                                      + + +

                                      Convert a number with a period (dot) as the decimal character to use +a different character (typically a comma). Use with a get formatter.

                                      + + + public + static toDecimalChar([mixed $char = ',' ]) : mixed + +

                                      @param string $val Value to convert to from a string to an array

                                      +
                                      + +
                                      Parameters
                                      +
                                      +
                                      + $char + : mixed + = ','
                                      +
                                      +
                                      + +
                                      +
                                      + + + +
                                      Return values
                                      + mixed + — + + +
                                      +
                                      + +
                                      +
                                      +
                                      +
                                      +
                                      
                                      +        
                                      + +
                                      +
                                      + + + +
                                      +
                                      +
                                      +
                                      +

                                      Search results

                                      + +
                                      +
                                      +
                                        +
                                        +
                                        +
                                        +
                                        +
                                        + + +
                                        + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Join.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Join.html new file mode 100644 index 00000000..70b3d1ea --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Join.html @@ -0,0 +1,2087 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                        +

                                        Editor PHP 2.1.3

                                        + + + + + +
                                        + +
                                        +
                                        + + + + +
                                        + + +
                                        +

                                        + Join + + + extends Ext + + +
                                        + in package + +
                                        + + +

                                        + + + +

                                        Join table class for DataTables Editor.

                                        + +

                                        The Join class can be used with Editor->join() to allow Editor to +obtain joined information from the database.

                                        +

                                        For an overview of how Join tables work, please refer to the +Editor manual as it is +useful to understand how this class represents the links between tables, +before fully getting to grips with it's API.

                                        +
                                        + + +
                                        + Tags + +
                                        +
                                        +
                                        + example +
                                        +
                                        + +

                                        Join the parent table (the one specified in the Editor->table() +method) with the table access, with a link table user__access, which +allows multiple properties to be found for each row in the parent table.

                                        +
                                          Join::inst( 'access', 'array' )
                                        +      ->link( 'users.id', 'user_access.user_id' )
                                        +      ->link( 'access.id', 'user_access.access_id' )
                                        +      ->field(
                                        +          Field::inst( 'id' )->validator( 'Validate::required' ),
                                        +          Field::inst( 'name' )
                                        +      )
                                        +
                                        +

                                        @example +Single row join - here we join the parent table with a single row in +the child table, without an intermediate link table. In this case the +child table is called extra and the two fields give the columns that +Editor will read from that table.

                                        +
                                            Join::inst( 'extra', 'object' )
                                        +        ->link( 'user.id', 'extra.user_id' )
                                        +        ->field(
                                        +            Field::inst( 'comments' ),
                                        +            Field::inst( 'review' )
                                        +        )
                                        +
                                        +
                                        + +
                                        +
                                        + + + + + + +

                                        + Table of Contents + +

                                        + +
                                        +
                                        + __construct() + +  : mixed +
                                        +
                                        Join instance constructor.
                                        + +
                                        + aliasParentTable() + +  : mixed +
                                        +
                                        Get / set parent table alias.
                                        + +
                                        + create() + +  : mixed +
                                        +
                                        Create a row.
                                        + +
                                        + data() + +  : mixed +
                                        +
                                        Get data
                                        + +
                                        + field() + +  : mixed +
                                        +
                                        Get / set field instances.
                                        + +
                                        + fields() + +  : mixed +
                                        +
                                        Get / set field instances.
                                        + +
                                        + get() + +  : mixed +
                                        +
                                        Get / set get attribute.
                                        + +
                                        + inst() + +  : Editor|Field|Join|Upload +
                                        +
                                        Static method to instantiate a new instance of a class (shorthand of +'instantiate').
                                        + +
                                        + instantiate() + +  : Editor|Field|Join|Upload +
                                        +
                                        Static method to instantiate a new instance of a class.
                                        + +
                                        + join() + +  : mixed +
                                        +
                                        Get / set join properties.
                                        + +
                                        + leftJoin() + +  : self +
                                        +
                                        Set up a left join operation for the Mjoined data
                                        + +
                                        + link() + +  : Join +
                                        +
                                        Create a join link between two tables. The order of the fields does not +matter, but each field must contain the table name as well as the field +name.
                                        + +
                                        + name() + +  : mixed +
                                        +
                                        Get / set name.
                                        + +
                                        + order() + +  : Join +
                                        +
                                        Specify the property that the data will be sorted by.
                                        + +
                                        + remove() + +  : mixed +
                                        +
                                        Delete rows
                                        + +
                                        + set() + +  : mixed +
                                        +
                                        Get / set set attribute.
                                        + +
                                        + table() + +  : mixed +
                                        +
                                        Get / set join table name.
                                        + +
                                        + type() + +  : mixed +
                                        +
                                        Get / set the join type.
                                        + +
                                        + update() + +  : mixed +
                                        +
                                        Update a row.
                                        + +
                                        + validator() + +  : self +
                                        +
                                        Set a validator for the array of data (not on a field basis)
                                        + +
                                        + where() + +  : mixed +
                                        +
                                        Where condition to add to the query used to get data from the database.
                                        + +
                                        + whereSet() + +  : mixed +
                                        +
                                        Get / set if the WHERE conditions should be included in the create and +edit actions.
                                        + +
                                        + _getSet() + +  : mixed +
                                        +
                                        Common getter / setter function for DataTables classes.
                                        + +
                                        + _propExists() + +  : bool +
                                        +
                                        Determine if a property is available in a data set (allowing `null` to be +a valid value)
                                        + +
                                        + _readProp() + +  : mixed +
                                        +
                                        Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.
                                        + +
                                        + _writeProp() + +  : mixed +
                                        +
                                        Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).
                                        + +
                                        + + + + + + + +
                                        +

                                        + Methods + +

                                        +
                                        +

                                        + __construct() + +

                                        + + +

                                        Join instance constructor.

                                        + + + public + __construct([mixed $table = null ][, string $type = 'object' ]) : mixed + +

                                        @param string $table Table name to get the joined data from.

                                        +
                                        + +
                                        Parameters
                                        +
                                        +
                                        + $table + : mixed + = null
                                        +
                                        +
                                        + +
                                        +
                                        + $type + : string + = 'object'
                                        +
                                        +

                                        Work with a single result ('object') or an array of +results ('array') for the join.

                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + mixed + — + + +
                                        +
                                        +

                                        + aliasParentTable() + +

                                        + + +

                                        Get / set parent table alias.

                                        + + + public + aliasParentTable([string $_ = null ]) : mixed + +

                                        When working with a self referencing table (i.e. a column in the table contains +a primary key value from its own table) it can be useful to set an alias on the +parent table's name, allowing a self referencing Join. For example:

                                        +
                                        SELECT p2.publisher
                                        +FROM   publisher as p2
                                        +JOIN   publisher on (publisher.idPublisher = p2.idPublisher)
                                        +
                                        +

                                        Where, in this case, publisher is the table that is used by the Editor instance, +and you want to use Join to link back to the table (resolving a name for example). +This method allows that alias to be set. Fields can then use standard SQL notation +to select a field, for example p2.publisher or publisher.publisher.

                                        +
                                        + +
                                        Parameters
                                        +
                                        +
                                        + $_ + : string + = null
                                        +
                                        +

                                        Table alias to use +@return string|self Table alias set (which is null by default), or self if used as +a setter.

                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + mixed + — + + +
                                        +
                                        +

                                        + create() + +

                                        + + +

                                        Create a row.

                                        + + + public + create(mixed $editor, int $parentId, mixed $data) : mixed + +

                                        @param Editor $editor Host Editor instance

                                        +
                                        + +
                                        Parameters
                                        +
                                        +
                                        + $editor + : mixed +
                                        +
                                        +
                                        + +
                                        +
                                        + $parentId + : int +
                                        +
                                        +

                                        Parent row's primary key value +@param string[] $data Data to be set for the join +@internal

                                        +
                                        + +
                                        +
                                        + $data + : mixed +
                                        +
                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + mixed + — + + +
                                        +
                                        +

                                        + data() + +

                                        + + +

                                        Get data

                                        + + + public + data(mixed $editor, array<string|int, string> &$data, mixed &$options) : mixed + +

                                        @param Editor $editor Host Editor instance

                                        +
                                        + +
                                        Parameters
                                        +
                                        +
                                        + $editor + : mixed +
                                        +
                                        +
                                        + +
                                        +
                                        + $data + : array<string|int, string> +
                                        +
                                        +

                                        Data from the parent table's get and were we need +to add out output. +@param array $options options array for fields +@internal

                                        +
                                        + +
                                        +
                                        + $options + : mixed +
                                        +
                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + mixed + — + + +
                                        +
                                        +

                                        + field() + +

                                        + + +

                                        Get / set field instances.

                                        + + + public + field([mixed $_ = null ]) : mixed + +

                                        The list of fields designates which columns in the table that will be read +from the joined table.

                                        +
                                        + +
                                        Parameters
                                        +
                                        +
                                        + $_ + : mixed + = null
                                        +
                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + mixed + — + + +
                                        +
                                        +

                                        + fields() + +

                                        + + +

                                        Get / set field instances.

                                        + + + public + fields([mixed $_ = null ]) : mixed + +

                                        An alias of field, for convenience.

                                        +
                                        + +
                                        Parameters
                                        +
                                        +
                                        + $_ + : mixed + = null
                                        +
                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + mixed + — + + +
                                        +
                                        +

                                        + get() + +

                                        + + +

                                        Get / set get attribute.

                                        + + + public + get([bool $_ = null ]) : mixed + +

                                        When set to false no read operations will occur on the join tables.

                                        +
                                        + +
                                        Parameters
                                        +
                                        +
                                        + $_ + : bool + = null
                                        +
                                        +

                                        Value +@return boolean|self Name

                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + mixed + — + + +
                                        +
                                        +

                                        + inst() + +

                                        + + +

                                        Static method to instantiate a new instance of a class (shorthand of +'instantiate').

                                        + + + public + static inst() : Editor|Field|Join|Upload + +

                                        This method performs exactly the same actions as the 'instantiate' +static method, but is simply shorter and easier to type!

                                        +
                                        + + + + +
                                        Return values
                                        + Editor|Field|Join|Upload + — +

                                        class +@static

                                        +
                                        + + +
                                        +
                                        +

                                        + instantiate() + +

                                        + + +

                                        Static method to instantiate a new instance of a class.

                                        + + + public + static instantiate() : Editor|Field|Join|Upload + +

                                        A factory method that will create a new instance of the class +that has extended 'Ext'. This allows classes to be instantiated +and then chained - which otherwise isn't available until PHP 5.4. +If using PHP 5.4 or later, simply create a 'new' instance of the +target class and chain methods as normal.

                                        +
                                        + + + + +
                                        Return values
                                        + Editor|Field|Join|Upload + — +

                                        Instantiated class +@static

                                        +
                                        + + +
                                        +
                                        +

                                        + join() + +

                                        + + +

                                        Get / set join properties.

                                        + + + public + join([string|array<string|int, string> $parent = null ][, mixed $child = null ][, mixed $table = null ]) : mixed + +

                                        Define how the SQL will be performed, on what columns. There are +basically two types of join that are supported by Editor here, a direct +foreign key reference in the join table to the parent table's primary +key, or a link table that contains just primary keys for the parent and +child tables (this approach is usually used with a Join->type() of +'array' since you can often have multiple links between the two tables, +while a direct foreign key reference will typically use a type of +'object' (i.e. a single entry).

                                        +
                                        + +
                                        Parameters
                                        +
                                        +
                                        + $parent + : string|array<string|int, string> + = null
                                        +
                                        +

                                        Parent table's primary key names. If used +with a link table (i.e. third parameter to this method is given, then +an array should be used, with the first element being the pkey's name +in the parent table, and the second element being the key's name in +the link table. +@param string|string[] $child Child table's primary key names. If used +with a link table (i.e. third parameter to this method is given, then +an array should be used, with the first element being the pkey's name +in the child table, and the second element being the key's name in the +link table. +@param string $table Join table name, if using a link table +@returns Join This for chaining +@deprecated 1.5 Please use the Join->link() method rather than this +method now.

                                        +
                                        + +
                                        +
                                        + $child + : mixed + = null
                                        +
                                        +
                                        + +
                                        +
                                        + $table + : mixed + = null
                                        +
                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + mixed + — + + +
                                        +
                                        +

                                        + leftJoin() + +

                                        + + +

                                        Set up a left join operation for the Mjoined data

                                        + + + public + leftJoin(string $table, string $field1, string $operator, string $field2) : self + + +
                                        Parameters
                                        +
                                        +
                                        + $table + : string +
                                        +
                                        +

                                        to get the information from

                                        +
                                        + +
                                        +
                                        + $field1 + : string +
                                        +
                                        +

                                        the first field to get the information from

                                        +
                                        + +
                                        +
                                        + $operator + : string +
                                        +
                                        +

                                        the operation to perform on the two fields

                                        +
                                        + +
                                        +
                                        + $field2 + : string +
                                        +
                                        +

                                        the second field to get the information from

                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + self + — + + +
                                        +
                                        + + + +

                                        Create a join link between two tables. The order of the fields does not +matter, but each field must contain the table name as well as the field +name.

                                        + + + public + link(string $field1, string $field2) : Join + +

                                        This method can be called a maximum of two times for an Mjoin instance:

                                        +
                                          +
                                        • First time, creates a link between the Editor host table and a join +table
                                        • +
                                        • Second time creates the links required for a link table.
                                        • +
                                        +

                                        Please refer to the Editor Mjoin documentation for further details: +https://editor.datatables.net/manual/php

                                        +
                                        + +
                                        Parameters
                                        +
                                        +
                                        + $field1 + : string +
                                        +
                                        +

                                        Table and field name

                                        +
                                        + +
                                        +
                                        + $field2 + : string +
                                        +
                                        +

                                        Table and field name

                                        +
                                        + +
                                        +
                                        + + +
                                        + Tags + +
                                        +
                                        +
                                        + throws +
                                        +
                                        + Exception + +

                                        Link limitations

                                        +
                                        + +
                                        +
                                        + +
                                        Return values
                                        + Join + — +

                                        Self for chaining

                                        +
                                        + + +
                                        +
                                        +

                                        + name() + +

                                        + + +

                                        Get / set name.

                                        + + + public + name([string $_ = null ]) : mixed + +

                                        The name of the Join is the JSON property key that is used when +'getting' the data, and the HTTP property key (in a JSON style) when +'setting' data. Typically the name of the db table will be used here, +but this method allows that to be overridden.

                                        +
                                        + +
                                        Parameters
                                        +
                                        +
                                        + $_ + : string + = null
                                        +
                                        +

                                        Field name +@return String|self Name

                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + mixed + — + + +
                                        +
                                        +

                                        + order() + +

                                        + + +

                                        Specify the property that the data will be sorted by.

                                        + + + public + order([mixed $_ = null ]) : Join + + +
                                        Parameters
                                        +
                                        +
                                        + $_ + : mixed + = null
                                        +
                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + Join + — +

                                        Self for chaining

                                        +
                                        + + +
                                        +
                                        +

                                        + remove() + +

                                        + + +

                                        Delete rows

                                        + + + public + remove(mixed $editor, array<string|int, int> $ids) : mixed + +

                                        @param Editor $editor Host Editor instance

                                        +
                                        + +
                                        Parameters
                                        +
                                        +
                                        + $editor + : mixed +
                                        +
                                        +
                                        + +
                                        +
                                        + $ids + : array<string|int, int> +
                                        +
                                        +

                                        Parent row IDs to delete +@internal

                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + mixed + — + + +
                                        +
                                        +

                                        + set() + +

                                        + + +

                                        Get / set set attribute.

                                        + + + public + set([bool $_ = null ]) : mixed + +

                                        When set to false no write operations will occur on the join tables. +This can be useful when you want to display information which is joined, +but want to only perform write operations on the parent table.

                                        +
                                        + +
                                        Parameters
                                        +
                                        +
                                        + $_ + : bool + = null
                                        +
                                        +

                                        Value +@return boolean|self Name

                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + mixed + — + + +
                                        +
                                        +

                                        + table() + +

                                        + + +

                                        Get / set join table name.

                                        + + + public + table([string $_ = null ]) : mixed + +

                                        Please note that this will also set the Join->name() used by the Join +as well. This is for convenience as the JSON output / HTTP input will +typically use the same name as the database name. If you want to set a +custom name, the Join->name() method must be called after this one.

                                        +
                                        + +
                                        Parameters
                                        +
                                        +
                                        + $_ + : string + = null
                                        +
                                        +

                                        Name of the table to read the join data from +@return String|self Name of the join table, or self if used as a setter.

                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + mixed + — + + +
                                        +
                                        +

                                        + type() + +

                                        + + +

                                        Get / set the join type.

                                        + + + public + type([string $_ = null ]) : mixed + +

                                        The join type allows the data that is returned from the join to be given +as an array (i.e. working with multiple possibly results for each record from +the parent table), or as an object (i.e. working which one and only one result +for each record form the parent table).

                                        +
                                        + +
                                        Parameters
                                        +
                                        +
                                        + $_ + : string + = null
                                        +
                                        +

                                        Join type ('object') or an array of +results ('array') for the join. +@return String|self Join type, or self if used as a setter.

                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + mixed + — + + +
                                        +
                                        +

                                        + update() + +

                                        + + +

                                        Update a row.

                                        + + + public + update(mixed $editor, int $parentId, mixed $data) : mixed + +

                                        @param Editor $editor Host Editor instance

                                        +
                                        + +
                                        Parameters
                                        +
                                        +
                                        + $editor + : mixed +
                                        +
                                        +
                                        + +
                                        +
                                        + $parentId + : int +
                                        +
                                        +

                                        Parent row's primary key value +@param string[] $data Data to be set for the join +@internal

                                        +
                                        + +
                                        +
                                        + $data + : mixed +
                                        +
                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + mixed + — + + +
                                        +
                                        +

                                        + validator() + +

                                        + + +

                                        Set a validator for the array of data (not on a field basis)

                                        + + + public + validator(string $fieldName, callable $fn) : self + + +
                                        Parameters
                                        +
                                        +
                                        + $fieldName + : string +
                                        +
                                        +

                                        Name of the field that any error should be shown +against on the client-side

                                        +
                                        + +
                                        +
                                        + $fn + : callable +
                                        +
                                        +

                                        Callback function for validation

                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + self + — +

                                        Chainable

                                        +
                                        + + +
                                        +
                                        +

                                        + where() + +

                                        + + +

                                        Where condition to add to the query used to get data from the database.

                                        + + + public + where([string|callable $key = null ][, mixed $value = null ][, mixed $op = '=' ]) : mixed + +

                                        Note that this is applied to the child table.

                                        +

                                        Can be used in two different ways:

                                        +
                                          +
                                        • Simple case: where( field, value, operator ) +
                                        • +
                                        • Complex: where( fn ) +
                                        • +
                                        +
                                        + +
                                        Parameters
                                        +
                                        +
                                        + $key + : string|callable + = null
                                        +
                                        +

                                        Single field name or a closure function +@param string|string[] $value Single field value, or an array of values. +@param string $op Condition operator: <, >, = etc +@return string[]|self Where condition array, or self if used as a setter.

                                        +
                                        + +
                                        +
                                        + $value + : mixed + = null
                                        +
                                        +
                                        + +
                                        +
                                        + $op + : mixed + = '='
                                        +
                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + mixed + — + + +
                                        +
                                        +

                                        + whereSet() + +

                                        + + +

                                        Get / set if the WHERE conditions should be included in the create and +edit actions.

                                        + + + public + whereSet([bool $_ = null ]) : mixed + +

                                        This means that the fields which have been used as part of the 'get' +WHERE condition (using the where() method) will be set as the values +given.

                                        +

                                        This is default false (i.e. they are not included).

                                        +
                                        + +
                                        Parameters
                                        +
                                        +
                                        + $_ + : bool + = null
                                        +
                                        +

                                        Include (true), or not (false) +@return boolean Current value

                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + mixed + — + + +
                                        +
                                        +

                                        + _getSet() + +

                                        + + +

                                        Common getter / setter function for DataTables classes.

                                        + + + protected + _getSet(mixed &$prop, mixed $val[, mixed $array = false ]) : mixed + +

                                        This getter / setter method makes building getter / setting methods +easier, by abstracting everything to a single function call.

                                        +
                                        + +
                                        Parameters
                                        +
                                        +
                                        + $prop + : mixed +
                                        +
                                        +

                                        The property to set +@param mixed $val The value to set - if given as null, then we assume +that the function is being used as a getter. +@param boolean $array Treat the target property as an array or not +(default false). If used as an array, then values passed in are added +to the $prop array. +@return self|mixed Class instance if setting (allowing chaining), or +the value requested if getting.

                                        +
                                        + +
                                        +
                                        + $val + : mixed +
                                        +
                                        +
                                        + +
                                        +
                                        + $array + : mixed + = false
                                        +
                                        +
                                        + +
                                        +
                                        + + + +
                                        Return values
                                        + mixed + — + + +
                                        +
                                        +

                                        + _propExists() + +

                                        + + +

                                        Determine if a property is available in a data set (allowing `null` to be +a valid value)

                                        + + + protected + _propExists(string $name, array<string|int, mixed> $data) : bool + + +
                                        Parameters
                                        +
                                        +
                                        + $name + : string +
                                        +
                                        +

                                        Javascript dotted object name to write to

                                        +
                                        + +
                                        +
                                        + $data + : array<string|int, mixed> +
                                        +
                                        +

                                        Data source array to read from

                                        +
                                        + +
                                        +
                                        + + +
                                        + Tags + +
                                        +
                                        +
                                        + private +
                                        +
                                        + + +
                                        +
                                        + +
                                        Return values
                                        + bool + — +

                                        true if present, false otherwise

                                        +
                                        + + +
                                        +
                                        +

                                        + _readProp() + +

                                        + + +

                                        Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.

                                        + + + protected + _readProp(string $name, array<string|int, mixed> $data) : mixed + + +
                                        Parameters
                                        +
                                        +
                                        + $name + : string +
                                        +
                                        +

                                        Javascript dotted object name to write to

                                        +
                                        + +
                                        +
                                        + $data + : array<string|int, mixed> +
                                        +
                                        +

                                        Data source array to read from

                                        +
                                        + +
                                        +
                                        + + +
                                        + Tags + +
                                        +
                                        +
                                        + private +
                                        +
                                        + + +
                                        +
                                        + +
                                        Return values
                                        + mixed + — +

                                        The read value, or null if no value found.

                                        +
                                        + + +
                                        +
                                        +

                                        + _writeProp() + +

                                        + + +

                                        Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).

                                        + + + protected + _writeProp(array<string|int, mixed> &$out, string $name, mixed $value) : mixed + + +
                                        Parameters
                                        +
                                        +
                                        + $out + : array<string|int, mixed> +
                                        +
                                        +

                                        Array to write the data to

                                        +
                                        + +
                                        +
                                        + $name + : string +
                                        +
                                        +

                                        Javascript dotted object name to write to

                                        +
                                        + +
                                        +
                                        + $value + : mixed +
                                        +
                                        +

                                        Value to write

                                        +
                                        + +
                                        +
                                        + + +
                                        + Tags + +
                                        +
                                        +
                                        + throws +
                                        +
                                        + Exception + +

                                        Information about duplicate properties

                                        +
                                        + +
                                        +
                                        + private +
                                        +
                                        + + +
                                        +
                                        + +
                                        Return values
                                        + mixed + — + + +
                                        +
                                        + +
                                        +
                                        +
                                        +
                                        +
                                        
                                        +        
                                        + +
                                        +
                                        + + + +
                                        +
                                        +
                                        +
                                        +

                                        Search results

                                        + +
                                        +
                                        +
                                          +
                                          +
                                          +
                                          +
                                          +
                                          + + +
                                          + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Mjoin.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Mjoin.html new file mode 100644 index 00000000..1dd0298f --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Mjoin.html @@ -0,0 +1,2038 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                          +

                                          Editor PHP 2.1.3

                                          + + + + + +
                                          + +
                                          +
                                          + + + + +
                                          + + +
                                          +

                                          + Mjoin + + + extends Join + + +
                                          + in package + +
                                          + + +

                                          + + + +

                                          The `Mjoin` class extends the `Join` class with the join data type set to +'array', whereas the `Join` default is `object` which has been rendered +obsolete by the `Editor->leftJoin()` method. The API API is otherwise +identical.

                                          + +

                                          This class is recommended over the Join class.

                                          +
                                          + + + + + + + + +

                                          + Table of Contents + +

                                          + +
                                          +
                                          + __construct() + +  : mixed +
                                          +
                                          Join instance constructor.
                                          + +
                                          + aliasParentTable() + +  : mixed +
                                          +
                                          Get / set parent table alias.
                                          + +
                                          + create() + +  : mixed +
                                          +
                                          Create a row.
                                          + +
                                          + data() + +  : mixed +
                                          +
                                          Get data
                                          + +
                                          + field() + +  : mixed +
                                          +
                                          Get / set field instances.
                                          + +
                                          + fields() + +  : mixed +
                                          +
                                          Get / set field instances.
                                          + +
                                          + get() + +  : mixed +
                                          +
                                          Get / set get attribute.
                                          + +
                                          + inst() + +  : Editor|Field|Join|Upload +
                                          +
                                          Static method to instantiate a new instance of a class (shorthand of +'instantiate').
                                          + +
                                          + instantiate() + +  : Editor|Field|Join|Upload +
                                          +
                                          Static method to instantiate a new instance of a class.
                                          + +
                                          + join() + +  : mixed +
                                          +
                                          Get / set join properties.
                                          + +
                                          + leftJoin() + +  : self +
                                          +
                                          Set up a left join operation for the Mjoined data
                                          + +
                                          + link() + +  : Join +
                                          +
                                          Create a join link between two tables. The order of the fields does not +matter, but each field must contain the table name as well as the field +name.
                                          + +
                                          + name() + +  : mixed +
                                          +
                                          Get / set name.
                                          + +
                                          + order() + +  : Join +
                                          +
                                          Specify the property that the data will be sorted by.
                                          + +
                                          + remove() + +  : mixed +
                                          +
                                          Delete rows
                                          + +
                                          + set() + +  : mixed +
                                          +
                                          Get / set set attribute.
                                          + +
                                          + table() + +  : mixed +
                                          +
                                          Get / set join table name.
                                          + +
                                          + type() + +  : mixed +
                                          +
                                          Get / set the join type.
                                          + +
                                          + update() + +  : mixed +
                                          +
                                          Update a row.
                                          + +
                                          + validator() + +  : self +
                                          +
                                          Set a validator for the array of data (not on a field basis)
                                          + +
                                          + where() + +  : mixed +
                                          +
                                          Where condition to add to the query used to get data from the database.
                                          + +
                                          + whereSet() + +  : mixed +
                                          +
                                          Get / set if the WHERE conditions should be included in the create and +edit actions.
                                          + +
                                          + _getSet() + +  : mixed +
                                          +
                                          Common getter / setter function for DataTables classes.
                                          + +
                                          + _propExists() + +  : bool +
                                          +
                                          Determine if a property is available in a data set (allowing `null` to be +a valid value)
                                          + +
                                          + _readProp() + +  : mixed +
                                          +
                                          Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.
                                          + +
                                          + _writeProp() + +  : mixed +
                                          +
                                          Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).
                                          + +
                                          + + + + + + + +
                                          +

                                          + Methods + +

                                          +
                                          +

                                          + __construct() + +

                                          + + +

                                          Join instance constructor.

                                          + + + public + __construct([mixed $table = null ]) : mixed + +

                                          @param string $table Table name to get the joined data from.

                                          +
                                          + +
                                          Parameters
                                          +
                                          +
                                          + $table + : mixed + = null
                                          +
                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + mixed + — + + +
                                          +
                                          +

                                          + aliasParentTable() + +

                                          + + +

                                          Get / set parent table alias.

                                          + + + public + aliasParentTable([string $_ = null ]) : mixed + +

                                          When working with a self referencing table (i.e. a column in the table contains +a primary key value from its own table) it can be useful to set an alias on the +parent table's name, allowing a self referencing Join. For example:

                                          +
                                          SELECT p2.publisher
                                          +FROM   publisher as p2
                                          +JOIN   publisher on (publisher.idPublisher = p2.idPublisher)
                                          +
                                          +

                                          Where, in this case, publisher is the table that is used by the Editor instance, +and you want to use Join to link back to the table (resolving a name for example). +This method allows that alias to be set. Fields can then use standard SQL notation +to select a field, for example p2.publisher or publisher.publisher.

                                          +
                                          + +
                                          Parameters
                                          +
                                          +
                                          + $_ + : string + = null
                                          +
                                          +

                                          Table alias to use +@return string|self Table alias set (which is null by default), or self if used as +a setter.

                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + mixed + — + + +
                                          +
                                          +

                                          + create() + +

                                          + + +

                                          Create a row.

                                          + + + public + create(mixed $editor, int $parentId, mixed $data) : mixed + +

                                          @param Editor $editor Host Editor instance

                                          +
                                          + +
                                          Parameters
                                          +
                                          +
                                          + $editor + : mixed +
                                          +
                                          +
                                          + +
                                          +
                                          + $parentId + : int +
                                          +
                                          +

                                          Parent row's primary key value +@param string[] $data Data to be set for the join +@internal

                                          +
                                          + +
                                          +
                                          + $data + : mixed +
                                          +
                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + mixed + — + + +
                                          +
                                          +

                                          + data() + +

                                          + + +

                                          Get data

                                          + + + public + data(mixed $editor, array<string|int, string> &$data, mixed &$options) : mixed + +

                                          @param Editor $editor Host Editor instance

                                          +
                                          + +
                                          Parameters
                                          +
                                          +
                                          + $editor + : mixed +
                                          +
                                          +
                                          + +
                                          +
                                          + $data + : array<string|int, string> +
                                          +
                                          +

                                          Data from the parent table's get and were we need +to add out output. +@param array $options options array for fields +@internal

                                          +
                                          + +
                                          +
                                          + $options + : mixed +
                                          +
                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + mixed + — + + +
                                          +
                                          +

                                          + field() + +

                                          + + +

                                          Get / set field instances.

                                          + + + public + field([mixed $_ = null ]) : mixed + +

                                          The list of fields designates which columns in the table that will be read +from the joined table.

                                          +
                                          + +
                                          Parameters
                                          +
                                          +
                                          + $_ + : mixed + = null
                                          +
                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + mixed + — + + +
                                          +
                                          +

                                          + fields() + +

                                          + + +

                                          Get / set field instances.

                                          + + + public + fields([mixed $_ = null ]) : mixed + +

                                          An alias of field, for convenience.

                                          +
                                          + +
                                          Parameters
                                          +
                                          +
                                          + $_ + : mixed + = null
                                          +
                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + mixed + — + + +
                                          +
                                          +

                                          + get() + +

                                          + + +

                                          Get / set get attribute.

                                          + + + public + get([bool $_ = null ]) : mixed + +

                                          When set to false no read operations will occur on the join tables.

                                          +
                                          + +
                                          Parameters
                                          +
                                          +
                                          + $_ + : bool + = null
                                          +
                                          +

                                          Value +@return boolean|self Name

                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + mixed + — + + +
                                          +
                                          +

                                          + inst() + +

                                          + + +

                                          Static method to instantiate a new instance of a class (shorthand of +'instantiate').

                                          + + + public + static inst() : Editor|Field|Join|Upload + +

                                          This method performs exactly the same actions as the 'instantiate' +static method, but is simply shorter and easier to type!

                                          +
                                          + + + + +
                                          Return values
                                          + Editor|Field|Join|Upload + — +

                                          class +@static

                                          +
                                          + + +
                                          +
                                          +

                                          + instantiate() + +

                                          + + +

                                          Static method to instantiate a new instance of a class.

                                          + + + public + static instantiate() : Editor|Field|Join|Upload + +

                                          A factory method that will create a new instance of the class +that has extended 'Ext'. This allows classes to be instantiated +and then chained - which otherwise isn't available until PHP 5.4. +If using PHP 5.4 or later, simply create a 'new' instance of the +target class and chain methods as normal.

                                          +
                                          + + + + +
                                          Return values
                                          + Editor|Field|Join|Upload + — +

                                          Instantiated class +@static

                                          +
                                          + + +
                                          +
                                          +

                                          + join() + +

                                          + + +

                                          Get / set join properties.

                                          + + + public + join([string|array<string|int, string> $parent = null ][, mixed $child = null ][, mixed $table = null ]) : mixed + +

                                          Define how the SQL will be performed, on what columns. There are +basically two types of join that are supported by Editor here, a direct +foreign key reference in the join table to the parent table's primary +key, or a link table that contains just primary keys for the parent and +child tables (this approach is usually used with a Join->type() of +'array' since you can often have multiple links between the two tables, +while a direct foreign key reference will typically use a type of +'object' (i.e. a single entry).

                                          +
                                          + +
                                          Parameters
                                          +
                                          +
                                          + $parent + : string|array<string|int, string> + = null
                                          +
                                          +

                                          Parent table's primary key names. If used +with a link table (i.e. third parameter to this method is given, then +an array should be used, with the first element being the pkey's name +in the parent table, and the second element being the key's name in +the link table. +@param string|string[] $child Child table's primary key names. If used +with a link table (i.e. third parameter to this method is given, then +an array should be used, with the first element being the pkey's name +in the child table, and the second element being the key's name in the +link table. +@param string $table Join table name, if using a link table +@returns Join This for chaining +@deprecated 1.5 Please use the Join->link() method rather than this +method now.

                                          +
                                          + +
                                          +
                                          + $child + : mixed + = null
                                          +
                                          +
                                          + +
                                          +
                                          + $table + : mixed + = null
                                          +
                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + mixed + — + + +
                                          +
                                          +

                                          + leftJoin() + +

                                          + + +

                                          Set up a left join operation for the Mjoined data

                                          + + + public + leftJoin(string $table, string $field1, string $operator, string $field2) : self + + +
                                          Parameters
                                          +
                                          +
                                          + $table + : string +
                                          +
                                          +

                                          to get the information from

                                          +
                                          + +
                                          +
                                          + $field1 + : string +
                                          +
                                          +

                                          the first field to get the information from

                                          +
                                          + +
                                          +
                                          + $operator + : string +
                                          +
                                          +

                                          the operation to perform on the two fields

                                          +
                                          + +
                                          +
                                          + $field2 + : string +
                                          +
                                          +

                                          the second field to get the information from

                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + self + — + + +
                                          +
                                          + + + +

                                          Create a join link between two tables. The order of the fields does not +matter, but each field must contain the table name as well as the field +name.

                                          + + + public + link(string $field1, string $field2) : Join + +

                                          This method can be called a maximum of two times for an Mjoin instance:

                                          +
                                            +
                                          • First time, creates a link between the Editor host table and a join +table
                                          • +
                                          • Second time creates the links required for a link table.
                                          • +
                                          +

                                          Please refer to the Editor Mjoin documentation for further details: +https://editor.datatables.net/manual/php

                                          +
                                          + +
                                          Parameters
                                          +
                                          +
                                          + $field1 + : string +
                                          +
                                          +

                                          Table and field name

                                          +
                                          + +
                                          +
                                          + $field2 + : string +
                                          +
                                          +

                                          Table and field name

                                          +
                                          + +
                                          +
                                          + + +
                                          + Tags + +
                                          +
                                          +
                                          + throws +
                                          +
                                          + Exception + +

                                          Link limitations

                                          +
                                          + +
                                          +
                                          + +
                                          Return values
                                          + Join + — +

                                          Self for chaining

                                          +
                                          + + +
                                          +
                                          +

                                          + name() + +

                                          + + +

                                          Get / set name.

                                          + + + public + name([string $_ = null ]) : mixed + +

                                          The name of the Join is the JSON property key that is used when +'getting' the data, and the HTTP property key (in a JSON style) when +'setting' data. Typically the name of the db table will be used here, +but this method allows that to be overridden.

                                          +
                                          + +
                                          Parameters
                                          +
                                          +
                                          + $_ + : string + = null
                                          +
                                          +

                                          Field name +@return String|self Name

                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + mixed + — + + +
                                          +
                                          +

                                          + order() + +

                                          + + +

                                          Specify the property that the data will be sorted by.

                                          + + + public + order([mixed $_ = null ]) : Join + + +
                                          Parameters
                                          +
                                          +
                                          + $_ + : mixed + = null
                                          +
                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + Join + — +

                                          Self for chaining

                                          +
                                          + + +
                                          +
                                          +

                                          + remove() + +

                                          + + +

                                          Delete rows

                                          + + + public + remove(mixed $editor, array<string|int, int> $ids) : mixed + +

                                          @param Editor $editor Host Editor instance

                                          +
                                          + +
                                          Parameters
                                          +
                                          +
                                          + $editor + : mixed +
                                          +
                                          +
                                          + +
                                          +
                                          + $ids + : array<string|int, int> +
                                          +
                                          +

                                          Parent row IDs to delete +@internal

                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + mixed + — + + +
                                          +
                                          +

                                          + set() + +

                                          + + +

                                          Get / set set attribute.

                                          + + + public + set([bool $_ = null ]) : mixed + +

                                          When set to false no write operations will occur on the join tables. +This can be useful when you want to display information which is joined, +but want to only perform write operations on the parent table.

                                          +
                                          + +
                                          Parameters
                                          +
                                          +
                                          + $_ + : bool + = null
                                          +
                                          +

                                          Value +@return boolean|self Name

                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + mixed + — + + +
                                          +
                                          +

                                          + table() + +

                                          + + +

                                          Get / set join table name.

                                          + + + public + table([string $_ = null ]) : mixed + +

                                          Please note that this will also set the Join->name() used by the Join +as well. This is for convenience as the JSON output / HTTP input will +typically use the same name as the database name. If you want to set a +custom name, the Join->name() method must be called after this one.

                                          +
                                          + +
                                          Parameters
                                          +
                                          +
                                          + $_ + : string + = null
                                          +
                                          +

                                          Name of the table to read the join data from +@return String|self Name of the join table, or self if used as a setter.

                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + mixed + — + + +
                                          +
                                          +

                                          + type() + +

                                          + + +

                                          Get / set the join type.

                                          + + + public + type([string $_ = null ]) : mixed + +

                                          The join type allows the data that is returned from the join to be given +as an array (i.e. working with multiple possibly results for each record from +the parent table), or as an object (i.e. working which one and only one result +for each record form the parent table).

                                          +
                                          + +
                                          Parameters
                                          +
                                          +
                                          + $_ + : string + = null
                                          +
                                          +

                                          Join type ('object') or an array of +results ('array') for the join. +@return String|self Join type, or self if used as a setter.

                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + mixed + — + + +
                                          +
                                          +

                                          + update() + +

                                          + + +

                                          Update a row.

                                          + + + public + update(mixed $editor, int $parentId, mixed $data) : mixed + +

                                          @param Editor $editor Host Editor instance

                                          +
                                          + +
                                          Parameters
                                          +
                                          +
                                          + $editor + : mixed +
                                          +
                                          +
                                          + +
                                          +
                                          + $parentId + : int +
                                          +
                                          +

                                          Parent row's primary key value +@param string[] $data Data to be set for the join +@internal

                                          +
                                          + +
                                          +
                                          + $data + : mixed +
                                          +
                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + mixed + — + + +
                                          +
                                          +

                                          + validator() + +

                                          + + +

                                          Set a validator for the array of data (not on a field basis)

                                          + + + public + validator(string $fieldName, callable $fn) : self + + +
                                          Parameters
                                          +
                                          +
                                          + $fieldName + : string +
                                          +
                                          +

                                          Name of the field that any error should be shown +against on the client-side

                                          +
                                          + +
                                          +
                                          + $fn + : callable +
                                          +
                                          +

                                          Callback function for validation

                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + self + — +

                                          Chainable

                                          +
                                          + + +
                                          +
                                          +

                                          + where() + +

                                          + + +

                                          Where condition to add to the query used to get data from the database.

                                          + + + public + where([string|callable $key = null ][, mixed $value = null ][, mixed $op = '=' ]) : mixed + +

                                          Note that this is applied to the child table.

                                          +

                                          Can be used in two different ways:

                                          +
                                            +
                                          • Simple case: where( field, value, operator ) +
                                          • +
                                          • Complex: where( fn ) +
                                          • +
                                          +
                                          + +
                                          Parameters
                                          +
                                          +
                                          + $key + : string|callable + = null
                                          +
                                          +

                                          Single field name or a closure function +@param string|string[] $value Single field value, or an array of values. +@param string $op Condition operator: <, >, = etc +@return string[]|self Where condition array, or self if used as a setter.

                                          +
                                          + +
                                          +
                                          + $value + : mixed + = null
                                          +
                                          +
                                          + +
                                          +
                                          + $op + : mixed + = '='
                                          +
                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + mixed + — + + +
                                          +
                                          +

                                          + whereSet() + +

                                          + + +

                                          Get / set if the WHERE conditions should be included in the create and +edit actions.

                                          + + + public + whereSet([bool $_ = null ]) : mixed + +

                                          This means that the fields which have been used as part of the 'get' +WHERE condition (using the where() method) will be set as the values +given.

                                          +

                                          This is default false (i.e. they are not included).

                                          +
                                          + +
                                          Parameters
                                          +
                                          +
                                          + $_ + : bool + = null
                                          +
                                          +

                                          Include (true), or not (false) +@return boolean Current value

                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + mixed + — + + +
                                          +
                                          +

                                          + _getSet() + +

                                          + + +

                                          Common getter / setter function for DataTables classes.

                                          + + + protected + _getSet(mixed &$prop, mixed $val[, mixed $array = false ]) : mixed + +

                                          This getter / setter method makes building getter / setting methods +easier, by abstracting everything to a single function call.

                                          +
                                          + +
                                          Parameters
                                          +
                                          +
                                          + $prop + : mixed +
                                          +
                                          +

                                          The property to set +@param mixed $val The value to set - if given as null, then we assume +that the function is being used as a getter. +@param boolean $array Treat the target property as an array or not +(default false). If used as an array, then values passed in are added +to the $prop array. +@return self|mixed Class instance if setting (allowing chaining), or +the value requested if getting.

                                          +
                                          + +
                                          +
                                          + $val + : mixed +
                                          +
                                          +
                                          + +
                                          +
                                          + $array + : mixed + = false
                                          +
                                          +
                                          + +
                                          +
                                          + + + +
                                          Return values
                                          + mixed + — + + +
                                          +
                                          +

                                          + _propExists() + +

                                          + + +

                                          Determine if a property is available in a data set (allowing `null` to be +a valid value)

                                          + + + protected + _propExists(string $name, array<string|int, mixed> $data) : bool + + +
                                          Parameters
                                          +
                                          +
                                          + $name + : string +
                                          +
                                          +

                                          Javascript dotted object name to write to

                                          +
                                          + +
                                          +
                                          + $data + : array<string|int, mixed> +
                                          +
                                          +

                                          Data source array to read from

                                          +
                                          + +
                                          +
                                          + + +
                                          + Tags + +
                                          +
                                          +
                                          + private +
                                          +
                                          + + +
                                          +
                                          + +
                                          Return values
                                          + bool + — +

                                          true if present, false otherwise

                                          +
                                          + + +
                                          +
                                          +

                                          + _readProp() + +

                                          + + +

                                          Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.

                                          + + + protected + _readProp(string $name, array<string|int, mixed> $data) : mixed + + +
                                          Parameters
                                          +
                                          +
                                          + $name + : string +
                                          +
                                          +

                                          Javascript dotted object name to write to

                                          +
                                          + +
                                          +
                                          + $data + : array<string|int, mixed> +
                                          +
                                          +

                                          Data source array to read from

                                          +
                                          + +
                                          +
                                          + + +
                                          + Tags + +
                                          +
                                          +
                                          + private +
                                          +
                                          + + +
                                          +
                                          + +
                                          Return values
                                          + mixed + — +

                                          The read value, or null if no value found.

                                          +
                                          + + +
                                          +
                                          +

                                          + _writeProp() + +

                                          + + +

                                          Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).

                                          + + + protected + _writeProp(array<string|int, mixed> &$out, string $name, mixed $value) : mixed + + +
                                          Parameters
                                          +
                                          +
                                          + $out + : array<string|int, mixed> +
                                          +
                                          +

                                          Array to write the data to

                                          +
                                          + +
                                          +
                                          + $name + : string +
                                          +
                                          +

                                          Javascript dotted object name to write to

                                          +
                                          + +
                                          +
                                          + $value + : mixed +
                                          +
                                          +

                                          Value to write

                                          +
                                          + +
                                          +
                                          + + +
                                          + Tags + +
                                          +
                                          +
                                          + throws +
                                          +
                                          + Exception + +

                                          Information about duplicate properties

                                          +
                                          + +
                                          +
                                          + private +
                                          +
                                          + + +
                                          +
                                          + +
                                          Return values
                                          + mixed + — + + +
                                          +
                                          + +
                                          +
                                          +
                                          +
                                          +
                                          
                                          +        
                                          + +
                                          +
                                          + + + +
                                          +
                                          +
                                          +
                                          +

                                          Search results

                                          + +
                                          +
                                          +
                                            +
                                            +
                                            +
                                            +
                                            +
                                            + + +
                                            + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Options.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Options.html new file mode 100644 index 00000000..9d9d7b99 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Options.html @@ -0,0 +1,1299 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                            +

                                            Editor PHP 2.1.3

                                            + + + + + +
                                            + +
                                            +
                                            + + + + +
                                            + + +
                                            +

                                            + Options + + + extends Ext + + +
                                            + in package + +
                                            + + +

                                            + + + +

                                            The Options class provides a convenient method of specifying where Editor +should get the list of options for a `select`, `radio` or `checkbox` field.

                                            + +

                                            This is normally from a table that is left joined to the main table being +edited, and a list of the values available from the joined table is shown to +the end user to let them select from.

                                            +

                                            Options instances are used with the Field->options() method.

                                            +
                                            + + +
                                            + Tags + +
                                            +
                                            +
                                            + example +
                                            +
                                            + +

                                            Get a list of options from the sites table

                                            +
                                            Field::inst( 'users.site' )
                                            +    ->options( Options::inst()
                                            +        ->table( 'sites' )
                                            +        ->value( 'id' )
                                            +        ->label( 'name' )
                                            +    )
                                            +
                                            +

                                            @example +Get a list of options with custom ordering

                                            +
                                            Field::inst( 'users.site' )
                                            +    ->options( Options::inst()
                                            +        ->table( 'sites' )
                                            +        ->value( 'id' )
                                            +        ->label( 'name' )
                                            +        ->order( 'name DESC' )
                                            +    )
                                            +
                                            +

                                            @example +Get a list of options showing the id and name in the label

                                            +
                                            Field::inst( 'users.site' )
                                            +    ->options( Options::inst()
                                            +        ->table( 'sites' )
                                            +        ->value( 'id' )
                                            +        ->label( [ 'name', 'id' ] )
                                            +        ->render( function ( $row ) {
                                            +          return $row['name'].' ('.$row['id'].')';
                                            +        } )
                                            +    )
                                            +
                                            +
                                            + +
                                            +
                                            + + + + + + +

                                            + Table of Contents + +

                                            + +
                                            +
                                            + add() + +  : Options +
                                            +
                                            Add extra options to the list, in addition to any obtained from the database
                                            + +
                                            + inst() + +  : Editor|Field|Join|Upload +
                                            +
                                            Static method to instantiate a new instance of a class (shorthand of +'instantiate').
                                            + +
                                            + instantiate() + +  : Editor|Field|Join|Upload +
                                            +
                                            Static method to instantiate a new instance of a class.
                                            + +
                                            + label() + +  : Options|array<string|int, string> +
                                            +
                                            Get / set the column(s) to use as the label value of the options
                                            + +
                                            + leftJoin() + +  : self +
                                            +
                                            Set up a left join operation for the options
                                            + +
                                            + limit() + +  : Options|array<string|int, string> +
                                            +
                                            Get / set the LIMIT clause to limit the number of records returned.
                                            + +
                                            + order() + +  : Options|string +
                                            +
                                            Get / set the ORDER BY clause to use in the SQL. If this option is not +provided the ordering will be based on the rendered output, either +numerically or alphabetically based on the data returned by the renderer.
                                            + +
                                            + render() + +  : Options|callable +
                                            +
                                            Get / set the label renderer. The renderer can be used to combine +multiple database columns into a single string that is shown as the label +to the end user in the list of options.
                                            + +
                                            + table() + +  : Options|string +
                                            +
                                            Get / set the database table from which to gather the options for the +list.
                                            + +
                                            + value() + +  : Options|string +
                                            +
                                            Get / set the column name to use for the value in the options list. This +would normally be the primary key for the table.
                                            + +
                                            + where() + +  : Options|callable +
                                            +
                                            Get / set the method to use for a WHERE condition if it is to be +applied to the query to get the options.
                                            + +
                                            + _getSet() + +  : mixed +
                                            +
                                            Common getter / setter function for DataTables classes.
                                            + +
                                            + _propExists() + +  : bool +
                                            +
                                            Determine if a property is available in a data set (allowing `null` to be +a valid value)
                                            + +
                                            + _readProp() + +  : mixed +
                                            +
                                            Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.
                                            + +
                                            + _writeProp() + +  : mixed +
                                            +
                                            Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).
                                            + +
                                            + + + + + + + +
                                            +

                                            + Methods + +

                                            +
                                            +

                                            + add() + +

                                            + + +

                                            Add extra options to the list, in addition to any obtained from the database

                                            + + + public + add(string $label[, string|null $value = null ]) : Options + + +
                                            Parameters
                                            +
                                            +
                                            + $label + : string +
                                            +
                                            +

                                            The label to use for the option

                                            +
                                            + +
                                            +
                                            + $value + : string|null + = null
                                            +
                                            +

                                            Value for the option. If not given, the label will be used

                                            +
                                            + +
                                            +
                                            + + + +
                                            Return values
                                            + Options + — +

                                            Self for chaining

                                            +
                                            + + +
                                            +
                                            +

                                            + inst() + +

                                            + + +

                                            Static method to instantiate a new instance of a class (shorthand of +'instantiate').

                                            + + + public + static inst() : Editor|Field|Join|Upload + +

                                            This method performs exactly the same actions as the 'instantiate' +static method, but is simply shorter and easier to type!

                                            +
                                            + + + + +
                                            Return values
                                            + Editor|Field|Join|Upload + — +

                                            class +@static

                                            +
                                            + + +
                                            +
                                            +

                                            + instantiate() + +

                                            + + +

                                            Static method to instantiate a new instance of a class.

                                            + + + public + static instantiate() : Editor|Field|Join|Upload + +

                                            A factory method that will create a new instance of the class +that has extended 'Ext'. This allows classes to be instantiated +and then chained - which otherwise isn't available until PHP 5.4. +If using PHP 5.4 or later, simply create a 'new' instance of the +target class and chain methods as normal.

                                            +
                                            + + + + +
                                            Return values
                                            + Editor|Field|Join|Upload + — +

                                            Instantiated class +@static

                                            +
                                            + + +
                                            +
                                            +

                                            + label() + +

                                            + + +

                                            Get / set the column(s) to use as the label value of the options

                                            + + + public + label([null|string|array<string|int, string> $_ = null ]) : Options|array<string|int, string> + + +
                                            Parameters
                                            +
                                            +
                                            + $_ + : null|string|array<string|int, string> + = null
                                            +
                                            +

                                            null to get the current value, string or +array to get.

                                            +
                                            + +
                                            +
                                            + + + +
                                            Return values
                                            + Options|array<string|int, string> + — +

                                            Self if setting for chaining, array of values if +getting.

                                            +
                                            + + +
                                            +
                                            +

                                            + leftJoin() + +

                                            + + +

                                            Set up a left join operation for the options

                                            + + + public + leftJoin(string $table, string $field1, string $operator, string $field2) : self + + +
                                            Parameters
                                            +
                                            +
                                            + $table + : string +
                                            +
                                            +

                                            to get the information from

                                            +
                                            + +
                                            +
                                            + $field1 + : string +
                                            +
                                            +

                                            the first field to get the information from

                                            +
                                            + +
                                            +
                                            + $operator + : string +
                                            +
                                            +

                                            the operation to perform on the two fields

                                            +
                                            + +
                                            +
                                            + $field2 + : string +
                                            +
                                            +

                                            the second field to get the information from

                                            +
                                            + +
                                            +
                                            + + + +
                                            Return values
                                            + self + — + + +
                                            +
                                            +

                                            + limit() + +

                                            + + +

                                            Get / set the LIMIT clause to limit the number of records returned.

                                            + + + public + limit([null|number $_ = null ]) : Options|array<string|int, string> + + +
                                            Parameters
                                            +
                                            +
                                            + $_ + : null|number + = null
                                            +
                                            +

                                            Number of rows to limit the result to

                                            +
                                            + +
                                            +
                                            + + + +
                                            Return values
                                            + Options|array<string|int, string> + — +

                                            Self if setting for chaining, limit if getting.

                                            +
                                            + + +
                                            +
                                            +

                                            + order() + +

                                            + + +

                                            Get / set the ORDER BY clause to use in the SQL. If this option is not +provided the ordering will be based on the rendered output, either +numerically or alphabetically based on the data returned by the renderer.

                                            + + + public + order([null|string $_ = null ]) : Options|string + + +
                                            Parameters
                                            +
                                            +
                                            + $_ + : null|string + = null
                                            +
                                            +

                                            String to set, null to get current value

                                            +
                                            + +
                                            +
                                            + + + +
                                            Return values
                                            + Options|string + — +

                                            Self if setting for chaining, string if getting.

                                            +
                                            + + +
                                            +
                                            +

                                            + render() + +

                                            + + +

                                            Get / set the label renderer. The renderer can be used to combine +multiple database columns into a single string that is shown as the label +to the end user in the list of options.

                                            + + + public + render([null|callable $_ = null ]) : Options|callable + + +
                                            Parameters
                                            +
                                            +
                                            + $_ + : null|callable + = null
                                            +
                                            +

                                            Function to set, null to get current value

                                            +
                                            + +
                                            +
                                            + + + +
                                            Return values
                                            + Options|callable + — +

                                            Self if setting for chaining, callable if +getting.

                                            +
                                            + + +
                                            +
                                            +

                                            + table() + +

                                            + + +

                                            Get / set the database table from which to gather the options for the +list.

                                            + + + public + table([null|string $_ = null ]) : Options|string + + +
                                            Parameters
                                            +
                                            +
                                            + $_ + : null|string + = null
                                            +
                                            +

                                            String to set, null to get current value

                                            +
                                            + +
                                            +
                                            + + + +
                                            Return values
                                            + Options|string + — +

                                            Self if setting for chaining, string if getting.

                                            +
                                            + + +
                                            +
                                            +

                                            + value() + +

                                            + + +

                                            Get / set the column name to use for the value in the options list. This +would normally be the primary key for the table.

                                            + + + public + value([null|string $_ = null ]) : Options|string + + +
                                            Parameters
                                            +
                                            +
                                            + $_ + : null|string + = null
                                            +
                                            +

                                            String to set, null to get current value

                                            +
                                            + +
                                            +
                                            + + + +
                                            Return values
                                            + Options|string + — +

                                            Self if setting for chaining, string if getting.

                                            +
                                            + + +
                                            +
                                            +

                                            + where() + +

                                            + + +

                                            Get / set the method to use for a WHERE condition if it is to be +applied to the query to get the options.

                                            + + + public + where([null|callable $_ = null ]) : Options|callable + + +
                                            Parameters
                                            +
                                            +
                                            + $_ + : null|callable + = null
                                            +
                                            +

                                            Function to set, null to get current value

                                            +
                                            + +
                                            +
                                            + + + +
                                            Return values
                                            + Options|callable + — +

                                            Self if setting for chaining, callable if +getting.

                                            +
                                            + + +
                                            +
                                            +

                                            + _getSet() + +

                                            + + +

                                            Common getter / setter function for DataTables classes.

                                            + + + protected + _getSet(mixed &$prop, mixed $val[, mixed $array = false ]) : mixed + +

                                            This getter / setter method makes building getter / setting methods +easier, by abstracting everything to a single function call.

                                            +
                                            + +
                                            Parameters
                                            +
                                            +
                                            + $prop + : mixed +
                                            +
                                            +

                                            The property to set +@param mixed $val The value to set - if given as null, then we assume +that the function is being used as a getter. +@param boolean $array Treat the target property as an array or not +(default false). If used as an array, then values passed in are added +to the $prop array. +@return self|mixed Class instance if setting (allowing chaining), or +the value requested if getting.

                                            +
                                            + +
                                            +
                                            + $val + : mixed +
                                            +
                                            +
                                            + +
                                            +
                                            + $array + : mixed + = false
                                            +
                                            +
                                            + +
                                            +
                                            + + + +
                                            Return values
                                            + mixed + — + + +
                                            +
                                            +

                                            + _propExists() + +

                                            + + +

                                            Determine if a property is available in a data set (allowing `null` to be +a valid value)

                                            + + + protected + _propExists(string $name, array<string|int, mixed> $data) : bool + + +
                                            Parameters
                                            +
                                            +
                                            + $name + : string +
                                            +
                                            +

                                            Javascript dotted object name to write to

                                            +
                                            + +
                                            +
                                            + $data + : array<string|int, mixed> +
                                            +
                                            +

                                            Data source array to read from

                                            +
                                            + +
                                            +
                                            + + +
                                            + Tags + +
                                            +
                                            +
                                            + private +
                                            +
                                            + + +
                                            +
                                            + +
                                            Return values
                                            + bool + — +

                                            true if present, false otherwise

                                            +
                                            + + +
                                            +
                                            +

                                            + _readProp() + +

                                            + + +

                                            Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.

                                            + + + protected + _readProp(string $name, array<string|int, mixed> $data) : mixed + + +
                                            Parameters
                                            +
                                            +
                                            + $name + : string +
                                            +
                                            +

                                            Javascript dotted object name to write to

                                            +
                                            + +
                                            +
                                            + $data + : array<string|int, mixed> +
                                            +
                                            +

                                            Data source array to read from

                                            +
                                            + +
                                            +
                                            + + +
                                            + Tags + +
                                            +
                                            +
                                            + private +
                                            +
                                            + + +
                                            +
                                            + +
                                            Return values
                                            + mixed + — +

                                            The read value, or null if no value found.

                                            +
                                            + + +
                                            +
                                            +

                                            + _writeProp() + +

                                            + + +

                                            Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).

                                            + + + protected + _writeProp(array<string|int, mixed> &$out, string $name, mixed $value) : mixed + + +
                                            Parameters
                                            +
                                            +
                                            + $out + : array<string|int, mixed> +
                                            +
                                            +

                                            Array to write the data to

                                            +
                                            + +
                                            +
                                            + $name + : string +
                                            +
                                            +

                                            Javascript dotted object name to write to

                                            +
                                            + +
                                            +
                                            + $value + : mixed +
                                            +
                                            +

                                            Value to write

                                            +
                                            + +
                                            +
                                            + + +
                                            + Tags + +
                                            +
                                            +
                                            + throws +
                                            +
                                            + Exception + +

                                            Information about duplicate properties

                                            +
                                            + +
                                            +
                                            + private +
                                            +
                                            + + +
                                            +
                                            + +
                                            Return values
                                            + mixed + — + + +
                                            +
                                            + +
                                            +
                                            +
                                            +
                                            +
                                            
                                            +        
                                            + +
                                            +
                                            + + + +
                                            +
                                            +
                                            +
                                            +

                                            Search results

                                            + +
                                            +
                                            +
                                              +
                                              +
                                              +
                                              +
                                              +
                                              + + +
                                              + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-SearchBuilderOptions.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-SearchBuilderOptions.html new file mode 100644 index 00000000..02611837 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-SearchBuilderOptions.html @@ -0,0 +1,1182 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                              +

                                              Editor PHP 2.1.3

                                              + + + + + +
                                              + +
                                              +
                                              + + + + +
                                              + + +
                                              +

                                              + SearchBuilderOptions + + + extends Ext + + +
                                              + in package + +
                                              + + +

                                              + + + +

                                              The Options class provides a convenient method of specifying where Editor +should get the list of options for a `select`, `radio` or `checkbox` field.

                                              + +

                                              This is normally from a table that is left joined to the main table being +edited, and a list of the values available from the joined table is shown to +the end user to let them select from.

                                              +

                                              Options instances are used with the Field->options() method.

                                              +
                                              + + +
                                              + Tags + +
                                              +
                                              +
                                              + example +
                                              +
                                              + +

                                              Get a list of options from the sites table

                                              +
                                              Field::inst( 'users.site' )
                                              +    ->options( Options::inst()
                                              +        ->table( 'sites' )
                                              +        ->value( 'id' )
                                              +        ->label( 'name' )
                                              +    )
                                              +
                                              +

                                              @example +Get a list of options with custom ordering

                                              +
                                              Field::inst( 'users.site' )
                                              +    ->options( Options::inst()
                                              +        ->table( 'sites' )
                                              +        ->value( 'id' )
                                              +        ->label( 'name' )
                                              +        ->order( 'name DESC' )
                                              +    )
                                              +
                                              +

                                              @example +Get a list of options showing the id and name in the label

                                              +
                                              Field::inst( 'users.site' )
                                              +    ->options( Options::inst()
                                              +        ->table( 'sites' )
                                              +        ->value( 'id' )
                                              +        ->label( [ 'name', 'id' ] )
                                              +        ->render( function ( $row ) {
                                              +          return $row['name'].' ('.$row['id'].')';
                                              +        } )
                                              +    )
                                              +
                                              +
                                              + +
                                              +
                                              + + + + + + +

                                              + Table of Contents + +

                                              + +
                                              +
                                              + inst() + +  : Editor|Field|Join|Upload +
                                              +
                                              Static method to instantiate a new instance of a class (shorthand of +'instantiate').
                                              + +
                                              + instantiate() + +  : Editor|Field|Join|Upload +
                                              +
                                              Static method to instantiate a new instance of a class.
                                              + +
                                              + label() + +  : Options|array<string|int, string> +
                                              +
                                              Get / set the column(s) to use as the label value of the options
                                              + +
                                              + leftJoin() + +  : self +
                                              +
                                              Get / set the array values used for a leftJoin condition if it is to be +applied to the query to get the options.
                                              + +
                                              + order() + +  : Options|string +
                                              +
                                              Get / set the ORDER BY clause to use in the SQL. If this option is not +provided the ordering will be based on the rendered output, either +numerically or alphabetically based on the data returned by the renderer.
                                              + +
                                              + render() + +  : Options|callable +
                                              +
                                              Get / set the label renderer. The renderer can be used to combine +multiple database columns into a single string that is shown as the label +to the end user in the list of options.
                                              + +
                                              + table() + +  : Options|string +
                                              +
                                              Get / set the database table from which to gather the options for the +list.
                                              + +
                                              + value() + +  : Options|string +
                                              +
                                              Get / set the column name to use for the value in the options list. This +would normally be the primary key for the table.
                                              + +
                                              + where() + +  : Options|callable +
                                              +
                                              Get / set the method to use for a WHERE condition if it is to be +applied to the query to get the options.
                                              + +
                                              + _getSet() + +  : mixed +
                                              +
                                              Common getter / setter function for DataTables classes.
                                              + +
                                              + _propExists() + +  : bool +
                                              +
                                              Determine if a property is available in a data set (allowing `null` to be +a valid value)
                                              + +
                                              + _readProp() + +  : mixed +
                                              +
                                              Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.
                                              + +
                                              + _writeProp() + +  : mixed +
                                              +
                                              Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).
                                              + +
                                              + + + + + + + +
                                              +

                                              + Methods + +

                                              +
                                              +

                                              + inst() + +

                                              + + +

                                              Static method to instantiate a new instance of a class (shorthand of +'instantiate').

                                              + + + public + static inst() : Editor|Field|Join|Upload + +

                                              This method performs exactly the same actions as the 'instantiate' +static method, but is simply shorter and easier to type!

                                              +
                                              + + + + +
                                              Return values
                                              + Editor|Field|Join|Upload + — +

                                              class +@static

                                              +
                                              + + +
                                              +
                                              +

                                              + instantiate() + +

                                              + + +

                                              Static method to instantiate a new instance of a class.

                                              + + + public + static instantiate() : Editor|Field|Join|Upload + +

                                              A factory method that will create a new instance of the class +that has extended 'Ext'. This allows classes to be instantiated +and then chained - which otherwise isn't available until PHP 5.4. +If using PHP 5.4 or later, simply create a 'new' instance of the +target class and chain methods as normal.

                                              +
                                              + + + + +
                                              Return values
                                              + Editor|Field|Join|Upload + — +

                                              Instantiated class +@static

                                              +
                                              + + +
                                              +
                                              +

                                              + label() + +

                                              + + +

                                              Get / set the column(s) to use as the label value of the options

                                              + + + public + label([null|string|array<string|int, string> $_ = null ]) : Options|array<string|int, string> + + +
                                              Parameters
                                              +
                                              +
                                              + $_ + : null|string|array<string|int, string> + = null
                                              +
                                              +

                                              null to get the current value, string or +array to get.

                                              +
                                              + +
                                              +
                                              + + + +
                                              Return values
                                              + Options|array<string|int, string> + — +

                                              Self if setting for chaining, array of values if +getting.

                                              +
                                              + + +
                                              +
                                              +

                                              + leftJoin() + +

                                              + + +

                                              Get / set the array values used for a leftJoin condition if it is to be +applied to the query to get the options.

                                              + + + public + leftJoin(string $table, string $field1, string $operator, string $field2) : self + + +
                                              Parameters
                                              +
                                              +
                                              + $table + : string +
                                              +
                                              +

                                              to get the information from

                                              +
                                              + +
                                              +
                                              + $field1 + : string +
                                              +
                                              +

                                              the first field to get the information from

                                              +
                                              + +
                                              +
                                              + $operator + : string +
                                              +
                                              +

                                              the operation to perform on the two fields

                                              +
                                              + +
                                              +
                                              + $field2 + : string +
                                              +
                                              +

                                              the second field to get the information from

                                              +
                                              + +
                                              +
                                              + + + +
                                              Return values
                                              + self + — + + +
                                              +
                                              +

                                              + order() + +

                                              + + +

                                              Get / set the ORDER BY clause to use in the SQL. If this option is not +provided the ordering will be based on the rendered output, either +numerically or alphabetically based on the data returned by the renderer.

                                              + + + public + order([null|string $_ = null ]) : Options|string + + +
                                              Parameters
                                              +
                                              +
                                              + $_ + : null|string + = null
                                              +
                                              +

                                              String to set, null to get current value

                                              +
                                              + +
                                              +
                                              + + + +
                                              Return values
                                              + Options|string + — +

                                              Self if setting for chaining, string if getting.

                                              +
                                              + + +
                                              +
                                              +

                                              + render() + +

                                              + + +

                                              Get / set the label renderer. The renderer can be used to combine +multiple database columns into a single string that is shown as the label +to the end user in the list of options.

                                              + + + public + render([null|callable $_ = null ]) : Options|callable + + +
                                              Parameters
                                              +
                                              +
                                              + $_ + : null|callable + = null
                                              +
                                              +

                                              Function to set, null to get current value

                                              +
                                              + +
                                              +
                                              + + + +
                                              Return values
                                              + Options|callable + — +

                                              Self if setting for chaining, callable if +getting.

                                              +
                                              + + +
                                              +
                                              +

                                              + table() + +

                                              + + +

                                              Get / set the database table from which to gather the options for the +list.

                                              + + + public + table([null|string $_ = null ]) : Options|string + + +
                                              Parameters
                                              +
                                              +
                                              + $_ + : null|string + = null
                                              +
                                              +

                                              String to set, null to get current value

                                              +
                                              + +
                                              +
                                              + + + +
                                              Return values
                                              + Options|string + — +

                                              Self if setting for chaining, string if getting.

                                              +
                                              + + +
                                              +
                                              +

                                              + value() + +

                                              + + +

                                              Get / set the column name to use for the value in the options list. This +would normally be the primary key for the table.

                                              + + + public + value([null|string $_ = null ]) : Options|string + + +
                                              Parameters
                                              +
                                              +
                                              + $_ + : null|string + = null
                                              +
                                              +

                                              String to set, null to get current value

                                              +
                                              + +
                                              +
                                              + + + +
                                              Return values
                                              + Options|string + — +

                                              Self if setting for chaining, string if getting.

                                              +
                                              + + +
                                              +
                                              +

                                              + where() + +

                                              + + +

                                              Get / set the method to use for a WHERE condition if it is to be +applied to the query to get the options.

                                              + + + public + where([null|callable $_ = null ]) : Options|callable + + +
                                              Parameters
                                              +
                                              +
                                              + $_ + : null|callable + = null
                                              +
                                              +

                                              Function to set, null to get current value

                                              +
                                              + +
                                              +
                                              + + + +
                                              Return values
                                              + Options|callable + — +

                                              Self if setting for chaining, callable if +getting.

                                              +
                                              + + +
                                              +
                                              +

                                              + _getSet() + +

                                              + + +

                                              Common getter / setter function for DataTables classes.

                                              + + + protected + _getSet(mixed &$prop, mixed $val[, mixed $array = false ]) : mixed + +

                                              This getter / setter method makes building getter / setting methods +easier, by abstracting everything to a single function call.

                                              +
                                              + +
                                              Parameters
                                              +
                                              +
                                              + $prop + : mixed +
                                              +
                                              +

                                              The property to set +@param mixed $val The value to set - if given as null, then we assume +that the function is being used as a getter. +@param boolean $array Treat the target property as an array or not +(default false). If used as an array, then values passed in are added +to the $prop array. +@return self|mixed Class instance if setting (allowing chaining), or +the value requested if getting.

                                              +
                                              + +
                                              +
                                              + $val + : mixed +
                                              +
                                              +
                                              + +
                                              +
                                              + $array + : mixed + = false
                                              +
                                              +
                                              + +
                                              +
                                              + + + +
                                              Return values
                                              + mixed + — + + +
                                              +
                                              +

                                              + _propExists() + +

                                              + + +

                                              Determine if a property is available in a data set (allowing `null` to be +a valid value)

                                              + + + protected + _propExists(string $name, array<string|int, mixed> $data) : bool + + +
                                              Parameters
                                              +
                                              +
                                              + $name + : string +
                                              +
                                              +

                                              Javascript dotted object name to write to

                                              +
                                              + +
                                              +
                                              + $data + : array<string|int, mixed> +
                                              +
                                              +

                                              Data source array to read from

                                              +
                                              + +
                                              +
                                              + + +
                                              + Tags + +
                                              +
                                              +
                                              + private +
                                              +
                                              + + +
                                              +
                                              + +
                                              Return values
                                              + bool + — +

                                              true if present, false otherwise

                                              +
                                              + + +
                                              +
                                              +

                                              + _readProp() + +

                                              + + +

                                              Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.

                                              + + + protected + _readProp(string $name, array<string|int, mixed> $data) : mixed + + +
                                              Parameters
                                              +
                                              +
                                              + $name + : string +
                                              +
                                              +

                                              Javascript dotted object name to write to

                                              +
                                              + +
                                              +
                                              + $data + : array<string|int, mixed> +
                                              +
                                              +

                                              Data source array to read from

                                              +
                                              + +
                                              +
                                              + + +
                                              + Tags + +
                                              +
                                              +
                                              + private +
                                              +
                                              + + +
                                              +
                                              + +
                                              Return values
                                              + mixed + — +

                                              The read value, or null if no value found.

                                              +
                                              + + +
                                              +
                                              +

                                              + _writeProp() + +

                                              + + +

                                              Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).

                                              + + + protected + _writeProp(array<string|int, mixed> &$out, string $name, mixed $value) : mixed + + +
                                              Parameters
                                              +
                                              +
                                              + $out + : array<string|int, mixed> +
                                              +
                                              +

                                              Array to write the data to

                                              +
                                              + +
                                              +
                                              + $name + : string +
                                              +
                                              +

                                              Javascript dotted object name to write to

                                              +
                                              + +
                                              +
                                              + $value + : mixed +
                                              +
                                              +

                                              Value to write

                                              +
                                              + +
                                              +
                                              + + +
                                              + Tags + +
                                              +
                                              +
                                              + throws +
                                              +
                                              + Exception + +

                                              Information about duplicate properties

                                              +
                                              + +
                                              +
                                              + private +
                                              +
                                              + + +
                                              +
                                              + +
                                              Return values
                                              + mixed + — + + +
                                              +
                                              + +
                                              +
                                              +
                                              +
                                              +
                                              
                                              +        
                                              + +
                                              +
                                              + + + +
                                              +
                                              +
                                              +
                                              +

                                              Search results

                                              + +
                                              +
                                              +
                                                +
                                                +
                                                +
                                                +
                                                +
                                                + + +
                                                + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-SearchPaneOptions.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-SearchPaneOptions.html new file mode 100644 index 00000000..411de632 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-SearchPaneOptions.html @@ -0,0 +1,1182 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                +

                                                Editor PHP 2.1.3

                                                + + + + + +
                                                + +
                                                +
                                                + + + + +
                                                + + +
                                                +

                                                + SearchPaneOptions + + + extends Ext + + +
                                                + in package + +
                                                + + +

                                                + + + +

                                                The Options class provides a convenient method of specifying where Editor +should get the list of options for a `select`, `radio` or `checkbox` field.

                                                + +

                                                This is normally from a table that is left joined to the main table being +edited, and a list of the values available from the joined table is shown to +the end user to let them select from.

                                                +

                                                Options instances are used with the Field->options() method.

                                                +
                                                + + +
                                                + Tags + +
                                                +
                                                +
                                                + example +
                                                +
                                                + +

                                                Get a list of options from the sites table

                                                +
                                                Field::inst( 'users.site' )
                                                +    ->options( Options::inst()
                                                +        ->table( 'sites' )
                                                +        ->value( 'id' )
                                                +        ->label( 'name' )
                                                +    )
                                                +
                                                +

                                                @example +Get a list of options with custom ordering

                                                +
                                                Field::inst( 'users.site' )
                                                +    ->options( Options::inst()
                                                +        ->table( 'sites' )
                                                +        ->value( 'id' )
                                                +        ->label( 'name' )
                                                +        ->order( 'name DESC' )
                                                +    )
                                                +
                                                +

                                                @example +Get a list of options showing the id and name in the label

                                                +
                                                Field::inst( 'users.site' )
                                                +    ->options( Options::inst()
                                                +        ->table( 'sites' )
                                                +        ->value( 'id' )
                                                +        ->label( [ 'name', 'id' ] )
                                                +        ->render( function ( $row ) {
                                                +          return $row['name'].' ('.$row['id'].')';
                                                +        } )
                                                +    )
                                                +
                                                +
                                                + +
                                                +
                                                + + + + + + +

                                                + Table of Contents + +

                                                + +
                                                +
                                                + inst() + +  : Editor|Field|Join|Upload +
                                                +
                                                Static method to instantiate a new instance of a class (shorthand of +'instantiate').
                                                + +
                                                + instantiate() + +  : Editor|Field|Join|Upload +
                                                +
                                                Static method to instantiate a new instance of a class.
                                                + +
                                                + label() + +  : Options|array<string|int, string> +
                                                +
                                                Get / set the column(s) to use as the label value of the options
                                                + +
                                                + leftJoin() + +  : self +
                                                +
                                                Get / set the array values used for a leftJoin condition if it is to be +applied to the query to get the options.
                                                + +
                                                + order() + +  : Options|string +
                                                +
                                                Get / set the ORDER BY clause to use in the SQL. If this option is not +provided the ordering will be based on the rendered output, either +numerically or alphabetically based on the data returned by the renderer.
                                                + +
                                                + render() + +  : Options|callable +
                                                +
                                                Get / set the label renderer. The renderer can be used to combine +multiple database columns into a single string that is shown as the label +to the end user in the list of options.
                                                + +
                                                + table() + +  : Options|string +
                                                +
                                                Get / set the database table from which to gather the options for the +list.
                                                + +
                                                + value() + +  : Options|string +
                                                +
                                                Get / set the column name to use for the value in the options list. This +would normally be the primary key for the table.
                                                + +
                                                + where() + +  : Options|callable +
                                                +
                                                Get / set the method to use for a WHERE condition if it is to be +applied to the query to get the options.
                                                + +
                                                + _getSet() + +  : mixed +
                                                +
                                                Common getter / setter function for DataTables classes.
                                                + +
                                                + _propExists() + +  : bool +
                                                +
                                                Determine if a property is available in a data set (allowing `null` to be +a valid value)
                                                + +
                                                + _readProp() + +  : mixed +
                                                +
                                                Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.
                                                + +
                                                + _writeProp() + +  : mixed +
                                                +
                                                Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).
                                                + +
                                                + + + + + + + +
                                                +

                                                + Methods + +

                                                +
                                                +

                                                + inst() + +

                                                + + +

                                                Static method to instantiate a new instance of a class (shorthand of +'instantiate').

                                                + + + public + static inst() : Editor|Field|Join|Upload + +

                                                This method performs exactly the same actions as the 'instantiate' +static method, but is simply shorter and easier to type!

                                                +
                                                + + + + +
                                                Return values
                                                + Editor|Field|Join|Upload + — +

                                                class +@static

                                                +
                                                + + +
                                                +
                                                +

                                                + instantiate() + +

                                                + + +

                                                Static method to instantiate a new instance of a class.

                                                + + + public + static instantiate() : Editor|Field|Join|Upload + +

                                                A factory method that will create a new instance of the class +that has extended 'Ext'. This allows classes to be instantiated +and then chained - which otherwise isn't available until PHP 5.4. +If using PHP 5.4 or later, simply create a 'new' instance of the +target class and chain methods as normal.

                                                +
                                                + + + + +
                                                Return values
                                                + Editor|Field|Join|Upload + — +

                                                Instantiated class +@static

                                                +
                                                + + +
                                                +
                                                +

                                                + label() + +

                                                + + +

                                                Get / set the column(s) to use as the label value of the options

                                                + + + public + label([null|string|array<string|int, string> $_ = null ]) : Options|array<string|int, string> + + +
                                                Parameters
                                                +
                                                +
                                                + $_ + : null|string|array<string|int, string> + = null
                                                +
                                                +

                                                null to get the current value, string or +array to get.

                                                +
                                                + +
                                                +
                                                + + + +
                                                Return values
                                                + Options|array<string|int, string> + — +

                                                Self if setting for chaining, array of values if +getting.

                                                +
                                                + + +
                                                +
                                                +

                                                + leftJoin() + +

                                                + + +

                                                Get / set the array values used for a leftJoin condition if it is to be +applied to the query to get the options.

                                                + + + public + leftJoin(string $table, string $field1, string $operator, string $field2) : self + + +
                                                Parameters
                                                +
                                                +
                                                + $table + : string +
                                                +
                                                +

                                                to get the information from

                                                +
                                                + +
                                                +
                                                + $field1 + : string +
                                                +
                                                +

                                                the first field to get the information from

                                                +
                                                + +
                                                +
                                                + $operator + : string +
                                                +
                                                +

                                                the operation to perform on the two fields

                                                +
                                                + +
                                                +
                                                + $field2 + : string +
                                                +
                                                +

                                                the second field to get the information from

                                                +
                                                + +
                                                +
                                                + + + +
                                                Return values
                                                + self + — + + +
                                                +
                                                +

                                                + order() + +

                                                + + +

                                                Get / set the ORDER BY clause to use in the SQL. If this option is not +provided the ordering will be based on the rendered output, either +numerically or alphabetically based on the data returned by the renderer.

                                                + + + public + order([null|string $_ = null ]) : Options|string + + +
                                                Parameters
                                                +
                                                +
                                                + $_ + : null|string + = null
                                                +
                                                +

                                                String to set, null to get current value

                                                +
                                                + +
                                                +
                                                + + + +
                                                Return values
                                                + Options|string + — +

                                                Self if setting for chaining, string if getting.

                                                +
                                                + + +
                                                +
                                                +

                                                + render() + +

                                                + + +

                                                Get / set the label renderer. The renderer can be used to combine +multiple database columns into a single string that is shown as the label +to the end user in the list of options.

                                                + + + public + render([null|callable $_ = null ]) : Options|callable + + +
                                                Parameters
                                                +
                                                +
                                                + $_ + : null|callable + = null
                                                +
                                                +

                                                Function to set, null to get current value

                                                +
                                                + +
                                                +
                                                + + + +
                                                Return values
                                                + Options|callable + — +

                                                Self if setting for chaining, callable if +getting.

                                                +
                                                + + +
                                                +
                                                +

                                                + table() + +

                                                + + +

                                                Get / set the database table from which to gather the options for the +list.

                                                + + + public + table([null|string $_ = null ]) : Options|string + + +
                                                Parameters
                                                +
                                                +
                                                + $_ + : null|string + = null
                                                +
                                                +

                                                String to set, null to get current value

                                                +
                                                + +
                                                +
                                                + + + +
                                                Return values
                                                + Options|string + — +

                                                Self if setting for chaining, string if getting.

                                                +
                                                + + +
                                                +
                                                +

                                                + value() + +

                                                + + +

                                                Get / set the column name to use for the value in the options list. This +would normally be the primary key for the table.

                                                + + + public + value([null|string $_ = null ]) : Options|string + + +
                                                Parameters
                                                +
                                                +
                                                + $_ + : null|string + = null
                                                +
                                                +

                                                String to set, null to get current value

                                                +
                                                + +
                                                +
                                                + + + +
                                                Return values
                                                + Options|string + — +

                                                Self if setting for chaining, string if getting.

                                                +
                                                + + +
                                                +
                                                +

                                                + where() + +

                                                + + +

                                                Get / set the method to use for a WHERE condition if it is to be +applied to the query to get the options.

                                                + + + public + where([null|callable $_ = null ]) : Options|callable + + +
                                                Parameters
                                                +
                                                +
                                                + $_ + : null|callable + = null
                                                +
                                                +

                                                Function to set, null to get current value

                                                +
                                                + +
                                                +
                                                + + + +
                                                Return values
                                                + Options|callable + — +

                                                Self if setting for chaining, callable if +getting.

                                                +
                                                + + +
                                                +
                                                +

                                                + _getSet() + +

                                                + + +

                                                Common getter / setter function for DataTables classes.

                                                + + + protected + _getSet(mixed &$prop, mixed $val[, mixed $array = false ]) : mixed + +

                                                This getter / setter method makes building getter / setting methods +easier, by abstracting everything to a single function call.

                                                +
                                                + +
                                                Parameters
                                                +
                                                +
                                                + $prop + : mixed +
                                                +
                                                +

                                                The property to set +@param mixed $val The value to set - if given as null, then we assume +that the function is being used as a getter. +@param boolean $array Treat the target property as an array or not +(default false). If used as an array, then values passed in are added +to the $prop array. +@return self|mixed Class instance if setting (allowing chaining), or +the value requested if getting.

                                                +
                                                + +
                                                +
                                                + $val + : mixed +
                                                +
                                                +
                                                + +
                                                +
                                                + $array + : mixed + = false
                                                +
                                                +
                                                + +
                                                +
                                                + + + +
                                                Return values
                                                + mixed + — + + +
                                                +
                                                +

                                                + _propExists() + +

                                                + + +

                                                Determine if a property is available in a data set (allowing `null` to be +a valid value)

                                                + + + protected + _propExists(string $name, array<string|int, mixed> $data) : bool + + +
                                                Parameters
                                                +
                                                +
                                                + $name + : string +
                                                +
                                                +

                                                Javascript dotted object name to write to

                                                +
                                                + +
                                                +
                                                + $data + : array<string|int, mixed> +
                                                +
                                                +

                                                Data source array to read from

                                                +
                                                + +
                                                +
                                                + + +
                                                + Tags + +
                                                +
                                                +
                                                + private +
                                                +
                                                + + +
                                                +
                                                + +
                                                Return values
                                                + bool + — +

                                                true if present, false otherwise

                                                +
                                                + + +
                                                +
                                                +

                                                + _readProp() + +

                                                + + +

                                                Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.

                                                + + + protected + _readProp(string $name, array<string|int, mixed> $data) : mixed + + +
                                                Parameters
                                                +
                                                +
                                                + $name + : string +
                                                +
                                                +

                                                Javascript dotted object name to write to

                                                +
                                                + +
                                                +
                                                + $data + : array<string|int, mixed> +
                                                +
                                                +

                                                Data source array to read from

                                                +
                                                + +
                                                +
                                                + + +
                                                + Tags + +
                                                +
                                                +
                                                + private +
                                                +
                                                + + +
                                                +
                                                + +
                                                Return values
                                                + mixed + — +

                                                The read value, or null if no value found.

                                                +
                                                + + +
                                                +
                                                +

                                                + _writeProp() + +

                                                + + +

                                                Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).

                                                + + + protected + _writeProp(array<string|int, mixed> &$out, string $name, mixed $value) : mixed + + +
                                                Parameters
                                                +
                                                +
                                                + $out + : array<string|int, mixed> +
                                                +
                                                +

                                                Array to write the data to

                                                +
                                                + +
                                                +
                                                + $name + : string +
                                                +
                                                +

                                                Javascript dotted object name to write to

                                                +
                                                + +
                                                +
                                                + $value + : mixed +
                                                +
                                                +

                                                Value to write

                                                +
                                                + +
                                                +
                                                + + +
                                                + Tags + +
                                                +
                                                +
                                                + throws +
                                                +
                                                + Exception + +

                                                Information about duplicate properties

                                                +
                                                + +
                                                +
                                                + private +
                                                +
                                                + + +
                                                +
                                                + +
                                                Return values
                                                + mixed + — + + +
                                                +
                                                + +
                                                +
                                                +
                                                +
                                                +
                                                
                                                +        
                                                + +
                                                +
                                                + + + +
                                                +
                                                +
                                                +
                                                +

                                                Search results

                                                + +
                                                +
                                                +
                                                  +
                                                  +
                                                  +
                                                  +
                                                  +
                                                  + + +
                                                  + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Upload.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Upload.html new file mode 100644 index 00000000..c5bc8d48 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Upload.html @@ -0,0 +1,1681 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                  +

                                                  Editor PHP 2.1.3

                                                  + + + + + +
                                                  + +
                                                  +
                                                  + + + + +
                                                  + + +
                                                  +

                                                  + Upload + + + extends Ext + + +
                                                  + in package + +
                                                  + + +

                                                  + + + +

                                                  Upload class for Editor. This class provides the ability to easily specify +file upload information, specifically how the file should be recorded on +the server (database and file system).

                                                  + +

                                                  An instance of this class is attached to a field using the Field->upload() method. When Editor detects a file upload for that file the +information provided for this instance is executed.

                                                  +

                                                  The configuration is primarily driven through the Upload->db() and +Upload->action() methods:

                                                  +
                                                    +
                                                  • Upload->db() Describes how information about the uploaded file is to be +stored on the database.
                                                  • +
                                                  • Upload->action() Describes where the file should be stored on the file system +and provides the option of specifying a custom action when a file is +uploaded.
                                                  • +
                                                  +

                                                  Both methods are optional - you can store the file on the server using the +Upload->db() method only if you want to store the file in the database, or if +you don't want to store relational data on the database us only +Upload->action(). However, the majority of the time it is best to use +both - store information about the file on the database for fast retrieval (using a +Editor->leftJoin() for example) and the file on the file system for direct +web access.

                                                  +
                                                  + + +
                                                  + Tags + +
                                                  +
                                                  +
                                                  + example +
                                                  +
                                                  + +

                                                  Store information about a file in a table called files and the actual +file in an uploads directory.

                                                  +
                                                  	Field::inst( 'imageId' )
                                                  +		->upload(
                                                  +			Upload::inst( $_SERVER['DOCUMENT_ROOT'].'/uploads/__ID__.__EXTN__' )
                                                  +		 		->db( 'files', 'id', array(
                                                  +					'webPath'     => Upload::DB_WEB_PATH,
                                                  +					'fileName'    => Upload::DB_FILE_NAME,
                                                  +					'fileSize'    => Upload::DB_FILE_SIZE,
                                                  +					'systemPath'  => Upload::DB_SYSTEM_PATH
                                                  +				) )
                                                  +				->allowedExtensions( array( 'png', 'jpg' ), "Please upload an image file" )
                                                  +		)
                                                  +
                                                  +
                                                  + +
                                                  +
                                                  + example +
                                                  +
                                                  + +

                                                  As above, but with PHP 5.4 (which allows chaining from new instances of a +class)

                                                  +
                                                  	newField( 'imageId' )
                                                  +		->upload(
                                                  +			new Upload( $_SERVER['DOCUMENT_ROOT'].'/uploads/__ID__.__EXTN__' )
                                                  +		 		->db( 'files', 'id', array(
                                                  +					'webPath'     => Upload::DB_WEB_PATH,
                                                  +					'fileName'    => Upload::DB_FILE_NAME,
                                                  +					'fileSize'    => Upload::DB_FILE_SIZE,
                                                  +					'systemPath'  => Upload::DB_SYSTEM_PATH
                                                  +				) )
                                                  +				->allowedExtensions( array( 'png', 'jpg' ), "Please upload an image file" )
                                                  +		)
                                                  +
                                                  +
                                                  + +
                                                  +
                                                  + + + + + + +

                                                  + Table of Contents + +

                                                  + +
                                                  +
                                                  + DB_CONTENT + +  = 'editor-content' +
                                                  +
                                                  Database value option (`Db()`) - File content. This should be written to +a blob. Typically this should be avoided and the file saved on the file +system, but there are cases where it can be useful to store the file in +the database.
                                                  + +
                                                  + DB_CONTENT_TYPE + +  = 'editor-contentType' +
                                                  +
                                                  Database value option (`Db()`) - Content type
                                                  + +
                                                  + DB_EXTN + +  = 'editor-extn' +
                                                  +
                                                  Database value option (`Db()`) - File extension
                                                  + +
                                                  + DB_FILE_NAME + +  = 'editor-fileName' +
                                                  +
                                                  Database value option (`Db()`) - File name (with extension)
                                                  + +
                                                  + DB_FILE_SIZE + +  = 'editor-fileSize' +
                                                  +
                                                  Database value option (`Db()`) - File size (bytes)
                                                  + +
                                                  + DB_MIME_TYPE + +  = 'editor-mimeType' +
                                                  +
                                                  Database value option (`Db()`) - MIME type
                                                  + +
                                                  + DB_READ_ONLY + +  = 'editor-readOnly' +
                                                  +
                                                  Read from the database - don't write to it
                                                  + +
                                                  + DB_SYSTEM_PATH + +  = 'editor-systemPath' +
                                                  +
                                                  Database value option (`Db()`) - Full system path to the file
                                                  + +
                                                  + DB_WEB_PATH + +  = 'editor-webPath' +
                                                  +
                                                  Database value option (`Db()`) - HTTP path to the file. This is derived +from the system path by removing `$_SERVER['DOCUMENT_ROOT']`. If your +images live outside of the document root a custom value would be to be +used.
                                                  + +
                                                  + __construct() + +  : mixed +
                                                  +
                                                  Upload instance constructor
                                                  + +
                                                  + action() + +  : self +
                                                  +
                                                  Set the action to take when a file is uploaded. This can be either of:
                                                  + +
                                                  + allowedExtensions() + +  : self +
                                                  +
                                                  An array of valid file extensions that can be uploaded. This is for +simple validation that the file is of the expected type - for example you +might use `[ 'png', 'jpg', 'jpeg', 'gif' ]` for images. The check is +case-insensitive. If no extensions are given, no validation is performed +on the file extension.
                                                  + +
                                                  + db() + +  : self +
                                                  +
                                                  Database configuration method. When used, this method will tell Editor +what information you want written to a database on file upload, should +you wish to store relational information about your file on the database +(this is generally recommended).
                                                  + +
                                                  + dbClean() + +  : self +
                                                  +
                                                  Set a callback function that is used to remove files which no longer have +a reference in a source table.
                                                  + +
                                                  + inst() + +  : Editor|Field|Join|Upload +
                                                  +
                                                  Static method to instantiate a new instance of a class (shorthand of +'instantiate').
                                                  + +
                                                  + instantiate() + +  : Editor|Field|Join|Upload +
                                                  +
                                                  Static method to instantiate a new instance of a class.
                                                  + +
                                                  + mode() + +  : mixed +
                                                  +
                                                  Set the permissions on the file after it has been uploaded using +chmod.
                                                  + +
                                                  + validator() + +  : self +
                                                  +
                                                  Add a validation method to check file uploads. Multiple validators can be +added by calling this method multiple times - they will be executed in +sequence when a file has been uploaded.
                                                  + +
                                                  + where() + +  : self +
                                                  +
                                                  Add a condition to the data to be retrieved from the database. This +must be given as a function to be executed (usually anonymous) and +will be passed in a single argument, the `Query` object, to which +conditions can be added. Multiple calls to this method can be made.
                                                  + +
                                                  + _getSet() + +  : mixed +
                                                  +
                                                  Common getter / setter function for DataTables classes.
                                                  + +
                                                  + _propExists() + +  : bool +
                                                  +
                                                  Determine if a property is available in a data set (allowing `null` to be +a valid value)
                                                  + +
                                                  + _readProp() + +  : mixed +
                                                  +
                                                  Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.
                                                  + +
                                                  + _writeProp() + +  : mixed +
                                                  +
                                                  Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).
                                                  + +
                                                  + + + + +
                                                  +

                                                  + Constants + +

                                                  +
                                                  +

                                                  + DB_CONTENT + +

                                                  + + + +

                                                  Database value option (`Db()`) - File content. This should be written to +a blob. Typically this should be avoided and the file saved on the file +system, but there are cases where it can be useful to store the file in +the database.

                                                  + + + public + mixed + DB_CONTENT + = 'editor-content' + + + + +
                                                  + + + +
                                                  +
                                                  +

                                                  + DB_CONTENT_TYPE + +

                                                  + + + +

                                                  Database value option (`Db()`) - Content type

                                                  + + + public + mixed + DB_CONTENT_TYPE + = 'editor-contentType' + + + + +
                                                  + + + +
                                                  +
                                                  +

                                                  + DB_EXTN + +

                                                  + + + +

                                                  Database value option (`Db()`) - File extension

                                                  + + + public + mixed + DB_EXTN + = 'editor-extn' + + + + +
                                                  + + + +
                                                  +
                                                  +

                                                  + DB_FILE_NAME + +

                                                  + + + +

                                                  Database value option (`Db()`) - File name (with extension)

                                                  + + + public + mixed + DB_FILE_NAME + = 'editor-fileName' + + + + +
                                                  + + + +
                                                  +
                                                  +

                                                  + DB_FILE_SIZE + +

                                                  + + + +

                                                  Database value option (`Db()`) - File size (bytes)

                                                  + + + public + mixed + DB_FILE_SIZE + = 'editor-fileSize' + + + + +
                                                  + + + +
                                                  +
                                                  +

                                                  + DB_MIME_TYPE + +

                                                  + + + +

                                                  Database value option (`Db()`) - MIME type

                                                  + + + public + mixed + DB_MIME_TYPE + = 'editor-mimeType' + + + + +
                                                  + + + +
                                                  +
                                                  +

                                                  + DB_READ_ONLY + +

                                                  + + + +

                                                  Read from the database - don't write to it

                                                  + + + public + mixed + DB_READ_ONLY + = 'editor-readOnly' + + + + +
                                                  + + + +
                                                  +
                                                  +

                                                  + DB_SYSTEM_PATH + +

                                                  + + + +

                                                  Database value option (`Db()`) - Full system path to the file

                                                  + + + public + mixed + DB_SYSTEM_PATH + = 'editor-systemPath' + + + + +
                                                  + + + +
                                                  +
                                                  +

                                                  + DB_WEB_PATH + +

                                                  + + + +

                                                  Database value option (`Db()`) - HTTP path to the file. This is derived +from the system path by removing `$_SERVER['DOCUMENT_ROOT']`. If your +images live outside of the document root a custom value would be to be +used.

                                                  + + + public + mixed + DB_WEB_PATH + = 'editor-webPath' + + + + +
                                                  + + + +
                                                  +
                                                  + + + +
                                                  +

                                                  + Methods + +

                                                  +
                                                  +

                                                  + __construct() + +

                                                  + + +

                                                  Upload instance constructor

                                                  + + + public + __construct([string|callable $action = null ]) : mixed + + +
                                                  Parameters
                                                  +
                                                  +
                                                  + $action + : string|callable + = null
                                                  +
                                                  +

                                                  Action to take on upload - this is applied +directly to Upload->action().

                                                  +
                                                  + +
                                                  +
                                                  + + + +
                                                  Return values
                                                  + mixed + — + + +
                                                  +
                                                  +

                                                  + action() + +

                                                  + + +

                                                  Set the action to take when a file is uploaded. This can be either of:

                                                  + + + public + action(string|callable $action) : self + +
                                                    +
                                                  • A string - the value given is the full system path to where the +uploaded file is written to. The value given can include three "macros" +which are replaced by the script dependent on the uploaded file: +
                                                      +
                                                    • +__EXTN__ - the file extension
                                                    • +
                                                    • +__NAME__ - the uploaded file's name (including the extension)
                                                    • +
                                                    • +__ID__ - Database primary key value if the Upload->db() method is +used.
                                                    • +
                                                    +
                                                  • +
                                                  • A closure - if a function is given the responsibility of what to do +with the uploaded file is transferred to this function. That will +typically involve writing it to the file system so it can be used +later.
                                                  • +
                                                  +
                                                  + +
                                                  Parameters
                                                  +
                                                  +
                                                  + $action + : string|callable +
                                                  +
                                                  +

                                                  Action to take - see description above.

                                                  +
                                                  + +
                                                  +
                                                  + + + +
                                                  Return values
                                                  + self + — +

                                                  Current instance, used for chaining

                                                  +
                                                  + + +
                                                  +
                                                  +

                                                  + allowedExtensions() + +

                                                  + + +

                                                  An array of valid file extensions that can be uploaded. This is for +simple validation that the file is of the expected type - for example you +might use `[ 'png', 'jpg', 'jpeg', 'gif' ]` for images. The check is +case-insensitive. If no extensions are given, no validation is performed +on the file extension.

                                                  + + + public + allowedExtensions(array<string|int, string> $extn[, string $error = "This file type cannot be uploaded" ]) : self + + +
                                                  Parameters
                                                  +
                                                  +
                                                  + $extn + : array<string|int, string> +
                                                  +
                                                  +

                                                  List of file extensions that are allowable for +the upload

                                                  +
                                                  + +
                                                  +
                                                  + $error + : string + = "This file type cannot be uploaded"
                                                  +
                                                  +

                                                  Error message if a file is uploaded that doesn't +match the valid list of extensions.

                                                  +
                                                  + +
                                                  +
                                                  + + +
                                                  + Tags + +
                                                  +
                                                  +
                                                  + deprecated +
                                                  +
                                                  + +

                                                  Use Validate::fileExtensions

                                                  +
                                                  + +
                                                  +
                                                  + +
                                                  Return values
                                                  + self + — +

                                                  Current instance, used for chaining

                                                  +
                                                  + + +
                                                  +
                                                  +

                                                  + db() + +

                                                  + + +

                                                  Database configuration method. When used, this method will tell Editor +what information you want written to a database on file upload, should +you wish to store relational information about your file on the database +(this is generally recommended).

                                                  + + + public + db(string $table, string $pkey, array<string|int, mixed> $fields[, mixed $format = null ]) : self + + +
                                                  Parameters
                                                  +
                                                  +
                                                  + $table + : string +
                                                  +
                                                  +

                                                  The name of the table where the file information +should be stored

                                                  +
                                                  + +
                                                  +
                                                  + $pkey + : string +
                                                  +
                                                  +

                                                  Primary key column name. The Upload class +requires that the database table have a single primary key so each +row can be uniquely identified.

                                                  +
                                                  + +
                                                  +
                                                  + $fields + : array<string|int, mixed> +
                                                  +
                                                  +

                                                  A list of the fields to be written to on upload. +The property names are the database columns and the values can be +defined by the constants of this class. The value can also be a +string or a closure function if you wish to send custom information +to the database.

                                                  +
                                                  + +
                                                  +
                                                  + $format + : mixed + = null
                                                  +
                                                  +
                                                  + +
                                                  +
                                                  + + + +
                                                  Return values
                                                  + self + — +

                                                  Current instance, used for chaining

                                                  +
                                                  + + +
                                                  +
                                                  +

                                                  + dbClean() + +

                                                  + + +

                                                  Set a callback function that is used to remove files which no longer have +a reference in a source table.

                                                  + + + public + dbClean(mixed $tableField[, callable $callback = null ]) : self + + +
                                                  Parameters
                                                  +
                                                  +
                                                  + $tableField + : mixed +
                                                  +
                                                  +
                                                  + +
                                                  +
                                                  + $callback + : callable + = null
                                                  +
                                                  +

                                                  Function that will be executed on clean. It is +given an array of information from the database about the orphaned +rows, and can return true to indicate that the rows should be +removed from the database. Any other return value (including none) +will result in the records being retained.

                                                  +
                                                  + +
                                                  +
                                                  + + + +
                                                  Return values
                                                  + self + — +

                                                  Current instance, used for chaining

                                                  +
                                                  + + +
                                                  +
                                                  +

                                                  + inst() + +

                                                  + + +

                                                  Static method to instantiate a new instance of a class (shorthand of +'instantiate').

                                                  + + + public + static inst() : Editor|Field|Join|Upload + +

                                                  This method performs exactly the same actions as the 'instantiate' +static method, but is simply shorter and easier to type!

                                                  +
                                                  + + + + +
                                                  Return values
                                                  + Editor|Field|Join|Upload + — +

                                                  class +@static

                                                  +
                                                  + + +
                                                  +
                                                  +

                                                  + instantiate() + +

                                                  + + +

                                                  Static method to instantiate a new instance of a class.

                                                  + + + public + static instantiate() : Editor|Field|Join|Upload + +

                                                  A factory method that will create a new instance of the class +that has extended 'Ext'. This allows classes to be instantiated +and then chained - which otherwise isn't available until PHP 5.4. +If using PHP 5.4 or later, simply create a 'new' instance of the +target class and chain methods as normal.

                                                  +
                                                  + + + + +
                                                  Return values
                                                  + Editor|Field|Join|Upload + — +

                                                  Instantiated class +@static

                                                  +
                                                  + + +
                                                  +
                                                  +

                                                  + mode() + +

                                                  + + +

                                                  Set the permissions on the file after it has been uploaded using +chmod.

                                                  + + + public + mode(mixed $m) : mixed + + +
                                                  Parameters
                                                  +
                                                  +
                                                  + $m + : mixed +
                                                  +
                                                  +
                                                  + +
                                                  +
                                                  + + + +
                                                  Return values
                                                  + mixed + — + + +
                                                  +
                                                  +

                                                  + validator() + +

                                                  + + +

                                                  Add a validation method to check file uploads. Multiple validators can be +added by calling this method multiple times - they will be executed in +sequence when a file has been uploaded.

                                                  + + + public + validator(callable $fn) : self + + +
                                                  Parameters
                                                  +
                                                  +
                                                  + $fn + : callable +
                                                  +
                                                  +

                                                  Validation function. A PHP $_FILES parameter is +passed in for the uploaded file and the return is either a string +(validation failed and error message), or null (validation passed).

                                                  +
                                                  + +
                                                  +
                                                  + + + +
                                                  Return values
                                                  + self + — +

                                                  Current instance, used for chaining

                                                  +
                                                  + + +
                                                  +
                                                  +

                                                  + where() + +

                                                  + + +

                                                  Add a condition to the data to be retrieved from the database. This +must be given as a function to be executed (usually anonymous) and +will be passed in a single argument, the `Query` object, to which +conditions can be added. Multiple calls to this method can be made.

                                                  + + + public + where(callable $fn) : self + + +
                                                  Parameters
                                                  +
                                                  +
                                                  + $fn + : callable +
                                                  +
                                                  +

                                                  Where function.

                                                  +
                                                  + +
                                                  +
                                                  + + + +
                                                  Return values
                                                  + self + — +

                                                  Current instance, used for chaining

                                                  +
                                                  + + +
                                                  +
                                                  +

                                                  + _getSet() + +

                                                  + + +

                                                  Common getter / setter function for DataTables classes.

                                                  + + + protected + _getSet(mixed &$prop, mixed $val[, mixed $array = false ]) : mixed + +

                                                  This getter / setter method makes building getter / setting methods +easier, by abstracting everything to a single function call.

                                                  +
                                                  + +
                                                  Parameters
                                                  +
                                                  +
                                                  + $prop + : mixed +
                                                  +
                                                  +

                                                  The property to set +@param mixed $val The value to set - if given as null, then we assume +that the function is being used as a getter. +@param boolean $array Treat the target property as an array or not +(default false). If used as an array, then values passed in are added +to the $prop array. +@return self|mixed Class instance if setting (allowing chaining), or +the value requested if getting.

                                                  +
                                                  + +
                                                  +
                                                  + $val + : mixed +
                                                  +
                                                  +
                                                  + +
                                                  +
                                                  + $array + : mixed + = false
                                                  +
                                                  +
                                                  + +
                                                  +
                                                  + + + +
                                                  Return values
                                                  + mixed + — + + +
                                                  +
                                                  +

                                                  + _propExists() + +

                                                  + + +

                                                  Determine if a property is available in a data set (allowing `null` to be +a valid value)

                                                  + + + protected + _propExists(string $name, array<string|int, mixed> $data) : bool + + +
                                                  Parameters
                                                  +
                                                  +
                                                  + $name + : string +
                                                  +
                                                  +

                                                  Javascript dotted object name to write to

                                                  +
                                                  + +
                                                  +
                                                  + $data + : array<string|int, mixed> +
                                                  +
                                                  +

                                                  Data source array to read from

                                                  +
                                                  + +
                                                  +
                                                  + + +
                                                  + Tags + +
                                                  +
                                                  +
                                                  + private +
                                                  +
                                                  + + +
                                                  +
                                                  + +
                                                  Return values
                                                  + bool + — +

                                                  true if present, false otherwise

                                                  +
                                                  + + +
                                                  +
                                                  +

                                                  + _readProp() + +

                                                  + + +

                                                  Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.

                                                  + + + protected + _readProp(string $name, array<string|int, mixed> $data) : mixed + + +
                                                  Parameters
                                                  +
                                                  +
                                                  + $name + : string +
                                                  +
                                                  +

                                                  Javascript dotted object name to write to

                                                  +
                                                  + +
                                                  +
                                                  + $data + : array<string|int, mixed> +
                                                  +
                                                  +

                                                  Data source array to read from

                                                  +
                                                  + +
                                                  +
                                                  + + +
                                                  + Tags + +
                                                  +
                                                  +
                                                  + private +
                                                  +
                                                  + + +
                                                  +
                                                  + +
                                                  Return values
                                                  + mixed + — +

                                                  The read value, or null if no value found.

                                                  +
                                                  + + +
                                                  +
                                                  +

                                                  + _writeProp() + +

                                                  + + +

                                                  Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).

                                                  + + + protected + _writeProp(array<string|int, mixed> &$out, string $name, mixed $value) : mixed + + +
                                                  Parameters
                                                  +
                                                  +
                                                  + $out + : array<string|int, mixed> +
                                                  +
                                                  +

                                                  Array to write the data to

                                                  +
                                                  + +
                                                  +
                                                  + $name + : string +
                                                  +
                                                  +

                                                  Javascript dotted object name to write to

                                                  +
                                                  + +
                                                  +
                                                  + $value + : mixed +
                                                  +
                                                  +

                                                  Value to write

                                                  +
                                                  + +
                                                  +
                                                  + + +
                                                  + Tags + +
                                                  +
                                                  +
                                                  + throws +
                                                  +
                                                  + Exception + +

                                                  Information about duplicate properties

                                                  +
                                                  + +
                                                  +
                                                  + private +
                                                  +
                                                  + + +
                                                  +
                                                  + +
                                                  Return values
                                                  + mixed + — + + +
                                                  +
                                                  + +
                                                  +
                                                  +
                                                  +
                                                  +
                                                  
                                                  +        
                                                  + +
                                                  +
                                                  + + + +
                                                  +
                                                  +
                                                  +
                                                  +

                                                  Search results

                                                  + +
                                                  +
                                                  +
                                                    +
                                                    +
                                                    +
                                                    +
                                                    +
                                                    + + +
                                                    + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Validate.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Validate.html new file mode 100644 index 00000000..490dac38 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-Validate.html @@ -0,0 +1,2108 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                    +

                                                    Editor PHP 2.1.3

                                                    + + + + + +
                                                    + +
                                                    +
                                                    + + + + +
                                                    + + +
                                                    +

                                                    + Validate + + +
                                                    + in package + +
                                                    + + +

                                                    + + + +

                                                    Validation methods for DataTables Editor fields.

                                                    + +

                                                    These methods will typically be applied through the Field::validator() +method and thus the arguments to be passed will be automatically resolved +by Editor.

                                                    +

                                                    The validation methods in this class all take three parameters:

                                                    +
                                                      +
                                                    1. Data to be validated
                                                    2. +
                                                    3. Full data from the form (this can be used with a custom validation method +for dependent validation).
                                                    4. +
                                                    5. Validation configuration options.
                                                    6. +
                                                    +

                                                    When using the Validate class functions with the Field::validator() +method, the second parameter passed into Field::validator() is given +to the validation functions here as the third parameter. The first and +second parameters are automatically resolved by the Field class.

                                                    +

                                                    The validation configuration options is an array of options that can be used +to customise the validation - for example defining a date format for date +validation. Each validation method has the option of defining its own +validation options, but all validation methods provide four common options:

                                                    +
                                                      +
                                                    • +{boolean} optional - Require the field to be submitted (false) or not +(true - default). When set to true the field does not need to be +included in the list of parameters sent by the client - if set to false +then it must be included. This option can be be particularly used in Editor +as Editor will not set a value for fields which have not been submitted - +giving the ability to submit just a partial list of options.
                                                    • +
                                                    • +{boolean} empty - Allow a field to be empty, i.e. a zero length string - +'' (true - default) or require it to be non-zero length (false).
                                                    • +
                                                    • +{boolean} required - Short-cut for optional=false and empty=false. +Note that if this option is set the optional and empty parameters are +automatically set and cannot be overridden by passing in different values.
                                                    • +
                                                    • +{string} message - Error message shown should validation fail. This +provides complete control over the message shown to the end user, including +internationalisation (i.e. to provide a translation that is not in the +English language).
                                                    • +
                                                    +
                                                    + + +
                                                    + Tags + +
                                                    +
                                                    +
                                                    + example +
                                                    +
                                                    + +
                                                        // Ensure that a non-empty value is given for a field
                                                    +    Field::inst( 'engine' )->validator( Validate::required() )
                                                    +
                                                    +

                                                    @example

                                                    +
                                                      // Don't require a field to be submitted, but if it is submitted, it
                                                    +  // must be non-empty
                                                    +  Field::inst( 'reg_date' )->validator( Validate::notEmpty() )
                                                    +
                                                    +

                                                    @example

                                                    +
                                                      // Date validation
                                                    +  Field::inst( 'reg_date' )->validator( Validate::dateFormat( 'D, d M y' ) )
                                                    +
                                                    +

                                                    @example

                                                    +
                                                      // Date validation with a custom error message
                                                    +  Field::inst( 'reg_date' )->validator( Validate::dateFormat( 'D, d M y',
                                                    +      ValidateOptions::inst()
                                                    +          ->message( 'Invalid date' )
                                                    +  ) )
                                                    +
                                                    +

                                                    @example

                                                    +
                                                      // Require a non-empty e-mail address
                                                    +  Field::inst( 'reg_date' )->validator( Validate::email( ValidateOptions::inst()
                                                    +    ->empty( false )
                                                    +  ) )
                                                    +
                                                    +

                                                    @example

                                                    +
                                                      // Custom validation - closure
                                                    +  Field::inst( 'engine' )->validator( function($val, $data, $opts) {
                                                    +     if ( ! preg_match( '/^1/', $val ) ) {
                                                    +       return "Value <b>must</b> start with a 1";
                                                    +     }
                                                    +     return true;
                                                    +  } )
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + + + + +

                                                    + Table of Contents + +

                                                    + +
                                                    +
                                                    + _common() + +  : mixed +
                                                    +
                                                    Perform common validation using the configuration parameters
                                                    + +
                                                    + _commonLegacy() + +  : mixed +
                                                    +
                                                    Convert the old style validation parameters into ValidateOptions
                                                    + +
                                                    + _extend() + +  : mixed +
                                                    +
                                                    Extend the options from the user function and the validation function +with core defaults.
                                                    + +
                                                    + basic() + +  : string|true +
                                                    +
                                                    Basic validation - this is used to perform the validation provided by the +validation options only. If the validation options pass (e.g. `required`, +`empty` and `optional`) then the validation will pass regardless of the +actual value.
                                                    + +
                                                    + boolean() + +  : mixed +
                                                    +
                                                    Validate an input as a boolean value.
                                                    + +
                                                    + dateFormat() + +  : mixed +
                                                    +
                                                    Check that a valid date input is given
                                                    + +
                                                    + dbValues() + +  : mixed +
                                                    +
                                                    Check that the given value is a value that is available in a database - +i.e. a join primary key. This will attempt to automatically use the table +name and value column from the field's `options` method (under the +assumption that it will typically be used with a joined field), but the +table and field can also be specified via the options.
                                                    + +
                                                    + email() + +  : mixed +
                                                    +
                                                    Validate an input as an e-mail address.
                                                    + +
                                                    + fileExtensions() + +  : mixed +
                                                    +
                                                    + +
                                                    + fileSize() + +  : mixed +
                                                    +
                                                    + +
                                                    + ip() + +  : mixed +
                                                    +
                                                    Validate as an IP address.
                                                    + +
                                                    + maxLen() + +  : mixed +
                                                    +
                                                    Validate a string does not exceed a maximum length.
                                                    + +
                                                    + maxNum() + +  : mixed +
                                                    +
                                                    Check for a numeric input and that it is less than a given value.
                                                    + +
                                                    + minLen() + +  : mixed +
                                                    +
                                                    Validate a string has a minimum length.
                                                    + +
                                                    + minMaxLen() + +  : mixed +
                                                    +
                                                    Require a string with a certain minimum or maximum number of characters.
                                                    + +
                                                    + minMaxNum() + +  : mixed +
                                                    +
                                                    Check for a numeric input and that it is both greater and smaller than +given numbers.
                                                    + +
                                                    + minNum() + +  : mixed +
                                                    +
                                                    Check for a numeric input and that it is greater than a given value.
                                                    + +
                                                    + mjoinMaxCount() + +  : mixed +
                                                    +
                                                    + +
                                                    + mjoinMinCount() + +  : mixed +
                                                    +
                                                    + +
                                                    + none() + +  : mixed +
                                                    +
                                                    No validation - all inputs are valid.
                                                    + +
                                                    + noTags() + +  : mixed +
                                                    +
                                                    Check if there are any tags in the submitted value
                                                    + +
                                                    + notEmpty() + +  : mixed +
                                                    +
                                                    Optional field, but if given there must be a non-empty value
                                                    + +
                                                    + numeric() + +  : mixed +
                                                    +
                                                    Check that any input is numeric.
                                                    + +
                                                    + required() + +  : mixed +
                                                    +
                                                    Required field - there must be a value and it must be a non-empty value
                                                    + +
                                                    + unique() + +  : mixed +
                                                    +
                                                    Check that the given value is unique in the database
                                                    + +
                                                    + url() + +  : mixed +
                                                    +
                                                    Validate as an URL address.
                                                    + +
                                                    + values() + +  : mixed +
                                                    +
                                                    Confirm that the value submitted is in a list of allowable values
                                                    + +
                                                    + xss() + +  : mixed +
                                                    +
                                                    Check if string could contain an XSS attack string
                                                    + +
                                                    + + + + + + + +
                                                    +

                                                    + Methods + +

                                                    +
                                                    +

                                                    + _common() + +

                                                    + + +

                                                    Perform common validation using the configuration parameters

                                                    + + + public + static _common(mixed $val, mixed $opts) : mixed + +

                                                    @internal

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $val + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $opts + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + _commonLegacy() + +

                                                    + + +

                                                    Convert the old style validation parameters into ValidateOptions

                                                    + + + public + static _commonLegacy(mixed $cfg) : mixed + +

                                                    @internal

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $cfg + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + _extend() + +

                                                    + + +

                                                    Extend the options from the user function and the validation function +with core defaults.

                                                    + + + public + static _extend(mixed $userOpts, mixed $prop, mixed $fnOpts) : mixed + +

                                                    @internal

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $userOpts + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $prop + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $fnOpts + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + basic() + +

                                                    + + +

                                                    Basic validation - this is used to perform the validation provided by the +validation options only. If the validation options pass (e.g. `required`, +`empty` and `optional`) then the validation will pass regardless of the +actual value.

                                                    + + + public + static basic([mixed $cfg = null ]) : string|true + +

                                                    Note that there are two helper short-cut methods that provide the same +function as this method, but are slightly shorter:

                                                    +
                                                    // Required:
                                                    +Validate::required()
                                                    +
                                                    +// is the same as
                                                    +Validate::basic( $val, $data, array(
                                                    +  "required" => true
                                                    +);
                                                    +
                                                    +
                                                    // Optional, but not empty if given:
                                                    +Validate::notEmpty()
                                                    +
                                                    +// is the same as
                                                    +Validate::basic( $val, $data, array(
                                                    +  "empty" => false
                                                    +);
                                                    +
                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $cfg + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + string|true + — +

                                                    true if the value is valid, a string with an error +message otherwise.

                                                    +
                                                    + + +
                                                    +
                                                    +

                                                    + boolean() + +

                                                    + + +

                                                    Validate an input as a boolean value.

                                                    + + + public + static boolean([mixed $cfg = null ]) : mixed + +

                                                    @param string $val The value to check for validity

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $cfg + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + dateFormat() + +

                                                    + + +

                                                    Check that a valid date input is given

                                                    + + + public + static dateFormat(mixed $format[, mixed $cfg = null ]) : mixed + +

                                                    @param string $val The value to check for validity

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $format + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $cfg + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + dbValues() + +

                                                    + + +

                                                    Check that the given value is a value that is available in a database - +i.e. a join primary key. This will attempt to automatically use the table +name and value column from the field's `options` method (under the +assumption that it will typically be used with a joined field), but the +table and field can also be specified via the options.

                                                    + + + public + static dbValues([mixed $cfg = null ][, mixed $column = null ][, mixed $table = null ][, mixed $db = null ][, mixed $values = array() ]) : mixed + +

                                                    @param string $val The value to check for validity

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $cfg + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $column + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $table + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $db + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $values + : mixed + = array()
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + email() + +

                                                    + + +

                                                    Validate an input as an e-mail address.

                                                    + + + public + static email([mixed $cfg = null ]) : mixed + +

                                                    @param string $val The value to check for validity

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $cfg + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + fileExtensions() + +

                                                    + + + + + public + static fileExtensions(mixed $extensions[, mixed $msg = "This file type cannot be uploaded." ]) : mixed + +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $extensions + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $msg + : mixed + = "This file type cannot be uploaded."
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + fileSize() + +

                                                    + + + + + public + static fileSize(mixed $size[, mixed $msg = "Uploaded file is too large." ]) : mixed + +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $size + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $msg + : mixed + = "Uploaded file is too large."
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + ip() + +

                                                    + + +

                                                    Validate as an IP address.

                                                    + + + public + static ip([mixed $cfg = null ]) : mixed + +

                                                    @param string $val The value to check for validity

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $cfg + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + maxLen() + +

                                                    + + +

                                                    Validate a string does not exceed a maximum length.

                                                    + + + public + static maxLen(mixed $max[, mixed $cfg = null ]) : mixed + +

                                                    @param string $val The value to check for validity

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $max + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $cfg + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + maxNum() + +

                                                    + + +

                                                    Check for a numeric input and that it is less than a given value.

                                                    + + + public + static maxNum(mixed $max[, mixed $decimal = "." ][, mixed $cfg = null ]) : mixed + +

                                                    @param string $val The value to check for validity

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $max + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $decimal + : mixed + = "."
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $cfg + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + minLen() + +

                                                    + + +

                                                    Validate a string has a minimum length.

                                                    + + + public + static minLen(mixed $min[, mixed $cfg = null ]) : mixed + +

                                                    @param string $val The value to check for validity

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $min + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $cfg + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + minMaxLen() + +

                                                    + + +

                                                    Require a string with a certain minimum or maximum number of characters.

                                                    + + + public + static minMaxLen(mixed $min, mixed $max[, mixed $cfg = null ]) : mixed + +

                                                    @param string $val The value to check for validity

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $min + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $max + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $cfg + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + minMaxNum() + +

                                                    + + +

                                                    Check for a numeric input and that it is both greater and smaller than +given numbers.

                                                    + + + public + static minMaxNum(mixed $min, mixed $max[, mixed $decimal = '.' ][, mixed $cfg = null ]) : mixed + +

                                                    @param string $val The value to check for validity

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $min + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $max + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $decimal + : mixed + = '.'
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $cfg + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + minNum() + +

                                                    + + +

                                                    Check for a numeric input and that it is greater than a given value.

                                                    + + + public + static minNum(mixed $min[, mixed $decimal = "." ][, mixed $cfg = null ]) : mixed + +

                                                    @param string $val The value to check for validity

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $min + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $decimal + : mixed + = "."
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $cfg + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + mjoinMaxCount() + +

                                                    + + + + + public + static mjoinMaxCount(mixed $count[, mixed $msg = "Too many items." ]) : mixed + +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $count + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $msg + : mixed + = "Too many items."
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + mjoinMinCount() + +

                                                    + + + + + public + static mjoinMinCount(mixed $count[, mixed $msg = "Too few items." ]) : mixed + +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $count + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $msg + : mixed + = "Too few items."
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + none() + +

                                                    + + +

                                                    No validation - all inputs are valid.

                                                    + + + public + static none() : mixed + +

                                                    @return callable Validation function

                                                    +
                                                    + + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + noTags() + +

                                                    + + +

                                                    Check if there are any tags in the submitted value

                                                    + + + public + static noTags([mixed $cfg = null ]) : mixed + +

                                                    @param string $val The value to check for validity

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $cfg + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + notEmpty() + +

                                                    + + +

                                                    Optional field, but if given there must be a non-empty value

                                                    + + + public + static notEmpty([ValidateOptions $cfg = null ]) : mixed + +

                                                    This is a helper short-cut method which is the same as:

                                                    +
                                                    Validate::basic( $val, $data, array(
                                                    +  "empty" => false
                                                    +);
                                                    +
                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $cfg + : ValidateOptions + = null
                                                    +
                                                    +

                                                    Validation options +@return callable Validation function

                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + numeric() + +

                                                    + + +

                                                    Check that any input is numeric.

                                                    + + + public + static numeric([mixed $decimal = "." ][, mixed $cfg = null ]) : mixed + +

                                                    @param string $val The value to check for validity

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $decimal + : mixed + = "."
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $cfg + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + required() + +

                                                    + + +

                                                    Required field - there must be a value and it must be a non-empty value

                                                    + + + public + static required([mixed $cfg = null ]) : mixed + +

                                                    This is a helper short-cut method which is the same as:

                                                    +
                                                    Validate::basic( $val, $data, array(
                                                    +  "required" => true
                                                    +);
                                                    +
                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $cfg + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + unique() + +

                                                    + + +

                                                    Check that the given value is unique in the database

                                                    + + + public + static unique([mixed $cfg = null ][, mixed $column = null ][, mixed $table = null ][, mixed $db = null ]) : mixed + +

                                                    @param string $val The value to check for validity

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $cfg + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $column + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $table + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $db + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + url() + +

                                                    + + +

                                                    Validate as an URL address.

                                                    + + + public + static url([mixed $cfg = null ]) : mixed + +

                                                    @param string $val The value to check for validity

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $cfg + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + values() + +

                                                    + + +

                                                    Confirm that the value submitted is in a list of allowable values

                                                    + + + public + static values(mixed $values[, mixed $cfg = null ]) : mixed + +

                                                    @param string $val The value to check for validity

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $values + : mixed +
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + $cfg + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    +

                                                    + xss() + +

                                                    + + +

                                                    Check if string could contain an XSS attack string

                                                    + + + public + static xss([mixed $cfg = null ]) : mixed + +

                                                    @param string $val The value to check for validity

                                                    +
                                                    + +
                                                    Parameters
                                                    +
                                                    +
                                                    + $cfg + : mixed + = null
                                                    +
                                                    +
                                                    + +
                                                    +
                                                    + + + +
                                                    Return values
                                                    + mixed + — + + +
                                                    +
                                                    + +
                                                    +
                                                    +
                                                    +
                                                    +
                                                    
                                                    +        
                                                    + +
                                                    +
                                                    + + + +
                                                    +
                                                    +
                                                    +
                                                    +

                                                    Search results

                                                    + +
                                                    +
                                                    +
                                                      +
                                                      +
                                                      +
                                                      +
                                                      +
                                                      + + +
                                                      + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-ValidateOptions.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-ValidateOptions.html new file mode 100644 index 00000000..6e788003 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor-ValidateOptions.html @@ -0,0 +1,922 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                      +

                                                      Editor PHP 2.1.3

                                                      + + + + + +
                                                      + +
                                                      +
                                                      + + + + +
                                                      + + +
                                                      +

                                                      + ValidateOptions + + + extends Ext + + +
                                                      + in package + +
                                                      + + +

                                                      + + + +

                                                      Common validation options that can be specified for all validation methods.

                                                      + + + + + + + + + +

                                                      + Table of Contents + +

                                                      + +
                                                      +
                                                      + __construct() + +  : mixed +
                                                      +
                                                      + +
                                                      + allowEmpty() + +  : ValidateOptions|bool +
                                                      +
                                                      Get / set the field empty option
                                                      + +
                                                      + inst() + +  : Editor|Field|Join|Upload +
                                                      +
                                                      Static method to instantiate a new instance of a class (shorthand of +'instantiate').
                                                      + +
                                                      + instantiate() + +  : Editor|Field|Join|Upload +
                                                      +
                                                      Static method to instantiate a new instance of a class.
                                                      + +
                                                      + message() + +  : ValidateOptions|string +
                                                      +
                                                      Get / set the error message to use if validation fails
                                                      + +
                                                      + optional() + +  : ValidateOptions|bool +
                                                      +
                                                      Get / set the field optional option
                                                      + +
                                                      + _getSet() + +  : mixed +
                                                      +
                                                      Common getter / setter function for DataTables classes.
                                                      + +
                                                      + _propExists() + +  : bool +
                                                      +
                                                      Determine if a property is available in a data set (allowing `null` to be +a valid value)
                                                      + +
                                                      + _readProp() + +  : mixed +
                                                      +
                                                      Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.
                                                      + +
                                                      + _writeProp() + +  : mixed +
                                                      +
                                                      Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).
                                                      + +
                                                      + + + + + + + +
                                                      +

                                                      + Methods + +

                                                      +
                                                      +

                                                      + __construct() + +

                                                      + + + + + public + __construct([mixed $opts = null ]) : mixed + +
                                                      + +
                                                      Parameters
                                                      +
                                                      +
                                                      + $opts + : mixed + = null
                                                      +
                                                      +
                                                      + +
                                                      +
                                                      + + + +
                                                      Return values
                                                      + mixed + — + + +
                                                      +
                                                      +

                                                      + allowEmpty() + +

                                                      + + +

                                                      Get / set the field empty option

                                                      + + + public + allowEmpty([bool $empty = null ]) : ValidateOptions|bool + + +
                                                      Parameters
                                                      +
                                                      +
                                                      + $empty + : bool + = null
                                                      +
                                                      +

                                                      false if the field is not allowed to be +empty. true if it can be.

                                                      +
                                                      + +
                                                      +
                                                      + + + +
                                                      Return values
                                                      + ValidateOptions|bool + — +

                                                      Self if setting, current value if getting.

                                                      +
                                                      + + +
                                                      +
                                                      +

                                                      + inst() + +

                                                      + + +

                                                      Static method to instantiate a new instance of a class (shorthand of +'instantiate').

                                                      + + + public + static inst() : Editor|Field|Join|Upload + +

                                                      This method performs exactly the same actions as the 'instantiate' +static method, but is simply shorter and easier to type!

                                                      +
                                                      + + + + +
                                                      Return values
                                                      + Editor|Field|Join|Upload + — +

                                                      class +@static

                                                      +
                                                      + + +
                                                      +
                                                      +

                                                      + instantiate() + +

                                                      + + +

                                                      Static method to instantiate a new instance of a class.

                                                      + + + public + static instantiate() : Editor|Field|Join|Upload + +

                                                      A factory method that will create a new instance of the class +that has extended 'Ext'. This allows classes to be instantiated +and then chained - which otherwise isn't available until PHP 5.4. +If using PHP 5.4 or later, simply create a 'new' instance of the +target class and chain methods as normal.

                                                      +
                                                      + + + + +
                                                      Return values
                                                      + Editor|Field|Join|Upload + — +

                                                      Instantiated class +@static

                                                      +
                                                      + + +
                                                      +
                                                      +

                                                      + message() + +

                                                      + + +

                                                      Get / set the error message to use if validation fails

                                                      + + + public + message([string $msg = null ]) : ValidateOptions|string + + +
                                                      Parameters
                                                      +
                                                      +
                                                      + $msg + : string + = null
                                                      +
                                                      +

                                                      Error message to use. If not given, the currently +set message will be returned.

                                                      +
                                                      + +
                                                      +
                                                      + + + +
                                                      Return values
                                                      + ValidateOptions|string + — +

                                                      Self if setting, message if getting.

                                                      +
                                                      + + +
                                                      +
                                                      +

                                                      + optional() + +

                                                      + + +

                                                      Get / set the field optional option

                                                      + + + public + optional([bool $optional = null ]) : ValidateOptions|bool + + +
                                                      Parameters
                                                      +
                                                      +
                                                      + $optional + : bool + = null
                                                      +
                                                      +

                                                      false if the field does not need to be +submitted. true if it must be.

                                                      +
                                                      + +
                                                      +
                                                      + + + +
                                                      Return values
                                                      + ValidateOptions|bool + — +

                                                      Self if setting, current value if getting.

                                                      +
                                                      + + +
                                                      +
                                                      +

                                                      + _getSet() + +

                                                      + + +

                                                      Common getter / setter function for DataTables classes.

                                                      + + + protected + _getSet(mixed &$prop, mixed $val[, mixed $array = false ]) : mixed + +

                                                      This getter / setter method makes building getter / setting methods +easier, by abstracting everything to a single function call.

                                                      +
                                                      + +
                                                      Parameters
                                                      +
                                                      +
                                                      + $prop + : mixed +
                                                      +
                                                      +

                                                      The property to set +@param mixed $val The value to set - if given as null, then we assume +that the function is being used as a getter. +@param boolean $array Treat the target property as an array or not +(default false). If used as an array, then values passed in are added +to the $prop array. +@return self|mixed Class instance if setting (allowing chaining), or +the value requested if getting.

                                                      +
                                                      + +
                                                      +
                                                      + $val + : mixed +
                                                      +
                                                      +
                                                      + +
                                                      +
                                                      + $array + : mixed + = false
                                                      +
                                                      +
                                                      + +
                                                      +
                                                      + + + +
                                                      Return values
                                                      + mixed + — + + +
                                                      +
                                                      +

                                                      + _propExists() + +

                                                      + + +

                                                      Determine if a property is available in a data set (allowing `null` to be +a valid value)

                                                      + + + protected + _propExists(string $name, array<string|int, mixed> $data) : bool + + +
                                                      Parameters
                                                      +
                                                      +
                                                      + $name + : string +
                                                      +
                                                      +

                                                      Javascript dotted object name to write to

                                                      +
                                                      + +
                                                      +
                                                      + $data + : array<string|int, mixed> +
                                                      +
                                                      +

                                                      Data source array to read from

                                                      +
                                                      + +
                                                      +
                                                      + + +
                                                      + Tags + +
                                                      +
                                                      +
                                                      + private +
                                                      +
                                                      + + +
                                                      +
                                                      + +
                                                      Return values
                                                      + bool + — +

                                                      true if present, false otherwise

                                                      +
                                                      + + +
                                                      +
                                                      +

                                                      + _readProp() + +

                                                      + + +

                                                      Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.

                                                      + + + protected + _readProp(string $name, array<string|int, mixed> $data) : mixed + + +
                                                      Parameters
                                                      +
                                                      +
                                                      + $name + : string +
                                                      +
                                                      +

                                                      Javascript dotted object name to write to

                                                      +
                                                      + +
                                                      +
                                                      + $data + : array<string|int, mixed> +
                                                      +
                                                      +

                                                      Data source array to read from

                                                      +
                                                      + +
                                                      +
                                                      + + +
                                                      + Tags + +
                                                      +
                                                      +
                                                      + private +
                                                      +
                                                      + + +
                                                      +
                                                      + +
                                                      Return values
                                                      + mixed + — +

                                                      The read value, or null if no value found.

                                                      +
                                                      + + +
                                                      +
                                                      +

                                                      + _writeProp() + +

                                                      + + +

                                                      Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).

                                                      + + + protected + _writeProp(array<string|int, mixed> &$out, string $name, mixed $value) : mixed + + +
                                                      Parameters
                                                      +
                                                      +
                                                      + $out + : array<string|int, mixed> +
                                                      +
                                                      +

                                                      Array to write the data to

                                                      +
                                                      + +
                                                      +
                                                      + $name + : string +
                                                      +
                                                      +

                                                      Javascript dotted object name to write to

                                                      +
                                                      + +
                                                      +
                                                      + $value + : mixed +
                                                      +
                                                      +

                                                      Value to write

                                                      +
                                                      + +
                                                      +
                                                      + + +
                                                      + Tags + +
                                                      +
                                                      +
                                                      + throws +
                                                      +
                                                      + Exception + +

                                                      Information about duplicate properties

                                                      +
                                                      + +
                                                      +
                                                      + private +
                                                      +
                                                      + + +
                                                      +
                                                      + +
                                                      Return values
                                                      + mixed + — + + +
                                                      +
                                                      + +
                                                      +
                                                      +
                                                      +
                                                      +
                                                      
                                                      +        
                                                      + +
                                                      +
                                                      + + + +
                                                      +
                                                      +
                                                      +
                                                      +

                                                      Search results

                                                      + +
                                                      +
                                                      +
                                                        +
                                                        +
                                                        +
                                                        +
                                                        +
                                                        + + +
                                                        + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor.html new file mode 100644 index 00000000..972a63e3 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Editor.html @@ -0,0 +1,2989 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                        +

                                                        Editor PHP 2.1.3

                                                        + + + + + +
                                                        + +
                                                        +
                                                        + + + + +
                                                        + + +
                                                        +

                                                        + Editor + + + extends Ext + + +
                                                        + in package + +
                                                        + + +

                                                        + + + +

                                                        DataTables Editor base class for creating editable tables.

                                                        + +

                                                        Editor class instances are capable of servicing all of the requests that +DataTables and Editor will make from the client-side - specifically:

                                                        +
                                                          +
                                                        • Get data
                                                        • +
                                                        • Create new record
                                                        • +
                                                        • Edit existing record
                                                        • +
                                                        • Delete existing records
                                                        • +
                                                        +

                                                        The Editor instance is configured with information regarding the +database table fields that you wish to make editable, and other information +needed to read and write to the database (table name for example!).

                                                        +

                                                        This documentation is very much focused on describing the API presented +by these DataTables Editor classes. For a more general overview of how +the Editor class is used, and how to install Editor on your server, please +refer to the Editor manual.

                                                        +
                                                        + + +
                                                        + Tags + +
                                                        +
                                                        +
                                                        + example +
                                                        +
                                                        + +

                                                        A very basic example of using Editor to create a table with four fields. +This is all that is needed on the server-side to create a editable +table - the Editor->process() method determines what action DataTables / +Editor is requesting from the server-side and will correctly action it.

                                                        +
                                                          Editor::inst( $db, 'browsers' )
                                                        +      ->fields(
                                                        +          Field::inst( 'first_name' )->validator( Validate::required() ),
                                                        +          Field::inst( 'last_name' )->validator( Validate::required() ),
                                                        +          Field::inst( 'country' ),
                                                        +          Field::inst( 'details' )
                                                        +      )
                                                        +      ->process( $_POST )
                                                        +      ->json();
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + + + + + + +

                                                        + Table of Contents + +

                                                        + +
                                                        +
                                                        + ACTION_CREATE + +  = 'create' +
                                                        +
                                                        Request type - create
                                                        + +
                                                        + ACTION_DELETE + +  = 'remove' +
                                                        +
                                                        Request type - delete
                                                        + +
                                                        + ACTION_EDIT + +  = 'edit' +
                                                        +
                                                        Request type - edit
                                                        + +
                                                        + ACTION_READ + +  = 'read' +
                                                        +
                                                        Request type - read
                                                        + +
                                                        + ACTION_UPLOAD + +  = 'upload' +
                                                        +
                                                        Request type - upload
                                                        + +
                                                        + $version + +  : string +
                                                        +
                                                        + +
                                                        + __construct() + +  : mixed +
                                                        +
                                                        Constructor.
                                                        + +
                                                        + _ssp_field() + +  : mixed +
                                                        +
                                                        Convert a column index to a database field name - used for server-side +processing requests.
                                                        + +
                                                        + action() + +  : string +
                                                        +
                                                        Determine the request type from an HTTP request.
                                                        + +
                                                        + actionName() + +  : string|self +
                                                        +
                                                        Get / set the action name to read in HTTP parameters. This can be useful +to set if you are using a framework that uses the default name of `action` +for something else (e.g. WordPress).
                                                        + +
                                                        + data() + +  : array<string|int, mixed> +
                                                        +
                                                        Get the data constructed in this instance.
                                                        + +
                                                        + db() + +  : Database|self +
                                                        +
                                                        Get / set the DB connection instance
                                                        + +
                                                        + debug() + +  : mixed +
                                                        +
                                                        Get / set debug mode and set a debug message.
                                                        + +
                                                        + field() + +  : mixed +
                                                        +
                                                        Get / set field instance.
                                                        + +
                                                        + fields() + +  : mixed +
                                                        +
                                                        Get / set field instances.
                                                        + +
                                                        + idPrefix() + +  : mixed +
                                                        +
                                                        Get / set the DOM prefix.
                                                        + +
                                                        + inData() + +  : mixed +
                                                        +
                                                        Get the data that is being processed by the Editor instance. This is only +useful once the `process()` method has been called, and is available for +use in validation and formatter methods.
                                                        + +
                                                        + inst() + +  : Editor|Field|Join|Upload +
                                                        +
                                                        Static method to instantiate a new instance of a class (shorthand of +'instantiate').
                                                        + +
                                                        + instantiate() + +  : Editor|Field|Join|Upload +
                                                        +
                                                        Static method to instantiate a new instance of a class.
                                                        + +
                                                        + join() + +  : mixed +
                                                        +
                                                        Get / set join instances. Note that for the majority of use cases you +will want to use the `leftJoin()` method. It is significantly easier +to use if you are just doing a simple left join!
                                                        + +
                                                        + json() + +  : mixed +
                                                        +
                                                        Get the JSON for the data constructed in this instance.
                                                        + +
                                                        + jsonp() + +  : self +
                                                        +
                                                        Echo out JSONP for the data constructed and processed in this instance.
                                                        + +
                                                        + leftJoin() + +  : self +
                                                        +
                                                        Add a left join condition to the Editor instance, allowing it to operate +over multiple tables. Multiple `leftJoin()` calls can be made for a +single Editor instance to join multiple tables.
                                                        + +
                                                        + leftJoinRemove() + +  : mixed +
                                                        +
                                                        Indicate if a remove should be performed on left joined tables when deleting +from the parent row. Note that this is disabled by default and will be +removed completely in v2. Use `ON DELETE CASCADE` in your database instead.
                                                        + +
                                                        + on() + +  : self +
                                                        +
                                                        Add an event listener. The `Editor` class will trigger an number of +events that some action can be taken on.
                                                        + +
                                                        + pkey() + +  : mixed +
                                                        +
                                                        Get / set the primary key.
                                                        + +
                                                        + pkeyToArray() + +  : array<string|int, mixed> +
                                                        +
                                                        Convert a primary key combined value to an array of field values.
                                                        + +
                                                        + pkeyToValue() + +  : string +
                                                        +
                                                        Convert a primary key array of field values to a combined value.
                                                        + +
                                                        + process() + +  : self +
                                                        +
                                                        Process a request from the Editor client-side to get / set data.
                                                        + +
                                                        + readTable() + +  : array<string|int, string>|self +
                                                        +
                                                        The CRUD read table name. If this method is used, Editor will create from the +table name(s) given rather than those given by `Editor->table()`. This can be +a useful distinction to allow a read from a VIEW (which could make use of a +complex SELECT) while writing to a different table.
                                                        + +
                                                        + table() + +  : mixed +
                                                        +
                                                        Get / set the table name.
                                                        + +
                                                        + transaction() + +  : mixed +
                                                        +
                                                        Get / set transaction support.
                                                        + +
                                                        + tryCatch() + +  : bool|Editor +
                                                        +
                                                        Enable / try catch when `process()` is called. Disabling this can be +useful for debugging, but is not recommended for production.
                                                        + +
                                                        + validate() + +  : mixed +
                                                        +
                                                        Perform validation on a data set.
                                                        + +
                                                        + validator() + +  : Editor|callable +
                                                        +
                                                        Get / set a global validator that will be triggered for the create, edit +and remove actions performed from the client-side. Multiple validators +can be added.
                                                        + +
                                                        + where() + +  : array<string|int, string>|self +
                                                        +
                                                        Where condition to add to the query used to get data from the database.
                                                        + +
                                                        + whereSet() + +  : bool +
                                                        +
                                                        Get / set if the WHERE conditions should be included in the create and +edit actions.
                                                        + +
                                                        + write() + +  : mixed +
                                                        +
                                                        + +
                                                        + _getSet() + +  : mixed +
                                                        +
                                                        Common getter / setter function for DataTables classes.
                                                        + +
                                                        + _propExists() + +  : bool +
                                                        +
                                                        Determine if a property is available in a data set (allowing `null` to be +a valid value)
                                                        + +
                                                        + _readProp() + +  : mixed +
                                                        +
                                                        Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.
                                                        + +
                                                        + _writeProp() + +  : mixed +
                                                        +
                                                        Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).
                                                        + +
                                                        + + + + +
                                                        +

                                                        + Constants + +

                                                        +
                                                        +

                                                        + ACTION_CREATE + +

                                                        + + + +

                                                        Request type - create

                                                        + + + public + mixed + ACTION_CREATE + = 'create' + + + + +
                                                        + + + +
                                                        +
                                                        +

                                                        + ACTION_DELETE + +

                                                        + + + +

                                                        Request type - delete

                                                        + + + public + mixed + ACTION_DELETE + = 'remove' + + + + +
                                                        + + + +
                                                        +
                                                        +

                                                        + ACTION_EDIT + +

                                                        + + + +

                                                        Request type - edit

                                                        + + + public + mixed + ACTION_EDIT + = 'edit' + + + + +
                                                        + + + +
                                                        +
                                                        +

                                                        + ACTION_READ + +

                                                        + + + +

                                                        Request type - read

                                                        + + + public + mixed + ACTION_READ + = 'read' + + + + +
                                                        + + + +
                                                        +
                                                        +

                                                        + ACTION_UPLOAD + +

                                                        + + + +

                                                        Request type - upload

                                                        + + + public + mixed + ACTION_UPLOAD + = 'upload' + + + + +
                                                        + + + +
                                                        +
                                                        + + +
                                                        +

                                                        + Properties + +

                                                        +
                                                        +

                                                        + $version + + + +

                                                        + + + + + public + string + $version + = '2.1.3' + + + + + +
                                                        +
                                                        + +
                                                        +

                                                        + Methods + +

                                                        +
                                                        +

                                                        + __construct() + +

                                                        + + +

                                                        Constructor.

                                                        + + + public + __construct([mixed $db = null ][, string|array<string|int, mixed> $table = null ][, mixed $pkey = null ]) : mixed + +

                                                        @param Database $db An instance of the DataTables Database class that we can +use for the DB connection. Can be given here or with the 'db' method.

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $db + : mixed + = null
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + $table + : string|array<string|int, mixed> + = null
                                                        +
                                                        +

                                                        The table name in the database to read and write +information from and to. Can be given here or with the 'table' method. +@param string|array $pkey Primary key column name in the table given in +the $table parameter. Can be given here or with the 'pkey' method.

                                                        +
                                                        + +
                                                        +
                                                        + $pkey + : mixed + = null
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + mixed + — + + +
                                                        +
                                                        +

                                                        + _ssp_field() + +

                                                        + + +

                                                        Convert a column index to a database field name - used for server-side +processing requests.

                                                        + + + public + _ssp_field(mixed $http, int $index) : mixed + +

                                                        @param array $http HTTP variables (i.e. GET or POST)

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $http + : mixed +
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + $index + : int +
                                                        +
                                                        +

                                                        Index in the DataTables' submitted data +@returns string DB field name +@throws \Exception Unknown fields +@private Note that it is actually public for PHP 5.3 - thread 39810

                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + mixed + — + + +
                                                        +
                                                        +

                                                        + action() + +

                                                        + + +

                                                        Determine the request type from an HTTP request.

                                                        + + + public + static action(array<string|int, mixed> $http[, string $name = 'action' ]) : string + + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $http + : array<string|int, mixed> +
                                                        +
                                                        +

                                                        Typically $_POST, but can be any array used to carry +an Editor payload

                                                        +
                                                        + +
                                                        +
                                                        + $name + : string + = 'action'
                                                        +
                                                        +

                                                        The parameter name that the action should be read from.

                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + string + — +

                                                        Editor::ACTION_READ, Editor::ACTION_CREATE, +Editor::ACTION_EDIT or Editor::ACTION_DELETE indicating the request +type.

                                                        +
                                                        + + +
                                                        +
                                                        +

                                                        + actionName() + +

                                                        + + +

                                                        Get / set the action name to read in HTTP parameters. This can be useful +to set if you are using a framework that uses the default name of `action` +for something else (e.g. WordPress).

                                                        + + + public + actionName([mixed $_ = null ]) : string|self + +

                                                        @param string Value to set. If not given, then used as a getter.

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $_ + : mixed + = null
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + string|self + — +

                                                        Value, or self if used as a setter.

                                                        +
                                                        + + +
                                                        +
                                                        +

                                                        + data() + +

                                                        + + +

                                                        Get the data constructed in this instance.

                                                        + + + public + data() : array<string|int, mixed> + +

                                                        This will get the PHP array of data that has been constructed for the +command that has been processed by this instance. Therefore only useful after +process has been called.

                                                        +
                                                        + + + + +
                                                        Return values
                                                        + array<string|int, mixed> + — +

                                                        Processed data array.

                                                        +
                                                        + + +
                                                        +
                                                        +

                                                        + db() + +

                                                        + + +

                                                        Get / set the DB connection instance

                                                        + + + public + db([mixed $_ = null ]) : Database|self + +

                                                        @param Database $_ DataTable's Database class instance to use for database +connectivity. If not given, then used as a getter.

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $_ + : mixed + = null
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + Database|self + — +

                                                        The Database connection instance if no parameter +is given, or self if used as a setter.

                                                        +
                                                        + + +
                                                        +
                                                        +

                                                        + debug() + +

                                                        + + +

                                                        Get / set debug mode and set a debug message.

                                                        + + + public + debug([bool|mixed $_ = null ][, mixed $path = null ]) : mixed + +

                                                        It can be useful to see the SQL statements that Editor is using. This +method enables that ability. Information about the queries used is +automatically added to the output data array / JSON under the property +name debugSql.

                                                        +

                                                        This method can also be called with a string parameter, which will be +added to the debug information sent back to the client-side. This can +be useful when debugging event listeners, etc.

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $_ + : bool|mixed + = null
                                                        +
                                                        +

                                                        Debug mode state. If not given, then used as a +getter. If given as anything other than a boolean, it will be added +to the debug information sent back to the client. +@param string [$path=null] Set an output path to log debug information +@return boolean|self Debug mode state if no parameter is given, or +self if used as a setter or when adding a debug message.

                                                        +
                                                        + +
                                                        +
                                                        + $path + : mixed + = null
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + mixed + — + + +
                                                        +
                                                        +

                                                        + field() + +

                                                        + + +

                                                        Get / set field instance.

                                                        + + + public + field([mixed $_ = null ]) : mixed + +

                                                        The list of fields designates which columns in the table that Editor will work +with (both get and set).

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $_ + : mixed + = null
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + mixed + — + + +
                                                        +
                                                        +

                                                        + fields() + +

                                                        + + +

                                                        Get / set field instances.

                                                        + + + public + fields([mixed $_ = null ]) : mixed + +

                                                        An alias of field, for convenience.

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $_ + : mixed + = null
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + mixed + — + + +
                                                        +
                                                        +

                                                        + idPrefix() + +

                                                        + + +

                                                        Get / set the DOM prefix.

                                                        + + + public + idPrefix([string $_ = null ]) : mixed + +

                                                        Typically primary keys are numeric and this is not a valid ID value in an +HTML document - is also increases the likelihood of an ID clash if multiple +tables are used on a single page. As such, a prefix is assigned to the +primary key value for each row, and this is used as the DOM ID, so Editor +can track individual rows.

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $_ + : string + = null
                                                        +
                                                        +

                                                        Primary key's name. If not given, then used as a getter. +@return string|self Primary key value if no parameter is given, or +self if used as a setter.

                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + mixed + — + + +
                                                        +
                                                        +

                                                        + inData() + +

                                                        + + +

                                                        Get the data that is being processed by the Editor instance. This is only +useful once the `process()` method has been called, and is available for +use in validation and formatter methods.

                                                        + + + public + inData() : mixed + +

                                                        @return array Data given to process().

                                                        +
                                                        + + + + +
                                                        Return values
                                                        + mixed + — + + +
                                                        +
                                                        +

                                                        + inst() + +

                                                        + + +

                                                        Static method to instantiate a new instance of a class (shorthand of +'instantiate').

                                                        + + + public + static inst() : Editor|Field|Join|Upload + +

                                                        This method performs exactly the same actions as the 'instantiate' +static method, but is simply shorter and easier to type!

                                                        +
                                                        + + + + +
                                                        Return values
                                                        + Editor|Field|Join|Upload + — +

                                                        class +@static

                                                        +
                                                        + + +
                                                        +
                                                        +

                                                        + instantiate() + +

                                                        + + +

                                                        Static method to instantiate a new instance of a class.

                                                        + + + public + static instantiate() : Editor|Field|Join|Upload + +

                                                        A factory method that will create a new instance of the class +that has extended 'Ext'. This allows classes to be instantiated +and then chained - which otherwise isn't available until PHP 5.4. +If using PHP 5.4 or later, simply create a 'new' instance of the +target class and chain methods as normal.

                                                        +
                                                        + + + + +
                                                        Return values
                                                        + Editor|Field|Join|Upload + — +

                                                        Instantiated class +@static

                                                        +
                                                        + + +
                                                        +
                                                        +

                                                        + join() + +

                                                        + + +

                                                        Get / set join instances. Note that for the majority of use cases you +will want to use the `leftJoin()` method. It is significantly easier +to use if you are just doing a simple left join!

                                                        + + + public + join([mixed $_ = null ]) : mixed + +

                                                        The list of Join instances that Editor will join the parent table to +(i.e. the one that the Editor->table() and Editor->fields +methods refer to in this class instance).

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $_ + : mixed + = null
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + mixed + — + + +
                                                        +
                                                        +

                                                        + json() + +

                                                        + + +

                                                        Get the JSON for the data constructed in this instance.

                                                        + + + public + json([bool $print = true ], mixed $options) : mixed + +

                                                        Basically the same as the Editor->data() method, but in this case we echo, or +return the JSON string of the data.

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $print + : bool + = true
                                                        +
                                                        +

                                                        Echo the JSON string out (true, default) or return it +(false). +@param int JSON encode option https://www.php.net/manual/en/json.constants.php +@return string|self self if printing the JSON, or JSON representation of +the processed data if false is given as the first parameter.

                                                        +
                                                        + +
                                                        +
                                                        + $options + : mixed +
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + mixed + — + + +
                                                        +
                                                        +

                                                        + jsonp() + +

                                                        + + +

                                                        Echo out JSONP for the data constructed and processed in this instance.

                                                        + + + public + jsonp([string $callback = null ]) : self + +

                                                        This is basically the same as Editor->json() but wraps the return in a +JSONP callback.

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $callback + : string + = null
                                                        +
                                                        +

                                                        The callback function name to use. If not given +or null, then $_GET['callback'] is used (the jQuery default).

                                                        +
                                                        + +
                                                        +
                                                        + + +
                                                        + Tags + +
                                                        +
                                                        +
                                                        + throws +
                                                        +
                                                        + Exception + +

                                                        JSONP function name validation

                                                        +
                                                        + +
                                                        +
                                                        + +
                                                        Return values
                                                        + self + — +

                                                        Self for chaining.

                                                        +
                                                        + + +
                                                        +
                                                        +

                                                        + leftJoin() + +

                                                        + + +

                                                        Add a left join condition to the Editor instance, allowing it to operate +over multiple tables. Multiple `leftJoin()` calls can be made for a +single Editor instance to join multiple tables.

                                                        + + + public + leftJoin(string $table, string $field1[, string $operator = null ][, string $field2 = null ]) : self + +

                                                        A left join is the most common type of join that is used with Editor +so this method is provided to make its use very easy to configure. Its +parameters are basically the same as writing an SQL left join statement, +but in this case Editor will handle the create, update and remove +requirements of the join for you:

                                                        +
                                                          +
                                                        • Create - On create Editor will insert the data into the primary table +and then into the joined tables - selecting the required data for each +table.
                                                        • +
                                                        • Edit - On edit Editor will update the main table, and then either +update the existing rows in the joined table that match the join and +edit conditions, or insert a new row into the joined table if required.
                                                        • +
                                                        • Remove - On delete Editor will remove the main row and then loop over +each of the joined tables and remove the joined data matching the join +link from the main table.
                                                        • +
                                                        +

                                                        Please note that when using join tables, Editor requires that you fully +qualify each field with the field's table name. SQL can result table +names for ambiguous field names, but for Editor to provide its full CRUD +options, the table name must also be given. For example the field +first_name in the table users would be given as users.first_name.

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $table + : string +
                                                        +
                                                        +

                                                        Table name to do a join onto

                                                        +
                                                        + +
                                                        +
                                                        + $field1 + : string +
                                                        +
                                                        +

                                                        Field from the parent table to use as the join link

                                                        +
                                                        + +
                                                        +
                                                        + $operator + : string + = null
                                                        +
                                                        +

                                                        Join condition (=, '<`, etc)

                                                        +
                                                        + +
                                                        +
                                                        + $field2 + : string + = null
                                                        +
                                                        +

                                                        Field from the child table to use as the join link

                                                        +
                                                        + +
                                                        +
                                                        + + +
                                                        + Tags + +
                                                        +
                                                        +
                                                        + example +
                                                        +
                                                        + +

                                                        Simple join:

                                                        +
                                                            ->field(
                                                        +      Field::inst( 'users.first_name as myField' ),
                                                        +      Field::inst( 'users.last_name' ),
                                                        +      Field::inst( 'users.dept_id' ),
                                                        +      Field::inst( 'dept.name' )
                                                        +    )
                                                        +    ->leftJoin( 'dept', 'users.dept_id', '=', 'dept.id' )
                                                        +    ->process($_POST)
                                                        +    ->json();
                                                        +```</code>```
                                                        +
                                                        +This is basically the same as the following SQL statement:
                                                        +
                                                        +```sql
                                                        +  SELECT users.first_name, users.last_name, user.dept_id, dept.name
                                                        +  FROM users
                                                        +  LEFT JOIN dept ON users.dept_id = dept.id
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + +
                                                        Return values
                                                        + self + — +

                                                        Self for chaining.

                                                        +
                                                        + + +
                                                        +
                                                        +

                                                        + leftJoinRemove() + +

                                                        + + +

                                                        Indicate if a remove should be performed on left joined tables when deleting +from the parent row. Note that this is disabled by default and will be +removed completely in v2. Use `ON DELETE CASCADE` in your database instead.

                                                        + + + public + leftJoinRemove([bool $_ = null ]) : mixed + +

                                                        @deprecated

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $_ + : bool + = null
                                                        +
                                                        +

                                                        Value to set. If not given, then used as a getter. +@return boolean|self Value if no parameter is given, or +self if used as a setter.

                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + mixed + — + + +
                                                        +
                                                        +

                                                        + on() + +

                                                        + + +

                                                        Add an event listener. The `Editor` class will trigger an number of +events that some action can be taken on.

                                                        + + + public + on(string $name, callable $callback) : self + + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $name + : string +
                                                        +
                                                        +

                                                        Event name

                                                        +
                                                        + +
                                                        +
                                                        + $callback + : callable +
                                                        +
                                                        +

                                                        Callback function to execute when the event +occurs

                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + self + — +

                                                        Self for chaining.

                                                        +
                                                        + + +
                                                        +
                                                        +

                                                        + pkey() + +

                                                        + + +

                                                        Get / set the primary key.

                                                        + + + public + pkey([string|array<string|int, mixed> $_ = null ]) : mixed + +

                                                        The primary key must be known to Editor so it will know which rows are being +edited / deleted upon those actions. The default value is ['id'].

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $_ + : string|array<string|int, mixed> + = null
                                                        +
                                                        +

                                                        Primary key's name. If not given, then used as a +getter. An array of column names can be given to allow composite keys to +be used. +@return string|self Primary key value if no parameter is given, or +self if used as a setter.

                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + mixed + — + + +
                                                        +
                                                        +

                                                        + pkeyToArray() + +

                                                        + + +

                                                        Convert a primary key combined value to an array of field values.

                                                        + + + public + pkeyToArray(string $value[, bool $flat = false ][, array<string|int, string> $pkey = null ]) : array<string|int, mixed> + + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $value + : string +
                                                        +
                                                        +

                                                        The id that should be split apart

                                                        +
                                                        + +
                                                        +
                                                        + $flat + : bool + = false
                                                        +
                                                        +

                                                        Flag to indicate if the returned array should be +flat (useful for where conditions) or nested for join tables.

                                                        +
                                                        + +
                                                        +
                                                        + $pkey + : array<string|int, string> + = null
                                                        +
                                                        +

                                                        The primary key name - will use the instance value +if not given

                                                        +
                                                        + +
                                                        +
                                                        + + +
                                                        + Tags + +
                                                        +
                                                        +
                                                        + throws +
                                                        +
                                                        + Exception + +

                                                        If the primary key value does not match the expected +length based on the primary key configuration, an exception will be +thrown.

                                                        +
                                                        + +
                                                        +
                                                        + +
                                                        Return values
                                                        + array<string|int, mixed> + — +

                                                        Array of field values that the id was made up of.

                                                        +
                                                        + + +
                                                        +
                                                        +

                                                        + pkeyToValue() + +

                                                        + + +

                                                        Convert a primary key array of field values to a combined value.

                                                        + + + public + pkeyToValue(string $row[, bool $flat = false ]) : string + + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $row + : string +
                                                        +
                                                        +

                                                        The row of data that the primary key value should +be extracted from.

                                                        +
                                                        + +
                                                        +
                                                        + $flat + : bool + = false
                                                        +
                                                        +

                                                        Flag to indicate if the given array is flat +(useful for where conditions) or nested for join tables.

                                                        +
                                                        + +
                                                        +
                                                        + + +
                                                        + Tags + +
                                                        +
                                                        +
                                                        + throws +
                                                        +
                                                        + Exception + +

                                                        If one of the values that the primary key is made up +of cannot be found in the data set given, an Exception will be thrown.

                                                        +
                                                        + +
                                                        +
                                                        + +
                                                        Return values
                                                        + string + — +

                                                        The created primary key value.

                                                        +
                                                        + + +
                                                        +
                                                        +

                                                        + process() + +

                                                        + + +

                                                        Process a request from the Editor client-side to get / set data.

                                                        + + + public + process(mixed $data) : self + +

                                                        @param array $data Typically $_POST or $_GET as required by what is sent +by Editor

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $data + : mixed +
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + self + — + + +
                                                        +
                                                        +

                                                        + readTable() + +

                                                        + + +

                                                        The CRUD read table name. If this method is used, Editor will create from the +table name(s) given rather than those given by `Editor->table()`. This can be +a useful distinction to allow a read from a VIEW (which could make use of a +complex SELECT) while writing to a different table.

                                                        + + + public + readTable([mixed $_ = null ]) : array<string|int, string>|self + +

                                                        @param string|array $_,... Read table names given as a single string, an array +of strings or multiple string parameters for the function.

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $_ + : mixed + = null
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + array<string|int, string>|self + — +

                                                        Array of read tables names, or self if used as a setter.

                                                        +
                                                        + + +
                                                        +
                                                        +

                                                        + table() + +

                                                        + + +

                                                        Get / set the table name.

                                                        + + + public + table([mixed $_ = null ]) : mixed + +

                                                        The table name designated which DB table Editor will use as its data +source for working with the database. Table names can be given with an +alias, which can be used to simplify larger table names. The field +names would also need to reflect the alias, just like an SQL query. For +example: users as a.

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $_ + : mixed + = null
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + mixed + — + + +
                                                        +
                                                        +

                                                        + transaction() + +

                                                        + + +

                                                        Get / set transaction support.

                                                        + + + public + transaction([bool $_ = null ]) : mixed + +

                                                        When enabled (which it is by default) Editor will use an SQL transaction +to ensure data integrity while it is performing operations on the table. +This can be optionally disabled using this method, if required by your +database configuration.

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $_ + : bool + = null
                                                        +
                                                        +

                                                        Enable (true) or disabled (false) transactions. +If not given, then used as a getter. +@return boolean|self Transactions enabled flag, or self if used as a +setter.

                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + mixed + — + + +
                                                        +
                                                        +

                                                        + tryCatch() + +

                                                        + + +

                                                        Enable / try catch when `process()` is called. Disabling this can be +useful for debugging, but is not recommended for production.

                                                        + + + public + tryCatch([bool $_ = null ]) : bool|Editor + + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $_ + : bool + = null
                                                        +
                                                        +

                                                        true to enable (default), otherwise false to disable

                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + bool|Editor + — +

                                                        Value if used as a getter, otherwise $this when +used as a setter.

                                                        +
                                                        + + +
                                                        +
                                                        +

                                                        + validate() + +

                                                        + + +

                                                        Perform validation on a data set.

                                                        + + + public + validate(array<string|int, mixed> &$errors, mixed $data) : mixed + +

                                                        Note that validation is performed on data only when the action is +create or edit. Additionally, validation is performed on the wire +data - i.e. that which is submitted from the client, without formatting. +Any formatting required by setFormatter is performed after the data +from the client has been validated.

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $errors + : array<string|int, mixed> +
                                                        +
                                                        +

                                                        Output array to which field error information will +be written. Each element in the array represents a field in an error +condition. These elements are themselves arrays with two properties +set; name and status. +@param array $data The format data to check +@return boolean true if the data is valid, false if not.

                                                        +
                                                        + +
                                                        +
                                                        + $data + : mixed +
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + mixed + — + + +
                                                        +
                                                        +

                                                        + validator() + +

                                                        + + +

                                                        Get / set a global validator that will be triggered for the create, edit +and remove actions performed from the client-side. Multiple validators +can be added.

                                                        + + + public + validator([callable $_ = null ]) : Editor|callable + + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $_ + : callable + = null
                                                        +
                                                        +

                                                        Function to execute when validating the input data. +It is passed three parameters: 1. The editor instance, 2. The action +and 3. The values.

                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + Editor|callable + — +

                                                        Editor instance if called as a setter, or the +validator function if not.

                                                        +
                                                        + + +
                                                        +
                                                        +

                                                        + where() + +

                                                        + + +

                                                        Where condition to add to the query used to get data from the database.

                                                        + + + public + where([string|callable $key = null ][, string $value = null ][, string $op = '=' ]) : array<string|int, string>|self + +

                                                        Can be used in two different ways:

                                                        +
                                                          +
                                                        • Simple case: where( field, value, operator ) +
                                                        • +
                                                        • Complex: where( fn ) +
                                                        • +
                                                        +

                                                        The simple case is fairly self explanatory, a condition is applied to the +data that looks like field operator value (e.g. name = 'Allan'). The +complex case allows full control over the query conditions by providing a +closure function that has access to the database Query that Editor is +using, so you can use the where(), or_where(), and_where() and +where_group() methods as you require.

                                                        +

                                                        Please be very careful when using this method! If an edit made by a user +using Editor removes the row from the where condition, the result is +undefined (since Editor expects the row to still be available, but the +condition removes it from the result set).

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $key + : string|callable + = null
                                                        +
                                                        +

                                                        Single field name or a closure function

                                                        +
                                                        + +
                                                        +
                                                        + $value + : string + = null
                                                        +
                                                        +

                                                        Single field value.

                                                        +
                                                        + +
                                                        +
                                                        + $op + : string + = '='
                                                        +
                                                        +

                                                        Condition operator: <, >, = etc

                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + array<string|int, string>|self + — +

                                                        Where condition array, or self if used as a setter.

                                                        +
                                                        + + +
                                                        +
                                                        +

                                                        + whereSet() + +

                                                        + + +

                                                        Get / set if the WHERE conditions should be included in the create and +edit actions.

                                                        + + + public + whereSet([mixed $_ = null ]) : bool + +

                                                        @param boolean $_ Include (true), or not (false)

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $_ + : mixed + = null
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + bool + — +

                                                        Current value +@deprecated Note that whereSet is now deprecated and replaced with the +ability to set values for columns on create and edit. The C# libraries +do not support this option at all.

                                                        +
                                                        + + +
                                                        +
                                                        +

                                                        + write() + +

                                                        + + + + + public + write([mixed $_writeVal = null ]) : mixed + +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $_writeVal + : mixed + = null
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + mixed + — + + +
                                                        +
                                                        +

                                                        + _getSet() + +

                                                        + + +

                                                        Common getter / setter function for DataTables classes.

                                                        + + + protected + _getSet(mixed &$prop, mixed $val[, mixed $array = false ]) : mixed + +

                                                        This getter / setter method makes building getter / setting methods +easier, by abstracting everything to a single function call.

                                                        +
                                                        + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $prop + : mixed +
                                                        +
                                                        +

                                                        The property to set +@param mixed $val The value to set - if given as null, then we assume +that the function is being used as a getter. +@param boolean $array Treat the target property as an array or not +(default false). If used as an array, then values passed in are added +to the $prop array. +@return self|mixed Class instance if setting (allowing chaining), or +the value requested if getting.

                                                        +
                                                        + +
                                                        +
                                                        + $val + : mixed +
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + $array + : mixed + = false
                                                        +
                                                        +
                                                        + +
                                                        +
                                                        + + + +
                                                        Return values
                                                        + mixed + — + + +
                                                        +
                                                        +

                                                        + _propExists() + +

                                                        + + +

                                                        Determine if a property is available in a data set (allowing `null` to be +a valid value)

                                                        + + + protected + _propExists(string $name, array<string|int, mixed> $data) : bool + + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $name + : string +
                                                        +
                                                        +

                                                        Javascript dotted object name to write to

                                                        +
                                                        + +
                                                        +
                                                        + $data + : array<string|int, mixed> +
                                                        +
                                                        +

                                                        Data source array to read from

                                                        +
                                                        + +
                                                        +
                                                        + + +
                                                        + Tags + +
                                                        +
                                                        +
                                                        + private +
                                                        +
                                                        + + +
                                                        +
                                                        + +
                                                        Return values
                                                        + bool + — +

                                                        true if present, false otherwise

                                                        +
                                                        + + +
                                                        +
                                                        +

                                                        + _readProp() + +

                                                        + + +

                                                        Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.

                                                        + + + protected + _readProp(string $name, array<string|int, mixed> $data) : mixed + + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $name + : string +
                                                        +
                                                        +

                                                        Javascript dotted object name to write to

                                                        +
                                                        + +
                                                        +
                                                        + $data + : array<string|int, mixed> +
                                                        +
                                                        +

                                                        Data source array to read from

                                                        +
                                                        + +
                                                        +
                                                        + + +
                                                        + Tags + +
                                                        +
                                                        +
                                                        + private +
                                                        +
                                                        + + +
                                                        +
                                                        + +
                                                        Return values
                                                        + mixed + — +

                                                        The read value, or null if no value found.

                                                        +
                                                        + + +
                                                        +
                                                        +

                                                        + _writeProp() + +

                                                        + + +

                                                        Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).

                                                        + + + protected + _writeProp(array<string|int, mixed> &$out, string $name, mixed $value) : mixed + + +
                                                        Parameters
                                                        +
                                                        +
                                                        + $out + : array<string|int, mixed> +
                                                        +
                                                        +

                                                        Array to write the data to

                                                        +
                                                        + +
                                                        +
                                                        + $name + : string +
                                                        +
                                                        +

                                                        Javascript dotted object name to write to

                                                        +
                                                        + +
                                                        +
                                                        + $value + : mixed +
                                                        +
                                                        +

                                                        Value to write

                                                        +
                                                        + +
                                                        +
                                                        + + +
                                                        + Tags + +
                                                        +
                                                        +
                                                        + throws +
                                                        +
                                                        + Exception + +

                                                        Information about duplicate properties

                                                        +
                                                        + +
                                                        +
                                                        + private +
                                                        +
                                                        + + +
                                                        +
                                                        + +
                                                        Return values
                                                        + mixed + — + + +
                                                        +
                                                        + +
                                                        +
                                                        +
                                                        +
                                                        +
                                                        
                                                        +        
                                                        + +
                                                        +
                                                        + + + +
                                                        +
                                                        +
                                                        +
                                                        +

                                                        Search results

                                                        + +
                                                        +
                                                        +
                                                          +
                                                          +
                                                          +
                                                          +
                                                          +
                                                          + + +
                                                          + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Ext.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Ext.html new file mode 100644 index 00000000..363d70dd --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-Ext.html @@ -0,0 +1,698 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                          +

                                                          Editor PHP 2.1.3

                                                          + + + + + +
                                                          + +
                                                          +
                                                          + + + + +
                                                          + + +
                                                          +

                                                          + Ext + + +
                                                          + in package + +
                                                          + + +

                                                          + + + +

                                                          Base class for DataTables classes.

                                                          + + + + + + + + + +

                                                          + Table of Contents + +

                                                          + +
                                                          +
                                                          + inst() + +  : Editor|Field|Join|Upload +
                                                          +
                                                          Static method to instantiate a new instance of a class (shorthand of +'instantiate').
                                                          + +
                                                          + instantiate() + +  : Editor|Field|Join|Upload +
                                                          +
                                                          Static method to instantiate a new instance of a class.
                                                          + +
                                                          + _getSet() + +  : mixed +
                                                          +
                                                          Common getter / setter function for DataTables classes.
                                                          + +
                                                          + _propExists() + +  : bool +
                                                          +
                                                          Determine if a property is available in a data set (allowing `null` to be +a valid value)
                                                          + +
                                                          + _readProp() + +  : mixed +
                                                          +
                                                          Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.
                                                          + +
                                                          + _writeProp() + +  : mixed +
                                                          +
                                                          Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).
                                                          + +
                                                          + + + + + + + +
                                                          +

                                                          + Methods + +

                                                          +
                                                          +

                                                          + inst() + +

                                                          + + +

                                                          Static method to instantiate a new instance of a class (shorthand of +'instantiate').

                                                          + + + public + static inst() : Editor|Field|Join|Upload + +

                                                          This method performs exactly the same actions as the 'instantiate' +static method, but is simply shorter and easier to type!

                                                          +
                                                          + + + + +
                                                          Return values
                                                          + Editor|Field|Join|Upload + — +

                                                          class +@static

                                                          +
                                                          + + +
                                                          +
                                                          +

                                                          + instantiate() + +

                                                          + + +

                                                          Static method to instantiate a new instance of a class.

                                                          + + + public + static instantiate() : Editor|Field|Join|Upload + +

                                                          A factory method that will create a new instance of the class +that has extended 'Ext'. This allows classes to be instantiated +and then chained - which otherwise isn't available until PHP 5.4. +If using PHP 5.4 or later, simply create a 'new' instance of the +target class and chain methods as normal.

                                                          +
                                                          + + + + +
                                                          Return values
                                                          + Editor|Field|Join|Upload + — +

                                                          Instantiated class +@static

                                                          +
                                                          + + +
                                                          +
                                                          +

                                                          + _getSet() + +

                                                          + + +

                                                          Common getter / setter function for DataTables classes.

                                                          + + + protected + _getSet(mixed &$prop, mixed $val[, mixed $array = false ]) : mixed + +

                                                          This getter / setter method makes building getter / setting methods +easier, by abstracting everything to a single function call.

                                                          +
                                                          + +
                                                          Parameters
                                                          +
                                                          +
                                                          + $prop + : mixed +
                                                          +
                                                          +

                                                          The property to set +@param mixed $val The value to set - if given as null, then we assume +that the function is being used as a getter. +@param boolean $array Treat the target property as an array or not +(default false). If used as an array, then values passed in are added +to the $prop array. +@return self|mixed Class instance if setting (allowing chaining), or +the value requested if getting.

                                                          +
                                                          + +
                                                          +
                                                          + $val + : mixed +
                                                          +
                                                          +
                                                          + +
                                                          +
                                                          + $array + : mixed + = false
                                                          +
                                                          +
                                                          + +
                                                          +
                                                          + + + +
                                                          Return values
                                                          + mixed + — + + +
                                                          +
                                                          +

                                                          + _propExists() + +

                                                          + + +

                                                          Determine if a property is available in a data set (allowing `null` to be +a valid value)

                                                          + + + protected + _propExists(string $name, array<string|int, mixed> $data) : bool + + +
                                                          Parameters
                                                          +
                                                          +
                                                          + $name + : string +
                                                          +
                                                          +

                                                          Javascript dotted object name to write to

                                                          +
                                                          + +
                                                          +
                                                          + $data + : array<string|int, mixed> +
                                                          +
                                                          +

                                                          Data source array to read from

                                                          +
                                                          + +
                                                          +
                                                          + + +
                                                          + Tags + +
                                                          +
                                                          +
                                                          + private +
                                                          +
                                                          + + +
                                                          +
                                                          + +
                                                          Return values
                                                          + bool + — +

                                                          true if present, false otherwise

                                                          +
                                                          + + +
                                                          +
                                                          +

                                                          + _readProp() + +

                                                          + + +

                                                          Read a value from a data structure, using Javascript dotted object +notation. This is the inverse of the `_writeProp` method and provides +the same support, matching DataTables' ability to read nested JSON +data objects.

                                                          + + + protected + _readProp(string $name, array<string|int, mixed> $data) : mixed + + +
                                                          Parameters
                                                          +
                                                          +
                                                          + $name + : string +
                                                          +
                                                          +

                                                          Javascript dotted object name to write to

                                                          +
                                                          + +
                                                          +
                                                          + $data + : array<string|int, mixed> +
                                                          +
                                                          +

                                                          Data source array to read from

                                                          +
                                                          + +
                                                          +
                                                          + + +
                                                          + Tags + +
                                                          +
                                                          +
                                                          + private +
                                                          +
                                                          + + +
                                                          +
                                                          + +
                                                          Return values
                                                          + mixed + — +

                                                          The read value, or null if no value found.

                                                          +
                                                          + + +
                                                          +
                                                          +

                                                          + _writeProp() + +

                                                          + + +

                                                          Write the field's value to an array structure, using Javascript dotted +object notation to indicate JSON data structure. For example `name.first` +gives the data structure: `name: { first: ... }`. This matches DataTables +own ability to do this on the client-side, although this doesn't +implement implement quite such a complex structure (no array / function +support).

                                                          + + + protected + _writeProp(array<string|int, mixed> &$out, string $name, mixed $value) : mixed + + +
                                                          Parameters
                                                          +
                                                          +
                                                          + $out + : array<string|int, mixed> +
                                                          +
                                                          +

                                                          Array to write the data to

                                                          +
                                                          + +
                                                          +
                                                          + $name + : string +
                                                          +
                                                          +

                                                          Javascript dotted object name to write to

                                                          +
                                                          + +
                                                          +
                                                          + $value + : mixed +
                                                          +
                                                          +

                                                          Value to write

                                                          +
                                                          + +
                                                          +
                                                          + + +
                                                          + Tags + +
                                                          +
                                                          +
                                                          + throws +
                                                          +
                                                          + Exception + +

                                                          Information about duplicate properties

                                                          +
                                                          + +
                                                          +
                                                          + private +
                                                          +
                                                          + + +
                                                          +
                                                          + +
                                                          Return values
                                                          + mixed + — + + +
                                                          +
                                                          + +
                                                          +
                                                          +
                                                          +
                                                          +
                                                          
                                                          +        
                                                          + +
                                                          +
                                                          + + + +
                                                          +
                                                          +
                                                          +
                                                          +

                                                          Search results

                                                          + +
                                                          +
                                                          +
                                                            +
                                                            +
                                                            +
                                                            +
                                                            +
                                                            + + +
                                                            + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-HtmLawed-Htmlaw.html b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-HtmLawed-Htmlaw.html new file mode 100644 index 00000000..e91df86f --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/classes/DataTables-HtmLawed-Htmlaw.html @@ -0,0 +1,516 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                            +

                                                            Editor PHP 2.1.3

                                                            + + + + + +
                                                            + +
                                                            +
                                                            + + + + +
                                                            + + +
                                                            +

                                                            + Htmlaw + + +
                                                            + in package + +
                                                            + + +

                                                            + + + +

                                                            A class wrapper for the htmLawed library.

                                                            + + + + + + + + + +

                                                            + Table of Contents + +

                                                            + +
                                                            +
                                                            + $defaultConfig + +  : mixed +
                                                            +
                                                            + +
                                                            + $defaultSpec + +  : mixed +
                                                            +
                                                            + +
                                                            + filter() + +  : string +
                                                            +
                                                            Filters a string of html with the htmLawed library.
                                                            + +
                                                            + filterRSS() + +  : string +
                                                            +
                                                            Filter a string of html so that it can be put into an rss feed.
                                                            + +
                                                            + + + + + + +
                                                            +

                                                            + Properties + +

                                                            +
                                                            +

                                                            + $defaultConfig + + + +

                                                            + + + + + public + static mixed + $defaultConfig + = array( + 'anti_link_spam' => array('`.`', ''), + 'comment' => 1, + 'cdata' => 3, + 'css_expression' => 1, + 'deny_attribute' => 'on*', + 'unique_ids' => 0, + 'elements' => '*-applet-form-input-textarea-iframe-script-style-embed-object', + 'keep_bad' => 1, + 'schemes' => 'classid:clsid; href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; style: nil; *:file, http, https', + // clsid allowed in class + 'valid_xhtml' => 0, + 'direct_list_nest' => 1, + 'balance' => 1, +) + +
                                                            + +
                                                            + + + +
                                                            +
                                                            +

                                                            + $defaultSpec + + + +

                                                            + + + + + public + static mixed + $defaultSpec + = array('object=-classid-type, -codebase', 'embed=type(oneof=application/x-shockwave-flash)') + +
                                                            + +
                                                            + + + +
                                                            +
                                                            + +
                                                            +

                                                            + Methods + +

                                                            +
                                                            +

                                                            + filter() + +

                                                            + + +

                                                            Filters a string of html with the htmLawed library.

                                                            + + + public + static filter(string $html[, array<string|int, mixed>|null $config = null ][, string|array<string|int, mixed>|null $spec = null ]) : string + + +
                                                            Parameters
                                                            +
                                                            +
                                                            + $html + : string +
                                                            +
                                                            +

                                                            The text to filter.

                                                            +
                                                            + +
                                                            +
                                                            + $config + : array<string|int, mixed>|null + = null
                                                            +
                                                            +

                                                            Config settings for the array.

                                                            +
                                                            + +
                                                            +
                                                            + $spec + : string|array<string|int, mixed>|null + = null
                                                            +
                                                            +

                                                            A specification to further limit the allowed attribute values in the html.

                                                            +
                                                            + +
                                                            +
                                                            + + +
                                                            + Tags + +
                                                            +
                                                            +
                                                            + see +
                                                            +
                                                            + http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/htmLawed_README.htm + + +
                                                            +
                                                            + +
                                                            Return values
                                                            + string + — +

                                                            Returns the filtered html.

                                                            +
                                                            + + +
                                                            +
                                                            +

                                                            + filterRSS() + +

                                                            + + +

                                                            Filter a string of html so that it can be put into an rss feed.

                                                            + + + public + static filterRSS( $html) : string + + +
                                                            Parameters
                                                            +
                                                            +
                                                            + $html + : +
                                                            +
                                                            +

                                                            The html text to fitlter.

                                                            +
                                                            + +
                                                            +
                                                            + + +
                                                            + Tags + +
                                                            +
                                                            +
                                                            + see +
                                                            +
                                                            + +

                                                            Htmlawed::filter().

                                                            +
                                                            + +
                                                            +
                                                            + +
                                                            Return values
                                                            + string + — +

                                                            Returns the filtered html.

                                                            +
                                                            + + +
                                                            +
                                                            + +
                                                            +
                                                            +
                                                            +
                                                            +
                                                            
                                                            +        
                                                            + +
                                                            +
                                                            + + + +
                                                            +
                                                            +
                                                            +
                                                            +

                                                            Search results

                                                            + +
                                                            +
                                                            +
                                                              +
                                                              +
                                                              +
                                                              +
                                                              +
                                                              + + +
                                                              + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/css/base.css b/ci4/app/ThirdParty/DatatablesEditor/docs/css/base.css new file mode 100644 index 00000000..b71c759f --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/css/base.css @@ -0,0 +1,1105 @@ + +:root { + /* Typography */ + --font-primary: 'Source Sans Pro', Helvetica, Arial, sans-serif; + --font-secondary: 'Source Sans Pro', Helvetica, Arial, sans-serif; + --font-monospace: 'Source Code Pro', monospace; + --line-height--primary: 1.6; + --letter-spacing--primary: .05rem; + --text-base-size: 1em; + --text-scale-ratio: 1.2; + + --text-xxs: calc(var(--text-base-size) / var(--text-scale-ratio) / var(--text-scale-ratio) / var(--text-scale-ratio)); + --text-xs: calc(var(--text-base-size) / var(--text-scale-ratio) / var(--text-scale-ratio)); + --text-sm: calc(var(--text-base-size) / var(--text-scale-ratio)); + --text-md: var(--text-base-size); + --text-lg: calc(var(--text-base-size) * var(--text-scale-ratio)); + --text-xl: calc(var(--text-base-size) * var(--text-scale-ratio) * var(--text-scale-ratio)); + --text-xxl: calc(var(--text-base-size) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio)); + --text-xxxl: calc(var(--text-base-size) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio)); + --text-xxxxl: calc(var(--text-base-size) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio)); + --text-xxxxxl: calc(var(--text-base-size) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio) * var(--text-scale-ratio)); + + /* Colors */ + --primary-color-hue: 96; + --primary-color-saturation: 57%; + --primary-color: hsl(var(--primary-color-hue), var(--primary-color-saturation), 60%); + --primary-color-darken: hsl(var(--primary-color-hue), var(--primary-color-saturation), 40%); + --primary-color-darker: hsl(var(--primary-color-hue), var(--primary-color-saturation), 20%); + --primary-color-darkest: hsl(var(--primary-color-hue), var(--primary-color-saturation), 10%); + --primary-color-lighten: hsl(var(--primary-color-hue), var(--primary-color-saturation), 80%); + --primary-color-lighter: hsl(var(--primary-color-hue), var(--primary-color-saturation), 99%); + --dark-gray: #d1d1d1; + --light-gray: #f0f0f0; + + --text-color: var(--primary-color-darkest); + + --header-height: var(--spacing-xxxxl); + --header-bg-color: var(--primary-color); + --code-background-color: var(--primary-color-lighter); + --code-border-color: --primary-color-lighten; + --button-border-color: var(--primary-color-darken); + --button-color: transparent; + --button-color-primary: var(--primary-color); + --button-text-color: #555; + --button-text-color-primary: white; + --popover-background-color: rgba(255, 255, 255, 0.75); + --link-color-primary: var(--primary-color-darken); + --link-hover-color-primary: var(--primary-color-darker); + --form-field-border-color: var(--dark-gray); + --form-field-color: #fff; + --admonition-success-color: var(--primary-color); + --admonition-border-color: silver; + --table-separator-color: var(--primary-color-lighten); + --title-text-color: var(--primary-color); + + --sidebar-border-color: var(--primary-color-lighten); + + /* Grid */ + --container-width: 1400px; + + /* Spacing */ + --spacing-base-size: 1rem; + --spacing-scale-ratio: 1.5; + + --spacing-xxxs: calc(var(--spacing-base-size) / var(--spacing-scale-ratio) / var(--spacing-scale-ratio) / var(--spacing-scale-ratio) / var(--spacing-scale-ratio)); + --spacing-xxs: calc(var(--spacing-base-size) / var(--spacing-scale-ratio) / var(--spacing-scale-ratio) / var(--spacing-scale-ratio)); + --spacing-xs: calc(var(--spacing-base-size) / var(--spacing-scale-ratio) / var(--spacing-scale-ratio)); + --spacing-sm: calc(var(--spacing-base-size) / var(--spacing-scale-ratio)); + --spacing-md: var(--spacing-base-size); + --spacing-lg: calc(var(--spacing-base-size) * var(--spacing-scale-ratio)); + --spacing-xl: calc(var(--spacing-base-size) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio)); + --spacing-xxl: calc(var(--spacing-base-size) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio)); + --spacing-xxxl: calc(var(--spacing-base-size) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio)); + --spacing-xxxxl: calc(var(--spacing-base-size) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio) * var(--spacing-scale-ratio)); + + --border-radius-base-size: 3px; +} + +/* Base Styles +-------------------------------------------------- */ +body { + color: var(--text-color); + font-family: var(--font-primary); + font-size: var(--text-md); + letter-spacing: var(--letter-spacing--primary); + line-height: var(--line-height--primary); + width: 100%; +} + +.phpdocumentor h1, +.phpdocumentor h2, +.phpdocumentor h3, +.phpdocumentor h4, +.phpdocumentor h5, +.phpdocumentor h6 { + margin-bottom: var(--spacing-lg); + margin-top: var(--spacing-lg); + font-weight: 600; +} + +.phpdocumentor h1 { + font-size: var(--text-xxxxl); + letter-spacing: var(--letter-spacing--primary); + line-height: 1.2; + margin-top: 0; +} + +.phpdocumentor h2 { + font-size: var(--text-xxxl); + letter-spacing: var(--letter-spacing--primary); + line-height: 1.25; +} + +.phpdocumentor h3 { + font-size: var(--text-xxl); + letter-spacing: var(--letter-spacing--primary); + line-height: 1.3; +} + +.phpdocumentor h4 { + font-size: var(--text-xl); + letter-spacing: calc(var(--letter-spacing--primary) / 2); + line-height: 1.35; + margin-bottom: var(--spacing-md); +} + +.phpdocumentor h5 { + font-size: var(--text-lg); + letter-spacing: calc(var(--letter-spacing--primary) / 4); + line-height: 1.5; + margin-bottom: var(--spacing-md); + margin-top: var(--spacing-md); +} + +.phpdocumentor h6 { + font-size: var(--text-md); + letter-spacing: 0; + line-height: var(--line-height--primary); + margin-bottom: var(--spacing-md); + margin-top: var(--spacing-md); +} + +.phpdocumentor h1 .headerlink, +.phpdocumentor h2 .headerlink, +.phpdocumentor h3 .headerlink, +.phpdocumentor h4 .headerlink, +.phpdocumentor h5 .headerlink, +.phpdocumentor h6 .headerlink +{ + transition: all .3s ease-in-out; + opacity: 0; + text-decoration: none; + color: silver; + font-size: 80%; +} + +.phpdocumentor h1:hover .headerlink, +.phpdocumentor h2:hover .headerlink, +.phpdocumentor h3:hover .headerlink, +.phpdocumentor h4:hover .headerlink, +.phpdocumentor h5:hover .headerlink, +.phpdocumentor h6:hover .headerlink +{ + opacity: 1; +} +.phpdocumentor p { + margin-top: 0; + margin-bottom: var(--spacing-md); +} +.phpdocumentor figure { + margin-bottom: var(--spacing-md); +} + +.phpdocumentor figcaption { + text-align: center; + font-style: italic; + font-size: 80%; +} + +.phpdocumentor-uml-diagram svg { + max-width: 100%; + height: auto !important; +} +.phpdocumentor-line { + border-top: 1px solid #E1E1E1; + border-width: 0; + margin-bottom: var(--spacing-xxl); + margin-top: var(--spacing-xxl); +} +.phpdocumentor-section { + box-sizing: border-box; + margin: 0 auto; + max-width: var(--container-width); + padding: 0 var(--spacing-lg); + position: relative; + width: 100%; +} + +@media (min-width: 1200px) { + .phpdocumentor-section { + padding: 0; + width: 95%; + } +} +.phpdocumentor-column { + box-sizing: border-box; + float: left; + width: 100%; +} + +@media (min-width: 550px) { + .phpdocumentor-column { + margin-left: 4%; + } + + .phpdocumentor-column:first-child { + margin-left: 0; + } + + .-one.phpdocumentor-column { + width: 4.66666666667%; + } + + .-two.phpdocumentor-column { + width: 13.3333333333%; + } + + .-three.phpdocumentor-column { + width: 22%; + } + + .-four.phpdocumentor-column { + width: 30.6666666667%; + } + + .-five.phpdocumentor-column { + width: 39.3333333333%; + } + + .-six.phpdocumentor-column { + width: 48%; + } + + .-seven.phpdocumentor-column { + width: 56.6666666667%; + } + + .-eight.phpdocumentor-column { + width: 65.3333333333%; + } + + .-nine.phpdocumentor-column { + width: 74.0%; + } + + .-ten.phpdocumentor-column { + width: 82.6666666667%; + } + + .-eleven.phpdocumentor-column { + width: 91.3333333333%; + } + + .-twelve.phpdocumentor-column { + margin-left: 0; + width: 100%; + } + + .-one-third.phpdocumentor-column { + width: 30.6666666667%; + } + + .-two-thirds.phpdocumentor-column { + width: 65.3333333333%; + } + + .-one-half.phpdocumentor-column { + width: 48%; + } + + /* Offsets */ + .-offset-by-one.phpdocumentor-column { + margin-left: 8.66666666667%; + } + + .-offset-by-two.phpdocumentor-column { + margin-left: 17.3333333333%; + } + + .-offset-by-three.phpdocumentor-column { + margin-left: 26%; + } + + .-offset-by-four.phpdocumentor-column { + margin-left: 34.6666666667%; + } + + .-offset-by-five.phpdocumentor-column { + margin-left: 43.3333333333%; + } + + .-offset-by-six.phpdocumentor-column { + margin-left: 52%; + } + + .-offset-by-seven.phpdocumentor-column { + margin-left: 60.6666666667%; + } + + .-offset-by-eight.phpdocumentor-column { + margin-left: 69.3333333333%; + } + + .-offset-by-nine.phpdocumentor-column { + margin-left: 78.0%; + } + + .-offset-by-ten.phpdocumentor-column { + margin-left: 86.6666666667%; + } + + .-offset-by-eleven.phpdocumentor-column { + margin-left: 95.3333333333%; + } + + .-offset-by-one-third.phpdocumentor-column { + margin-left: 34.6666666667%; + } + + .-offset-by-two-thirds.phpdocumentor-column { + margin-left: 69.3333333333%; + } + + .-offset-by-one-half.phpdocumentor-column { + margin-left: 52%; + } +} +.phpdocumentor a { + color: var(--link-color-primary); +} + +.phpdocumentor a:hover { + color: var(--link-hover-color-primary); +} +.phpdocumentor-button { + background-color: var(--button-color); + border: 1px solid var(--button-border-color); + border-radius: var(--border-radius-base-size); + box-sizing: border-box; + color: var(--button-text-color); + cursor: pointer; + display: inline-block; + font-size: var(--text-sm); + font-weight: 600; + height: 38px; + letter-spacing: .1rem; + line-height: 38px; + padding: 0 var(--spacing-xxl); + text-align: center; + text-decoration: none; + text-transform: uppercase; + white-space: nowrap; + margin-bottom: var(--spacing-md); +} + +.phpdocumentor-button .-wide { + width: 100%; +} + +.phpdocumentor-button:hover, +.phpdocumentor-button:focus { + border-color: #888; + color: #333; + outline: 0; +} + +.phpdocumentor-button.-primary { + background-color: var(--button-color-primary); + border-color: var(--button-color-primary); + color: var(--button-text-color-primary); +} + +.phpdocumentor-button.-primary:hover, +.phpdocumentor-button.-primary:focus { + background-color: var(--link-color-primary); + border-color: var(--link-color-primary); + color: var(--button-text-color-primary); +} +.phpdocumentor form { + margin-bottom: var(--spacing-md); +} + +.phpdocumentor-field { + background-color: var(--form-field-color); + border: 1px solid var(--form-field-border-color); + border-radius: var(--border-radius-base-size); + box-shadow: none; + box-sizing: border-box; + height: 38px; + padding: var(--spacing-xxxs) var(--spacing-xxs); /* The 6px vertically centers text on FF, ignored by Webkit */ + margin-bottom: var(--spacing-md); +} + +/* Removes awkward default styles on some inputs for iOS */ +input[type="email"], +input[type="number"], +input[type="search"], +input[type="text"], +input[type="tel"], +input[type="url"], +input[type="password"], +textarea { + -moz-appearance: none; + -webkit-appearance: none; + appearance: none; +} + +.phpdocumentor-textarea { + min-height: 65px; + padding-bottom: var(--spacing-xxxs); + padding-top: var(--spacing-xxxs); +} + +.phpdocumentor-field:focus { + border: 1px solid var(--button-color-primary); + outline: 0; +} + +.phpdocumentor-label { + display: block; + margin-bottom: var(--spacing-xs); +} + +.phpdocumentor-fieldset { + border-width: 0; + padding: 0; +} + +input[type="checkbox"].phpdocumentor-field, +input[type="radio"].phpdocumentor-field { + display: inline; +} +.phpdocumentor-column ul, +div.phpdocumentor-list > ul, +ul.phpdocumentor-list { + list-style: circle; +} + +.phpdocumentor-column ol, +div.phpdocumentor-list > ol, +ol.phpdocumentor-list { + list-style: decimal; +} + + +.phpdocumentor-column ul, +div.phpdocumentor-list > ul, +ol.phpdocumentor-list, +ul.phpdocumentor-list { + margin-top: 0; + padding-left: 1rem; + margin-bottom: var(--spacing-md); +} + +dl { + margin-bottom: var(--spacing-md); +} + +.phpdocumentor-column ul ul, +div.phpdocumentor-list > ul ul, +ul.phpdocumentor-list ul.phpdocumentor-list, +ul.phpdocumentor-list ol.phpdocumentor-list, +ol.phpdocumentor-list ol.phpdocumentor-list, +ol.phpdocumentor-list ul.phpdocumentor-list { + font-size: var(--text-sm); + margin: var(--spacing-xs) 0 var(--spacing-xs) calc(var(--spacing-xs) * 2); +} + +.phpdocumentor-column ul li, +.phpdocumentor-list li { + padding-bottom: var(--spacing-xs); +} + +.phpdocumentor dl dt { + margin-bottom: var(--spacing-xs); +} + +.phpdocumentor dl dd { + margin-bottom: var(--spacing-md); +} +.phpdocumentor pre { + margin-bottom: var(--spacing-md); +} + +.phpdocumentor-code { + font-family: var(--font-monospace); + background: var(--code-background-color); + border: 1px solid var(--code-border-color); + border-radius: var(--border-radius-base-size); + font-size: var(--text-sm); + padding: var(--spacing-sm) var(--spacing-md); + width: 100%; + box-sizing: border-box; +} + +.phpdocumentor-code.-dark { + background: var(--primary-color-darkest); + color: var(--light-gray); + box-shadow: 0 2px 3px var(--dark-gray); +} + +pre > .phpdocumentor-code { + display: block; + white-space: pre; +} +.phpdocumentor blockquote { + border-left: 4px solid var(--primary-color-darken); + margin: var(--spacing-md) 0; + padding: var(--spacing-xs) var(--spacing-sm); + color: var(--primary-color-darker); + font-style: italic; +} + +.phpdocumentor blockquote p:last-of-type { + margin-bottom: 0; +} +.phpdocumentor table { + margin-bottom: var(--spacing-md); +} + +th.phpdocumentor-heading, +td.phpdocumentor-cell { + border-bottom: 1px solid var(--table-separator-color); + padding: var(--spacing-sm) var(--spacing-md); + text-align: left; +} + +th.phpdocumentor-heading:first-child, +td.phpdocumentor-cell:first-child { + padding-left: 0; +} + +th.phpdocumentor-heading:last-child, +td.phpdocumentor-cell:last-child { + padding-right: 0; +} + +.phpdocumentor-header { + display: flex; + flex-direction: row; + align-items: stretch; + flex-wrap: wrap; + justify-content: space-between; + height: auto; + padding: var(--spacing-md) var(--spacing-md); +} + +.phpdocumentor-header__menu-button { + position: absolute; + top: -100%; + left: -100%; +} + +.phpdocumentor-header__menu-icon { + font-size: 2rem; + color: var(--primary-color); +} + +.phpdocumentor-header__menu-button:checked ~ .phpdocumentor-topnav { + max-height: 250px; + padding-top: var(--spacing-md); +} + +@media (min-width: 1000px) { + .phpdocumentor-header { + flex-direction: row; + padding: var(--spacing-lg) var(--spacing-lg); + min-height: var(--header-height); + } + + .phpdocumentor-header__menu-icon { + display: none; + } +} + +@media (min-width: 1000px) { + .phpdocumentor-header { + padding-top: 0; + padding-bottom: 0; + } +} +@media (min-width: 1200px) { + .phpdocumentor-header { + padding: 0; + } +} +.phpdocumentor-title { + box-sizing: border-box; + color: var(--title-text-color); + font-size: var(--text-xxl); + letter-spacing: .05rem; + font-weight: normal; + width: auto; + margin: 0; + display: flex; + align-items: center; +} + +.phpdocumentor-title.-without-divider { + border: none; +} + +.phpdocumentor-title__link { + transition: all .3s ease-out; + display: flex; + color: var(--title-text-color); + text-decoration: none; + font-weight: normal; + white-space: nowrap; + transform: scale(.75); + transform-origin: left; +} + +.phpdocumentor-title__link:hover { + transform: perspective(15rem) translateX(.5rem); + font-weight: 600; +} + +@media (min-width: 1000px) { + .phpdocumentor-title { + width: 30.6666666667%; + border-right: var(--sidebar-border-color) solid 1px; + } + + .phpdocumentor-title__link { + transform-origin: left; + } +} + +@media (min-width: 1000px) { + .phpdocumentor-title__link { + transform: scale(.85); + } +} + +@media (min-width: 1200px) { + .phpdocumentor-title__link { + transform: scale(1); + } +} +.phpdocumentor-topnav { + display: flex; + align-items: center; + margin: 0; + max-height: 0; + overflow: hidden; + transition: max-height 0.2s ease-out; + flex-basis: 100%; +} + +.phpdocumentor-topnav__menu { + text-align: right; + list-style: none; + margin: 0; + padding: 0; + flex: 1; + display: flex; + flex-flow: row wrap; + justify-content: center; +} + +.phpdocumentor-topnav__menu-item { + margin: 0; + width: 100%; + display: inline-block; + text-align: center; + padding: var(--spacing-sm) 0 +} + +.phpdocumentor-topnav__menu-item.-social { + width: auto; + padding: var(--spacing-sm) +} + +.phpdocumentor-topnav__menu-item a { + display: inline-block; + color: var(--text-color); + text-decoration: none; + font-size: var(--text-lg); + transition: all .3s ease-out; + border-bottom: 1px dotted transparent; + line-height: 1; +} + +.phpdocumentor-topnav__menu-item a:hover { + transform: perspective(15rem) translateY(.1rem); + border-bottom: 1px dotted var(--text-color); +} + +@media (min-width: 1000px) { + .phpdocumentor-topnav { + max-height: none; + overflow: visible; + flex-basis: auto; + } + + .phpdocumentor-topnav__menu { + display: flex; + flex-flow: row wrap; + justify-content: flex-end; + } + + .phpdocumentor-topnav__menu-item, + .phpdocumentor-topnav__menu-item.-social { + width: auto; + display: inline; + text-align: right; + padding: 0 0 0 var(--spacing-md) + } +} +.phpdocumentor-sidebar { + margin: 0; + overflow: hidden; + max-height: 0; +} + +.phpdocumentor .phpdocumentor-sidebar .phpdocumentor-list { + padding: var(--spacing-xs) var(--spacing-md); + list-style: none; + margin: 0; +} + +.phpdocumentor .phpdocumentor-sidebar li { + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; + padding: 0 0 var(--spacing-xxxs) var(--spacing-md); +} + +.phpdocumentor .phpdocumentor-sidebar abbr, +.phpdocumentor .phpdocumentor-sidebar a { + text-decoration: none; + border-bottom: none; + color: var(--text-color); + font-size: var(--text-md); + padding-left: 0; + transition: padding-left .4s ease-out; +} + +.phpdocumentor .phpdocumentor-sidebar a:hover, +.phpdocumentor .phpdocumentor-sidebar a.-active { + padding-left: 5px; + font-weight: 600; +} + +.phpdocumentor .phpdocumentor-sidebar__category > * { + border-left: 1px solid var(--primary-color-lighten); +} + +.phpdocumentor .phpdocumentor-sidebar__category { + margin-bottom: var(--spacing-lg); +} + +.phpdocumentor .phpdocumentor-sidebar__category-header { + font-size: var(--text-md); + margin-bottom: var(--spacing-xs); + color: var(--link-color-primary); + font-weight: 600; + border-left: 0; +} + +.phpdocumentor .phpdocumentor-sidebar__root-package, +.phpdocumentor .phpdocumentor-sidebar__root-namespace { + font-size: var(--text-md); + margin: 0; + padding-top: var(--spacing-xs); + padding-left: var(--spacing-md); + color: var(--text-color); + font-weight: normal; +} + +@media (min-width: 550px) { + .phpdocumentor-sidebar { + border-right: var(--sidebar-border-color) solid 1px; + } +} + +.phpdocumentor-sidebar__menu-button { + position: absolute; + top: -100%; + left: -100%; +} + +.phpdocumentor-sidebar__menu-icon { + font-size: var(--text-md); + font-weight: 600; + background: var(--primary-color); + color: white; + margin: 0 0 var(--spacing-lg); + display: block; + padding: var(--spacing-sm); + text-align: center; + border-radius: 3px; + text-transform: uppercase; + letter-spacing: .15rem; +} + +.phpdocumentor-sidebar__menu-button:checked ~ .phpdocumentor-sidebar { + max-height: 100%; + padding-top: var(--spacing-md); +} + +@media (min-width: 550px) { + .phpdocumentor-sidebar { + overflow: visible; + max-height: 100%; + } + + .phpdocumentor-sidebar__menu-icon { + display: none; + } +} +.phpdocumentor-admonition { + border: 1px solid var(--admonition-border-color); + border-radius: var(--border-radius-base-size); + border-color: var(--primary-color-lighten); + background-color: var(--primary-color-lighter); + padding: var(--spacing-lg); + margin: var(--spacing-lg) 0; + display: flex; + flex-direction: row; + align-items: flex-start; +} + +.phpdocumentor-admonition p:last-of-type { + margin-bottom: 0; +} + +.phpdocumentor-admonition--success, +.phpdocumentor-admonition.-success { + border-color: var(--admonition-success-color); +} + +.phpdocumentor-admonition__icon { + margin-right: var(--spacing-md); + color: var(--primary-color); + max-width: 3rem; +} +.phpdocumentor ul.phpdocumentor-breadcrumbs { + font-size: var(--text-md); + list-style: none; + margin: 0; + padding: 0; +} + +.phpdocumentor ul.phpdocumentor-breadcrumbs a { + color: var(--text-color); + text-decoration: none; +} + +.phpdocumentor ul.phpdocumentor-breadcrumbs > li { + display: inline-block; + margin: 0; +} + +.phpdocumentor ul.phpdocumentor-breadcrumbs > li + li:before { + color: var(--dark-gray); + content: "\\\A0"; + padding: 0; +} +.phpdocumentor .phpdocumentor-back-to-top { + position: fixed; + bottom: 2rem; + font-size: 2.5rem; + opacity: .25; + transition: all .3s ease-in-out; + right: 2rem; +} + +.phpdocumentor .phpdocumentor-back-to-top:hover { + color: var(--link-color-primary); + opacity: 1; +} +.phpdocumentor-search { + position: relative; + display: none; /** disable by default for non-js flow */ + opacity: .3; /** white-out default for loading indication */ + transition: opacity .3s, background .3s; + margin: var(--spacing-sm) 0; + flex: 1; + min-width: 100%; +} + +.phpdocumentor-search label { + display: flex; + align-items: center; + flex: 1; +} + +.phpdocumentor-search__icon { + color: var(--primary-color); + margin-right: var(--spacing-sm); + width: 1rem; + height: 1rem; +} + +.phpdocumentor-search--enabled { + display: flex; +} + +.phpdocumentor-search--active { + opacity: 1; +} + +.phpdocumentor-search input:disabled { + background-color: lightgray; +} + +.phpdocumentor-search__field:focus, +.phpdocumentor-search__field { + margin-bottom: 0; + border: 0; + border-bottom: 2px solid var(--primary-color); + padding: 0; + border-radius: 0; + flex: 1; +} + +@media (min-width: 1000px) { + .phpdocumentor-search { + min-width: auto; + max-width: 20rem; + margin: 0 0 0 auto; + } +} +.phpdocumentor-content { + position: relative; +} + +.phpdocumentor-search-results { + backdrop-filter: blur(5px); + background: var(--popover-background-color); + position: fixed; + top: 0; + left: 0; + right: 0; + bottom: 0; + padding: 0; + opacity: 1; + pointer-events: all; + + transition: opacity .3s, background .3s; +} + +.phpdocumentor-search-results--hidden { + background: transparent; + backdrop-filter: blur(0); + opacity: 0; + pointer-events: none; +} + +.phpdocumentor-search-results__dialog { + width: 100%; + background: white; + max-height: 100%; + display: flex; + flex-direction: column; +} + +.phpdocumentor-search-results__body { + overflow: auto; +} + +.phpdocumentor-search-results__header { + padding: var(--spacing-lg); + display: flex; + justify-content: space-between; + background: var(--primary-color-darken); + color: white; + align-items: center; +} + +.phpdocumentor-search-results__close { + font-size: var(--text-xl); + background: none; + border: none; + padding: 0; + margin: 0; +} + +.phpdocumentor .phpdocumentor-search-results__title { + font-size: var(--text-xl); + margin-bottom: 0; +} + +.phpdocumentor-search-results__entries { + list-style: none; + padding: 0 var(--spacing-lg); + margin: 0; +} + +.phpdocumentor-search-results__entry { + border-bottom: 1px solid var(--table-separator-color); + padding: var(--spacing-sm) 0; + text-align: left; +} + +.phpdocumentor-search-results__entry a { + display: block; +} + +.phpdocumentor-search-results__entry small { + margin-top: var(--spacing-xs); + margin-bottom: var(--spacing-md); + color: var(--primary-color-darker); + display: block; + word-break: break-word; +} + +.phpdocumentor-search-results__entry h3 { + font-size: var(--text-lg); + margin: 0; +} + +@media (min-width: 550px) { + .phpdocumentor-search-results { + padding: 0 var(--spacing-lg); + } + + .phpdocumentor-search-results__entry h3 { + font-size: var(--text-xxl); + } + + .phpdocumentor-search-results__dialog { + margin: var(--spacing-xl) auto; + max-width: 40rem; + background: white; + border: 1px solid silver; + box-shadow: 0 2px 5px silver; + max-height: 40rem; + border-radius: 3px; + } +} +.phpdocumentor-modal { + position: fixed; + width: 100vw; + height: 100vh; + opacity: 0; + visibility: hidden; + transition: all 0.3s ease; + top: 0; + left: 0; + display: flex; + align-items: center; + justify-content: center; +} + +.phpdocumentor-modal__open { + visibility: visible; + opacity: 1; + transition-delay: 0s; +} + +.phpdocumentor-modal-bg { + position: absolute; + background: gray; + opacity: 50%; + width: 100%; + height: 100%; +} + +.phpdocumentor-modal-container { + border-radius: 1em; + background: #fff; + position: relative; + padding: 2em; + box-sizing: border-box; + max-width:100vw; +} + +.phpdocumentor-modal__close { + position: absolute; + right: 0.75em; + top: 0.75em; + outline: none; + appearance: none; + color: var(--primary-color); + background: none; + border: 0px; + font-weight: bold; + cursor: pointer; +} + +/* Used for screen readers and such */ +.visually-hidden { + display: none; +} + +.float-right { + float: right; +} + +.float-left { + float: left; +} diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/css/normalize.css b/ci4/app/ThirdParty/DatatablesEditor/docs/css/normalize.css new file mode 100644 index 00000000..579152b0 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/css/normalize.css @@ -0,0 +1,427 @@ +/*! normalize.css v3.0.2 | MIT License | git.io/normalize */ + +/** + * 1. Set default font family to sans-serif. + * 2. Prevent iOS text size adjust after orientation change, without disabling + * user zoom. + */ + +html { + font-family: sans-serif; /* 1 */ + -ms-text-size-adjust: 100%; /* 2 */ + -webkit-text-size-adjust: 100%; /* 2 */ +} + +/** + * Remove default margin. + */ + +body { + margin: 0; +} + +/* HTML5 display definitions + ========================================================================== */ + +/** + * Correct `block` display not defined for any HTML5 element in IE 8/9. + * Correct `block` display not defined for `details` or `summary` in IE 10/11 + * and Firefox. + * Correct `block` display not defined for `main` in IE 11. + */ + +article, +aside, +details, +figcaption, +figure, +footer, +header, +hgroup, +main, +menu, +nav, +section, +summary { + display: block; +} + +/** + * 1. Correct `inline-block` display not defined in IE 8/9. + * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera. + */ + +audio, +canvas, +progress, +video { + display: inline-block; /* 1 */ + vertical-align: baseline; /* 2 */ +} + +/** + * Prevent modern browsers from displaying `audio` without controls. + * Remove excess height in iOS 5 devices. + */ + +audio:not([controls]) { + display: none; + height: 0; +} + +/** + * Address `[hidden]` styling not present in IE 8/9/10. + * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22. + */ + +[hidden], +template { + display: none; +} + +/* Links + ========================================================================== */ + +/** + * Remove the gray background color from active links in IE 10. + */ + +a { + background-color: transparent; +} + +/** + * Improve readability when focused and also mouse hovered in all browsers. + */ + +a:active, +a:hover { + outline: 0; +} + +/* Text-level semantics + ========================================================================== */ + +/** + * Address styling not present in IE 8/9/10/11, Safari, and Chrome. + */ + +abbr[title] { + border-bottom: 1px dotted; +} + +/** + * Address style set to `bolder` in Firefox 4+, Safari, and Chrome. + */ + +b, +strong { + font-weight: bold; +} + +/** + * Address styling not present in Safari and Chrome. + */ + +dfn { + font-style: italic; +} + +/** + * Address variable `h1` font-size and margin within `section` and `article` + * contexts in Firefox 4+, Safari, and Chrome. + */ + +h1 { + font-size: 2em; + margin: 0.67em 0; +} + +/** + * Address styling not present in IE 8/9. + */ + +mark { + background: #ff0; + color: #000; +} + +/** + * Address inconsistent and variable font size in all browsers. + */ + +small { + font-size: 80%; +} + +/** + * Prevent `sub` and `sup` affecting `line-height` in all browsers. + */ + +sub, +sup { + font-size: 75%; + line-height: 0; + position: relative; + vertical-align: baseline; +} + +sup { + top: -0.5em; +} + +sub { + bottom: -0.25em; +} + +/* Embedded content + ========================================================================== */ + +/** + * Remove border when inside `a` element in IE 8/9/10. + */ + +img { + border: 0; +} + +/** + * Correct overflow not hidden in IE 9/10/11. + */ + +svg:not(:root) { + overflow: hidden; +} + +/* Grouping content + ========================================================================== */ + +/** + * Address margin not present in IE 8/9 and Safari. + */ + +figure { + margin: 1em 40px; +} + +/** + * Address differences between Firefox and other browsers. + */ + +hr { + -moz-box-sizing: content-box; + box-sizing: content-box; + height: 0; +} + +/** + * Contain overflow in all browsers. + */ + +pre { + overflow: auto; +} + +/** + * Address odd `em`-unit font size rendering in all browsers. + */ + +code, +kbd, +pre, +samp { + font-family: var(--font-monospace); + font-size: 1em; +} + +/* Forms + ========================================================================== */ + +/** + * Known limitation: by default, Chrome and Safari on OS X allow very limited + * styling of `select`, unless a `border` property is set. + */ + +/** + * 1. Correct color not being inherited. + * Known issue: affects color of disabled elements. + * 2. Correct font properties not being inherited. + * 3. Address margins set differently in Firefox 4+, Safari, and Chrome. + */ + +button, +input, +optgroup, +select, +textarea { + color: inherit; /* 1 */ + font: inherit; /* 2 */ + margin: 0; /* 3 */ +} + +/** + * Address `overflow` set to `hidden` in IE 8/9/10/11. + */ + +button { + overflow: visible; +} + +/** + * Address inconsistent `text-transform` inheritance for `button` and `select`. + * All other form control elements do not inherit `text-transform` values. + * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera. + * Correct `select` style inheritance in Firefox. + */ + +button, +select { + text-transform: none; +} + +/** + * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` + * and `video` controls. + * 2. Correct inability to style clickable `input` types in iOS. + * 3. Improve usability and consistency of cursor style between image-type + * `input` and others. + */ + +button, +html input[type="button"], /* 1 */ +input[type="reset"], +input[type="submit"] { + -webkit-appearance: button; /* 2 */ + cursor: pointer; /* 3 */ +} + +/** + * Re-set default cursor for disabled elements. + */ + +button[disabled], +html input[disabled] { + cursor: default; +} + +/** + * Remove inner padding and border in Firefox 4+. + */ + +button::-moz-focus-inner, +input::-moz-focus-inner { + border: 0; + padding: 0; +} + +/** + * Address Firefox 4+ setting `line-height` on `input` using `!important` in + * the UA stylesheet. + */ + +input { + line-height: normal; +} + +/** + * It's recommended that you don't attempt to style these elements. + * Firefox's implementation doesn't respect box-sizing, padding, or width. + * + * 1. Address box sizing set to `content-box` in IE 8/9/10. + * 2. Remove excess padding in IE 8/9/10. + */ + +input[type="checkbox"], +input[type="radio"] { + box-sizing: border-box; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Fix the cursor style for Chrome's increment/decrement buttons. For certain + * `font-size` values of the `input`, it causes the cursor style of the + * decrement button to change from `default` to `text`. + */ + +input[type="number"]::-webkit-inner-spin-button, +input[type="number"]::-webkit-outer-spin-button { + height: auto; +} + +/** + * 1. Address `appearance` set to `searchfield` in Safari and Chrome. + * 2. Address `box-sizing` set to `border-box` in Safari and Chrome + * (include `-moz` to future-proof). + */ + +input[type="search"] { + -webkit-appearance: textfield; /* 1 */ + -moz-box-sizing: content-box; + -webkit-box-sizing: content-box; /* 2 */ + box-sizing: content-box; +} + +/** + * Remove inner padding and search cancel button in Safari and Chrome on OS X. + * Safari (but not Chrome) clips the cancel button when the search input has + * padding (and `textfield` appearance). + */ + +input[type="search"]::-webkit-search-cancel-button, +input[type="search"]::-webkit-search-decoration { + -webkit-appearance: none; +} + +/** + * Define consistent border, margin, and padding. + */ + +fieldset { + border: 1px solid #c0c0c0; + margin: 0 2px; + padding: 0.35em 0.625em 0.75em; +} + +/** + * 1. Correct `color` not being inherited in IE 8/9/10/11. + * 2. Remove padding so people aren't caught out if they zero out fieldsets. + */ + +legend { + border: 0; /* 1 */ + padding: 0; /* 2 */ +} + +/** + * Remove default vertical scrollbar in IE 8/9/10/11. + */ + +textarea { + overflow: auto; +} + +/** + * Don't inherit the `font-weight` (applied by a rule above). + * NOTE: the default cannot safely be changed in Chrome and Safari on OS X. + */ + +optgroup { + font-weight: bold; +} + +/* Tables + ========================================================================== */ + +/** + * Remove most spacing between table cells. + */ + +table { + border-collapse: collapse; + border-spacing: 0; +} + +td, +th { + padding: 0; +} diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/css/template.css b/ci4/app/ThirdParty/DatatablesEditor/docs/css/template.css new file mode 100644 index 00000000..f7178281 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/css/template.css @@ -0,0 +1,192 @@ +.phpdocumentor-summary { + font-style: italic; +} +.phpdocumentor-description { + margin-bottom: var(--spacing-md); +} +.phpdocumentor-element { + position: relative; +} + +.phpdocumentor .phpdocumentor-element__name { + line-height: 1; +} + +.phpdocumentor-element__package, +.phpdocumentor-element__extends, +.phpdocumentor-element__implements { + display: block; + font-size: var(--text-xxs); + font-weight: normal; + opacity: .7; +} + +.phpdocumentor-element__package .phpdocumentor-breadcrumbs { + display: inline; +} + +.phpdocumentor-element:not(:last-child) { + border-bottom: 1px solid var(--primary-color-lighten); + padding-bottom: var(--spacing-lg); +} + +.phpdocumentor-element.-deprecated .phpdocumentor-element__name { + text-decoration: line-through; +} + +.phpdocumentor-element__modifier { + font-size: var(--text-xxs); + padding: calc(var(--spacing-base-size) / 4) calc(var(--spacing-base-size) / 2); + color: var(--text-color); + background-color: var(--light-gray); + border-radius: 3px; + text-transform: uppercase; +} +.phpdocumentor-signature { + display: inline-block; + font-size: var(--text-sm); + margin-bottom: var(--spacing-md); +} + +.phpdocumentor-signature.-deprecated .phpdocumentor-signature__name { + text-decoration: line-through; +} +.phpdocumentor-table-of-contents { +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry { + padding-top: var(--spacing-xs); + margin-left: 2rem; + display: flex; +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry > a { + flex: 0 1 auto; +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry > span { + flex: 1; + white-space: nowrap; + text-overflow: ellipsis; + overflow: hidden; +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry:after { + content: ''; + height: 12px; + width: 12px; + left: 16px; + position: absolute; +} +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-private:after { + background: url('data:image/svg+xml;utf8,') no-repeat; +} +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-protected:after { + left: 13px; + background: url('data:image/svg+xml;utf8,') no-repeat; +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry:before { + width: 1.25rem; + height: 1.25rem; + line-height: 1.25rem; + background: transparent url('data:image/svg+xml;utf8,') no-repeat center center; + content: ''; + position: absolute; + left: 0; + border-radius: 50%; + font-weight: 600; + color: white; + text-align: center; + font-size: .75rem; + margin-top: .2rem; +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-method:before { + content: 'M'; + background-image: url('data:image/svg+xml;utf8,'); +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-function:before { + content: 'M'; + background-image: url('data:image/svg+xml;utf8,'); +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-property:before { + content: 'P' +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-constant:before { + content: 'C'; + background-color: transparent; + background-image: url('data:image/svg+xml;utf8,'); +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-class:before { + content: 'C' +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-interface:before { + content: 'I' +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-trait:before { + content: 'T' +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-namespace:before { + content: 'N' +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-package:before { + content: 'P' +} + +.phpdocumentor-table-of-contents .phpdocumentor-table-of-contents__entry.-enum:before { + content: 'E' +} + +.phpdocumentor-table-of-contents dd { + font-style: italic; + margin-left: 2rem; +} +.phpdocumentor-element-found-in { + position: absolute; + top: 0; + right: 0; + font-size: var(--text-sm); + color: gray; +} + +.phpdocumentor-element-found-in .phpdocumentor-element-found-in__source { + flex: 0 1 auto; + display: inline-flex; +} + +.phpdocumentor-element-found-in .phpdocumentor-element-found-in__source:after { + width: 1.25rem; + height: 1.25rem; + line-height: 1.25rem; + background: transparent url('data:image/svg+xml;utf8,') no-repeat center center; + content: ''; + left: 0; + border-radius: 50%; + font-weight: 600; + text-align: center; + font-size: .75rem; + margin-top: .2rem; +} +.phpdocumentor-class-graph { + width: 100%; height: 600px; border:1px solid black; overflow: hidden +} + +.phpdocumentor-class-graph__graph { + width: 100%; +} +.phpdocumentor-tag-list__definition { + display: flex; +} + +.phpdocumentor-tag-link { + margin-right: var(--spacing-sm); +} diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Bootstrap.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Bootstrap.php.txt new file mode 100644 index 00000000..eb620ca0 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Bootstrap.php.txt @@ -0,0 +1,54 @@ + "Editor PHP libraries required PHP 5.3 or newer. You are ". + "currently using ".PHP_VERSION.". PHP 5.3 and newer have a lot of ". + "great new features that the Editor libraries take advantage of to ". + "present an easy to use and flexible API." + ) ); + exit(0); +} + + +// +// Load the DataTables bootstrap core file and let it register the required +// handlers. +// +require( dirname(__FILE__).'/Bootstrap.php' ); + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database.php.txt new file mode 100644 index 00000000..7d86935f --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database.php.txt @@ -0,0 +1,473 @@ + "", // User name + * "pass" => "", // Password + * "host" => "", // Host name + * "port" => "", // Port + * "db" => "", // Database name + * "type" => "" // Datable type: "Mysql", "Postgres" or "Sqlite" + * ) + * ``` + */ + function __construct( $opts ) + { + $types = array( 'Mysql', 'Oracle', 'Postgres', 'Sqlite', 'Sqlserver', 'Db2', 'Firebird' ); + + if ( ! in_array( $opts['type'], $types ) ) { + throw new \Exception( + "Unknown database driver type. Must be one of ".implode(', ', $types), + 1 + ); + } + + $this->_type = $opts['type']; + $this->query_driver = "DataTables\\Database\\Driver\\".$opts['type'].'Query'; + $this->_dbResource = isset( $opts['pdo'] ) ? + $opts['pdo'] : + call_user_func($this->query_driver.'::connect', $opts ); + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + /** @var resource */ + private $_dbResource = null; + + /** @var callable */ + private $_type = null; + private $_debugCallback = null; + private $query_driver = null; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + /** + * Determine if there is any data in the table that matches the query + * condition + * + * @param string|string[] $table Table name(s) to act upon. + * @param array $where Where condition for what to select - see {@see + * Query->where()}. + * @return boolean Boolean flag - true if there were rows + */ + public function any( $table, $where=null ) + { + $res = $this->query( 'select' ) + ->table( $table ) + ->get( '*' ) + ->where( $where ) + ->limit(1) + ->exec(); + + return $res->count() > 0; + } + + + /** + * Commit a database transaction. + * + * Use with {@see Database->transaction()} and {@see Database->rollback()}. + * @return self + */ + public function commit () + { + call_user_func($this->query_driver.'::commit', $this->_dbResource ); + return $this; + } + + + /** + * Get a count from a table. + * @param string|string[] $table Table name(s) to act upon. + * @param string $field Primary key field name + * @param array $where Where condition for what to select - see {@see + * Query->where()}. + * @return Number + */ + public function count ( $table, $field="id", $where=null ) + { + $res = $this->query( 'count' ) + ->table( $table ) + ->get( $field ) + ->where( $where ) + ->exec(); + + $cnt = $res->fetch(); + return $cnt['cnt']; + } + + + /** + * Get / set debug mode. + * + * @param boolean $_ Debug mode state. If not given, then used as a getter. + * @return boolean|self Debug mode state if no parameter is given, or + * self if used as a setter. + */ + public function debug ( $set=null ) + { + if ( $set === null ) { + return $this->_debugCallback ? true : false; + } + else if ( $set === false ) { + $this->_debugCallback = null; + } + else { + $this->_debugCallback = $set; + } + + return $this; + } + + + /** + * Perform a delete query on a table. + * + * This is a short cut method that creates an update query and then uses + * the query('delete'), table, where and exec methods of the query. + * @param string|string[] $table Table name(s) to act upon. + * @param array $where Where condition for what to delete - see {@see + * Query->where()}. + * @return Result + */ + public function delete ( $table, $where=null ) + { + return $this->query( 'delete' ) + ->table( $table ) + ->where( $where ) + ->exec(); + } + + + /** + * Insert data into a table. + * + * This is a short cut method that creates an update query and then uses + * the query('insert'), table, set and exec methods of the query. + * @param string|string[] $table Table name(s) to act upon. + * @param array $set Field names and values to set - see {@see + * Query->set()}. + * @param array $pkey Primary key column names (this is an array for + * forwards compt, although only the first item in the array is actually + * used). This doesn't need to be set, but it must be if you want to use + * the `Result->insertId()` method. + * @return Result + */ + public function insert ( $table, $set, $pkey='' ) + { + return $this->query( 'insert' ) + ->pkey( $pkey ) + ->table( $table ) + ->set( $set ) + ->exec(); + } + + + /** + * Update or Insert data. When doing an insert, the where condition is + * added as a set field + * @param string|string[] $table Table name(s) to act upon. + * @param array $set Field names and values to set - see {@see + * Query->set()}. + * @param array $where Where condition for what to update - see {@see + * Query->where()}. + * @param array $pkey Primary key column names (this is an array for + * forwards compt, although only the first item in the array is actually + * used). This doesn't need to be set, but it must be if you want to use + * the `Result->insertId()` method. Only used if an insert is performed. + * @return Result + */ + public function push ( $table, $set, $where=null, $pkey='' ) + { + $selectColumn = '*'; + + if ( $pkey ) { + $selectColumn = is_array($pkey) ? + $pkey[0] : + $pkey; + } + + // Update or insert + if ( $this->select( $table, $selectColumn, $where )->count() > 0 ) { + return $this->update( $table, $set, $where ); + } + + // Add the where condition to the values to set + foreach ($where as $key => $value) { + if ( ! isset( $set[ $key ] ) ) { + $set[ $key ] = $value; + } + } + + return $this->insert( $table, $set, $pkey ); + } + + + /** + * Create a query object to build a database query. + * @param string $type Query type - select, insert, update or delete. + * @param string|string[] $table Table name(s) to act upon. + * @return Query + */ + public function query ( $type, $table=null ) + { + return new $this->query_driver( $this, $type, $table ); + } + + + /** + * Quote a string for a quote. Note you should generally use a bind! + * @param string $val Value to quote + * @param string $type Value type + * @return string + */ + public function quote ( $val, $type=\PDO::PARAM_STR ) + { + return $this->_dbResource->quote( $val, $type ); + } + + + /** + * Create a `Query` object that will execute a custom SQL query. This is + * similar to the `sql` method, but in this case you must call the `exec()` + * method of the returned `Query` object manually. This can be useful if you + * wish to bind parameters using the query `bind` method to ensure data is + * properly escaped. + * + * @return Result + * + * @example + * Safely escape user input + * ```php + * $db + * ->raw() + * ->bind( ':date', $_POST['date'] ) + * ->exec( 'SELECT * FROM staff where date < :date' ); + * ``` + */ + public function raw () + { + return $this->query( 'raw' ); + } + + + /** + * Get the database resource connector. This is typically a PDO object. + * @return resource PDO connection resource (driver dependent) + */ + public function resource () + { + return $this->_dbResource; + } + + + /** + * Rollback the database state to the start of the transaction. + * + * Use with {@see Database->transaction()} and {@see Database->commit()}. + * @return self + */ + public function rollback () + { + call_user_func($this->query_driver.'::rollback', $this->_dbResource ); + return $this; + } + + + /** + * Select data from a table. + * + * This is a short cut method that creates an update query and then uses + * the query('select'), table, get, where and exec methods of the query. + * @param string|string[] $table Table name(s) to act upon. + * @param array $field Fields to get from the table(s) - see {@see + * Query->get()}. + * @param array $where Where condition for what to select - see {@see + * Query->where()}. + * @param array $orderBy Order condition - see {@see + * Query->order()}. + * @return Result + */ + public function select ( $table, $field="*", $where=null, $orderBy=null ) + { + return $this->query( 'select' ) + ->table( $table ) + ->get( $field ) + ->where( $where ) + ->order( $orderBy ) + ->exec(); + } + + + /** + * Select distinct data from a table. + * + * This is a short cut method that creates an update query and then uses the + * query('select'), distinct ,table, get, where and exec methods of the + * query. + * @param string|string[] $table Table name(s) to act upon. + * @param array $field Fields to get from the table(s) - see {@see + * Query->get()}. + * @param array $where Where condition for what to select - see {@see + * Query->where()}. + * @param array $orderBy Order condition - see {@see + * Query->order()}. + * @return Result + */ + public function selectDistinct ( $table, $field="*", $where=null, $orderBy=null ) + { + return $this->query( 'select' ) + ->table( $table ) + ->distinct( true ) + ->get( $field ) + ->where( $where ) + ->order( $orderBy ) + ->exec(); + } + + + /** + * Execute an raw SQL query - i.e. give the method your own SQL, rather + * than having the Database classes building it for you. + * + * This method will execute the given SQL immediately. Use the `raw()` + * method if you need the ability to add bound parameters. + * @param string $sql SQL string to execute (only if _type is 'raw'). + * @return Result + * + * @example + * Basic select + * ```php + * $result = $db->sql( 'SELECT * FROM myTable;' ); + * ``` + * + * @example + * Set the character set of the connection + * ```php + * $db->sql("SET character_set_client=utf8"); + * $db->sql("SET character_set_connection=utf8"); + * $db->sql("SET character_set_results=utf8"); + * ``` + */ + public function sql ( $sql ) + { + return $this->query( 'raw' ) + ->exec( $sql ); + } + + + /** + * Start a new database transaction. + * + * Use with {@see Database->commit()} and {@see Database->rollback()}. + * @return self + */ + public function transaction () + { + call_user_func($this->query_driver.'::transaction', $this->_dbResource ); + return $this; + } + + + /** + * Get the database type (e.g. Postgres, Mysql, etc) + */ + public function type () + { + return $this->_type; + } + + + /** + * Update data. + * + * This is a short cut method that creates an update query and then uses + * the query('update'), table, set, where and exec methods of the query. + * @param string|string[] $table Table name(s) to act upon. + * @param array $set Field names and values to set - see {@see + * Query->set()}. + * @param array $where Where condition for what to update - see {@see + * Query->where()}. + * @return Result + */ + public function update ( $table, $set=null, $where=null ) + { + return $this->query( 'update' ) + ->table( $table ) + ->set( $set ) + ->where( $where ) + ->exec(); + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Internal functions + */ + + /** + * Get debug query information. + * + * @return array Information about the queries used. When this method is + * called it will reset the query cache. + * @internal + */ + public function debugInfo ( $query=null, $bindings=null ) + { + $callback = $this->_debugCallback; + + if ( $callback ) { + $callback( array( + "query" => $query, + "bindings" => $bindings + ) ); + } + + return $this; + } +}; + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/Db2Query.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/Db2Query.php.txt new file mode 100644 index 00000000..3461491d --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/Db2Query.php.txt @@ -0,0 +1,161 @@ + "An error occurred while connecting to the database ". + "'{$db}'. The error reported by the server was: ".$e + ) ); + exit(0); + } + + return $conn; + } + + public static function transaction ( $conn ) + { + // no op + } + + public static function commit ( $conn ) + { + // no op + } + + public static function rollback ( $conn ) + { + // no op + } + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Protected methods + */ + + protected function _prepare($sql) + { + $this->_sql = $sql; + } + + protected function _exec() + { + $resource = $this->database()->resource(); + $bindings = $this->_bindings; + + $paramSql = preg_replace('/(:[a-zA-Z\-_0-9]*)/', '?', $this->_sql); + //echo $paramSql."\n"; + $this->_stmt = db2_prepare($resource, $paramSql); + $stmt = $this->_stmt; + + //echo $this->_sql."\n"; + + preg_match_all('/(:[a-zA-Z\-_0-9]*)/', $this->_sql, $matches); + + //print_r( $matches ); + //print_r( $bindings); + + //$allanTest = 65; + //db2_bind_param( $stmt, 1, 'allanTest', DB2_PARAM_IN ); + + for ( $i=0, $ien=count($matches[0]) ; $i<$ien ; $i++ ) { + for ( $j=0, $jen=count($bindings) ; $j<$jen ; $j++ ) { + if ( $bindings[$j]['name'] === $matches[0][$i] ) { + $name = str_replace(':', '', $matches[0][$i]); + $$name = $bindings[$j]['value']; + //$_GLOBALS[ $name ] = $bindings[$j]['value']; + + //echo "bind $name as ".$$name."\n"; + + db2_bind_param( $stmt, $i+1, $name, DB2_PARAM_IN ); + } + } + } + + //print_r( get_defined_vars() ); + + $res = db2_execute($stmt); + + if (! $res) { + throw new \Exception('DB2 SQL error = '.db2_stmt_error($this->_stmt)); + + return false; + } + + $resource = $this->database()->resource(); + return new Db2Result($resource, $this->_stmt, $this->_editor_pkey_value); + } + + protected function _build_table() + { + $out = array(); + + for ($i = 0, $ien = count($this->_table); $i < $ien; $i ++) { + $t = $this->_table[$i]; + + if (strpos($t, ' as ')) { + $a = explode(' as ', $t); + $out[] = $a[0] . ' ' . $a[1]; + } else { + $out[] = $t; + } + } + + return ' ' . implode(', ', $out) . ' '; + } +} diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/Db2Result.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/Db2Result.php.txt new file mode 100644 index 00000000..9885d862 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/Db2Result.php.txt @@ -0,0 +1,82 @@ +_dbh = $dbh; + $this->_stmt = $stmt; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + private $_stmt; + private $_dbh; + private $_allRows = null; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + public function count () + { + $all = $this->_fetchAll(); + return count($all); + } + + + public function fetch ( $fetchType=\PDO::FETCH_ASSOC ) + { + return db2_fetch_assoc( $this->_stmt ); + } + + + public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC ) + { + $all = $this->_fetchAll(); + return $all; + } + + public function insertId () + { + return db2_last_insert_id( $this->_dbh ); + } + + private function _fetchAll () { + $a = array(); + while ( $row = db2_fetch_assoc( $this->_stmt ) ) { + $a[] = $row; + } + return $a; + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/FirebirdQuery.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/FirebirdQuery.php.txt new file mode 100644 index 00000000..fa71840e --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/FirebirdQuery.php.txt @@ -0,0 +1,137 @@ + "An error occurred while connecting to the database ". + "'{$db}'. The error reported by the server was: ".$e->getMessage() + ) ); + exit(0); + } + + return $pdo; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Protected methods + */ + + protected function _prepare( $sql ) + { + $this->database()->debugInfo( $sql, $this->_bindings ); + + $resource = $this->database()->resource(); + $pkey = $this->pkey(); + + // If insert, add the pkey column + if ( $this->_type === 'insert' && $pkey ) { + $this->_pkeyInsertedTo = (is_array($pkey) ? $pkey[0] : $pkey); + $sql .= ' RETURNING "'.$this->_pkeyInsertedTo.'"'; + } + + $this->_stmt = $resource->prepare( $sql ); + + // bind values + for ( $i=0 ; $i_bindings) ; $i++ ) { + $binding = $this->_bindings[$i]; + + $this->_stmt->bindValue( + $binding['name'], + $binding['value'], + $binding['type'] ? $binding['type'] : \PDO::PARAM_STR + ); + } + } + + + protected function _exec() + { + try { + $this->_stmt->execute(); + } + catch (\PDOException $e) { + throw new \Exception( "An SQL error occurred: ".$e->getMessage() ); + error_log( "An SQL error occurred: ".$e->getMessage() ); + return false; + } + + $resource = $this->database()->resource(); + return new FirebirdResult( $resource, $this->_stmt, $this->_pkeyInsertedTo ); + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/FirebirdResult.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/FirebirdResult.php.txt new file mode 100644 index 00000000..da372542 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/FirebirdResult.php.txt @@ -0,0 +1,77 @@ +_dbh = $dbh; + $this->_stmt = $stmt; + $this->_pkey = $pkey; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + private $_stmt; + private $_dbh; + private $_pkey; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + public function count () + { + return count($this->fetchAll()); + } + + + public function fetch ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetch( $fetchType ); + } + + + public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetchAll( $fetchType ); + } + + + public function insertId () + { + // Only useful after an insert of course... + $rows = $this->_stmt->fetchAll(); + return $rows[0][$this->_pkey]; + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/MysqlQuery.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/MysqlQuery.php.txt new file mode 100644 index 00000000..fb21b381 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/MysqlQuery.php.txt @@ -0,0 +1,121 @@ + "An error occurred while connecting to the database ". + "'{$db}'. The error reported by the server was: ".$e->getMessage() + ) ); + exit(0); + } + + return $pdo; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Protected methods + */ + + protected function _prepare( $sql ) + { + $this->database()->debugInfo( $sql, $this->_bindings ); + + $resource = $this->database()->resource(); + $this->_stmt = $resource->prepare( $sql ); + + // bind values + for ( $i=0 ; $i_bindings) ; $i++ ) { + $binding = $this->_bindings[$i]; + + $this->_stmt->bindValue( + $binding['name'], + $binding['value'], + $binding['type'] ? $binding['type'] : \PDO::PARAM_STR + ); + } + } + + + protected function _exec() + { + // $start = hrtime(true); + + try { + $this->_stmt->execute(); + } + catch (\PDOException $e) { + throw new \Exception( "An SQL error occurred: ".$e->getMessage() ); + error_log( "An SQL error occurred: ".$e->getMessage() ); + return false; + } + + // $this->database()->debugInfo( 'Execution complete - duration: '. (hrtime(true) - $start) . ' Time: '. microtime(true), [] ); + + $resource = $this->database()->resource(); + return new MysqlResult( $resource, $this->_stmt ); + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/MysqlResult.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/MysqlResult.php.txt new file mode 100644 index 00000000..b044f4ea --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/MysqlResult.php.txt @@ -0,0 +1,73 @@ +_dbh = $dbh; + $this->_stmt = $stmt; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + private $_stmt; + private $_dbh; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + public function count () + { + return count($this->fetchAll()); + } + + + public function fetch ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetch( $fetchType ); + } + + + public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetchAll( $fetchType ); + } + + + public function insertId () + { + return $this->_dbh->lastInsertId(); + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/OracleQuery.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/OracleQuery.php.txt new file mode 100644 index 00000000..9d1b448d --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/OracleQuery.php.txt @@ -0,0 +1,203 @@ + "oci methods are not available in this PHP install to connect to Oracle" + ) ); + exit(0); + } + + $conn = @oci_connect($user, $pass, $host.$port.'/'.$db, 'utf8'); + + if ( ! $conn ) { + // If we can't establish a DB connection then we return a DataTables + // error. + $e = oci_error(); + + echo json_encode( array( + "error" => "An error occurred while connecting to the database ". + "'{$db}'. The error reported by the server was: ".$e['message'] + ) ); + exit(0); + } + + // Use ISO date and time styles + $stmt = oci_parse($conn, "ALTER SESSION SET NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'" ); + $res = oci_execute( $stmt ); + + $stmt = oci_parse($conn, "ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'" ); + $res = oci_execute( $stmt ); + + return $conn; + } + + + public static function transaction ( $conn ) + { + // no op + } + + public static function commit ( $conn ) + { + oci_commit( $conn ); + } + + public static function rollback ( $conn ) + { + oci_rollback( $conn ); + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Protected methods + */ + + protected function _prepare( $sql ) + { + + $resource = $this->database()->resource(); + $pkey = $this->pkey(); + + // If insert, add the pkey column + if ( $this->_type === 'insert' && $pkey ) { + $sql .= ' RETURNING '.$this->_protect_identifiers(is_array($pkey) ? $pkey[0] : $pkey).' INTO :editor_pkey_value'; + } + else if ( $this->_type === 'select' && $this->_oracle_offset !== null ) { + $sql = ' + select * from (select rownum rnum, a.* + from ('.$sql.') a where rownum <= '.($this->_oracle_offset+$this->_oracle_limit).') + where rnum > '.$this->_oracle_offset; + } + + $this->database()->debugInfo( $sql, $this->_bindings ); + + $this->_stmt = oci_parse( $resource, $sql ); + + // If insert, add a binding for the returned id + if ( $this->_type === 'insert' && $pkey ) { + oci_bind_by_name( + $this->_stmt, + ':editor_pkey_value', + $this->_editor_pkey_value, + 36 + ); + } + + // Bind values + for ( $i=0 ; $i_bindings) ; $i++ ) { + $binding = $this->_bindings[$i]; + + oci_bind_by_name( + $this->_stmt, + $binding['name'], + $binding['value'] + ); + } + } + + + protected function _exec() + { + $res = @oci_execute( $this->_stmt, OCI_NO_AUTO_COMMIT ); + + if ( ! $res ) { + $e = oci_error( $this->_stmt ); + throw new \Exception( "Oracle SQL error: ".$e['message'] ); + + return false; + } + + $resource = $this->database()->resource(); + return new OracleResult( $resource, $this->_stmt, $this->_editor_pkey_value ); + } + + + protected function _build_table() + { + $out = array(); + + for ( $i=0, $ien=count($this->_table) ; $i<$ien ; $i++ ) { + $t = $this->_table[$i]; + + if ( strpos($t, ' as ') ) { + $a = explode( ' as ', $t ); + $out[] = $this->_protect_identifiers($a[0]).' '.$this->_protect_identifiers($a[1]); + } + else { + $out[] = $t; + } + } + + return ' '.implode(', ', $out).' '; + } + + + private $_oracle_offset = null; + private $_oracle_limit = null; + + protected function _build_limit() + { + $this->_oracle_offset = $this->_offset; + $this->_oracle_limit = $this->_limit; + + return ' '; + } +} diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/OracleResult.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/OracleResult.php.txt new file mode 100644 index 00000000..b8eee5de --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/OracleResult.php.txt @@ -0,0 +1,82 @@ +_dbh = $dbh; + $this->_stmt = $stmt; + $this->_pkey_val = $pkey_val; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + private $_stmt; // Result from oci_parse + private $_dbh; // Result from oci_connect + private $_rows = null; + private $_pkey_val; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + public function count () + { + return count($this->fetchAll()); + } + + + public function fetch ( $fetchType=\PDO::FETCH_ASSOC /* irrelevant for oci8 */ ) + { + return oci_fetch_assoc( $this->_stmt ); + } + + + public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC /* irrelevant for oci8 */ ) + { + if ( ! $this->_rows ) { + $out = array(); + + oci_fetch_all( $this->_stmt, $out, 0, -1, OCI_FETCHSTATEMENT_BY_ROW + OCI_ASSOC ); + + $this->_rows = $out; + } + + return $this->_rows; + } + + + public function insertId () + { + return $this->_pkey_val; + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/PostgresQuery.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/PostgresQuery.php.txt new file mode 100644 index 00000000..67c9247a --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/PostgresQuery.php.txt @@ -0,0 +1,146 @@ + "An error occurred while connecting to the database ". + "'{$db}'. The error reported by the server was: ".$e->getMessage() + ) ); + exit(0); + } + + return $pdo; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Protected methods + */ + + protected function _prepare( $sql ) + { + $this->database()->debugInfo( $sql, $this->_bindings ); + + $resource = $this->database()->resource(); + + // Add a RETURNING command to postgres insert queries so we can get the + // pkey value from the query reliably + if ( $this->_type === 'insert' ) { + $table = explode( ' as ', $this->_table[0] ); + + // Get the pkey field name + $pkRes = $resource->prepare( + "SELECT + pg_attribute.attname, + format_type(pg_attribute.atttypid, pg_attribute.atttypmod) + FROM pg_index, pg_class, pg_attribute + WHERE + pg_class.oid = '{$table[0]}'::regclass AND + indrelid = pg_class.oid AND + pg_attribute.attrelid = pg_class.oid AND + pg_attribute.attnum = any(pg_index.indkey) + AND indisprimary" + ); + $pkRes->execute(); + $row = $pkRes->fetch(); + + if ( $row && isset($row['attname'] ) ) { + $sql .= ' RETURNING '.$row['attname'].' as dt_pkey'; + } + } + + $this->_stmt = $resource->prepare( $sql ); + + // bind values + for ( $i=0 ; $i_bindings) ; $i++ ) { + $binding = $this->_bindings[$i]; + + $this->_stmt->bindValue( + $binding['name'], + $binding['value'], + $binding['type'] ? $binding['type'] : \PDO::PARAM_STR + ); + } + } + + + protected function _exec() + { + try { + $this->_stmt->execute(); + } + catch (\PDOException $e) { + throw new \Exception( "An SQL error occurred: ".$e->getMessage() ); + error_log( "An SQL error occurred: ".$e->getMessage() ); + return false; + } + + $resource = $this->database()->resource(); + return new PostgresResult( $resource, $this->_stmt ); + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/PostgresResult.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/PostgresResult.php.txt new file mode 100644 index 00000000..eb204efe --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/PostgresResult.php.txt @@ -0,0 +1,75 @@ +_dbh = $dbh; + $this->_stmt = $stmt; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + private $_stmt; + private $_dbh; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + public function count () + { + return count($this->fetchAll()); + } + + + public function fetch ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetch( $fetchType ); + } + + + public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetchAll( $fetchType ); + } + + + public function insertId () + { + // Only useful after an insert of course... + $rows = $this->_stmt->fetchAll(); + return $rows[0]['dt_pkey']; + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/SqliteQuery.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/SqliteQuery.php.txt new file mode 100644 index 00000000..9c1ef0bc --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/SqliteQuery.php.txt @@ -0,0 +1,112 @@ + "An error occurred while connecting to the database ". + "'{$db}'. The error reported by the server was: ".$e->getMessage() + ) ); + exit(0); + } + + return $pdo; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Protected methods + */ + + protected function _prepare( $sql ) + { + $this->database()->debugInfo( $sql, $this->_bindings ); + + $resource = $this->database()->resource(); + $this->_stmt = $resource->prepare( $sql ); + + // bind values + for ( $i=0 ; $i_bindings) ; $i++ ) { + $binding = $this->_bindings[$i]; + + $this->_stmt->bindValue( + $binding['name'], + $binding['value'], + $binding['type'] ? $binding['type'] : \PDO::PARAM_STR + ); + } + } + + + protected function _exec() + { + try { + $this->_stmt->execute(); + } + catch (PDOException $e) { + throw new \Exception( "An SQL error occurred: ".$e->getMessage() ); + error_log( "An SQL error occurred: ".$e->getMessage() ); + return false; + } + + $resource = $this->database()->resource(); + return new SqliteResult( $resource, $this->_stmt ); + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/SqliteResult.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/SqliteResult.php.txt new file mode 100644 index 00000000..f71964e2 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/SqliteResult.php.txt @@ -0,0 +1,73 @@ +_dbh = $dbh; + $this->_stmt = $stmt; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + private $_stmt; + private $_dbh; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + public function count () + { + return count($this->fetchAll()); + } + + + public function fetch ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetch( $fetchType ); + } + + + public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetchAll( $fetchType ); + } + + + public function insertId () + { + return $this->_dbh->lastInsertId(); + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/SqlserverQuery.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/SqlserverQuery.php.txt new file mode 100644 index 00000000..87e62ead --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/SqlserverQuery.php.txt @@ -0,0 +1,153 @@ + "An error occurred while connecting to the database ". + "'{$db}'. The error reported by the server was: ".$e->getMessage() + ) ); + exit(0); + } + + return $pdo; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Protected methods + */ + + protected function _prepare( $sql ) + { + $this->database()->debugInfo( $sql, $this->_bindings ); + + $resource = $this->database()->resource(); + $this->_stmt = $resource->prepare( $sql ); + + // bind values + for ( $i=0 ; $i_bindings) ; $i++ ) { + $binding = $this->_bindings[$i]; + + $this->_stmt->bindValue( + $binding['name'], + $binding['value'], + $binding['type'] ? $binding['type'] : \PDO::PARAM_STR + ); + } + } + + + protected function _exec() + { + try { + $this->_stmt->execute(); + } + catch (PDOException $e) { + throw new \Exception( "An SQL error occurred: ".$e->getMessage() ); + error_log( "An SQL error occurred: ".$e->getMessage() ); + return false; + } + + $resource = $this->database()->resource(); + return new SqlserverResult( $resource, $this->_stmt ); + } + + + // SQL Server 2012+ only + protected function _build_limit() + { + $out = ''; + + if ( $this->_offset ) { + $out .= ' OFFSET '.$this->_offset.' ROWS'; + } + + if ( $this->_limit ) { + if ( ! $this->_offset ) { + $out .= ' OFFSET 0 ROWS'; + } + $out .= ' FETCH NEXT '.$this->_limit. ' ROWS ONLY'; + } + + return $out; + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/SqlserverResult.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/SqlserverResult.php.txt new file mode 100644 index 00000000..14773c56 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Driver/SqlserverResult.php.txt @@ -0,0 +1,71 @@ +_dbh = $dbh; + $this->_stmt = $stmt; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + private $_stmt; + private $_dbh; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + public function count () + { + return count($this->fetchAll()); + } + + + public function fetch ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetch( $fetchType ); + } + + + public function fetchAll ( $fetchType=\PDO::FETCH_ASSOC ) + { + return $this->_stmt->fetchAll( $fetchType ); + } + + + public function insertId () + { + return $this->_dbh->lastInsertId(); + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Query.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Query.php.txt new file mode 100644 index 00000000..cd9a60e2 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Query.php.txt @@ -0,0 +1,1295 @@ +query()} method (and it's 'select', etc short-cuts). + * Typically it would not be initialised directly. + * + * Note that this is a stub class that a driver will extend and complete as + * required for individual database types. Individual drivers could add + * additional methods, but this is discouraged to ensure that the API is the + * same for all database types. + */ +abstract class Query { + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Constructor + */ + + /** + * Query instance constructor. + * + * Note that typically instances of this class will be automatically created + * through the {@see \DataTables\Database->query()} method. + * @param Database $db Database instance + * @param string $type Query type - 'select', 'insert', 'update' or 'delete' + * @param string|string[] $table Tables to operate on - see {@see Query->table()}. + */ + public function __construct( $dbHost, $type, $table=null ) + { + $this->_dbHost = $dbHost; + $this->_type = $type; + $this->table( $table ); + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + /** + * @var Database Database connection instance + * @internal + */ + protected $_dbHost; + + /** + * @var string Driver to use + * @internal + */ + protected $_type = ""; + + /** + * @var array + * @internal + */ + protected $_table = array(); + + /** + * @var array + * @internal + */ + protected $_field = array(); + + /** + * @var array + * @internal + */ + protected $_bindings = array(); + + /** + * @var array + * @internal + */ + protected $_where = array(); + + /** + * @var array + * @internal + */ + protected $_join = array(); + + /** + * @var array + * @internal + */ + protected $_order = array(); + + /** + * @var array + * @internal + */ + protected $_noBind = array(); + + /** + * @var int + * @internal + */ + protected $_limit = null; + + /** + * @var int + * @internal + */ + protected $_group_by = null; + + /** + * @var int + * @internal + */ + protected $_offset = null; + + /** + * @var string + * @internal + */ + protected $_distinct = false; + + /** + * @var string + * @internal + */ + protected $_identifier_limiter = array( '`', '`' ); + + /** + * @var string + * @internal + */ + protected $_field_quote = '\''; + + /** + * @var array + * @internal + */ + protected $_pkey = null; + + protected $_supportsAsAlias = true; + + protected $_whereInCnt = 1; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Static methods + */ + + /** + * Commit a transaction. + * @param \PDO $dbh The Database handle (typically a PDO object, but not always). + */ + public static function commit ( $dbh ) + { + $dbh->commit(); + } + + /** + * Database connection - override by the database driver. + * @param string|array $user User name or all parameters in an array + * @param string $pass Password + * @param string $host Host name + * @param string $db Database name + * @return Query + */ + public static function connect ( $user, $pass='', $host='', $port='', $db='', $dsn='' ) { + // noop - PHP <7 can't have an abstract static without causing + // an error in strict mode. This should technically be an + // abstract method however. + } + + + /** + * Start a database transaction + * @param \PDO $dbh The Database handle (typically a PDO object, but not always). + */ + public static function transaction ( $dbh ) + { + $dbh->beginTransaction(); + } + + + /** + * Rollback the database state to the start of the transaction. + * @param \PDO $dbh The Database handle (typically a PDO object, but not always). + */ + public static function rollback ( $dbh ) + { + $dbh->rollBack(); + } + + + /** + * Common helper for the drivers to handle a PDO DSN postfix + * @param string $dsn DSN postfix to use + * @return Query + * @internal + */ + static function dsnPostfix ( $dsn ) + { + if ( ! $dsn ) { + return ''; + } + + // Add a DSN field separator if not given + if ( strpos( $dsn, ';' ) !== 0 ) { + return ';'.$dsn; + } + + return $dsn; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + /** + * Safely bind an input value to a parameter. This is evaluated when the + * query is executed. This allows user input to be safely executed without + * risk of an SQL injection attack. + * + * @param string $name Parameter name. This should include a leading colon + * @param string $value Value to bind + * @param mixed $type Data type. See the PHP PDO documentation: + * http://php.net/manual/en/pdo.constants.php + * @return Query + */ + public function bind ( $name, $value, $type=null ) + { + $this->_bindings[] = array( + "name" => $this->_safe_bind( $name ), + "value" => $value, + "type" => $type + ); + + return $this; + } + + + /** + * Get the Database host for this query instance + * @return DataTable Database class instance + */ + public function database () + { + return $this->_dbHost; + } + + + /** + * Set a distinct flag for a `select` query. Note that this has no effect on + * any of the other query types. + * @param boolean $dis Optional + * @return Query + */ + public function distinct ( $dis ) + { + $this->_distinct = $dis; + return $this; + } + + + /** + * Execute the query. + * @param string $sql SQL string to execute (only if _type is 'raw'). + * @return Result + */ + public function exec ( $sql=null ) + { + $type = strtolower( $this->_type ); + + if ( $type === 'select' ) { + return $this->_select(); + } + else if ( $type === 'insert' ) { + return $this->_insert(); + } + else if ( $type === 'update' ) { + return $this->_update(); + } + else if ( $type === 'delete' ) { + return $this->_delete(); + } + else if ( $type === 'count' ) { + return $this->_count(); + } + else if ( $type === 'raw' ) { + return $this->_raw( $sql ); + } + + throw new \Exception("Unknown database command or not supported: ".$type, 1); + } + + + /** + * Get fields. + * @param string|string[] $get,... Fields to get - can be specified as + * individual fields or an array of fields. + * @return self + */ + public function get ( $get ) + { + $args = func_get_args(); + + if ( $get === null ) { + return $this; + } + + for ( $i=0 ; $iget( $args[$i][$j] ); + } + } + else if ( strpos($args[$i], ',') !== false && strpos($args[$i], '(') === false) { + // Comma delimited set of fields - legacy. Recommended that fields be split into + // an array on input + $a = explode(',', $args[$i]); + + for ( $j=0 ; $jget( $a[$j] ); + } + } + else { + $this->_field[] = trim( $args[$i] ); + } + } + + return $this; + } + + + /** + * Perform a JOIN operation + * @param string $table Table name to do the JOIN on + * @param string $condition JOIN condition + * @param string $type JOIN type + * @return self + */ + public function join ( $table, $condition, $type='', $bind=true ) + { + // Tidy and check we know what the join type is + if ($type !== '') { + $type = strtoupper(trim($type)); + + if ( ! in_array($type, array('LEFT', 'RIGHT', 'INNER', 'OUTER', 'LEFT OUTER', 'RIGHT OUTER'))) { + $type = ''; + } + } + + // Protect the identifiers + if ($bind && preg_match('/([\w\.]+)([\W\s]+)(.+)/', $condition, $match)) + { + $match[1] = $this->_protect_identifiers( $match[1] ); + $match[3] = $this->_protect_identifiers( $match[3] ); + + $condition = $match[1].$match[2].$match[3]; + } + + $this->_join[] = $type .' JOIN '. $this->_protect_identifiers($table) .' ON '. $condition .' '; + + return $this; + } + + /** + * Add a left join, with common logic for handling binding or not + */ + public function left_join( $joins ) + { + // Allow a single associative array + if ($this->_is_assoc($joins)) { + $joins = array( + $joins + ); + } + + for ( $i=0, $ien=count($joins) ; $i<$ien ; $i++ ) { + $join = $joins[$i]; + + if ($join['field2'] === null && $join['operator'] === null) { + $this->join( + $join['table'], + $join['field1'], + 'LEFT', + false + ); + } + else { + $this->join( + $join['table'], + $join['field1'].' '.$join['operator'].' '.$join['field2'], + 'LEFT' + ); + } + } + + return $this; + } + + + /** + * Limit the result set to a certain size. + * @param int $lim The number of records to limit the result to. + * @return self + */ + public function limit ( $lim ) + { + $this->_limit = $lim; + + return $this; + } + + /** + * Group the results by the values in a field + * @param string The field of which the values are to be grouped + * @return self + */ + public function group_by ( $group_by ) + { + $this->_group_by = $group_by; + + return $this; + } + + + /** + * Get / set the primary key column name(s) so they can be easily returned + * after an insert. + * @param string[] $pkey Primary keys + * @return Query|string[] + */ + public function pkey ( $pkey=null ) + { + if ( $pkey === null ) { + return $this->_pkey; + } + + $this->_pkey = $pkey; + + return $this; + } + + + /** + * Set table(s) to perform the query on. + * @param string|string[] $table,... Table(s) to use - can be specified as + * individual names, an array of names, a string of comma separated + * names or any combination of those. + * @return self + */ + public function table ( $table ) + { + if ( $table === null ) { + return $this; + } + + if ( is_array($table) ) { + // Array so loop internally + for ( $i=0 ; $itable( $table[$i] ); + } + } + else { + // String based, explode for multiple tables + $tables = explode(",", $table); + + for ( $i=0 ; $i_table[] = $this->_protect_identifiers( trim($tables[$i]) ); + } + } + + return $this; + } + + + /** + * Offset the return set by a given number of records (useful for paging). + * @param int $off The number of records to offset the result by. + * @return self + */ + public function offset ( $off ) + { + $this->_offset = $off; + + return $this; + } + + + /** + * Order by + * @param string|string[] $order Columns and direction to order by - can + * be specified as individual names, an array of names, a string of comma + * separated names or any combination of those. + * @return self + */ + public function order ( $order ) + { + if ( $order === null ) { + return $this; + } + + if ( !is_array($order) ) { + $order = preg_split('/\,(?![^\(]*\))/',$order); + } + + for ( $i=0 ; $i_order[] = $this->_protect_identifiers( $identifier ).' '.$direction; + } + + return $this; + } + + + /** + * Set fields to a given value. + * + * Can be used in two different ways, as set( field, value ) or as an array of + * fields to set: set( array( 'fieldName' => 'value', ...) ); + * @param string|string[] $set Can be given as a single string, when then $val + * must be set, or as an array of key/value pairs to be set. + * @param string $val When $set is given as a simple string, $set is the field + * name and this is the field's value. + * @param boolean $bind Should the value be bound or not + * @return self + */ + public function set ( $set, $val=null, $bind=true ) + { + if ( $set === null ) { + return $this; + } + + if ( !is_array($set) ) { + $set = array( $set => $val ); + } + + foreach ($set as $key => $value) { + $this->_field[] = $key; + + if ( $bind ) { + $this->bind( ':'.$key, $value ); + } + else { + $this->_noBind[$key] = $value; + } + } + + return $this; + } + + + /** + * Where query - multiple conditions are bound as ANDs. + * + * Can be used in two different ways, as where( field, value ) or as an array of + * conditions to use: where( array('fieldName', ...), array('value', ...) ); + * @param string|string[]|callable $key Single field name, or an array of field names. + * If given as a function (i.e. a closure), the function is called, passing the + * query itself in as the only parameter, so the function can add extra conditions + * with parentheses around the additional parameters. + * @param string|string[] $value Single field value, or an array of + * values. Can be null to search for `IS NULL` or `IS NOT NULL` (depending + * on the value of `$op` which should be `=` or `!=`. + * @param string $op Condition operator: <, >, = etc + * @param boolean $bind Escape the value (true, default) or not (false). + * @return self + * + * @example + * The following will produce + * `'WHERE name='allan' AND ( location='Scotland' OR location='Canada' )`: + * + * ```php + * $query + * ->where( 'name', 'allan' ) + * ->where( function ($q) { + * $q->where( 'location', 'Scotland' ); + * $q->or_where( 'location', 'Canada' ); + * } ); + * ``` + */ + public function where ( $key, $value=null, $op="=", $bind=true ) + { + if ( $key === null ) { + return $this; + } + else if ( is_callable($key) && is_object($key) ) { // is a closure + $this->_where_group( true, 'AND' ); + $key( $this ); + $this->_where_group( false, 'OR' ); + } + else if ( !is_array($key) && is_array($value) ) { + for ( $i=0 ; $iwhere( $key, $value[$i], $op, $bind ); + } + } + else { + $this->_where( $key, $value, 'AND ', $op, $bind ); + } + + return $this; + } + + + /** + * Add addition where conditions to the query with an AND operator. An alias + * of `where` for naming consistency. + * + * Can be used in two different ways, as where( field, value ) or as an array of + * conditions to use: where( array('fieldName', ...), array('value', ...) ); + * @param string|string[]|callable $key Single field name, or an array of field names. + * If given as a function (i.e. a closure), the function is called, passing the + * query itself in as the only parameter, so the function can add extra conditions + * with parentheses around the additional parameters. + * @param string|string[] $value Single field value, or an array of + * values. Can be null to search for `IS NULL` or `IS NOT NULL` (depending + * on the value of `$op` which should be `=` or `!=`. + * @param string $op Condition operator: <, >, = etc + * @param boolean $bind Escape the value (true, default) or not (false). + * @return self + */ + public function and_where ( $key, $value=null, $op="=", $bind=true ) + { + return $this->where( $key, $value, $op, $bind ); + } + + + /** + * Add addition where conditions to the query with an OR operator. + * + * Can be used in two different ways, as where( field, value ) or as an array of + * conditions to use: where( array('fieldName', ...), array('value', ...) ); + * @param string|string[]|callable $key Single field name, or an array of field names. + * If given as a function (i.e. a closure), the function is called, passing the + * query itself in as the only parameter, so the function can add extra conditions + * with parentheses around the additional parameters. + * @param string|string[] $value Single field value, or an array of + * values. Can be null to search for `IS NULL` or `IS NOT NULL` (depending + * on the value of `$op` which should be `=` or `!=`. + * @param string $op Condition operator: <, >, = etc + * @param boolean $bind Escape the value (true, default) or not (false). + * @return self + */ + public function or_where ( $key, $value=null, $op="=", $bind=true ) + { + if ( $key === null ) { + return $this; + } + else if ( is_callable($key) && is_object($key) ) { + $this->_where_group( true, 'OR' ); + $key( $this ); + $this->_where_group( false, 'OR' ); + } + else { + if ( !is_array($key) && is_array($value) ) { + for ( $i=0 ; $ior_where( $key, $value[$i], $op, $bind ); + } + return $this; + } + + $this->_where( $key, $value, 'OR ', $op, $bind ); + } + + return $this; + } + + + /** + * Provide grouping for WHERE conditions. Use it with a callback function to + * automatically group any conditions applied inside the method. + * + * For legacy reasons this method also provides the ability to explicitly + * define if a grouping bracket should be opened or closed in the query. + * This method is not prefer. + * + * @param boolean|callable $inOut If callable it will create the group + * automatically and pass the query into the called function. For + * legacy operations use `true` to open brackets, `false` to close. + * @param string $op Conditional operator to use to join to the + * preceding condition. Default `AND`. + * @return self + * + * @example + * ```php + * $query->where_group( function ($q) { + * $q->where( 'location', 'Edinburgh' ); + * $q->where( 'position', 'Manager' ); + * } ); + * ``` + */ + public function where_group ( $inOut, $op='AND' ) + { + if ( is_callable($inOut) && is_object($inOut) ) { + $this->_where_group( true, $op ); + $inOut( $this ); + $this->_where_group( false, $op ); + } + else { + $this->_where_group( $inOut, $op ); + } + + return $this; + } + + + /** + * Provide a method that can be used to perform a `WHERE ... IN (...)` query + * with bound values and parameters. + * + * Note this is only suitable for local values, not a sub-query. For that use + * `->where()` with an unbound value. + * + * @param string Field name + * @param array Values + * @param string Conditional operator to use to join to the + * preceding condition. Default `AND`. + * @return self + */ + public function where_in ( $field, $arr, $operator="AND" ) + { + if ( count($arr) === 0 ) { + return $this; + } + + $binders = array(); + $prefix = ':wherein'; + + // Need to build an array of the binders (having bound the values) so + // the query can be constructed + for ( $i=0, $ien=count($arr) ; $i<$ien ; $i++ ) { + $binder = $prefix.$this->_whereInCnt; + + $this->bind( $binder, $arr[$i] ); + + $binders[] = $binder; + $this->_whereInCnt++; + } + + $this->_where[] = array( + 'operator' => $operator, + 'group' => null, + 'field' => $this->_protect_identifiers($field), + 'query' => $this->_protect_identifiers($field) .' IN ('.implode(', ', $binders).')' + ); + + return $this; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Protected methods + */ + + /** + * Create a comma separated field list + * @param bool $addAlias Flag to add an alias + * @return string + * @internal + */ + protected function _build_field( $addAlias=false ) + { + $a = array(); + $asAlias = $this->_supportsAsAlias ? + ' as ' : + ' '; + + for ( $i=0 ; $i_field) ; $i++ ) { + $field = $this->_field[$i]; + + // Keep the name when referring to a table + if ( $addAlias && $field !== '*' && strpos($field, '(') === false ) { + $split = preg_split( '/ as (?![^\(]*\))/i', $field ); + + if ( count($split) > 1 ) { + $a[] = $this->_protect_identifiers( $split[0] ).$asAlias. + $this->_field_quote. $split[1] .$this->_field_quote; + } + else { + $a[] = $this->_protect_identifiers( $field ).$asAlias. + $this->_field_quote. $this->_escape_field($field) .$this->_field_quote; + } + } + else if ( $addAlias && strpos($field, '(') !== false && ! strpos($field, ' as ') ) { + $a[] = $this->_protect_identifiers( $field ).$asAlias. + $this->_field_quote. $this->_escape_field($field) .$this->_field_quote; + } + else { + $a[] = $this->_protect_identifiers( $field ); + } + } + + return ' '.implode(', ', $a).' '; + } + + /** + * Create a JOIN statement list + * @return string + * @internal + */ + protected function _build_join() + { + return implode(' ', $this->_join); + } + + /** + * Create the LIMIT / OFFSET string + * + * MySQL and Postgres style - anything else can have the driver override + * @return string + * @internal + */ + protected function _build_limit() + { + $out = ''; + $limit = intval($this->_limit); + $offset = intval($this->_offset); + + if ( $limit ) { + $out .= ' LIMIT '.$limit; + } + + if ( $offset ) { + $out .= ' OFFSET '.$offset; + } + + return $out; + } + + /** + * Create the GROUP BY string + * + * @return string + * @internal + */ + protected function _build_group_by() + { + $out = ''; + + if ( $this->_group_by) { + $out .= ' GROUP BY '.$this->_protect_identifiers( $this->_group_by ); + } + + return $out; + } + + /** + * Create the ORDER BY string + * @return string + * @internal + */ + protected function _build_order() + { + if ( count( $this->_order ) > 0 ) { + return ' ORDER BY '.implode(', ', $this->_order).' '; + } + return ''; + } + + /** + * Create a set list + * @return string + * @internal + */ + protected function _build_set() + { + $a = array(); + + for ( $i=0 ; $i_field) ; $i++ ) { + $field = $this->_field[$i]; + + if ( isset( $this->_noBind[ $field ] ) ) { + $a[] = $this->_protect_identifiers( $field ) .' = '. $this->_noBind[ $field ]; + } + else { + $a[] = $this->_protect_identifiers( $field ) .' = :'. $this->_safe_bind( $field ); + } + } + + return ' '.implode(', ', $a).' '; + } + + /** + * Create the TABLE list + * @return string + * @internal + */ + protected function _build_table() + { + if ( $this->_type === 'insert' ) { + // insert, update and delete statements don't need or want aliases in the table name + $a = array(); + + for ( $i=0, $ien=count($this->_table) ; $i<$ien ; $i++ ) { + $table = str_ireplace( ' as ', ' ', $this->_table[$i] ); + $tableParts = explode( ' ', $table ); + + $a[] = $tableParts[0]; + } + + return ' '.implode(', ', $a).' '; + } + + return ' '.implode(', ', $this->_table).' '; + } + + /** + * Create a bind field value list + * @return string + * @internal + */ + protected function _build_value() + { + $a = array(); + + for ( $i=0, $ien=count($this->_field) ; $i<$ien ; $i++ ) { + $a[] = ' :'.$this->_safe_bind( $this->_field[$i] ); + } + + return ' '.implode(', ', $a).' '; + } + + /** + * Create the WHERE statement + * @return string + * @internal + */ + protected function _build_where() + { + if ( count($this->_where) === 0 ) { + return ""; + } + + $condition = "WHERE "; + + for ( $i=0 ; $i_where) ; $i++ ) { + if ( $i === 0 ) { + // Nothing (simplifies the logic!) + } + else if ( $this->_where[$i]['group'] === ')' ) { + // If a group has been used but no conditions were added inside + // of, we don't want to end up with `()` in the SQL as that is + // invalid, so add a 1. + if ( $this->_where[$i-1]['group'] === '(' ) { + $condition .= '1=1'; + } + // else nothing + } + else if ( $this->_where[$i-1]['group'] === '(' ) { + // Nothing + } + else { + $condition .= $this->_where[$i]['operator'].' '; + } + + if ( $this->_where[$i]['group'] !== null ) { + $condition .= $this->_where[$i]['group']; + } + else { + $condition .= $this->_where[$i]['query'] .' '; + } + } + + return $condition; + } + + /** + * Create a DELETE statement + * @return Result + * @internal + */ + protected function _delete() + { + $this->_prepare( + 'DELETE FROM ' + .$this->_build_table() + .$this->_build_where() + ); + + return $this->_exec(); + } + + /** + * Escape quotes in a field identifier + * @internal + */ + protected function _escape_field( $field ) + { + $quote = $this->_field_quote; + + return str_replace($quote, "\\".$quote, $field); + } + + /** + * Execute the query. Provided by the driver + * @return Result + * @internal + */ + abstract protected function _exec(); + + /** + * Create an INSERT statement + * @return Result + * @internal + */ + protected function _insert() + { + $this->_prepare( + 'INSERT INTO ' + .$this->_build_table().' (' + .$this->_build_field() + .') ' + .'VALUES (' + .$this->_build_value() + .')' + ); + + return $this->_exec(); + } + + /** + * Prepare the SQL query by populating the bound variables. + * Provided by the driver + * @return void + * @internal + */ + abstract protected function _prepare( $sql ); + + /** + * Protect field names + * @param string $identifier String to be protected + * @return string + * @internal + */ + protected function _protect_identifiers( $identifier ) + { + $idl = $this->_identifier_limiter; + + // No escaping character + if ( ! $idl ) { + return $identifier; + } + + $left = $idl[0]; + $right = $idl[1]; + + // Dealing with a function or other expression? Just return immediately + if (strpos($identifier, '(') !== FALSE || strpos($identifier, '*') !== FALSE) + { + return $identifier; + } + + // Going to be operating on the spaces in strings, to simplify the white-space + $identifier = preg_replace('/[\t ]+/', ' ', $identifier); + $identifier = str_replace(' as ', ' ', $identifier); + + // If more that a single space, then return + if (substr_count($identifier, ' ') > 1) { + return $identifier; + } + + // Find if our identifier has an alias, so we don't escape that + if ( strpos($identifier, ' ') !== false ) { + $alias = strstr($identifier, ' '); + $identifier = substr($identifier, 0, - strlen($alias)); + } + else { + $alias = ''; + } + + $a = explode('.', $identifier); + return $left . implode($right.'.'.$left, $a) . $right . $alias; + } + + /** + * Passed in SQL statement + * @return Result + * @internal + */ + protected function _raw( $sql ) + { + $this->_prepare( $sql ); + + return $this->_exec(); + } + + /** + * The characters that can be used for the PDO bindValue name are quite + * limited (`[a-zA-Z0-9_]+`). We need to abstract this out to allow slightly + * more complex expressions including dots for easy aliasing + * @param string $name Field name + * @return string + * @internal + */ + protected function _safe_bind ( $name ) + { + $name = str_replace('.', '_1_', $name); + $name = str_replace('-', '_2_', $name); + $name = str_replace('/', '_3_', $name); + $name = str_replace('\\', '_4_', $name); + $name = str_replace(' ', '_5_', $name); + + return $name; + } + + /** + * Create a SELECT statement + * @return Result + * @internal + */ + protected function _select() + { + $this->_prepare( + 'SELECT '.($this->_distinct ? 'DISTINCT ' : '') + .$this->_build_field( true ) + .'FROM '.$this->_build_table() + .$this->_build_join() + .$this->_build_where() + .$this->_build_group_by() + .$this->_build_order() + .$this->_build_limit() + ); + + return $this->_exec(); + } + + /** + * Create a SELECT COUNT statement + * @return Result + * @internal + */ + protected function _count() + { + $select = $this->_supportsAsAlias ? + 'SELECT COUNT('.$this->_build_field().') as '.$this->_protect_identifiers('cnt') : + 'SELECT COUNT('.$this->_build_field().') '.$this->_protect_identifiers('cnt'); + + $this->_prepare( + $select + .' FROM '.$this->_build_table() + .$this->_build_join() + .$this->_build_where() + .$this->_build_limit() + ); + + return $this->_exec(); + } + + /** + * Create an UPDATE statement + * @return Result + * @internal + */ + protected function _update() + { + $this->_prepare( + 'UPDATE ' + .$this->_build_table() + .'SET '.$this->_build_set() + .$this->_build_where() + ); + + return $this->_exec(); + } + + /** + * Add an individual where condition to the query. + * @internal + * @param $where + * @param null $value + * @param string $type + * @param string $op + * @param bool $bind + */ + protected function _where ( $where, $value=null, $type='AND ', $op="=", $bind=true ) + { + if ( $where === null ) { + return; + } + else if ( !is_array($where) ) { + $where = array( $where => $value ); + } + + foreach ($where as $key => $value) { + $i = count( $this->_where ); + + if ( $value === null ) { + // Null query + $this->_where[] = array( + 'operator' => $type, + 'group' => null, + 'field' => $this->_protect_identifiers($key), + 'query' => $this->_protect_identifiers($key) .( $op === '=' ? + ' IS NULL' : + ' IS NOT NULL') + ); + } + else if ( $bind ) { + // Binding condition (i.e. escape data) + if ( $this->_dbHost->type() === 'Postgres' && $op === 'like' ) { + // Postgres specific a it needs a case for string searching non-text data + $this->_where[] = array( + 'operator' => $type, + 'group' => null, + 'field' => $this->_protect_identifiers($key), + 'query' => $this->_protect_identifiers($key).'::text ilike '.$this->_safe_bind(':where_'.$i) + ); + } + else { + $this->_where[] = array( + 'operator' => $type, + 'group' => null, + 'field' => $this->_protect_identifiers($key), + 'query' => $this->_protect_identifiers($key) .' '.$op.' '.$this->_safe_bind(':where_'.$i) + ); + } + $this->bind( ':where_'.$i, $value ); + } + else { + // Non-binding condition + $this->_where[] = array( + 'operator' => $type, + 'group' => null, + 'field' => null, + 'query' => $this->_protect_identifiers($key) .' '. $op .' '. $this->_protect_identifiers($value) + ); + } + } + } + + /** + * Add parentheses to a where condition + * @return string + * @internal + */ + protected function _where_group ( $inOut, $op ) + { + $this->_where[] = array( + "group" => $inOut ? '(' : ')', + "operator" => $op + ); + } + + /** + * Check if an array is associative or sequential + */ + private function _is_assoc(array $arr) + { + if (array() === $arr) { + return false; + } + + return array_keys($arr) !== range(0, count($arr) - 1); + } +}; + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Result.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Result.php.txt new file mode 100644 index 00000000..e186b245 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Database/Result.php.txt @@ -0,0 +1,68 @@ +process()} method determines what action DataTables / + * Editor is requesting from the server-side and will correctly action it. + * + * ```php + * Editor::inst( $db, 'browsers' ) + * ->fields( + * Field::inst( 'first_name' )->validator( Validate::required() ), + * Field::inst( 'last_name' )->validator( Validate::required() ), + * Field::inst( 'country' ), + * Field::inst( 'details' ) + * ) + * ->process( $_POST ) + * ->json(); + * ``` + */ +class Editor extends Ext { + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Statics + */ + + /** Request type - read */ + const ACTION_READ = 'read'; + + /** Request type - create */ + const ACTION_CREATE = 'create'; + + /** Request type - edit */ + const ACTION_EDIT = 'edit'; + + /** Request type - delete */ + const ACTION_DELETE = 'remove'; + + /** Request type - upload */ + const ACTION_UPLOAD = 'upload'; + + + /** + * Determine the request type from an HTTP request. + * + * @param array $http Typically $_POST, but can be any array used to carry + * an Editor payload + * @param string $name The parameter name that the action should be read from. + * @return string `Editor::ACTION_READ`, `Editor::ACTION_CREATE`, + * `Editor::ACTION_EDIT` or `Editor::ACTION_DELETE` indicating the request + * type. + */ + static public function action ( $http, $name='action' ) + { + if ( ! isset( $http[$name] ) ) { + return self::ACTION_READ; + } + + switch ( $http[$name] ) { + case 'create': + return self::ACTION_CREATE; + + case 'edit': + return self::ACTION_EDIT; + + case 'remove': + return self::ACTION_DELETE; + + case 'upload': + return self::ACTION_UPLOAD; + + default: + throw new \Exception("Unknown Editor action: ".$http['action']); + } + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Constructor + */ + + /** + * Constructor. + * @param Database $db An instance of the DataTables Database class that we can + * use for the DB connection. Can be given here or with the 'db' method. + * @param string|array $table The table name in the database to read and write + * information from and to. Can be given here or with the 'table' method. + * @param string|array $pkey Primary key column name in the table given in + * the $table parameter. Can be given here or with the 'pkey' method. + */ + function __construct( $db=null, $table=null, $pkey=null ) + { + // Set constructor parameters using the API - note that the get/set will + // ignore null values if they are used (i.e. not passed in) + $this->db( $db ); + $this->table( $table ); + $this->pkey( $pkey ); + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public properties + */ + + /** @var string */ + public $version = '2.1.3'; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + /** @var DataTables\Database */ + private $_db = null; + + /** @var DataTables\Editor\Field[] */ + private $_fields = array(); + + /** @var array */ + private $_formData; + + /** @var array */ + private $_processData; + + /** @var string */ + private $_idPrefix = 'row_'; + + /** @var DataTables\Editor\Join[] */ + private $_join = array(); + + /** @var array */ + private $_pkey = array('id'); + + /** @var string[] */ + private $_table = array(); + + /** @var string[] */ + private $_readTableNames = array(); + + /** @var boolean */ + private $_transaction = true; + + /** @var array */ + private $_where = array(); + + /** @var boolean */ + private $_write = true; + + /** @var array */ + private $_leftJoin = array(); + + /** @var boolean - deprecated */ + private $_whereSet = false; + + /** @var array */ + private $_out = array(); + + /** @var array */ + private $_events = array(); + + /** @var boolean */ + private $_debug = false; + + /** @var array */ + private $_debugInfo = array(); + + /** @var string Log output path */ + private $_debugLog = ''; + + /** @var callback */ + private $_validator = array(); + + /** @var boolean Enable true / catch when processing */ + private $_tryCatch = true; + + /** @var boolean Enable / disable delete on left joined tables */ + private $_leftJoinRemove = false; + + /** @var string Action name allowing for configuration */ + private $_actionName = 'action'; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + /** + * Get / set the action name to read in HTTP parameters. This can be useful + * to set if you are using a framework that uses the default name of `action` + * for something else (e.g. WordPress). + * @param string Value to set. If not given, then used as a getter. + * @return string|self Value, or self if used as a setter. + */ + public function actionName ( $_=null ) + { + return $this->_getSet( $this->_actionName, $_ ); + } + + + /** + * Get the data constructed in this instance. + * + * This will get the PHP array of data that has been constructed for the + * command that has been processed by this instance. Therefore only useful after + * process has been called. + * @return array Processed data array. + */ + public function data () + { + return $this->_out; + } + + + /** + * Get / set the DB connection instance + * @param Database $_ DataTable's Database class instance to use for database + * connectivity. If not given, then used as a getter. + * @return Database|self The Database connection instance if no parameter + * is given, or self if used as a setter. + */ + public function db ( $_=null ) + { + return $this->_getSet( $this->_db, $_ ); + } + + + /** + * Get / set debug mode and set a debug message. + * + * It can be useful to see the SQL statements that Editor is using. This + * method enables that ability. Information about the queries used is + * automatically added to the output data array / JSON under the property + * name `debugSql`. + * + * This method can also be called with a string parameter, which will be + * added to the debug information sent back to the client-side. This can + * be useful when debugging event listeners, etc. + * + * @param boolean|mixed $_ Debug mode state. If not given, then used as a + * getter. If given as anything other than a boolean, it will be added + * to the debug information sent back to the client. + * @param string [$path=null] Set an output path to log debug information + * @return boolean|self Debug mode state if no parameter is given, or + * self if used as a setter or when adding a debug message. + */ + public function debug ( $_=null, $path=null ) + { + if ( ! is_bool( $_ ) ) { + $this->_debugInfo[] = $_; + + return $this; + } + + if ( $path ) { + $this->_debugLog = $path; + } + + return $this->_getSet( $this->_debug, $_ ); + } + + + /** + * Get / set field instance. + * + * The list of fields designates which columns in the table that Editor will work + * with (both get and set). + * @param Field|string $_... This parameter effects the return value of the + * function: + * + * * `null` - Get an array of all fields assigned to the instance + * * `string` - Get a specific field instance whose 'name' matches the + * field passed in + * * {@see Field} - Add a field to the instance's list of fields. This + * can be as many fields as required (i.e. multiple arguments) + * * `array` - An array of {@see Field} instances to add to the list + * of fields. + * @return Field|Field[]|Editor The selected field, an array of fields, or + * the Editor instance for chaining, depending on the input parameter. + * @throws \Exception Unkown field error + * @see {@see Field} for field documentation. + */ + public function field ( $_=null ) + { + $args = func_get_args(); + + if ( is_string( $_ ) ) { + for ( $i=0, $ien=count($this->_fields) ; $i<$ien ; $i++ ) { + if ( $this->_fields[$i]->name() === $_ ) { + return $this->_fields[$i]; + } + } + + throw new \Exception('Unknown field: '.$_); + } + + if ( $_ !== null && !is_array($_) ) { + $_ = $args; + } + return $this->_getSet( $this->_fields, $_, true ); + } + + + /** + * Get / set field instances. + * + * An alias of {@see field}, for convenience. + * @param Field $_... Instances of the {@see Field} class, given as a single + * instance of {@see Field}, an array of {@see Field} instances, or multiple + * {@see Field} instance parameters for the function. + * @return Field[]|self Array of fields, or self if used as a setter. + * @see {@see Field} for field documentation. + */ + public function fields ( $_=null ) + { + $args = func_get_args(); + + if ( $_ !== null && !is_array($_) ) { + $_ = $args; + } + return $this->_getSet( $this->_fields, $_, true ); + } + + + /** + * Get / set the DOM prefix. + * + * Typically primary keys are numeric and this is not a valid ID value in an + * HTML document - is also increases the likelihood of an ID clash if multiple + * tables are used on a single page. As such, a prefix is assigned to the + * primary key value for each row, and this is used as the DOM ID, so Editor + * can track individual rows. + * @param string $_ Primary key's name. If not given, then used as a getter. + * @return string|self Primary key value if no parameter is given, or + * self if used as a setter. + */ + public function idPrefix ( $_=null ) + { + return $this->_getSet( $this->_idPrefix, $_ ); + } + + + /** + * Get the data that is being processed by the Editor instance. This is only + * useful once the `process()` method has been called, and is available for + * use in validation and formatter methods. + * + * @return array Data given to `process()`. + */ + public function inData () + { + return $this->_processData; + } + + /** + * Get / set join instances. Note that for the majority of use cases you + * will want to use the `leftJoin()` method. It is significantly easier + * to use if you are just doing a simple left join! + * + * The list of Join instances that Editor will join the parent table to + * (i.e. the one that the {@see Editor->table()} and {@see Editor->fields} + * methods refer to in this class instance). + * + * @param Join $_,... Instances of the {@see Join} class, given as a + * single instance of {@see Join}, an array of {@see Join} instances, + * or multiple {@see Join} instance parameters for the function. + * @return Join[]|self Array of joins, or self if used as a setter. + */ + public function join ( $_=null ) + { + $args = func_get_args(); + + if ( $_ !== null && !is_array($_) ) { + $_ = $args; + } + return $this->_getSet( $this->_join, $_, true ); + } + + + /** + * Get the JSON for the data constructed in this instance. + * + * Basically the same as the {@see Editor->data()} method, but in this case we echo, or + * return the JSON string of the data. + * @param boolean $print Echo the JSON string out (true, default) or return it + * (false). + * @param int JSON encode option https://www.php.net/manual/en/json.constants.php + * @return string|self self if printing the JSON, or JSON representation of + * the processed data if false is given as the first parameter. + */ + public function json ( $print=true, $options=0 ) + { + if ( $print ) { + $json = json_encode( $this->_out, $options ); + + if ( $json !== false ) { + echo $json; + } + else { + echo json_encode( array( + "error" => "JSON encoding error: ".json_last_error_msg() + ) ); + } + + return $this; + } + return json_encode( $this->_out ); + } + + + /** + * Echo out JSONP for the data constructed and processed in this instance. + * This is basically the same as {@see Editor->json()} but wraps the return in a + * JSONP callback. + * + * @param string $callback The callback function name to use. If not given + * or `null`, then `$_GET['callback']` is used (the jQuery default). + * @return self Self for chaining. + * @throws \Exception JSONP function name validation + */ + public function jsonp ( $callback=null ) + { + if ( ! $callback ) { + $callback = $_GET['callback']; + } + + if ( preg_match('/[^a-zA-Z0-9_]/', $callback) ) { + throw new \Exception("Invalid JSONP callback function name"); + } + + echo $callback.'('.json_encode( $this->_out ).');'; + return $this; + } + + + /** + * Add a left join condition to the Editor instance, allowing it to operate + * over multiple tables. Multiple `leftJoin()` calls can be made for a + * single Editor instance to join multiple tables. + * + * A left join is the most common type of join that is used with Editor + * so this method is provided to make its use very easy to configure. Its + * parameters are basically the same as writing an SQL left join statement, + * but in this case Editor will handle the create, update and remove + * requirements of the join for you: + * + * * Create - On create Editor will insert the data into the primary table + * and then into the joined tables - selecting the required data for each + * table. + * * Edit - On edit Editor will update the main table, and then either + * update the existing rows in the joined table that match the join and + * edit conditions, or insert a new row into the joined table if required. + * * Remove - On delete Editor will remove the main row and then loop over + * each of the joined tables and remove the joined data matching the join + * link from the main table. + * + * Please note that when using join tables, Editor requires that you fully + * qualify each field with the field's table name. SQL can result table + * names for ambiguous field names, but for Editor to provide its full CRUD + * options, the table name must also be given. For example the field + * `first_name` in the table `users` would be given as `users.first_name`. + * + * @param string $table Table name to do a join onto + * @param string $field1 Field from the parent table to use as the join link + * @param string $operator Join condition (`=`, '<`, etc) + * @param string $field2 Field from the child table to use as the join link + * @return self Self for chaining. + * + * @example + * Simple join: + * + * ```php + * ->field( + * Field::inst( 'users.first_name as myField' ), + * Field::inst( 'users.last_name' ), + * Field::inst( 'users.dept_id' ), + * Field::inst( 'dept.name' ) + * ) + * ->leftJoin( 'dept', 'users.dept_id', '=', 'dept.id' ) + * ->process($_POST) + * ->json(); + * `````` + * + * This is basically the same as the following SQL statement: + * + * ```sql + * SELECT users.first_name, users.last_name, user.dept_id, dept.name + * FROM users + * LEFT JOIN dept ON users.dept_id = dept.id + * ``` + */ + public function leftJoin ( $table, $field1, $operator = null, $field2 = null ) + { + $this->_leftJoin[] = array( + "table" => $table, + "field1" => $field1, + "field2" => $field2, + "operator" => $operator + ); + + return $this; + } + + + /** + * Indicate if a remove should be performed on left joined tables when deleting + * from the parent row. Note that this is disabled by default and will be + * removed completely in v2. Use `ON DELETE CASCADE` in your database instead. + * + * @deprecated + * @param boolean $_ Value to set. If not given, then used as a getter. + * @return boolean|self Value if no parameter is given, or + * self if used as a setter. + */ + public function leftJoinRemove ( $_=null ) + { + return $this->_getSet( $this->_leftJoinRemove, $_ ); + } + + + /** + * Add an event listener. The `Editor` class will trigger an number of + * events that some action can be taken on. + * + * @param string $name Event name + * @param callable $callback Callback function to execute when the event + * occurs + * @return self Self for chaining. + */ + public function on ( $name, $callback ) + { + if ( ! isset( $this->_events[ $name ] ) ) { + $this->_events[ $name ] = array(); + } + + $this->_events[ $name ][] = $callback; + + return $this; + } + + + /** + * Get / set the primary key. + * + * The primary key must be known to Editor so it will know which rows are being + * edited / deleted upon those actions. The default value is ['id']. + * + * @param string|array $_ Primary key's name. If not given, then used as a + * getter. An array of column names can be given to allow composite keys to + * be used. + * @return string|self Primary key value if no parameter is given, or + * self if used as a setter. + */ + public function pkey ( $_=null ) + { + if ( is_string( $_ ) ) { + $this->_pkey = array( $_ ); + return $this; + } + return $this->_getSet( $this->_pkey, $_ ); + } + + + /** + * Convert a primary key array of field values to a combined value. + * + * @param string $row The row of data that the primary key value should + * be extracted from. + * @param boolean $flat Flag to indicate if the given array is flat + * (useful for `where` conditions) or nested for join tables. + * @return string The created primary key value. + * @throws \Exception If one of the values that the primary key is made up + * of cannot be found in the data set given, an Exception will be thrown. + */ + public function pkeyToValue ( $row, $flat=false ) + { + $pkey = $this->_pkey; + $id = array(); + + for ( $i=0, $ien=count($pkey) ; $i<$ien ; $i++ ) { + $column = $pkey[ $i ]; + + if ( $flat ) { + if ( isset( $row[ $column ] ) ) { + if ( $row[ $column ] === null ) { + throw new \Exception("Primary key value is null.", 1); + } + $val = $row[ $column ]; + } + else { + $val = null; + } + } + else { + $val = $this->_readProp( $column, $row ); + } + + if ( $val === null ) { + throw new \Exception("Primary key element is not available in data set.", 1); + } + + $id[] = $val; + } + + return implode( $this->_pkey_separator(), $id ); + } + + + /** + * Convert a primary key combined value to an array of field values. + * + * @param string $value The id that should be split apart + * @param boolean $flat Flag to indicate if the returned array should be + * flat (useful for `where` conditions) or nested for join tables. + * @param string[] $pkey The primary key name - will use the instance value + * if not given + * @return array Array of field values that the id was made up of. + * @throws \Exception If the primary key value does not match the expected + * length based on the primary key configuration, an exception will be + * thrown. + */ + public function pkeyToArray ( $value, $flat=false, $pkey=null ) + { + $arr = array(); + $value = str_replace( $this->idPrefix(), '', $value ); + $idParts = explode( $this->_pkey_separator(), $value ); + + if ( $pkey === null ) { + $pkey = $this->_pkey; + } + + if ( count($pkey) !== count($idParts) ) { + throw new \Exception("Primary key data doesn't match submitted data", 1); + } + + for ( $i=0, $ien=count($idParts) ; $i<$ien ; $i++ ) { + if ( $flat ) { + $arr[ $pkey[$i] ] = $idParts[$i]; + } + else { + $this->_writeProp( $arr, $pkey[$i], $idParts[$i] ); + } + } + + return $arr; + } + + + /** + * Process a request from the Editor client-side to get / set data. + * + * @param array $data Typically $_POST or $_GET as required by what is sent + * by Editor + * @return self + */ + public function process ( $data ) + { + if ( $this->_debug ) { + $debugInfo = &$this->_debugInfo; + + $debugInfo[] = 'Editor PHP libraries - version '. $this->version; + $debugVal = $this->_db->debug( function ( $mess ) use ( &$debugInfo ) { + $debugInfo[] = $mess; + } ); + } + + if ( $this->_tryCatch ) { + try { + $this->_process( $data ); + } + catch (\Exception $e) { + // Error feedback + $this->_out['error'] = $e->getMessage(); + + if ( $this->_transaction ) { + $this->_db->rollback(); + } + } + } + else { + $this->_process( $data ); + } + + if ( $this->_debug ) { + $this->_out['debug'] = $this->_debugInfo; + + // Save to a log file + if ( $this->_debugLog ) { + file_put_contents( $this->_debugLog, json_encode( $this->_debugInfo )."\n", FILE_APPEND ); + } + + $this->_db->debug( false ); + } + + return $this; + } + + + /** + * The CRUD read table name. If this method is used, Editor will create from the + * table name(s) given rather than those given by `Editor->table()`. This can be + * a useful distinction to allow a read from a VIEW (which could make use of a + * complex SELECT) while writing to a different table. + * + * @param string|array $_,... Read table names given as a single string, an array + * of strings or multiple string parameters for the function. + * @return string[]|self Array of read tables names, or self if used as a setter. + */ + public function readTable ( $_=null ) + { + $args = func_get_args(); + + if ( $_ !== null && !is_array($_) ) { + $_ = $args; + } + return $this->_getSet( $this->_readTableNames, $_, true ); + } + + + /** + * Get / set the table name. + * + * The table name designated which DB table Editor will use as its data + * source for working with the database. Table names can be given with an + * alias, which can be used to simplify larger table names. The field + * names would also need to reflect the alias, just like an SQL query. For + * example: `users as a`. + * + * @param string|array $_,... Table names given as a single string, an array of + * strings or multiple string parameters for the function. + * @return string[]|self Array of tables names, or self if used as a setter. + */ + public function table ( $_=null ) + { + $args = func_get_args(); + + if ( $_ !== null && !is_array($_) ) { + $_ = $args; + } + return $this->_getSet( $this->_table, $_, true ); + } + + + /** + * Get / set transaction support. + * + * When enabled (which it is by default) Editor will use an SQL transaction + * to ensure data integrity while it is performing operations on the table. + * This can be optionally disabled using this method, if required by your + * database configuration. + * + * @param boolean $_ Enable (`true`) or disabled (`false`) transactions. + * If not given, then used as a getter. + * @return boolean|self Transactions enabled flag, or self if used as a + * setter. + */ + public function transaction ( $_=null ) + { + return $this->_getSet( $this->_transaction, $_ ); + } + + + /** + * Enable / try catch when `process()` is called. Disabling this can be + * useful for debugging, but is not recommended for production. + * + * @param boolean $_ `true` to enable (default), otherwise false to disable + * @return boolean|Editor Value if used as a getter, otherwise `$this` when + * used as a setter. + */ + public function tryCatch ( $_=null ) + { + return $this->_getSet( $this->_tryCatch, $_ ); + } + + + /** + * Perform validation on a data set. + * + * Note that validation is performed on data only when the action is + * `create` or `edit`. Additionally, validation is performed on the _wire + * data_ - i.e. that which is submitted from the client, without formatting. + * Any formatting required by `setFormatter` is performed after the data + * from the client has been validated. + * + * @param array $errors Output array to which field error information will + * be written. Each element in the array represents a field in an error + * condition. These elements are themselves arrays with two properties + * set; `name` and `status`. + * @param array $data The format data to check + * @return boolean `true` if the data is valid, `false` if not. + */ + public function validate ( &$errors, $data ) + { + // Validation is only performed on create and edit + if ( $data[$this->_actionName] != "create" && $data[$this->_actionName] != "edit" ) { + return true; + } + + foreach( $data['data'] as $id => $values ) { + for ( $i=0 ; $i_fields) ; $i++ ) { + $field = $this->_fields[$i]; + $validation = $field->validate( $values, $this, + str_replace( $this->idPrefix(), '', $id ) + ); + + if ( $validation !== true ) { + $errors[] = array( + "name" => $field->name(), + "status" => $validation + ); + } + } + + // MJoin validation + for ( $i=0 ; $i_join) ; $i++ ) { + $this->_join[$i]->validate( $errors, $this, $values, $data[$this->_actionName] ); + } + } + + return count( $errors ) > 0 ? false : true; + } + + + /** + * Get / set a global validator that will be triggered for the create, edit + * and remove actions performed from the client-side. Multiple validators + * can be added. + * + * @param callable $_ Function to execute when validating the input data. + * It is passed three parameters: 1. The editor instance, 2. The action + * and 3. The values. + * @return Editor|callback Editor instance if called as a setter, or the + * validator function if not. + */ + public function validator ( $_=null ) + { + return $this->_getSet( $this->_validator, $_, true ); + } + + + /** + * Where condition to add to the query used to get data from the database. + * + * Can be used in two different ways: + * + * * Simple case: `where( field, value, operator )` + * * Complex: `where( fn )` + * + * The simple case is fairly self explanatory, a condition is applied to the + * data that looks like `field operator value` (e.g. `name = 'Allan'`). The + * complex case allows full control over the query conditions by providing a + * closure function that has access to the database Query that Editor is + * using, so you can use the `where()`, `or_where()`, `and_where()` and + * `where_group()` methods as you require. + * + * Please be very careful when using this method! If an edit made by a user + * using Editor removes the row from the where condition, the result is + * undefined (since Editor expects the row to still be available, but the + * condition removes it from the result set). + * + * @param string|callable $key Single field name or a closure function + * @param string $value Single field value. + * @param string $op Condition operator: <, >, = etc + * @return string[]|self Where condition array, or self if used as a setter. + */ + public function where ( $key=null, $value=null, $op='=' ) + { + if ( $key === null ) { + return $this->_where; + } + + if ( is_callable($key) && is_object($key) ) { + $this->_where[] = $key; + } + else { + $this->_where[] = array( + "key" => $key, + "value" => $value, + "op" => $op + ); + } + + return $this; + } + + + /** + * Get / set if the WHERE conditions should be included in the create and + * edit actions. + * + * @param boolean $_ Include (`true`), or not (`false`) + * @return boolean Current value + * @deprecated Note that `whereSet` is now deprecated and replaced with the + * ability to set values for columns on create and edit. The C# libraries + * do not support this option at all. + */ + public function whereSet ( $_=null ) + { + return $this->_getSet( $this->_whereSet, $_ ); + } + + public function write ($_writeVal=null){ + return $this->_getSet($this->_write, $_writeVal); + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private methods + */ + + /** + * Process a request from the Editor client-side to get / set data. + * + * @param array $data Data to process + * @private + */ + private function _process( $data ) + { + $this->_out = array( + "fieldErrors" => array(), + "error" => "", + "data" => array(), + "ipOpts" => array(), + "cancelled" => array() + ); + + $action = Editor::action($data); + $this->_processData = $data; + $this->_formData = isset($data['data']) ? $data['data'] : null; + $validators = $this->_validator; + + // Sanity check that data isn't getting truncated as that can lead to data corruption + if ( $data && count($data, COUNT_RECURSIVE) >= ini_get('max_input_vars') ) { + $this->_out['error'] = 'Too many rows edited at the same time (tech info: max_input_vars exceeded).'; + } + + if ( ! $this->_out['error'] ) { + if ( $this->_transaction ) { + $this->_db->transaction(); + } + + $this->_prepJoin(); + + if ( $validators ) { + for ( $i=0 ; $i_out['error'] = $ret; + break; + } + } + } + } + + if ( ! $this->_out['error'] ) { + if ( $action === Editor::ACTION_READ ) { + /* Get data */ + $this->_out = array_merge( $this->_out, $this->_get( null, $data ) ); + } + else if ( $action === Editor::ACTION_UPLOAD && $this->_write === true ) { + /* File upload */ + $this->_upload( $data ); + } + else if ( $action === Editor::ACTION_DELETE && $this->_write === true) { + /* Remove rows */ + $this->_remove( $data ); + $this->_fileClean(); + } + else if (($action === Editor::ACTION_CREATE || $action === Editor::ACTION_EDIT ) && $this->_write === true ) { + /* Create or edit row */ + // Pre events so they can occur before the validation + foreach ($data['data'] as $idSrc => &$values) { + $cancel = null; + + if ( $action === Editor::ACTION_CREATE ) { + $cancel = $this->_trigger( 'preCreate', $values ); + } + else { + $id = str_replace( $this->_idPrefix, '', $idSrc ); + $cancel = $this->_trigger( 'preEdit', $id, $values ); + } + + // One of the event handlers returned false - don't continue + if ( $cancel === false ) { + // Remove the data from the data set so it won't be processed + unset( $data['data'][$idSrc] ); + + // Tell the client-side we aren't updating this row + $this->_out['cancelled'][] = $idSrc; + } + } + + // Validation + $valid = $this->validate( $this->_out['fieldErrors'], $data ); + + if ( $valid ) { + foreach ($data['data'] as $id => &$values) { + $d = $action === Editor::ACTION_CREATE ? + $this->_insert( $values ) : + $this->_update( $id, $values ); + + if ( $d !== null ) { + $this->_out['data'][] = $d; + } + } + + $this->_fileClean(); + } + } + } + + if ( $this->_transaction ) { + $this->_db->commit(); + } + + // Tidy up the reply + if ( count( $this->_out['fieldErrors'] ) === 0 ) { + unset( $this->_out['fieldErrors'] ); + } + + if ( $this->_out['error'] === '' ) { + unset( $this->_out['error'] ); + } + + if ( count( $this->_out['ipOpts'] ) === 0 ) { + unset( $this->_out['ipOpts'] ); + } + + if ( count( $this->_out['cancelled'] ) === 0 ) { + unset( $this->_out['cancelled'] ); + } + } + + + /** + * Get an array of objects from the database to be given to DataTables as a + * result of an sAjaxSource request, such that DataTables can display the information + * from the DB in the table. + * + * @param integer|string $id Primary key value to get an individual row + * (after create or update operations). Gets the full set if not given. + * If a compound key is being used, this should be the string + * representation of it (i.e. joined together) rather than an array form. + * @param array $http HTTP parameters from GET or POST request (so we can service + * server-side processing requests from DataTables). + * @return array DataTables get information + * @throws \Exception Error on SQL execution + * @private + */ + private function _get( $id=null, $http=null ) + { + $cancel = $this->_trigger( 'preGet', $id ); + if ( $cancel === false ) { + return array(); + } + + // print_r($id); + // print_r($http); + + $query = $this->_db + ->query('select') + ->table( $this->_read_table() ) + ->get( $this->_pkey ); + + // Add all fields that we need to get from the database + foreach ($this->_fields as $field) { + // Don't reselect a pkey column if it was already added + if ( in_array( $field->dbField(), $this->_pkey ) ) { + continue; + } + + if ( $field->apply('get') && $field->getValue() === null ) { + $query->get( $field->dbField() ); + } + } + + $this->_get_where( $query ); + $query->left_join($this->_leftJoin); + $ssp = $this->_ssp_query( $query, $http ); + + if ( $id !== null ) { + $query->where( $this->pkeyToArray( $id, true ) ); + } + + $res = $query->exec(); + if ( ! $res ) { + throw new \Exception('Error executing SQL for data get. Enable SQL debug using `->debug(true)`'); + } + + $out = array(); + while ( $row=$res->fetch() ) { + $inner = array(); + $inner['DT_RowId'] = $this->_idPrefix . $this->pkeyToValue( $row, true ); + + foreach ($this->_fields as $field) { + if ( $field->apply('get') ) { + $field->write( $inner, $row ); + } + } + + $out[] = $inner; + } + + // Field options + $options = array(); + $spOptions = array(); + $sbOptions = array(); + $searchPanes = array(); + + if ( $id === null ) { + foreach ($this->_fields as $field) { + $opts = $field->optionsExec( $this->_db ); + + if ( $opts !== false ) { + $options[ $field->name() ] = $opts; + } + + // SearchPanes options + $spOpts = $field->searchPaneOptionsExec( $field, $this, $http, $this->_fields, $this->_leftJoin); + + if ( $spOpts !== false ) { + $spOptions[ $field->name() ] = $spOpts; + } + + $sbOpts = $field->searchBuilderOptionsExec($field, $this, $http, $this->_fields, $this->_leftJoin); + + if ( $sbOpts !== false) { + $sbOptions[ $field->name() ] = $sbOpts; + } + } + } + + $searchPanes[ 'options' ] = $spOptions; + $searchBuilder[ 'options' ] = $sbOptions; + + // Row based "joins" + for ( $i=0 ; $i_join) ; $i++ ) { + $this->_join[$i]->data( $this, $out, $options ); + } + + $this->_trigger( 'postGet', $out, $id ); + + if (count($searchPanes['options']) > 0 && count($searchBuilder['options']) > 0) { + return array_merge( + array( + 'data' => $out, + 'options' => $options, + 'files' => $this->_fileData( null, null, $out ), + 'searchBuilder' => $searchBuilder, + 'searchPanes' => $searchPanes + ), + $ssp + ); + } + else if (count($searchBuilder['options']) > 0) { + return array_merge( + array( + 'data' => $out, + 'options' => $options, + 'files' => $this->_fileData( null, null, $out ), + 'searchBuilder' => $searchBuilder + ), + $ssp + ); + } + else if (count($searchPanes['options']) > 0) { + return array_merge( + array( + 'data' => $out, + 'options' => $options, + 'files' => $this->_fileData( null, null, $out ), + 'searchPanes' => $searchPanes + ), + $ssp + ); + } + else { + return array_merge( + array( + 'data' => $out, + 'options' => $options, + 'files' => $this->_fileData( null, null, $out ) + ), + $ssp + ); + } + + } + + + /** + * Insert a new row in the database + * @private + */ + private function _insert( $values ) + { + // Get values to generate the id, including from setValue, not just the + // submitted values + $all = array(); + foreach ($this->_fields as $field) { + if ($field->apply('set', $values)) { + $this->_writeProp($all, $field->name(), $field->val( 'set', $values )); + } + } + + // Only allow a composite insert if the values for the key are + // submitted. This is required because there is no reliable way in MySQL + // to return the newly inserted row, so we can't know any newly + // generated values. + $this->_pkey_validate_insert( $all ); + + $this->_trigger( 'validatedCreate', $values ); + + // Insert the new row + $id = $this->_insert_or_update( null, $values ); + + if ( $id === null ) { + return null; + } + + // Was the primary key altered as part of the edit, if so use the + // submitted values + $id = count( $this->_pkey ) > 1 ? + $this->pkeyToValue( $all ) : + $this->_pkey_submit_merge( $id, $all ); + + // Join tables + for ( $i=0 ; $i_join) ; $i++ ) { + $this->_join[$i]->create( $this, $id, $values ); + } + + $this->_trigger( 'writeCreate', $id, $values ); + + // Full data set for the created row + $row = $this->_get( $id ); + $row = count( $row['data'] ) > 0 ? + $row['data'][0] : + null; + + $this->_trigger( 'postCreate', $id, $values, $row ); + + return $row; + } + + + /** + * Update a row in the database + * @param string $id The DOM ID for the row that is being edited. + * @return array Row's data + * @private + */ + private function _update( $id, $values ) + { + $id = str_replace( $this->_idPrefix, '', $id ); + + $this->_trigger( 'validatedEdit', $id, $values ); + + // Update or insert the rows for the parent table and the left joined + // tables + $this->_insert_or_update( $id, $values ); + + // And the join tables + for ( $i=0 ; $i_join) ; $i++ ) { + $this->_join[$i]->update( $this, $id, $values ); + } + + // Was the primary key altered as part of the edit, if so use the + // submitted values + $getId = $this->_pkey_submit_merge( $id, $values ); + + $this->_trigger( 'writeEdit', $id, $values ); + + // Full data set for the modified row + $row = $this->_get( $getId ); + $row = count( $row['data'] ) > 0 ? + $row['data'][0] : + null; + + $this->_trigger( 'postEdit', $id, $values, $row ); + + return $row; + } + + + /** + * Delete one or more rows from the database + * @private + */ + private function _remove( $data ) + { + $ids = array(); + + // Get the ids to delete from the data source + foreach ($data['data'] as $idSrc => $rowData) { + // Strip the ID prefix that the client-side sends back + $id = str_replace( $this->_idPrefix, "", $idSrc ); + + $res = $this->_trigger( 'preRemove', $id, $rowData ); + + // Allow the event to be cancelled and inform the client-side + if ( $res === false ) { + $this->_out['cancelled'][] = $idSrc; + } + else { + $ids[] = $id; + } + } + + if ( count( $ids ) === 0 ) { + return; + } + + // Row based joins - remove first as the host row will be removed which + // is a dependency + for ( $i=0 ; $i_join) ; $i++ ) { + $this->_join[$i]->remove( $this, $ids ); + } + + // Remove from the left join tables + if ( $this->_leftJoinRemove ) { + for ( $i=0, $ien=count($this->_leftJoin) ; $i<$ien ; $i++ ) { + $join = $this->_leftJoin[$i]; + $table = $this->_alias( $join['table'], 'orig' ); + + // which side of the join refers to the parent table? + if ( strpos( $join['field1'], $join['table'] ) === 0 ) { + $parentLink = $join['field2']; + $childLink = $join['field1']; + } + else { + $parentLink = $join['field1']; + $childLink = $join['field2']; + } + + // Only delete on the primary key, since that is what the ids refer + // to - otherwise we'd be deleting random data! Note that this + // won't work with compound keys since the parent link would be + // over multiple fields. + if ( $parentLink === $this->_pkey[0] && count($this->_pkey) === 1 ) { + $this->_remove_table( $join['table'], $ids, array($childLink) ); + } + } + } + + // Remove from the primary tables + for ( $i=0, $ien=count($this->_table) ; $i<$ien ; $i++ ) { + $this->_remove_table( $this->_table[$i], $ids ); + } + + foreach ($data['data'] as $idSrc => $rowData) { + $id = str_replace( $this->_idPrefix, "", $idSrc ); + + $this->_trigger( 'postRemove', $id, $rowData ); + } + } + + + /** + * File upload + * @param array $data Upload data + * @throws \Exception File upload name error + * @private + */ + private function _upload( $data ) + { + // Search for upload field in local fields + $field = $this->_find_field( $data['uploadField'], 'name' ); + $fieldName = ''; + + if ( ! $field ) { + // Perhaps it is in a join instance + for ( $i=0 ; $i_join) ; $i++ ) { + $join = $this->_join[$i]; + $fields = $join->fields(); + + for ( $j=0, $jen=count($fields) ; $j<$jen ; $j++ ) { + $joinField = $fields[ $j ]; + $name = $join->name().'[].'.$joinField->name(); + + if ( $name === $data['uploadField'] ) { + $field = $joinField; + $fieldName = $name; + } + } + } + } + else { + $fieldName = $field->name(); + } + + if ( ! $field ) { + throw new \Exception("Unknown upload field name submitted"); + } + + $res = $this->_trigger( 'preUpload', $data ); + + // Allow the event to be cancelled and inform the client-side + if ( $res === false ) { + return; + } + + $upload = $field->upload(); + if ( ! $upload ) { + throw new \Exception("File uploaded to a field that does not have upload options configured"); + } + + $res = $upload->exec( $this ); + + if ( $res === false ) { + $this->_out['fieldErrors'][] = array( + "name" => $fieldName, // field name can be just the field's + "status" => $upload->error() // name or a join combination + ); + } + else { + $files = $this->_fileData( $upload->table(), array($res) ); + + $this->_out['files'] = $files; + $this->_out['upload']['id'] = $res; + + $this->_trigger( 'postUpload', $res, $files, $data ); + } + } + + + /** + * Get information about the files that are detailed in the database for + * the fields which have an upload method defined on them. + * + * @param string [$limitTable=null] Limit the data gathering to a single + * table only + * @param number[] [$id=null] Limit to a specific set of ids + * @return array File information + * @private + */ + private function _fileData ( $limitTable=null, $ids=null, $data=null ) + { + $files = array(); + + // The fields in this instance + $this->_fileDataFields( $files, $this->_fields, $limitTable, $ids, $data ); + + // From joined tables + for ( $i=0 ; $i_join) ; $i++ ) { + $joinData = null; + + // If we have data from the get, it is nested from the join, so we need to + // un-nest it (i.e. get the array of joined data for each row) + if ( $data ) { + $joinData = array(); + + for ( $j=0, $jen=count($data) ; $j<$jen ; $j++ ) { + $joinData = array_merge( $joinData, $data[$j][$this->_join[$i]->name()] ); + } + } + + $this->_fileDataFields( $files, $this->_join[$i]->fields(), $limitTable, $ids, $joinData ); + } + + return $files; + } + + + /** + * Common file get method for any array of fields + * @param array &$files File output array + * @param Field[] $fields Fields to get file information about + * @param string[] $limitTable Limit the data gathering to a single table + * only + * @private + */ + private function _fileDataFields ( &$files, $fields, $limitTable, $idsIn=null, $data=null ) + { + foreach ($fields as $field) { + $upload = $field->upload(); + + if ( $upload ) { + $table = $upload->table(); + + if ( ! $table ) { + continue; + } + + if ( $limitTable !== null && $table !== $limitTable ) { + continue; + } + + // Make a collection of the ids used in this data set to get a limited data set + // in return (security and performance) + $ids = $idsIn; + + if ( $ids === null ) { + $ids = array(); + } + + if ( $data !== null ) { + for ( $i=0, $ien=count($data); $i<$ien ; $i++ ) { + $val = $field->val( 'set', $data[$i] ); + + if ( $val && ! in_array($val, $ids) ) { + $ids[] = $val; + } + } + + if ( count($ids) === 0 ) { + // If no data to fetch for this field, so don't bother + continue; + } + else if ( count($ids) > 1000 ) { + // Don't use `where_in` for really large data sets + $ids = array(); + } + } + + $fileData = $upload->data( $this->_db, $ids ); + + if ( $fileData !== null ) { + if ( isset($files[$table]) ) { + $files[$table] = $files[$table] + $fileData; + } + else { + $files[$table] = $fileData; + } + } + } + } + } + + /** + * Run the file clean up + * + * @private + */ + private function _fileClean () + { + foreach ( $this->_fields as $field ) { + $upload = $field->upload(); + + if ( $upload ) { + $upload->dbCleanExec( $this, $field ); + } + } + + for ( $i=0 ; $i_join) ; $i++ ) { + foreach ( $this->_join[$i]->fields() as $field ) { + $upload = $field->upload(); + + if ( $upload ) { + $upload->dbCleanExec( $this, $field ); + } + } + } + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * + * Server-side processing methods + */ + + /** + * When server-side processing is being used, modify the query with // the + * required extra conditions + * + * @param \DataTables\Database\Query $query Query instance to apply the SSP commands to + * @param array $http Parameters from HTTP request + * @return array Server-side processing information array + * @private + */ + private function _ssp_query ( $query, $http ) + { + if ( ! isset( $http['draw'] ) ) { + return array(); + } + + // Add the server-side processing conditions + $this->_ssp_limit( $query, $http ); + $this->_ssp_sort( $query, $http ); + $this->_ssp_filter( $query, $http ); + + // Get the number of rows in the result set + $ssp_set_count = $this->_db + ->query('count') + ->table( $this->_read_table() ) + ->get( $this->_pkey[0] ); + $this->_get_where( $ssp_set_count ); + $this->_ssp_filter( $ssp_set_count, $http ); + $ssp_set_count->left_join($this->_leftJoin); + $ssp_set_count = $ssp_set_count->exec()->fetch(); + + // Get the number of rows in the full set + $ssp_full_count = $this->_db + ->query('count') + ->table( $this->_read_table() ) + ->get( $this->_pkey[0] ); + $this->_get_where( $ssp_full_count ); + if ( count( $this->_where ) ) { // only needed if there is a where condition + $ssp_full_count->left_join($this->_leftJoin); + } + $ssp_full_count = $ssp_full_count->exec()->fetch(); + + return array( + "draw" => intval( $http['draw'] ), + "recordsTotal" => $ssp_full_count['cnt'], + "recordsFiltered" => $ssp_set_count['cnt'] + ); + } + + + /** + * Convert a column index to a database field name - used for server-side + * processing requests. + * @param array $http HTTP variables (i.e. GET or POST) + * @param int $index Index in the DataTables' submitted data + * @returns string DB field name + * @throws \Exception Unknown fields + * @private Note that it is actually public for PHP 5.3 - thread 39810 + */ + public function _ssp_field( $http, $index ) + { + $name = $http['columns'][$index]['data']; + $field = $this->_find_field( $name, 'name' ); + + if ( ! $field ) { + // Is it the primary key? + if ( $name === 'DT_RowId' ) { + return $this->_pkey[0]; + } + + throw new \Exception('Unknown field: '.$name .' (index '.$index.')'); + } + + return $field->dbField(); + } + + + /** + * Sorting requirements to a server-side processing query. + * @param \DataTables\Database\Query $query Query instance to apply sorting to + * @param array $http HTTP variables (i.e. GET or POST) + * @private + */ + private function _ssp_sort ( $query, $http ) + { + if ( isset( $http['order'] ) ) { + for ( $i=0 ; $iorder( + $this->_ssp_field( $http, $order['column'] ) .' '. + ($order['dir']==='asc' ? 'asc' : 'desc') + ); + } + } + } + + private function _constructSearchBuilderConditions($query, $data) { + $first = true; + + if(!isset($data['criteria'])) { + return; + } + // Iterate over every group or criteria in the current group + foreach($data['criteria'] as $crit) { + // If criteria is defined then this must be a group + if(isset($crit['criteria'])) { + // Check if this is the first, or if it is and logic + if($data['logic'] === 'AND' || $first) { + // Call the function for the next group + $query->where_group(function($q) use ($crit) { + $this->_constructSearchBuilderConditions($q, $crit); + }); + // Set first to false so that in future only the logic is checked + $first = false; + } + else { + $query->where_group(function ($q) use ($crit) { + $this->_constructSearchBuilderConditions($q, $crit); + }, 'OR'); + } + } + else if (isset($crit['condition']) && (isset($crit['value1']) || $crit['condition'] === 'null' || $crit['condition'] === '!null')) { + // Sometimes the structure of the object that is passed across is named in a strange way. + // This conditional assignment solves that issue + $val1 = isset($crit['value1']) ? $crit['value1'] : ''; + $val2 = isset($crit['value2']) ? $crit['value2'] : ''; + + if(strlen($val1) === 0 && $crit['condition'] !== 'null' && $crit['condition'] !== '!null') { + continue; + } + if(strlen($val2) === 0 && ($crit['condition'] === 'between' || $crit['condition'] === '!between')) { + continue; + } + + // Switch on the condition that has been passed in + switch($crit['condition']) { + case '=': + // Check if this is the first, or if it is and logic + if($data['logic'] === 'AND' || $first) { + // Call the where function for this condition + $query->where($crit['origData'], $val1, '='); + // Set first to false so that in future only the logic is checked + $first = false; + } + else { + // Call the or_where function - has to be or logic in this block + $query->or_where($crit['origData'], $val1, '='); + } + break; + case '!=': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], $val1, '<>'); + $first = false; + } + else { + $query->or_where($crit['origData'], $val1, '<>'); + } + break; + case 'contains': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], '%'.$val1.'%', 'LIKE'); + $first = false; + } + else { + $query->or_where($crit['origData'], '%'.$val1.'%', 'LIKE'); + } + break; + case '!contains': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], '%'.$val1.'%', 'NOT LIKE'); + $first = false; + } + else { + $query->or_where($crit['origData'], '%'.$val1.'%', 'NOT LIKE'); + } + break; + case 'starts': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], $val1.'%', 'LIKE'); + $first = false; + } + else { + $query->or_where($crit['origData'], $val1.'%', 'LIKE'); + } + break; + case '!starts': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], $val1.'%', 'NOT LIKE'); + $first = false; + } + else { + $query->or_where($crit['origData'], $val1.'%', 'NOT LIKE'); + } + break; + case 'ends': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], '%'.$val1, 'LIKE'); + $first = false; + } + else { + $query->or_where($crit['origData'], '%'.$val1, 'LIKE'); + } + break; + case '!ends': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], '%'.$val1, 'NOT LIKE'); + $first = false; + } + else { + $query->or_where($crit['origData'], '%'.$val1, 'NOT LIKE'); + } + break; + case '<': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], $val1, '<'); + $first = false; + } + else { + $query->or_where($crit['origData'], $val1, '<'); + } + break; + case '<=': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], $val1, '<='); + $first = false; + } + else { + $query->or_where($crit['origData'], $val1, '<='); + } + break; + case '>=': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], $val1, '>='); + $first = false; + } + else { + $query->or_where($crit['origData'], $val1, '>='); + } + break; + case '>': + if($data['logic'] === 'AND' || $first) { + $query->where($crit['origData'], $val1, '>'); + $first = false; + } + else { + $query->or_where($crit['origData'], $val1, '>'); + } + break; + case 'between': + if($data['logic'] === 'AND' || $first) { + $query->where_group(function($q) use ($crit, $val1, $val2) { + $q->where($crit['origData'], is_numeric($val1) ? intval($val1) : $val1, '>')->where($crit['origData'], is_numeric($val2) ? intval($val2) : $val2, '<'); + }); + $first = false; + } + else { + $query->or_where($crit['origData'], is_numeric($val1) ? intval($val1) : $val1, '>')->where($crit['origData'], is_numeric($val2) ? intval($val2) : $val2, '<'); + } + break; + case '!between': + if($data['logic'] === 'AND' || $first) { + $query->where_group(function($q) use ($crit, $val1, $val2) { + $q->where($crit['origData'], is_numeric($val1) ? intval($val1) : $val1, '<')->or_where($crit['origData'], is_numeric($val2) ? intval($val2) : $val2, '>'); + }); + $first = false; + } + else { + $query->or_where($crit['origData'], is_numeric($val1) ? intval($val1) : $val1, '<')->or_where($crit['origData'], is_numeric($val2) ? intval($val2) : $val2, '>'); + } + break; + case 'null': + if($data['logic'] === 'AND' || $first) { + $query->where_group(function ($q) use ($crit) { + $q->where($crit['origData'], null, "="); + if (strpos($crit['type'], 'date') === false && strpos($crit['type'], 'moment') === false && strpos($crit['type'], 'luxon') === false) { + $q->or_where($crit['origData'], "", "="); + } + }); + $first = false; + } + else { + $query->where_group(function ($q) use ($crit) { + $q->where($crit['origData'], null, "="); + if (strpos($crit['type'], 'date') === false && strpos($crit['type'], 'moment') === false && strpos($crit['type'], 'luxon') === false) { + $q->or_where($crit['origData'], "", "="); + } + }, 'OR'); + } + break; + case '!null': + if($data['logic'] === 'AND' || $first) { + $query->where_group(function ($q) use ($crit) { + $q->where($crit['origData'], null, "!="); + if (strpos($crit['type'], 'date') === false && strpos($crit['type'], 'moment') === false && strpos($crit['type'], 'luxon') === false) { + $q->where($crit['origData'], "", "!="); + } + }); + $first = false; + } + else { + $query->where_group(function ($q) use ($crit) { + $q->where($crit['origData'], null, "!="); + if (strpos($crit['type'], 'date') === false && strpos($crit['type'], 'moment') === false && strpos($crit['type'], 'luxon') === false) { + $q->where($crit['origData'], "", "!="); + } + }, 'OR'); + + } + break; + default: + break; + } + } + } + return $query; + } + + + /** + * Add DataTables' 'where' condition to a server-side processing query. This + * works for both global and individual column filtering. + * @param \DataTables\Database\Query $query Query instance to apply the WHERE conditions to + * @param array $http HTTP variables (i.e. GET or POST) + * @private + */ + private function _ssp_filter ( $query, $http ) + { + $that = $this; + + // Global filter + $fields = $this->_fields; + + // Global search, add a ( ... or ... ) set of filters for each column + // in the table (not the fields, just the columns submitted) + if ( $http['search']['value'] ) { + $query->where( function ($q) use (&$that, &$fields, $http) { + for ( $i=0 ; $i_ssp_field( $http, $i ); + + if ( $fieldName ) { + $q->or_where( $fieldName, '%'.$http['search']['value'].'%', 'like' ); + } + } + } + } ); + } + + /* + foreach ($this->_fields as $field) { + // Don't reselect a pkey column if it was already added + if ( in_array( $field->dbField(), $this->_pkey ) ) { + continue; + } + + if ( $field->apply('get') && $field->getValue() === null ) { + $query->get( $field->dbField() ); + } + } + */ + + if( isset($http['searchPanes']) ) { + // Set the database from editor + $db = $this->_db; + // For every selection in every column + foreach ($this->_fields as $field) { + if( isset($http['searchPanes'][$field->name()])){ + for($i = 0; $i < count($http['searchPanes'][$field->name()]); $i++) { + // Check the number of rows... + $q = $db + ->query('select') + ->table($this->_table) + ->get('COUNT(*) as cnt'); + + $q->left_join($this->_leftJoin); + + // ... where the selected option is present... + $r = $q + ->where($field->dbField(), $http['searchPanes'][$field->name()][$i], '=') + ->exec() + ->fetchAll(); + + // ... If there are none then don't bother with this selection + if($r[0]['cnt'] == 0) { + array_splice($http['searchPanes'][$field->name()], $i, 1); + $i--; + } + } + + $query->where( function ($q) use ($field, $http) { + + for($j=0 ; $jname()]) ; $j++){ + $q->or_where( + $field->dbField(), + isset($http['searchPanes_null'][$field->name()][$j]) + ? null + : $http['searchPanes'][$field->name()][$j], + '=' + ); + } + }); + } + } + } + + if(isset($http['searchBuilder']) && $http['searchBuilder'] !== 'false') { + $query->where_group(function($q) use ($http) { + $this->_constructSearchBuilderConditions($q, $http['searchBuilder']); + }); + } + + // if ( $http['search']['value'] ) { + // $words = explode(" ", $http['search']['value']); + + // $query->where( function ($q) use (&$that, &$fields, $http, $words) { + // for ( $j=0, $jen=count($words) ; $j<$jen ; $j++ ) { + // if ( $words[$j] ) { + // $q->where_group( true ); + + // for ( $i=0, $ien=count($http['columns']) ; $i<$ien ; $i++ ) { + // if ( $http['columns'][$i]['searchable'] == 'true' ) { + // $field = $that->_ssp_field( $http, $i ); + + // $q->or_where( $field, $words[$j].'%', 'like' ); + // $q->or_where( $field, '% '.$words[$j].'%', 'like' ); + // } + // } + + // $q->where_group( false ); + // } + // } + // } ); + // } + + // Column filters + for ( $i=0, $ien=count($http['columns']) ; $i<$ien ; $i++ ) { + $column = $http['columns'][$i]; + $search = $column['search']['value']; + + if ( $search !== '' && $column['searchable'] == 'true' ) { + $query->where( $this->_ssp_field( $http, $i ), '%'.$search.'%', 'like' ); + } + } + + + } + + + /** + * Add a limit / offset to a server-side processing query + * @param \DataTables\Database\Query $query Query instance to apply the offset / limit to + * @param array $http HTTP variables (i.e. GET or POST) + * @private + */ + private function _ssp_limit ( $query, $http ) + { + if ( $http['length'] != -1 ) { // -1 is 'show all' in DataTables + $query + ->offset( $http['start'] ) + ->limit( $http['length'] ); + } + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * + * Internal helper methods + */ + + /** + * Add local WHERE condition to query + * @param \DataTables\Database\Query $query Query instance to apply the WHERE conditions to + * @private + */ + private function _get_where ( $query ) + { + for ( $i=0 ; $i_where) ; $i++ ) { + if ( is_callable( $this->_where[$i] ) ) { + $this->_where[$i]( $query ); + } + else { + $query->where( + $this->_where[$i]['key'], + $this->_where[$i]['value'], + $this->_where[$i]['op'] + ); + } + } + } + + + /** + * Get a field instance from a known field name + * + * @param string $name Field name + * @param string $type Matching name type + * @return Field Field instance + * @private + */ + private function _find_field ( $name, $type ) + { + for ( $i=0, $ien=count($this->_fields) ; $i<$ien ; $i++ ) { + $field = $this->_fields[ $i ]; + + if ( $type === 'name' && $field->name() === $name ) { + return $field; + } + else if ( $type === 'db' && $field->dbField() === $name ) { + return $field; + } + } + + return null; + } + + + /** + * Insert or update a row for all main tables and left joined tables. + * + * @param int|string $id ID to use to condition the update. If null is + * given, the first query performed is an insert and the inserted id + * used as the value should there be any subsequent tables to operate + * on. Mote that for compound keys, this should be the "joined" value + * (i.e. a single string rather than an array). + * @return \DataTables\Database\Result Result from the query or null if no + * query performed. + * @private + */ + private function _insert_or_update ( $id, $values ) + { + // Loop over all tables in _table, doing the insert or update as needed + for ( $i=0, $ien=count( $this->_table ) ; $i<$ien ; $i++ ) { + $res = $this->_insert_or_update_table( + $this->_table[$i], + $values, + $id !== null ? + $this->pkeyToArray( $id, true ) : + null + ); + + // If we don't have an id yet, then the first insert will return + // the id we want + if ( $res !== null && $id === null ) { + $id = $res->insertId(); + } + } + + // And for the left join tables as well + for ( $i=0, $ien=count( $this->_leftJoin ) ; $i<$ien ; $i++ ) { + $join = $this->_leftJoin[$i]; + + // which side of the join refers to the parent table? + $joinTable = $this->_alias( $join['table'], 'alias' ); + $tablePart = $this->_part( $join['field1'] ); + + if ( $this->_part( $join['field1'], 'db' ) ) { + $tablePart = $this->_part( $join['field1'], 'db' ).'.'.$tablePart; + } + + if ( $tablePart === $joinTable ) { + $parentLink = $join['field2']; + $childLink = $join['field1']; + } + else { + $parentLink = $join['field1']; + $childLink = $join['field2']; + } + + if ( $parentLink === $this->_pkey[0] && count($this->_pkey) === 1 ) { + $whereVal = $id; + } + else { + // We need submitted information about the joined data to be + // submitted as well as the new value. We first check if the + // host field was submitted + $field = $this->_find_field( $parentLink, 'db' ); + + if ( ! $field || ! $field->apply( 'set', $values ) ) { + // If not, then check if the child id was submitted + $field = $this->_find_field( $childLink, 'db' ); + + // No data available, so we can't do anything + if ( ! $field || ! $field->apply( 'set', $values ) ) { + continue; + } + } + + $whereVal = $field->val('set', $values); + } + + $whereName = $this->_part( $childLink, 'field' ); + + $this->_insert_or_update_table( + $join['table'], + $values, + array( $whereName => $whereVal ) + ); + } + + return $id; + } + + + /** + * Insert or update a row in a single database table, based on the data + * given and the fields configured for the instance. + * + * The function will find the fields which are required for this specific + * table, based on the names of fields and use only the appropriate data for + * this table. Therefore the full submitted data set can be passed in. + * + * @param string $table Database table name to use (can include an alias) + * @param array $where Update condition + * @return \DataTables\Database\Result Result from the query or null if no query + * performed. + * @throws \Exception Where set error + * @private + */ + private function _insert_or_update_table ( $table, $values, $where=null ) + { + $set = array(); + $action = ($where === null) ? 'create' : 'edit'; + $tableAlias = $this->_alias( $table, 'alias' ); + + for ( $i=0 ; $i_fields) ; $i++ ) { + $field = $this->_fields[$i]; + $tablePart = $this->_part( $field->dbField() ); + + if ( $this->_part( $field->dbField(), 'db' ) ) { + $tablePart = $this->_part( $field->dbField(), 'db' ).'.'.$tablePart; + } + + // Does this field apply to this table (only check when a join is + // being used) + if ( count($this->_leftJoin) && $tablePart !== $tableAlias ) { + continue; + } + + // Check if this field should be set, based on options and + // submitted data + if ( ! $field->apply( $action, $values ) ) { + continue; + } + + // Some db's (specifically postgres) don't like having the table + // name prefixing the column name. Todo: it might be nicer to have + // the db layer abstract this out? + $fieldPart = $this->_part( $field->dbField(), 'field' ); + $set[ $fieldPart ] = $field->val( 'set', $values ); + } + + // Add where fields if setting where values and required for this + // table + // Note that `whereSet` is now deprecated + if ( $this->_whereSet ) { + for ( $j=0, $jen=count($this->_where) ; $j<$jen ; $j++ ) { + $cond = $this->_where[$j]; + + if ( ! is_callable( $cond ) ) { + // Make sure the value wasn't in the submitted data set, + // otherwise we would be overwriting it + if ( ! isset( $set[ $cond['key'] ] ) ) + { + $whereTablePart = $this->_part( $cond['key'], 'table' ); + + // No table part on the where condition to match against + // or table operating on matches table part from cond. + if ( ! $whereTablePart || $tableAlias == $whereTablePart ) { + $set[ $cond['key'] ] = $cond['value']; + } + } + else { + throw new \Exception( 'Where condition used as a setter, '. + 'but value submitted for field: '.$cond['key'] + ); + } + } + } + } + + // If nothing to do, then do nothing! + if ( ! count( $set ) ) { + return null; + } + + // Use pkey only for the host table + $pkey = in_array( $table, $this->_table ) !== false ? + $this->_pkey : + ''; + + // Insert or update + if ( $action === 'create' ) { + return $this->_db->insert( $table, $set, $pkey ); + } + else { + return $this->_db->push( $table, $set, $where, $pkey ); + } + } + + + /** + * Delete one or more rows from the database for an individual table + * + * @param string $table Database table name to use + * @param array $ids Array of ids to remove + * @param string $pkey Database column name to match the ids on for the + * delete condition. If not given the instance's base primary key is + * used. + * @private + */ + private function _remove_table ( $table, $ids, $pkey=null ) + { + if ( $pkey === null ) { + $pkey = $this->_pkey; + } + + $tableAlias = $this->_alias($table, 'alias'); + $tableOrig = $this->_alias($table, 'orig'); + + // If using an alias we need to replace the alias'ed table name in our pkey + // with the real table name + for ($i=0 ; $i 1 && $a[0] === $tableAlias) { + $a[0] = $tableOrig; + $pkey[$i] = implode('.', $a); + } + } + + // Check there is a field which has a set option for this table + $count = 0; + + foreach ($this->_fields as $field) { + $fieldName = $field->dbField(); + $fieldDots = substr_count( $fieldName, '.' ); + + if ( $fieldDots === 0 ) { + $count++; + } + else if ( $fieldDots === 1 ) { + if ( + $field->set() !== Field::SET_NONE && + $this->_part( $fieldName, 'table' ) === $tableAlias + ) { + $count++; + } + } + else { + // db link + // note that if the table name for the constructor uses a db part, we need to also have + // the fields using the db name as Editor doesn't do any conflict resolution. + $dbTable = $this->_part( $fieldName, 'db' ) .'.'. $this->_part( $fieldName, 'table' ); + + if ( $field->set() !== Field::SET_NONE && $dbTable === $table ) { + $count++; + } + } + } + + if ( $count > 0 ) { + $q = $this->_db + ->query( 'delete' ) + ->table( $tableOrig ); + + for ( $i=0, $ien=count($ids) ; $i<$ien ; $i++ ) { + $cond = $this->pkeyToArray( $ids[$i], true, $pkey ); + + $q->or_where( function ($q2) use ($cond) { + $q2->where( $cond ); + } ); + } + + $q->exec(); + } + } + + + /** + * Check the validity of the set options if we are doing a join, since + * there are some conditions for this state. Will throw an error if not + * valid. + * + * @private + */ + private function _prepJoin () + { + if ( count( $this->_leftJoin ) === 0 ) { + return; + } + + // Check if the primary key has a table identifier - if not - add one + for ( $i=0, $ien=count($this->_pkey) ; $i<$ien ; $i++ ) { + $val = $this->_pkey[$i]; + + if ( strpos( $val, '.' ) === false ) { + $this->_pkey[$i] = $this->_alias( $this->_table[0], 'alias' ).'.'.$val; + } + } + + // Check that all fields have a table selector, otherwise, we'd need to + // know the structure of the tables, to know which fields belong in + // which. This extra requirement on the fields removes that + for ( $i=0, $ien=count($this->_fields) ; $i<$ien ; $i++ ) { + $field = $this->_fields[$i]; + $name = $field->dbField(); + + if ( strpos( $name, '.' ) === false ) { + throw new \Exception( 'Table part of the field "'.$name.'" was not found. '. + 'In Editor instances that use a join, all fields must have the '. + 'database table set explicitly.' + ); + } + } + } + + + /** + * Get one side or the other of an aliased SQL field name. + * + * @param string $name SQL field + * @param string $type Which part to get: `alias` (default) or `orig`. + * @returns string Alias + * @private + */ + private function _alias ( $name, $type='alias' ) + { + if ( stripos( $name, ' as ' ) !== false ) { + $a = preg_split( '/ as /i', $name ); + return $type === 'alias' ? + $a[1] : + $a[0]; + } + + if ( stripos( $name, ' ' ) !== false ) { + $a = preg_split( '/ /i', $name ); + return $type === 'alias' ? + $a[1] : + $a[0]; + } + + return $name; + } + + + /** + * Get part of an SQL field definition regardless of how deeply defined it + * is + * + * @param string $name SQL field + * @param string $type Which part to get: `table` (default) or `db` or + * `column` + * @return string Part name + * @private + */ + private function _part ( $name, $type='table' ) + { + $db = null; + $table = null; + $column = null; + + if ( strpos( $name, '.' ) !== false ) { + $a = explode( '.', $name ); + + if ( count($a) === 3 ) { + $db = $a[0]; + $table = $a[1]; + $column = $a[2]; + } + else if ( count($a) === 2 ) { + $table = $a[0]; + $column = $a[1]; + } + } + else { + $column = $name; + } + + if ( $type === 'db' ) { + return $db; + } + else if ( $type === 'table' ) { + return $table; + } + return $column; + } + + + /** + * Trigger an event + * + * @private + */ + private function _trigger ( $eventName, &$arg1=null, &$arg2=null, &$arg3=null, &$arg4=null, &$arg5=null ) + { + $out = null; + $argc = func_num_args(); + $args = array( $this ); + + // Hack to enable pass by reference with a "variable" number of parameters + for ( $i=1 ; $i<$argc ; $i++ ) { + $name = 'arg'.$i; + $args[] = &$$name; + } + + if ( ! isset( $this->_events[ $eventName ] ) ) { + return; + } + + $events = $this->_events[ $eventName ]; + + for ( $i=0, $ien=count($events) ; $i<$ien ; $i++ ) { + $res = call_user_func_array( $events[$i], $args ); + + if ( $res !== null ) { + $out = $res; + } + } + + return $out; + } + + + /** + * Merge a primary key value with an updated data source. + * + * @param string $pkeyVal Old primary key value to merge into + * @param array $row Data source for update + * @return string Merged value + */ + private function _pkey_submit_merge ( $pkeyVal, $row ) + { + $pkey = $this->_pkey; + $arr = $this->pkeyToArray( $pkeyVal, true ); + + for ( $i=0, $ien=count($pkey) ; $i<$ien ; $i++ ) { + $column = $pkey[ $i ]; + $field = $this->_find_field( $column, 'db' ); + + if ( $field && $field->apply( 'edit', $row ) ) { + $arr[ $column ] = $field->val( 'set', $row ); + } + } + + return $this->pkeyToValue( $arr, true ); + } + + + /** + * Validate that all primary key fields have values for create. + * + * @param array $row Row's data + * @return boolean `true` if valid, `false` otherwise + */ + private function _pkey_validate_insert ( $row ) + { + $pkey = $this->_pkey; + + if ( count( $pkey ) === 1 ) { + return true; + } + + for ( $i=0, $ien=count($pkey) ; $i<$ien ; $i++ ) { + $column = $pkey[ $i ]; + $field = $this->_find_field( $column, 'db' ); + + if ( ! $field || ! $field->apply("create", $row) ) { + throw new \Exception( "When inserting into a compound key table, ". + "all fields that are part of the compound key must be ". + "submitted with a specific value.", 1 + ); + } + } + + return true; + } + + + /** + * Create the separator value for a compound primary key. + * + * @return string Calculated separator + */ + private function _pkey_separator () + { + $str = implode(',', $this->_pkey); + + return hash( 'crc32', $str ); + } + + private function _read_table () + { + return count($this->_readTableNames) ? + $this->_readTableNames : + $this->_table; + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Field.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Field.php.txt new file mode 100644 index 00000000..5a023f6d --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Field.php.txt @@ -0,0 +1,961 @@ +field()} and + * {@see Join->field()} methods to describe what fields should be interacted + * with by the editable table. + * + * @example + * Simply get a column with the name "city". No validation is performed. + * ```php + * Field::inst( 'city' ) + * ``` + * + * @example + * Get a column with the name "first_name" - when edited a value must + * be given due to the "required" validation from the {@see Validate} class. + * ```php + * Field::inst( 'first_name' )->validator( 'Validate::required' ) + * ``` + * + * @example + * Working with a date field, which is validated, and also has *get* and + * *set* formatters. + * ```php + * Field::inst( 'registered_date' ) + * ->validator( 'Validate::dateFormat', 'D, d M y' ) + * ->getFormatter( 'Format::date_sql_to_format', 'D, d M y' ) + * ->setFormatter( 'Format::date_format_to_sql', 'D, d M y' ) + * ``` + * + * @example + * Using an alias in the first parameter + * ```php + * Field::inst( 'name.first as first_name' ) + * ``` + */ +class Field extends DataTables\Ext { + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Statics + */ + + /** Set option flag (`set()`) - do not set data */ + const SET_NONE = 'none'; + + /** Set option flag (`set()`) - write to database on both create and edit */ + const SET_BOTH = 'both'; + + /** Set option flag (`set()`) - write to database only on create */ + const SET_CREATE = 'create'; + + /** Set option flag (`set()`) - write to database only on edit */ + const SET_EDIT = 'edit'; + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Constructor + */ + + /** + * Field instance constructor. + * @param string $dbField Name of the database column + * @param string $name Name to use in the JSON output from Editor and the + * HTTP submit from the client-side when editing. If not given then the + * $dbField name is used. + */ + function __construct( $dbField=null, $name=null ) + { + if ( $dbField !== null && $name === null ) { + // Allow just a single parameter to be passed - each can be + // overridden if needed later using the API. + $this->name( $dbField ); + $this->dbField( $dbField ); + } + else { + $this->name( $name ); + $this->dbField( $dbField ); + } + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private parameters + */ + + /** @var string */ + private $_dbField = null; + + /** @var boolean */ + private $_get = true; + + /** @var mixed */ + private $_getFormatter = null; + + /** @var mixed */ + private $_getFormatterOpts = null; + + /** @var mixed */ + private $_getValue = null; + + /** @var Options */ + private $_opts = null; + + /** @var SearchPaneOptions */ + private $_spopts = null; + + /** @var SearchBuilderOptions */ + private $_sbopts = null; + + /** @var callable */ + private $_optsFn = null; + + /** @var callable */ + private $_spoptsFn = null; + + /** @var callable */ + private $_sboptsFn = null; + + /** @var string */ + private $_name = null; + + /** @var string */ + private $_set = Field::SET_BOTH; + + /** @var mixed */ + private $_setFormatter = null; + + /** @var mixed */ + private $_setFormatterOpts = null; + + /** @var mixed */ + private $_setValue = null; + + /** @var mixed */ + private $_validator = array(); + + /** @var Upload */ + private $_upload = null; + + /** @var callable */ + private $_xss = null; + + /** @var boolean */ + private $_xssFormat = true; + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + + /** + * Get / set the DB field name. + * + * Note that when used as a setter, an alias can be given for the field + * using the SQL `as` keyword - for example: `firstName as name`. In this + * situation the dbField is set to the field name before the `as`, and the + * field's name (`name()`) is set to the name after the ` as `. + * + * As a result of this, the following constructs have identical + * functionality: + * + * Field::inst( 'firstName as name' ); + * Field::inst( 'firstName', 'name' ); + * + * @param string $_ Value to set if using as a setter. + * @return string|self The name of the db field if no parameter is given, + * or self if used as a setter. + */ + public function dbField ( $_=null ) + { + if ( $_ === null ) { + return $this->_dbField; + } + + // Don't split on an `as` inside paraenthesis + $a = preg_split( '/ as (?![^\(]*\))/i', $_ ); + if ( count($a) > 1 ) { + $this->_dbField = trim( $a[0] ); + $this->_name = trim( $a[1] ); + } + else { + $this->_dbField = $_; + } + + return $this; + } + + + /** + * Get / set the 'get' property of the field. + * + * A field can be marked as write only when setting the get property to false + * here. + * @param boolean $_ Value to set if using as a setter. + * @return boolean|self The get property if no parameter is given, or self + * if used as a setter. + */ + public function get ( $_=null ) + { + return $this->_getSet( $this->_get, $_ ); + } + + + /** + * Get formatter for the field's data. + * + * When the data has been retrieved from the server, it can be passed through + * a formatter here, which will manipulate (format) the data as required. This + * can be useful when, for example, working with dates and a particular format + * is required on the client-side. + * + * Editor has a number of formatters available with the {@see Format} class + * which can be used directly with this method. + * @param callable|string $_ Value to set if using as a setter. Can be given as + * a closure function or a string with a reference to a function that will + * be called with call_user_func(). + * @param mixed $opts Variable that is passed through to the get formatting + * function - can be useful for passing through extra information such as + * date formatting string, or a required flag. The actual options available + * depend upon the formatter used. + * @return callable|string|self The get formatter if no parameter is given, or + * self if used as a setter. + */ + public function getFormatter ( $_=null, $opts=null ) + { + if ( $opts !== null ) { + $this->_getFormatterOpts = $opts; + } + return $this->_getSet( $this->_getFormatter, $_ ); + } + + + /** + * Get / set a get value. If given, then this value is used to send to the + * client-side, regardless of what value is held by the database. + * + * @param callable|string|number $_ Value to set, or no value to use as a + * getter + * @return callable|string|self Value if used as a getter, or self if used + * as a setter. + */ + public function getValue ( $_=null ) + { + return $this->_getSet( $this->_getValue, $_ ); + } + + + /** + * Get / set the 'name' property of the field. + * + * The name is typically the same as the dbField name, since it makes things + * less confusing(!), but it is possible to set a different name for the data + * which is used in the JSON returned to DataTables in a 'get' operation and + * the field name used in a 'set' operation. + * @param string $_ Value to set if using as a setter. + * @return string|self The name property if no parameter is given, or self + * if used as a setter. + */ + public function name ( $_=null ) + { + return $this->_getSet( $this->_name, $_ ); + } + + + /** + * Get a list of values that can be used for the options list in radio, + * select and checkbox inputs from the database for this field. + * + * Note that this is for simple 'label / value' pairs only. For more complex + * data, including pairs that require joins and where conditions, use a + * closure to provide a query + * + * @param string|callable $table Database table name to use to get the + * paired data from, or a closure function if providing a method + * @param string $value Table column name that contains the pair's + * value. Not used if the first parameter is given as a closure + * @param string $label Table column name that contains the pair's + * label. Not used if the first parameter is given as a closure + * @param callable $condition Function that will add `where` + * conditions to the query + * @param callable $format Function will render each label + * @param string $order SQL ordering + * @return Field Self for chaining + */ + public function options ( $table=null, $value=null, $label=null, $condition=null, $format=null, $order=null ) + { + if ( $table === null ) { + return $this->_opts; + } + + // Overloads for backwards compatibility + if ( is_a( $table, '\DataTables\Editor\Options' ) ) { + // Options class + $this->_optsFn = null; + $this->_opts = $table; + } + else if ( is_callable($table) && is_object($table) ) { + // Function + $this->_opts = null; + $this->_optsFn = $table; + } + else { + $this->_optsFn = null; + $this->_opts = Options::inst() + ->table( $table ) + ->value( $value ) + ->label( $label ); + + if ( $condition ) { + $this->_opts->where( $condition ); + } + + if ( $format ) { + $this->_opts->render( $format ); + } + + if ( $order ) { + $this->_opts->order( $order ); + } + } + + return $this; + } + + /** + * Get a list of values that can be used for the options list in SearchPanes + * + * @param SearchPaneOptions|callable $spInput SearchPaneOptions instance or a closure function if providing a method + * @return self + */ + public function searchPaneOptions ( $spInput=null ) + { + if ( $spInput === null ) { + return $this->_spopts; + } + + // Overloads for backwards compatibility + if ( is_a( $spInput, '\DataTables\Editor\SearchPaneOptions' ) ) { + // Options class + $this->_spoptsFn = null; + $this->_spopts = $spInput; + } + else if ( is_callable($spInput) && is_object($spInput) ) { + // Function + $this->_spopts = null; + $this->_spoptsFn = $spInput; + } + + return $this; + } + + /** + * Get a list of values that can be used for the options list in SearchBuilder + * + * @param SearchBuilderOptions|callable $sbInput SearchBuilderOptions instance or a closure function if providing a method + * @return self + */ + public function searchBuilderOptions ( $sbInput=null ) + { + if ( $sbInput === null ) { + return $this->_sbopts; + } + + // Overloads for backwards compatibility + if ( is_a( $sbInput, '\DataTables\Editor\SearchBuilderOptions' ) ) { + // Options class + $this->_sboptsFn = null; + $this->_sbopts = $sbInput; + } + else if ( is_callable($sbInput) && is_object($sbInput) ) { + // Function + $this->_sbopts = null; + $this->_sboptsFn = $sbInput; + } + + return $this; + } + + + + /** + * Get / set the 'set' property of the field. + * + * A field can be marked as read only using this option, to be set only + * during an create or edit action or to be set during both actions. This + * provides the ability to have fields that are only set when a new row is + * created (for example a "created" time stamp). + * @param string|boolean $_ Value to set when the method is being used as a + * setter (leave as undefined to use as a getter). This can take the + * value of: + * + * * `true` - Same as `Field::SET_BOTH` + * * `false` - Same as `Field::SET_NONE` + * * `Field::SET_BOTH` - Set the database value on both create and edit commands + * * `Field::SET_NONE` - Never set the database value + * * `Field::SET_CREATE` - Set the database value only on create + * * `Field::SET_EDIT` - Set the database value only on edit + * @return string|self The set property if no parameter is given, or self + * if used as a setter. + */ + public function set ( $_=null ) + { + if ( $_ === true ) { + $_ = Field::SET_BOTH; + } + else if ( $_ === false ) { + $_ = Field::SET_NONE; + } + + return $this->_getSet( $this->_set, $_ ); + } + + + /** + * Set formatter for the field's data. + * + * When the data has been retrieved from the server, it can be passed through + * a formatter here, which will manipulate (format) the data as required. This + * can be useful when, for example, working with dates and a particular format + * is required on the client-side. + * + * Editor has a number of formatters available with the {@see Format} class + * which can be used directly with this method. + * @param callable|string $_ Value to set if using as a setter. Can be given as + * a closure function or a string with a reference to a function that will + * be called with call_user_func(). + * @param mixed $opts Variable that is passed through to the get formatting + * function - can be useful for passing through extra information such as + * date formatting string, or a required flag. The actual options available + * depend upon the formatter used. + * @return callable|string|self The set formatter if no parameter is given, or + * self if used as a setter. + */ + public function setFormatter ( $_=null, $opts=null ) + { + if ( $opts !== null ) { + $this->_setFormatterOpts = $opts; + } + return $this->_getSet( $this->_setFormatter, $_ ); + } + + + /** + * Get / set a set value. If given, then this value is used to write to the + * database regardless of what data is sent from the client-side. + * + * @param callable|string|number $_ Value to set, or no value to use as a + * getter + * @return callable|string|self Value if used as a getter, or self if used + * as a setter. + */ + public function setValue ( $_=null ) + { + return $this->_getSet( $this->_setValue, $_ ); + } + + + /** + * Get / set the upload class for this field. + * @param Upload $_ Upload class if used as a setter + * @return Upload|self Value if used as a getter, or self if used + * as a setter. + */ + public function upload ( $_=null ) + { + return $this->_getSet( $this->_upload, $_ ); + } + + + /** + * Get / set the 'validator' of the field. + * + * The validator can be used to check if any abstract piece of data is valid + * or not according to the given rules of the validation function used. + * + * Multiple validation options can be applied to a field instance by calling + * this method multiple times. For example, it would be possible to have a + * 'required' validation and a 'maxLength' validation with multiple calls. + * + * Editor has a number of validation available with the {@see Validate} class + * which can be used directly with this method. + * @param callable|string $_ Value to set if using as the validation method. + * Can be given as a closure function or a string with a reference to a + * function that will be called with call_user_func(). + * @param mixed $opts Variable that is passed through to the validation + * function - can be useful for passing through extra information such as + * date formatting string, or a required flag. The actual options available + * depend upon the validation function used. + * @return callable|string|self The validation method if no parameter is given, + * or self if used as a setter. + */ + public function validator ( $_=null, $opts=null ) + { + if ( $_ === null ) { + return $this->_validator; + } + else { + $this->_validator[] = array( + "func" => $_, + "opts" => $opts + ); + } + + return $this; + } + + + /** + * Set a formatting method that will be used for XSS checking / removal. + * This should be a function that takes a single argument (the value to be + * cleaned) and returns the cleaned value. + * + * Editor will use HtmLawed by default for this operation, which is built + * into the software and no additional configuration is required, but a + * custom function can be used if you wish to use a different formatter such + * as HTMLPurifier. + * + * If you wish to disable this option (which you would only do if you are + * absolutely confident that your validation will pick up on any XSS inputs) + * simply provide a closure function that returns the value given to the + * function. This is _not_ recommended. + * + * @param callable|false $xssFormatter XSS cleaner function, use `false` or + * `null` to disable XSS cleaning. + * @return Field Self for chaining. + */ + public function xss ( $xssFormatter ) + { + if ( $xssFormatter === true || $xssFormatter === false || $xssFormatter === null ) { + $this->_xssFormat = $xssFormatter; + } + else { + $this->_xss = $xssFormatter; + } + + return $this; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Internal methods + * Used by the Editor class and not generally for public use + */ + + /** + * Check to see if a field should be used for a particular action (get or set). + * + * Called by the Editor / Join class instances - not expected for general + * consumption - internal. + * @param string $action Direction that the data is travelling - 'get' is + * reading DB data, `create` and `edit` for writing to the DB + * @param array $data Data submitted from the client-side when setting. + * @return boolean true if the field should be used in the get / set. + * @internal + */ + public function apply ( $action, $data=null ) + { + if ( $action === 'get' ) { + // Get action - can we get this field + return $this->_get; + } + else { + // Note that validation must be done on input data before we get here + + // Create or edit action, are we configured to use this field + if ( $action === 'create' && + ($this->_set === Field::SET_NONE || $this->_set === Field::SET_EDIT) + ) { + return false; + } + else if ( $action === 'edit' && + ($this->_set === Field::SET_NONE || $this->_set === Field::SET_CREATE) + ) { + return false; + } + + // Check it was in the submitted data. If not, then not required + // (validation would have failed if it was) and therefore we don't + // set it. Check for a value as well, as it can format data from + // some other source + if ( $this->_setValue === null && ! $this->_inData( $this->name(), $data ) ) { + return false; + } + + // In the data set, so use it + return true; + } + } + + + /** + * Execute the ipOpts to get the list of options to return to the client- + * side + * + * @param \DataTables\Database $db Database instance + * @return Array Array of value / label options for the list + * @internal + */ + public function optionsExec ( $db ) + { + if ( $this->_optsFn ) { + $fn = $this->_optsFn; + return $fn($db); + } + else if ( $this->_opts ) { + return $this->_opts->exec( $db ); + } + + return false; + } + + /** + * Execute the spopts to get the list of options for SearchPanes to return + * to the client-side + * + * @param DataTables\Field $field The field to retrieve the data from + * @param DataTables\Editor $editor The editor instance + * @param DataTables\DTRequest $http The http request sent to the server + * @param DataTables\Field[] $fields All of the fields + * @param any $leftJoin Info for a leftJoin if required + * @return Promise | boolean + * @internal + */ + public function searchPaneOptionsExec ( $field, $editor, $http, $fields, $leftJoin) + { + if ( $this->_spoptsFn ) { + $fn = $this->_spoptsFn; + return $fn($editor->db(), $editor); + } + else if ( $this->_spopts ) { + return $this->_spopts->exec( $field, $editor, $http, $fields, $leftJoin ); + } + + return false; + } + + /** + * Execute the spopts to get the list of options for SearchBuilder to return + * to the client-side + * + * @param DataTables\Field $field The field to retrieve the data from + * @param DataTables\Editor $editor The editor instance + * @param DataTables\DTRequest $http The http request sent to the server + * @param DataTables\Field[] $fields All of the fields + * @param any $leftJoin Info for a leftJoin if required + * @return Promise | boolean + * @internal + */ + public function searchBuilderOptionsExec ( $field, $editor, $http, $fields, $leftJoin) + { + if ( $this->_sboptsFn ) { + $fn = $this->_sboptsFn; + return $fn($editor->db(), $editor); + } + else if ( $this->_sbopts ) { + return $this->_sbopts->exec( $field, $editor, $http, $fields, $leftJoin ); + } + + return false; + } + + + /** + * Get the value of the field, taking into account if it is coming from the + * DB or from a POST. If formatting has been specified for this field, it + * will be applied here. + * + * Called by the Editor / Join class instances - not expected for general + * consumption - internal. + * @param string $direction Direction that the data is travelling - 'get' is + * reading data, and 'set' is writing it to the DB. + * @param array $data Data submitted from the client-side when setting or the + * data for the row when getting data from the DB. + * @return string Value for the field + * @internal + */ + public function val ( $direction, $data ) + { + if ( $direction === 'get' ) { + if ( $this->_getValue !== null ) { + $val = $this->_getAssignedValue( $this->_getValue ); + } + else { + // Getting data, so the db field name + $val = isset( $data[ $this->_dbField ] ) ? + $data[ $this->_dbField ] : + null; + } + + return $this->_format( + $val, $data, $this->_getFormatter, $this->_getFormatterOpts + ); + } + else { + // Sanity check that we aren't operating on a function + if ( strpos( $this->dbField(), '(' ) !== false ) { + throw new \Exception('Cannot set the value for an SQL function field. These fields are read only: ' . $this->name()); + } + + // Setting data, so using from the payload (POST usually) and thus + // use the 'name' + $val = $this->_setValue !== null ? + $this->_getAssignedValue( $this->_setValue ) : + $this->_readProp( $this->name(), $data ); + + // XSS removal / checker + if ( $this->_xssFormat && $val ) { + $val = $this->xssSafety( $val ); + } + + return $this->_format( + $val, $data, $this->_setFormatter, $this->_setFormatterOpts + ); + } + } + + + /** + * Check the validity of the field based on the data submitted. Note that + * this validation is performed on the wire data - i.e. that which is + * submitted, before any setFormatter is run + * + * Called by the Editor / Join class instances - not expected for general + * consumption - internal. + * + * @param array $data Data submitted from the client-side + * @param Editor $editor Editor instance + * @param mixed $id Row id that is being validated + * @return boolean|string `true` if valid, string with error message if not + * @internal + */ + public function validate ( $data, $editor, $id=null ) + { + // Three cases for the validator - closure, string or null + if ( ! count( $this->_validator ) ) { + return true; + } + + // Value could be from user data, or setValue might take priority + $val = $this->_setValue !== null ? + $this->_getAssignedValue( $this->_setValue ) : + $this->_readProp( $this->name(), $data ); + + $processData = $editor->inData(); + $instances = array( + 'action' => $processData['action'], + 'id' => $id, + 'field' => $this, + 'editor' => $editor, + 'db' => $editor->db() + ); + + for ( $i=0, $ien=count( $this->_validator ) ; $i<$ien ; $i++ ) { + $validator = $this->_validator[$i]; + + // Backwards compatibility + if ( is_string( $validator['func'] ) ) { + if ( strpos($validator['func'], "Validate::") === 0 ) { + $a = explode("::", $validator['func']); + + // Validate class static methods - they have `Legacy` counter parts that + // convert from the old style to the new so the old style options still work. + if ( method_exists( "\\DataTables\\Editor\\".$a[0], $a[1].'Legacy' ) ) { + $func = call_user_func( "\\DataTables\\Editor\\".$validator['func'].'Legacy', $validator['opts'] ); + $res = call_user_func( $func, $val, $data, $this, $instances ); + } + else { + // User style legacy function. Call it directly + $func = "\\DataTables\\Editor\\".$validator['func']; + $res = call_user_func( $func, $val, $data, $this, $instances ); + } + } + else { + // And for cases where a string was used to point to a function, + // which was not in the Validate class + $res = call_user_func( $validator['func'], $val, $data, $validator['opts'], $instances ); + } + } + else { + $func = $validator['func']; + $res = $func( $val, $data, $this, $instances ); + } + + // Check if there was a validation error and if so, return it + if ( $res !== true ) { + return $res; + } + } + + // Validation methods all run, must be valid + return true; + } + + + /** + * Write the value for this field to the output array for a read operation + * + * @param array $out Row output data (to the JSON) + * @param mixed $srcData Row input data (raw, from the database) + * @internal + */ + public function write( &$out, $srcData ) + { + $this->_writeProp( $out, $this->name(), $this->val('get', $srcData) ); + } + + + /** + * Perform XSS prevention on an input. + * + * @param mixed $val Value to be escaped + * @return string Safe value + */ + public function xssSafety ( $val ) { + $xss = $this->_xss; + + if ( is_array( $val ) ) { + $res = array(); + + foreach ( $val as $individual ) { + $res[] = $xss ? + $xss( $individual ) : + Htmlaw::filter( $individual ); + } + + return $res; + } + + return $xss ? + $xss( $val ) : + Htmlaw::filter( $val ); + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private methods + */ + + /** + * Apply a formatter to data. The caller will decide what formatter to apply + * (get or set) + * + * @param mixed $val Value to be formatted + * @param mixed $data Full row data + * @param callable $formatter Formatting function to be called + * @param array $opts Array of options to be passed to the formatter + * @return mixed Formatted value + */ + private function _format( $val, $data, $formatter, $opts ) + { + // Three cases for the formatter - closure, string or null + if ( ! $formatter ) { + return $val; + } + + if ( ! is_string( $formatter ) ) { + return $formatter( $val, $data, $opts ); + } + + // Backwards compatibility - strings will not be supported in v2 + if ( strpos($formatter, "Format::") === 0 ) { + $a = explode( '::', $formatter ); + + // Old style Editor formatter - use the legacy functions to + // convert to the new style + if ( method_exists( "\\DataTables\\Editor\\".$a[0], $a[1].'Legacy' ) ) { + $func = call_user_func( "\\DataTables\\Editor\\".$formatter.'Legacy', $opts ); + + return $func( $val, $data ); + } + else { + // User added old style methods + return call_user_func( "\\DataTables\\Editor\\".$formatter, $val, $data, $opts ); + } + } + + // User function (string identifier) + return call_user_func( $formatter, $val, $data, $opts ); + } + + /** + * Get the value from `_[gs]etValue` - taking into account if it is callable + * function or not + * + * @param mixed $val Value to be evaluated + * @return mixed Value assigned, or returned from the function + */ + private function _getAssignedValue ( $val ) + { + return is_callable($val) && is_object($val) ? + $val() : + $val; + } + + /** + * Check is a parameter is in the submitted data set. This is functionally + * the same as the `_readProp()` method, but in this case a binary value + * is required to indicate if the value is present or not. + * + * @param string $name Javascript dotted object name to write to + * @param array $data Data source array to read from + * @return boolean `true` if present, `false` otherwise + * @private + */ + private function _inData ( $name, $data ) + { + if ( strpos($name, '.') === false ) { + return isset( $data[ $name ] ) ? + true : + false; + } + + $names = explode( '.', $name ); + $inner = $data; + + for ( $i=0 ; $ijoin()} to allow Editor to + * obtain joined information from the database. + * + * For an overview of how Join tables work, please refer to the + * {@link https://editor.datatables.net/manual/php/ Editor manual} as it is + * useful to understand how this class represents the links between tables, + * before fully getting to grips with it's API. + * + * @example + * Join the parent table (the one specified in the {@see Editor->table()} + * method) with the table *access*, with a link table *user__access*, which + * allows multiple properties to be found for each row in the parent table. + * ```php + * Join::inst( 'access', 'array' ) + * ->link( 'users.id', 'user_access.user_id' ) + * ->link( 'access.id', 'user_access.access_id' ) + * ->field( + * Field::inst( 'id' )->validator( 'Validate::required' ), + * Field::inst( 'name' ) + * ) + * ``` + * + * @example + * Single row join - here we join the parent table with a single row in + * the child table, without an intermediate link table. In this case the + * child table is called *extra* and the two fields give the columns that + * Editor will read from that table. + * ```php + * Join::inst( 'extra', 'object' ) + * ->link( 'user.id', 'extra.user_id' ) + * ->field( + * Field::inst( 'comments' ), + * Field::inst( 'review' ) + * ) + * ``` + */ +class Join extends DataTables\Ext { + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Constructor + */ + + /** + * Join instance constructor. + * @param string $table Table name to get the joined data from. + * @param string $type Work with a single result ('object') or an array of + * results ('array') for the join. + */ + function __construct( $table=null, $type='object' ) + { + $this->table( $table ); + $this->type( $type ); + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private properties + */ + + /** @var DataTables\Editor\Field[] */ + private $_fields = array(); + + /** @var array */ + private $_join = array( + "parent" => null, + "child" => null, + "table" => null + ); + + /** @var array */ + private $_leftJoin = array(); + + /** @var string */ + private $_table = null; + + /** @var string */ + private $_type = null; + + /** @var string */ + private $_name = null; + + /** @var boolean */ + private $_get = true; + + /** @var boolean */ + private $_set = true; + + /** @var string */ + private $_aliasParentTable = null; + + /** @var array */ + private $_where = array(); + + /** @var boolean */ + private $_whereSet = false; + + /** @var array */ + private $_links = array(); + + /** @var string */ + private $_customOrder = null; + + /** @var callable[] */ + private $_validators = array(); + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + /** + * Get / set parent table alias. + * + * When working with a self referencing table (i.e. a column in the table contains + * a primary key value from its own table) it can be useful to set an alias on the + * parent table's name, allowing a self referencing Join. For example: + * ``` + * SELECT p2.publisher + * FROM publisher as p2 + * JOIN publisher on (publisher.idPublisher = p2.idPublisher) + * ``` + * Where, in this case, `publisher` is the table that is used by the Editor instance, + * and you want to use `Join` to link back to the table (resolving a name for example). + * This method allows that alias to be set. Fields can then use standard SQL notation + * to select a field, for example `p2.publisher` or `publisher.publisher`. + * @param string $_ Table alias to use + * @return string|self Table alias set (which is null by default), or self if used as + * a setter. + */ + public function aliasParentTable ( $_=null ) + { + return $this->_getSet( $this->_aliasParentTable, $_ ); + } + + + /** + * Get / set field instances. + * + * The list of fields designates which columns in the table that will be read + * from the joined table. + * @param Field $_... Instances of the {@see Field} class, given as a single + * instance of {@see Field}, an array of {@see Field} instances, or multiple + * {@see Field} instance parameters for the function. + * @return Field[]|self Array of fields, or self if used as a setter. + * @see {@see Field} for field documentation. + */ + public function field ( $_=null ) + { + $args = func_get_args(); + + if ( $_ !== null && !is_array($_) ) { + $_ = $args; + } + return $this->_getSet( $this->_fields, $_, true ); + } + + + /** + * Get / set field instances. + * + * An alias of {@see field}, for convenience. + * @param Field $_... Instances of the {@see Field} class, given as a single + * instance of {@see Field}, an array of {@see Field} instances, or multiple + * {@see Field} instance parameters for the function. + * @return Field[]|self Array of fields, or self if used as a setter. + * @see {@see Field} for field documentation. + */ + public function fields ( $_=null ) + { + $args = func_get_args(); + + if ( $_ !== null && !is_array($_) ) { + $_ = $args; + } + return $this->_getSet( $this->_fields, $_, true ); + } + + + /** + * Get / set get attribute. + * + * When set to false no read operations will occur on the join tables. + * @param boolean $_ Value + * @return boolean|self Name + */ + public function get ( $_=null ) + { + return $this->_getSet( $this->_get, $_ ); + } + + + /** + * Get / set join properties. + * + * Define how the SQL will be performed, on what columns. There are + * basically two types of join that are supported by Editor here, a direct + * foreign key reference in the join table to the parent table's primary + * key, or a link table that contains just primary keys for the parent and + * child tables (this approach is usually used with a {@see Join->type()} of + * 'array' since you can often have multiple links between the two tables, + * while a direct foreign key reference will typically use a type of + * 'object' (i.e. a single entry). + * + * @param string|string[] $parent Parent table's primary key names. If used + * with a link table (i.e. third parameter to this method is given, then + * an array should be used, with the first element being the pkey's name + * in the parent table, and the second element being the key's name in + * the link table. + * @param string|string[] $child Child table's primary key names. If used + * with a link table (i.e. third parameter to this method is given, then + * an array should be used, with the first element being the pkey's name + * in the child table, and the second element being the key's name in the + * link table. + * @param string $table Join table name, if using a link table + * @returns Join This for chaining + * @deprecated 1.5 Please use the {@see Join->link()} method rather than this + * method now. + */ + public function join ( $parent=null, $child=null, $table=null ) + { + if ( $parent === null && $child === null ) { + return $this->_join; + } + + $this->_join['parent'] = $parent; + $this->_join['child'] = $child; + $this->_join['table'] = $table; + return $this; + } + + + /** + * Set up a left join operation for the Mjoined data + * + * @param string $table to get the information from + * @param string $field1 the first field to get the information from + * @param string $operator the operation to perform on the two fields + * @param string $field2 the second field to get the information from + * @return self + */ + public function leftJoin ( $table, $field1, $operator, $field2 ) + { + $this->_leftJoin[] = array( + "table" => $table, + "field1" => $field1, + "field2" => $field2, + "operator" => $operator + ); + + return $this; + } + + + /** + * Create a join link between two tables. The order of the fields does not + * matter, but each field must contain the table name as well as the field + * name. + * + * This method can be called a maximum of two times for an Mjoin instance: + * + * * First time, creates a link between the Editor host table and a join + * table + * * Second time creates the links required for a link table. + * + * Please refer to the Editor Mjoin documentation for further details: + * https://editor.datatables.net/manual/php + * + * @param string $field1 Table and field name + * @param string $field2 Table and field name + * @return Join Self for chaining + * @throws \Exception Link limitations + */ + public function link ( $field1, $field2 ) + { + if ( strpos($field1, '.') === false || strpos($field2, '.') === false ) { + throw new \Exception("Link fields must contain both the table name and the column name"); + } + + if ( count( $this->_links ) >= 4 ) { + throw new \Exception("Link method cannot be called more than twice for a single instance"); + } + + $this->_links[] = $field1; + $this->_links[] = $field2; + + return $this; + } + + + /** + * Specify the property that the data will be sorted by. + * + * @param string $order SQL column name to order the data by + * @return Join Self for chaining + */ + public function order ( $_=null ) + { + // How this works is by setting the SQL order by clause, and since the + // join that is done in PHP is always done sequentially, the order is + // retained. + return $this->_getSet( $this->_customOrder, $_ ); + } + + + /** + * Get / set name. + * + * The `name` of the Join is the JSON property key that is used when + * 'getting' the data, and the HTTP property key (in a JSON style) when + * 'setting' data. Typically the name of the db table will be used here, + * but this method allows that to be overridden. + * @param string $_ Field name + * @return String|self Name + */ + public function name ( $_=null ) + { + return $this->_getSet( $this->_name, $_ ); + } + + + /** + * Get / set set attribute. + * + * When set to false no write operations will occur on the join tables. + * This can be useful when you want to display information which is joined, + * but want to only perform write operations on the parent table. + * @param boolean $_ Value + * @return boolean|self Name + */ + public function set ( $_=null ) + { + return $this->_getSet( $this->_set, $_ ); + } + + + /** + * Get / set join table name. + * + * Please note that this will also set the {@see Join->name()} used by the Join + * as well. This is for convenience as the JSON output / HTTP input will + * typically use the same name as the database name. If you want to set a + * custom name, the {@see Join->name()} method must be called ***after*** this one. + * @param string $_ Name of the table to read the join data from + * @return String|self Name of the join table, or self if used as a setter. + */ + public function table ( $_=null ) + { + if ( $_ !== null ) { + $this->_name = $_; + } + return $this->_getSet( $this->_table, $_ ); + } + + + /** + * Get / set the join type. + * + * The join type allows the data that is returned from the join to be given + * as an array (i.e. working with multiple possibly results for each record from + * the parent table), or as an object (i.e. working which one and only one result + * for each record form the parent table). + * @param string $_ Join type ('object') or an array of + * results ('array') for the join. + * @return String|self Join type, or self if used as a setter. + */ + public function type ( $_=null ) + { + return $this->_getSet( $this->_type, $_ ); + } + + + /** + * Set a validator for the array of data (not on a field basis) + * + * @param string $fieldName Name of the field that any error should be shown + * against on the client-side + * @param callable $fn Callback function for validation + * @return self Chainable + */ + public function validator ( $fieldName, $fn ) + { + $this->_validators[] = array( + 'fieldName' => $fieldName, + 'fn' => $fn + ); + + return $this; + } + + + /** + * Where condition to add to the query used to get data from the database. + * Note that this is applied to the child table. + * + * Can be used in two different ways: + * + * * Simple case: `where( field, value, operator )` + * * Complex: `where( fn )` + * + * @param string|callable $key Single field name or a closure function + * @param string|string[] $value Single field value, or an array of values. + * @param string $op Condition operator: <, >, = etc + * @return string[]|self Where condition array, or self if used as a setter. + */ + public function where ( $key=null, $value=null, $op='=' ) + { + if ( $key === null ) { + return $this->_where; + } + + if ( is_callable($key) && is_object($key) ) { + $this->_where[] = $key; + } + else { + $this->_where[] = array( + "key" => $key, + "value" => $value, + "op" => $op + ); + } + + return $this; + } + + + /** + * Get / set if the WHERE conditions should be included in the create and + * edit actions. + * + * This means that the fields which have been used as part of the 'get' + * WHERE condition (using the `where()` method) will be set as the values + * given. + * + * This is default false (i.e. they are not included). + * + * @param boolean $_ Include (`true`), or not (`false`) + * @return boolean Current value + */ + public function whereSet ( $_=null ) + { + return $this->_getSet( $this->_whereSet, $_ ); + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Internal methods + */ + + /** + * Get data + * @param Editor $editor Host Editor instance + * @param string[] $data Data from the parent table's get and were we need + * to add out output. + * @param array $options options array for fields + * @internal + */ + public function data( $editor, &$data, &$options ) + { + if ( ! $this->_get ) { + return; + } + + $this->_prep( $editor ); + $db = $editor->db(); + $dteTable = $editor->table(); + $pkey = $editor->pkey(); + $idPrefix = $editor->idPrefix(); + + $dteTable = $dteTable[0]; + if ( strpos($dteTable, ' as ') !== false ) { + $arr = explode(' as ', $dteTable); + $dteTable = $arr[0]; + $this->_aliasParentTable = $arr[1]; + } + + $dteTableLocal = $this->_aliasParentTable ? // Can be aliased to allow a self join + $this->_aliasParentTable : + $dteTable; + $joinField = isset($this->_join['table']) ? + $this->_join['parent'][0] : + $this->_join['parent']; + + // This is something that will likely come in a future version, but it + // is a relatively low use feature. Please get in touch if this is + // something you require. + if ( count( $pkey ) > 1 ) { + throw new \Exception("MJoin is not currently supported with a compound primary key for the main table", 1); + } + + if ( count($data) > 0 ) { + $pkey = $pkey[0]; + $pkeyIsJoin = $pkey === $joinField || $pkey === $dteTableLocal.'.'.$joinField; + + // Set up the JOIN query + $stmt = $db + ->query( 'select' ) + ->distinct( true ) + ->get( $dteTableLocal.'.'.$joinField.' as dteditor_pkey' ) + ->get( $this->_fields('get') ) + ->table( $dteTable .' as '. $dteTableLocal ); + + if ( $this->order() ) { + $stmt->order( $this->order() ); + } + + $stmt->left_join($this->_leftJoin); + $this->_apply_where( $stmt ); + + if ( isset($this->_join['table']) ) { + // Working with a link table + $stmt + ->join( + $this->_join['table'], + $dteTableLocal.'.'.$this->_join['parent'][0] .' = '. $this->_join['table'].'.'.$this->_join['parent'][1] + ) + ->join( + $this->_table, + $this->_table.'.'.$this->_join['child'][0] .' = '. $this->_join['table'].'.'.$this->_join['child'][1] + ); + } + else { + // No link table in the middle + $stmt + ->join( + $this->_table, + $this->_table.'.'.$this->_join['child'] .' = '. $dteTableLocal.'.'.$this->_join['parent'] + ); + } + + // Check that the joining field is available. The joining key can + // come from the Editor instance's primary key, or any other field, + // including a nested value (from a left join). If the instance's + // pkey, then we've got that in the DT_RowId parameter, so we can + // use that. Otherwise, the key must be in the field list. + if ( $this->_propExists( $dteTable.'.'.$joinField, $data[0] ) ) { + $readField = $dteTable.'.'.$joinField; + } + else if ( $this->_propExists( $joinField, $data[0] ) ) { + $readField = $joinField; + } + else if ( ! $pkeyIsJoin ) { + echo json_encode( array( + "sError" => "Join was performed on the field '{$joinField}' which was not " + ."included in the Editor field list. The join field must be included " + ."as a regular field in the Editor instance." + ) ); + exit(0); + } + + // Get list of pkey values and apply as a WHERE IN condition + // This is primarily useful in server-side processing mode and when filtering + // the table as it means only a sub-set will be selected + // This is only applied for "sensible" data sets. It will just complicate + // matters for really large data sets: + // https://stackoverflow.com/questions/21178390/in-clause-limitation-in-sql-server + if ( count($data) < 1000 ) { + $whereIn = array(); + + for ( $i=0 ; $i_readProp( $readField, $data[$i] ); + } + + $stmt->where_in( $dteTableLocal.'.'.$joinField, $whereIn ); + } + + // Go! + $res = $stmt->exec(); + if ( ! $res ) { + return; + } + + // Map to primary key for fast lookup + $join = array(); + while ( $row=$res->fetch() ) { + $inner = array(); + + for ( $j=0 ; $j_fields) ; $j++ ) { + $field = $this->_fields[$j]; + if ( $field->apply('get') ) { + $field->write($inner, $row); + } + } + + if ( $this->_type === 'object' ) { + $join[ $row['dteditor_pkey'] ] = $inner; + } + else { + if ( !isset( $join[ $row['dteditor_pkey'] ] ) ) { + $join[ $row['dteditor_pkey'] ] = array(); + } + $join[ $row['dteditor_pkey'] ][] = $inner; + } + } + + // Loop over the data and do a join based on the data available + for ( $i=0 ; $i_readProp( $readField, $data[$i] ); + + if ( isset( $join[$rowPKey] ) ) { + $data[$i][ $this->_name ] = $join[$rowPKey]; + } + else { + $data[$i][ $this->_name ] = ($this->_type === 'object') ? + (object)array() : array(); + } + } + } + + // Field options + foreach ($this->_fields as $field) { + $opts = $field->optionsExec( $db ); + + if ( $opts !== false ) { + $name = $this->name(). + ($this->_type === 'object' ? '.' : '[].'). + $field->name(); + $options[ $name ] = $opts; + } + } + } + + + /** + * Create a row. + * @param Editor $editor Host Editor instance + * @param int $parentId Parent row's primary key value + * @param string[] $data Data to be set for the join + * @internal + */ + public function create ( $editor, $parentId, $data ) + { + // If not settable, or the many count for the join was not submitted + // there we do nothing + if ( + ! $this->_set || + ! isset($data[$this->_name]) || + ! isset($data[$this->_name.'-many-count']) + ) { + return; + } + + $this->_prep( $editor ); + $db = $editor->db(); + + if ( $this->_type === 'object' ) { + $this->_insert( $db, $parentId, $data[$this->_name] ); + } + else { + for ( $i=0 ; $i_name]) ; $i++ ) { + $this->_insert( $db, $parentId, $data[$this->_name][$i] ); + } + } + } + + + /** + * Update a row. + * @param Editor $editor Host Editor instance + * @param int $parentId Parent row's primary key value + * @param string[] $data Data to be set for the join + * @internal + */ + public function update ( $editor, $parentId, $data ) + { + // If not settable, or the many count for the join was not submitted + // there we do nothing + if ( ! $this->_set || ! isset($data[$this->_name.'-many-count']) ) { + return; + } + + $this->_prep( $editor ); + $db = $editor->db(); + + if ( $this->_type === 'object' ) { + // update or insert + $this->_update_row( $db, $parentId, $data[$this->_name] ); + } + else { + // WARNING - this will remove rows and then readd them. Any + // data not in the field list WILL BE LOST + // todo - is there a better way of doing this? + $this->remove( $editor, array($parentId) ); + $this->create( $editor, $parentId, $data ); + } + } + + + /** + * Delete rows + * @param Editor $editor Host Editor instance + * @param int[] $ids Parent row IDs to delete + * @internal + */ + public function remove ( $editor, $ids ) + { + if ( ! $this->_set ) { + return; + } + + $that = $this; + $this->_prep( $editor ); + $db = $editor->db(); + + if ( isset($this->_join['table']) ) { + $stmt = $db + ->query( 'delete' ) + ->table( $this->_join['table'] ) + ->or_where( $this->_join['parent'][1], $ids ) + ->exec(); + } + else { + $stmt = $db + ->query( 'delete' ) + ->table( $this->_table ) + ->where_group( function ( $q ) use ( $that, $ids ) { + $q->or_where( $that->_join['child'], $ids ); + } ); + + $this->_apply_where( $stmt ); + + $stmt->exec(); + } + } + + + /** + * Validate input data + * + * @param array $errors Errors array + * @param Editor $editor Editor instance + * @param string[] $data Data to validate + * @param string $action `create` or `edit` + * @internal + */ + public function validate ( &$errors, $editor, $data, $action ) + { + if ( ! $this->_set && ! isset($data[$this->_name.'-many-count']) ) { + return; + } + + $this->_prep( $editor ); + + $joinData = isset($data[$this->_name]) ? + $data[$this->_name] : + array(); + + for ( $i=0 ; $i_validators) ; $i++ ) { + $validator = $this->_validators[$i]; + $fn = $validator['fn']; + $res = $fn( $editor, $action, $joinData ); + + if ( is_string($res) ) { + $errors[] = array( + "name" => $validator['fieldName'], + "status" => $res + ); + } + } + + if ( $this->_type === 'object' ) { + $this->_validateFields( $errors, $editor, $joinData, $this->_name.'.' ); + } + else { + for ( $i=0 ; $i_validateFields( $errors, $editor, $joinData[$i], $this->_name.'[].' ); + } + } + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private methods + */ + + /** + * Add local WHERE condition to query + * @param \DataTables\Database\Query $query Query instance to apply the WHERE conditions to + * @private + */ + private function _apply_where ( $query ) + { + for ( $i=0 ; $i_where) ; $i++ ) { + if ( is_callable( $this->_where[$i] ) ) { + $this->_where[$i]( $query ); + } + else { + $query->where( + $this->_where[$i]['key'], + $this->_where[$i]['value'], + $this->_where[$i]['op'] + ); + } + } + } + + + /** + * Create a row. + * @param \DataTables\Database $db Database reference to use + * @param int $parentId Parent row's primary key value + * @param string[] $data Data to be set for the join + * @private + */ + private function _insert( $db, $parentId, $data ) + { + if ( isset($this->_join['table']) ) { + // Insert keys into the join table + $stmt = $db + ->query('insert') + ->table( $this->_join['table'] ) + ->set( $this->_join['parent'][1], $parentId ) + ->set( $this->_join['child'][1], $data[$this->_join['child'][0]] ) + ->exec(); + } + else { + // Insert values into the target table + $stmt = $db + ->query('insert') + ->table( $this->_table ) + ->set( $this->_join['child'], $parentId ); + + for ( $i=0 ; $i_fields) ; $i++ ) { + $field = $this->_fields[$i]; + + if ( $field->apply( 'set', $data ) ) { // TODO should be create or edit + $stmt->set( $field->dbField(), $field->val('set', $data) ); + } + } + + // If the where condition variables should also be added to the database + // Note that `whereSet` is now deprecated + if ( $this->_whereSet ) { + for ( $i=0, $ien=count($this->_where) ; $i<$ien ; $i++ ) { + if ( ! is_callable( $this->_where[$i] ) ) { + $stmt->set( $this->_where[$i]['key'], $this->_where[$i]['value'] ); + } + } + } + + $stmt->exec(); + } + } + + + /** + * Prepare the instance to be run. + * + * @param Editor $editor Editor instance + * @private + */ + private function _prep ( $editor ) + { + $links = $this->_links; + + // Were links used to configure this instance - if so, we need to + // back them onto the join array + if ( $this->_join['parent'] === null && count($links) ) { + $editorTable = $editor->table(); + $editorTable = $editorTable[0]; + $joinTable = $this->table(); + if ( strpos($editorTable, ' as ') !== false ) { + $arr = explode(' as ', $editorTable); + $editorTable = $arr[0]; + $this->_aliasParentTable = $arr[1]; + } + + if ( $this->_aliasParentTable ) { + $editorTable = $this->_aliasParentTable; + } + + if ( count( $links ) === 2 ) { + // No link table + $f1 = explode( '.', $links[0] ); + $f2 = explode( '.', $links[1] ); + + if ( $f1[0] === $editorTable ) { + $this->_join['parent'] = $f1[1]; + $this->_join['child'] = $f2[1]; + } + else { + $this->_join['parent'] = $f2[1]; + $this->_join['child'] = $f1[1]; + } + } + else { + // Link table + $f1 = explode( '.', $links[0] ); + $f2 = explode( '.', $links[1] ); + $f3 = explode( '.', $links[2] ); + $f4 = explode( '.', $links[3] ); + + // Discover the name of the link table + if ( $f1[0] !== $editorTable && $f1[0] !== $joinTable ) { + $this->_join['table'] = $f1[0]; + } + else if ( $f2[0] !== $editorTable && $f2[0] !== $joinTable ) { + $this->_join['table'] = $f2[0]; + } + else if ( $f3[0] !== $editorTable && $f3[0] !== $joinTable ) { + $this->_join['table'] = $f3[0]; + } + else { + $this->_join['table'] = $f4[0]; + } + + $this->_join['parent'] = array( $f1[1], $f2[1] ); + $this->_join['child'] = array( $f3[1], $f4[1] ); + } + } + } + + + /** + * Update a row. + * @param \DataTables\Database $db Database reference to use + * @param int $parentId Parent row's primary key value + * @param string[] $data Data to be set for the join + * @private + */ + private function _update_row ( $db, $parentId, $data ) + { + if ( isset($this->_join['table']) ) { + // Got a link table, just insert the pkey references + $db->push( + $this->_join['table'], + array( + $this->_join['parent'][1] => $parentId, + $this->_join['child'][1] => $data[$this->_join['child'][0]] + ), + array( + $this->_join['parent'][1] => $parentId + ) + ); + } + else { + // No link table, just a direct reference + $set = array( + $this->_join['child'] => $parentId + ); + + for ( $i=0 ; $i_fields) ; $i++ ) { + $field = $this->_fields[$i]; + + if ( $field->apply( 'set', $data ) ) { + $set[ $field->dbField() ] = $field->val('set', $data); + } + } + + // Add WHERE conditions + $where = array($this->_join['child'] => $parentId); + for ( $i=0, $ien=count($this->_where) ; $i<$ien ; $i++ ) { + $where[ $this->_where[$i]['key'] ] = $this->_where[$i]['value']; + + // Is there any point in this? Is there any harm? + // Note that `whereSet` is now deprecated + if ( $this->_whereSet ) { + if ( ! is_callable( $this->_where[$i] ) ) { + $set[ $this->_where[$i]['key'] ] = $this->_where[$i]['value']; + } + } + } + + $db->push( $this->_table, $set, $where ); + } + } + + + /** + * Create an SQL string from the fields that this instance knows about for + * using in queries + * @param string $direction Direction: 'get' or 'set'. + * @returns array Fields to include + * @private + */ + private function _fields ( $direction ) + { + $fields = array(); + + for ( $i=0 ; $i_fields) ; $i++ ) { + $field = $this->_fields[$i]; + + if ( $field->apply( $direction, null ) ) { + if ( strpos( $field->dbField() , "." ) === false ) { + $fields[] = $this->_table.'.'.$field->dbField() ." as ".$field->dbField();; + } + else { + $fields[] = $field->dbField();// ." as ".$field->dbField(); + } + } + } + + return $fields; + } + + + /** + * Validate input data + * + * @param array $errors Errors array + * @param Editor $editor Editor instance + * @param string[] $data Data to validate + * @param string $prefix Field error prefix for client-side to show the + * error message on the appropriate field + * @internal + */ + private function _validateFields ( &$errors, $editor, $data, $prefix ) + { + for ( $i=0 ; $i_fields) ; $i++ ) { + $field = $this->_fields[$i]; + $validation = $field->validate( $data, $editor ); + + if ( $validation !== true ) { + $errors[] = array( + "name" => $prefix.$field->name(), + "status" => $validation + ); + } + } + } +} diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Mjoin.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Mjoin.php.txt new file mode 100644 index 00000000..cd05eecf --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Mjoin.php.txt @@ -0,0 +1,33 @@ +leftJoin()` method. The API API is otherwise + * identical. + * + * This class is recommended over the `Join` class. + */ +class Mjoin extends Join +{ + function __construct( $table=null ) + { + parent::__construct( $table, 'array' ); + } +} diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Options.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Options.php.txt new file mode 100644 index 00000000..738932ee --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Options.php.txt @@ -0,0 +1,341 @@ +options()} method. + * + * @example + * Get a list of options from the `sites` table + * ```php + * Field::inst( 'users.site' ) + * ->options( Options::inst() + * ->table( 'sites' ) + * ->value( 'id' ) + * ->label( 'name' ) + * ) + * ``` + * + * @example + * Get a list of options with custom ordering + * ```php + * Field::inst( 'users.site' ) + * ->options( Options::inst() + * ->table( 'sites' ) + * ->value( 'id' ) + * ->label( 'name' ) + * ->order( 'name DESC' ) + * ) + * ``` + * + * @example + * Get a list of options showing the id and name in the label + * ```php + * Field::inst( 'users.site' ) + * ->options( Options::inst() + * ->table( 'sites' ) + * ->value( 'id' ) + * ->label( [ 'name', 'id' ] ) + * ->render( function ( $row ) { + * return $row['name'].' ('.$row['id'].')'; + * } ) + * ) + * ``` + */ +class Options extends DataTables\Ext { + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private parameters + */ + + /** @var string Table to get the information from */ + private $_table = null; + + /** @var string Column name containing the value */ + private $_value = null; + + /** @var string[] Column names for the label(s) */ + private $_label = array(); + + /** Information for left join */ + private $_leftJoin = array(); + + /** @var integer Row limit */ + private $_limit = null; + + /** @var callable Callback function to do rendering of labels */ + private $_renderer = null; + + /** @var callback Callback function to add where conditions */ + private $_where = null; + + /** @var string ORDER BY clause */ + private $_order = null; + + private $_manualAdd = array(); + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + /** + * Add extra options to the list, in addition to any obtained from the database + * + * @param string $label The label to use for the option + * @param string|null $value Value for the option. If not given, the label will be used + * @return Options Self for chaining + */ + public function add ( $label, $value=null ) + { + if ( $value === null ) { + $value = $label; + } + + $this->_manualAdd[] = array( + 'label' => $label, + 'value' => $value + ); + + return $this; + } + + /** + * Get / set the column(s) to use as the label value of the options + * + * @param null|string|string[] $_ null to get the current value, string or + * array to get. + * @return Options|string[] Self if setting for chaining, array of values if + * getting. + */ + public function label ( $_=null ) + { + if ( $_ === null ) { + return $this; + } + else if ( is_string($_) ) { + $this->_label = array( $_ ); + } + else { + $this->_label = $_; + } + + return $this; + } + + /** + * Set up a left join operation for the options + * + * @param string $table to get the information from + * @param string $field1 the first field to get the information from + * @param string $operator the operation to perform on the two fields + * @param string $field2 the second field to get the information from + * @return self + */ + public function leftJoin ( $table, $field1, $operator, $field2 ) + { + $this->_leftJoin[] = array( + "table" => $table, + "field1" => $field1, + "field2" => $field2, + "operator" => $operator + ); + + return $this; + } + + /** + * Get / set the LIMIT clause to limit the number of records returned. + * + * @param null|number $_ Number of rows to limit the result to + * @return Options|string[] Self if setting for chaining, limit if getting. + */ + public function limit ( $_=null ) + { + return $this->_getSet( $this->_limit, $_ ); + } + + /** + * Get / set the ORDER BY clause to use in the SQL. If this option is not + * provided the ordering will be based on the rendered output, either + * numerically or alphabetically based on the data returned by the renderer. + * + * @param null|string $_ String to set, null to get current value + * @return Options|string Self if setting for chaining, string if getting. + */ + public function order ( $_=null ) + { + return $this->_getSet( $this->_order, $_ ); + } + + /** + * Get / set the label renderer. The renderer can be used to combine + * multiple database columns into a single string that is shown as the label + * to the end user in the list of options. + * + * @param null|callable $_ Function to set, null to get current value + * @return Options|callable Self if setting for chaining, callable if + * getting. + */ + public function render ( $_=null ) + { + return $this->_getSet( $this->_renderer, $_ ); + } + + /** + * Get / set the database table from which to gather the options for the + * list. + * + * @param null|string $_ String to set, null to get current value + * @return Options|string Self if setting for chaining, string if getting. + */ + public function table ( $_=null ) + { + return $this->_getSet( $this->_table, $_ ); + } + + /** + * Get / set the column name to use for the value in the options list. This + * would normally be the primary key for the table. + * + * @param null|string $_ String to set, null to get current value + * @return Options|string Self if setting for chaining, string if getting. + */ + public function value ( $_=null ) + { + return $this->_getSet( $this->_value, $_ ); + } + + /** + * Get / set the method to use for a WHERE condition if it is to be + * applied to the query to get the options. + * + * @param null|callable $_ Function to set, null to get current value + * @return Options|callable Self if setting for chaining, callable if + * getting. + */ + public function where ( $_=null ) + { + return $this->_getSet( $this->_where, $_ ); + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Internal methods + */ + + /** + * Execute the options (i.e. get them) + * + * @param Database $db Database connection + * @return array List of options + * @internal + */ + public function exec ( $db ) + { + $label = $this->_label; + $value = $this->_value; + $formatter = $this->_renderer; + + // Create a list of the fields that we need to get from the db + $fields = array(); + $fields[] = $value; + $fields = array_merge( $fields, $label ); + + // We need a default formatter if one isn't provided + if ( ! $formatter ) { + $formatter = function ( $row ) use ( $label ) { + $a = array(); + + for ( $i=0, $ien=count($label) ; $i<$ien ; $i++ ) { + $a[] = $row[ $label[$i] ]; + } + + return implode(' ', $a); + }; + } + + // Get the data + $q = $db + ->query('select') + ->distinct( true ) + ->table( $this->_table ) + ->left_join($this->_leftJoin) + ->get( $fields ) + ->where( $this->_where ); + + if ( $this->_order ) { + // For cases where we are ordering by a field which isn't included in the list + // of fields to display, we need to add the ordering field, due to the + // select distinct. + $orderFields = explode( ',', $this->_order ); + + for ( $i=0, $ien=count($orderFields) ; $i<$ien ; $i++ ) { + $field = strtolower( $orderFields[$i] ); + $field = str_replace( ' asc', '', $field ); + $field = str_replace( ' desc', '', $field ); + $field = trim( $field ); + + if ( ! in_array( $field, $fields ) ) { + $q->get( $field ); + } + } + + $q->order( $this->_order ); + } + + if ( $this->_limit !== null ) { + $q->limit( $this->_limit ); + } + + $rows = $q + ->exec() + ->fetchAll(); + + // Create the output array + $out = array(); + + for ( $i=0, $ien=count($rows) ; $i<$ien ; $i++ ) { + $out[] = array( + "label" => $formatter( $rows[$i] ), + "value" => $rows[$i][$value] + ); + } + + // Stick on any extra manually added options + if ( count( $this->_manualAdd ) ) { + $out = array_merge( $out, $this->_manualAdd ); + } + + // Only sort if there was no SQL order field + if ( ! $this->_order ) { + usort( $out, function ( $a, $b ) { + return is_numeric($a['label']) && is_numeric($b['label']) ? + ($a['label']*1) - ($b['label']*1) : + strcmp( $a['label'], $b['label'] ); + } ); + } + + return $out; + } +} + \ No newline at end of file diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/SearchBuilderOptions.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/SearchBuilderOptions.php.txt new file mode 100644 index 00000000..d6b0f63e --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/SearchBuilderOptions.php.txt @@ -0,0 +1,335 @@ +options()} method. + * + * @example + * Get a list of options from the `sites` table + * ```php + * Field::inst( 'users.site' ) + * ->options( Options::inst() + * ->table( 'sites' ) + * ->value( 'id' ) + * ->label( 'name' ) + * ) + * ``` + * + * @example + * Get a list of options with custom ordering + * ```php + * Field::inst( 'users.site' ) + * ->options( Options::inst() + * ->table( 'sites' ) + * ->value( 'id' ) + * ->label( 'name' ) + * ->order( 'name DESC' ) + * ) + * ``` + * + * @example + * Get a list of options showing the id and name in the label + * ```php + * Field::inst( 'users.site' ) + * ->options( Options::inst() + * ->table( 'sites' ) + * ->value( 'id' ) + * ->label( [ 'name', 'id' ] ) + * ->render( function ( $row ) { + * return $row['name'].' ('.$row['id'].')'; + * } ) + * ) + * ``` + */ +class SearchBuilderOptions extends DataTables\Ext { + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private parameters + */ + + /** @var string Table to get the information from */ + private $_table = null; + + /** @var string Column name containing the value */ + private $_value = null; + + /** @var string[] Column names for the label(s) */ + private $_label = array(); + + /** @var string[] Column names for left join */ + private $_leftJoin = array(); + + /** @var callable Callback function to do rendering of labels */ + private $_renderer = null; + + /** @var callback Callback function to add where conditions */ + private $_where = null; + + /** @var string ORDER BY clause */ + private $_order = null; + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + /** + * Get / set the column(s) to use as the label value of the options + * + * @param null|string|string[] $_ null to get the current value, string or + * array to get. + * @return Options|string[] Self if setting for chaining, array of values if + * getting. + */ + public function label ( $_=null ) + { + if ( $_ === null ) { + return $this; + } + else if ( is_string($_) ) { + $this->_label = array( $_ ); + } + else { + $this->_label = $_; + } + + return $this; + } + + /** + * Get / set the ORDER BY clause to use in the SQL. If this option is not + * provided the ordering will be based on the rendered output, either + * numerically or alphabetically based on the data returned by the renderer. + * + * @param null|string $_ String to set, null to get current value + * @return Options|string Self if setting for chaining, string if getting. + */ + public function order ( $_=null ) + { + return $this->_getSet( $this->_order, $_ ); + } + + /** + * Get / set the label renderer. The renderer can be used to combine + * multiple database columns into a single string that is shown as the label + * to the end user in the list of options. + * + * @param null|callable $_ Function to set, null to get current value + * @return Options|callable Self if setting for chaining, callable if + * getting. + */ + public function render ( $_=null ) + { + return $this->_getSet( $this->_renderer, $_ ); + } + + /** + * Get / set the database table from which to gather the options for the + * list. + * + * @param null|string $_ String to set, null to get current value + * @return Options|string Self if setting for chaining, string if getting. + */ + public function table ( $_=null ) + { + return $this->_getSet( $this->_table, $_ ); + } + + /** + * Get / set the column name to use for the value in the options list. This + * would normally be the primary key for the table. + * + * @param null|string $_ String to set, null to get current value + * @return Options|string Self if setting for chaining, string if getting. + */ + public function value ( $_=null ) + { + return $this->_getSet( $this->_value, $_ ); + } + + /** + * Get / set the method to use for a WHERE condition if it is to be + * applied to the query to get the options. + * + * @param null|callable $_ Function to set, null to get current value + * @return Options|callable Self if setting for chaining, callable if + * getting. + */ + public function where ( $_=null ) + { + return $this->_getSet( $this->_where, $_ ); + } + + /** + * Get / set the array values used for a leftJoin condition if it is to be + * applied to the query to get the options. + * + * @param string $table to get the information from + * @param string $field1 the first field to get the information from + * @param string $operator the operation to perform on the two fields + * @param string $field2 the second field to get the information from + * @return self + */ + public function leftJoin ( $table, $field1, $operator, $field2 ) + { + $this->_leftJoin[] = array( + "table" => $table, + "field1" => $field1, + "field2" => $field2, + "operator" => $operator + ); + + return $this; + } + + /** + * Adds all of the where conditions to the desired query + * + * @param string $query the query being built + * @return self + */ + private function _get_where ( $query ) + { + for ( $i=0 ; $i_where) ; $i++ ) { + if ( is_callable( $this->_where[$i] ) ) { + $this->_where[$i]( $query ); + } + else { + $query->where( + $this->_where[$i]['key'], + $this->_where[$i]['value'], + $this->_where[$i]['op'] + ); + } + } + return $this; + } + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Internal methods + */ + + /** + * Execute the options (i.e. get them) + * + * @param Database $db Database connection + * @return array List of options + * @internal + */ + public function exec ( $field, $editor, $http, $fields, $leftJoinIn ) + { + // If the value is not yet set then set the variable to be the field name + if ( $this->_value == null) { + $value = $field->dbField(); + } + else { + $value = $this->_value; + } + + $readTable = $editor->readTable(); + + // If the table is not yet set then set the table variable to be the same as editor + // This is not taking a value from the SearchBuilderOptions instance as the table should be defined in value/label. This throws up errors if not. + if($this->_table !== null) { + $table = $this->_table; + } + else if(count($readTable) > 0) { + $table = $readTable; + } + else { + $table = $editor->table(); + } + + // If the label value has not yet been set then just set it to be the same as value + if ( $this->_label == null ) { + $label = $value; + } + else { + $label = $this->_label[0]; + } + + // Set the database from editor + $db = $editor->db(); + + $formatter = $this->_renderer; + + // We need a default formatter if one isn't provided + if ( ! $formatter ) { + $formatter = function ( $str ) { + return $str; + }; + } + + // Set up the join variable so that it will fit nicely later + $leftJoin = gettype($this->_leftJoin) === 'array' ? + $this->_leftJoin : + array($this->_leftJoin); + + foreach($leftJoinIn as $lj) { + $found = false; + foreach($leftJoin as $lje) { + if($lj['table'] === $lje['table']) { + $found = true; + } + } + if(!$found) { + array_push($leftJoin, $lj); + } + } + + // Set the query to get the current counts for viewTotal + $query = $db + ->query('select') + ->table( $table ) + ->left_join($leftJoin); + + if ( $field->apply('get') && $field->getValue() === null ) { + $query->get($value." as value", $label." as label"); + $query->group_by( $value); + } + + $res = $query + ->exec() + ->fetchAll(); + + // Create the output array + $out = array(); + + for( $j=0 ; $j $res[$j]['value'], + "label" => $res[$j]['label'] + ); + } + + // Only sort if there was no SQL order field + if ( ! $this->_order ) { + usort( $out, function ( $a, $b ) { + return is_numeric($a['label']) && is_numeric($b['label']) ? + ($a['label']*1) - ($b['label']*1) : + strcmp( $a['label'], $b['label'] ); + } ); + } + + return $out; + } +} + \ No newline at end of file diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/SearchPaneOptions.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/SearchPaneOptions.php.txt new file mode 100644 index 00000000..e209111f --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/SearchPaneOptions.php.txt @@ -0,0 +1,467 @@ +options()} method. + * + * @example + * Get a list of options from the `sites` table + * ```php + * Field::inst( 'users.site' ) + * ->options( Options::inst() + * ->table( 'sites' ) + * ->value( 'id' ) + * ->label( 'name' ) + * ) + * ``` + * + * @example + * Get a list of options with custom ordering + * ```php + * Field::inst( 'users.site' ) + * ->options( Options::inst() + * ->table( 'sites' ) + * ->value( 'id' ) + * ->label( 'name' ) + * ->order( 'name DESC' ) + * ) + * ``` + * + * @example + * Get a list of options showing the id and name in the label + * ```php + * Field::inst( 'users.site' ) + * ->options( Options::inst() + * ->table( 'sites' ) + * ->value( 'id' ) + * ->label( [ 'name', 'id' ] ) + * ->render( function ( $row ) { + * return $row['name'].' ('.$row['id'].')'; + * } ) + * ) + * ``` + */ +class SearchPaneOptions extends DataTables\Ext { + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Private parameters + */ + + /** @var string Table to get the information from */ + private $_table = null; + + /** @var string Column name containing the value */ + private $_value = null; + + /** @var string[] Column names for the label(s) */ + private $_label = array(); + + /** @var string[] Column names for left join */ + private $_leftJoin = array(); + + /** @var callable Callback function to do rendering of labels */ + private $_renderer = null; + + /** @var callback Callback function to add where conditions */ + private $_where = null; + + /** @var string ORDER BY clause */ + private $_order = null; + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + /** + * Get / set the column(s) to use as the label value of the options + * + * @param null|string|string[] $_ null to get the current value, string or + * array to get. + * @return Options|string[] Self if setting for chaining, array of values if + * getting. + */ + public function label ( $_=null ) + { + if ( $_ === null ) { + return $this; + } + else if ( is_string($_) ) { + $this->_label = array( $_ ); + } + else { + $this->_label = $_; + } + + return $this; + } + + /** + * Get / set the ORDER BY clause to use in the SQL. If this option is not + * provided the ordering will be based on the rendered output, either + * numerically or alphabetically based on the data returned by the renderer. + * + * @param null|string $_ String to set, null to get current value + * @return Options|string Self if setting for chaining, string if getting. + */ + public function order ( $_=null ) + { + return $this->_getSet( $this->_order, $_ ); + } + + /** + * Get / set the label renderer. The renderer can be used to combine + * multiple database columns into a single string that is shown as the label + * to the end user in the list of options. + * + * @param null|callable $_ Function to set, null to get current value + * @return Options|callable Self if setting for chaining, callable if + * getting. + */ + public function render ( $_=null ) + { + return $this->_getSet( $this->_renderer, $_ ); + } + + /** + * Get / set the database table from which to gather the options for the + * list. + * + * @param null|string $_ String to set, null to get current value + * @return Options|string Self if setting for chaining, string if getting. + */ + public function table ( $_=null ) + { + return $this->_getSet( $this->_table, $_ ); + } + + /** + * Get / set the column name to use for the value in the options list. This + * would normally be the primary key for the table. + * + * @param null|string $_ String to set, null to get current value + * @return Options|string Self if setting for chaining, string if getting. + */ + public function value ( $_=null ) + { + return $this->_getSet( $this->_value, $_ ); + } + + /** + * Get / set the method to use for a WHERE condition if it is to be + * applied to the query to get the options. + * + * @param null|callable $_ Function to set, null to get current value + * @return Options|callable Self if setting for chaining, callable if + * getting. + */ + public function where ( $_=null ) + { + return $this->_getSet( $this->_where, $_ ); + } + + /** + * Get / set the array values used for a leftJoin condition if it is to be + * applied to the query to get the options. + * + * @param string $table to get the information from + * @param string $field1 the first field to get the information from + * @param string $operator the operation to perform on the two fields + * @param string $field2 the second field to get the information from + * @return self + */ + public function leftJoin ( $table, $field1, $operator, $field2 ) + { + $this->_leftJoin[] = array( + "table" => $table, + "field1" => $field1, + "field2" => $field2, + "operator" => $operator + ); + + return $this; + } + + /** + * Adds all of the where conditions to the desired query + * + * @param string $query the query being built + * @return self + */ + private function _get_where ( $query ) + { + for ( $i=0 ; $i_where) ; $i++ ) { + if ( is_callable( $this->_where[$i] ) ) { + $this->_where[$i]( $query ); + } + else { + $query->where( + $this->_where[$i]['key'], + $this->_where[$i]['value'], + $this->_where[$i]['op'] + ); + } + } + return $this; + } + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Internal methods + */ + + /** + * Execute the options (i.e. get them) + * + * @param Database $db Database connection + * @return array List of options + * @internal + */ + public function exec ( $field, $editor, $http, $fields, $leftJoinIn ) + { + $db = $editor->db(); + $readTable = $editor->readTable(); + $filteringActive = isset($http['searchPanes']); + $viewCount = isset($http['searchPanes_options']) + ? filter_var($http['searchPanes_options']['viewCount'], FILTER_VALIDATE_BOOLEAN) + : true; + $viewTotal = isset($http['searchPanes_options']) + ? filter_var($http['searchPanes_options']['viewTotal'], FILTER_VALIDATE_BOOLEAN) + : false; + $cascade = isset($http['searchPanes_options']) + ? filter_var($http['searchPanes_options']['cascade'], FILTER_VALIDATE_BOOLEAN) + : false; + $entries = null; + + // If the value is not yet set then set the variable to be the field name + $value = $this->_value == null + ? $field->dbField() + : $this->_value; + + + // If the table is not yet set then set the table variable to be the same as editor + // This is not taking a value from the SearchPaneOptions instance as the table should be defined in value/label. This throws up errors if not. + if($this->_table !== null) { + $table = $this->_table; + } + else if(count($readTable) > 0) { + $table = $readTable; + } + else { + $table = $editor->table(); + } + + // If the label value has not yet been set then just set it to be the same as value + $label = $this->_label == null + ? $value + : $this->_label[0]; + + $formatter = $this->_renderer + ? $this->_renderer + : function ( $str ) { + return $str; + }; + + // Set up the join variable so that it will fit nicely later + $leftJoin = gettype($this->_leftJoin) === 'array' ? + $this->_leftJoin : + array($this->_leftJoin); + + foreach($leftJoinIn as $lj) { + $found = false; + + foreach($leftJoin as $lje) { + if($lj['table'] === $lje['table']) { + $found = true; + } + } + + if(!$found) { + array_push($leftJoin, $lj); + } + } + + // Get the data for the pane options + $q = $db + ->query('select') + ->distinct(true) + ->table( $table ) + ->get( $label." as label", $value." as value" ) + ->left_join($leftJoin) + ->group_by( $value ) + ->where( $this->_where ); + + // If not cascading, then the total and count must be the same + if ($viewTotal) { + $q->get("COUNT(*) as total"); + } + + if ( $this->_order ) { + // For cases where we are ordering by a field which isn't included in the list + // of fields to display, we need to add the ordering field, due to the + // select distinct. + $orderFields = explode( ',', $this->_order ); + + for ( $i=0, $ien=count($orderFields) ; $i<$ien ; $i++ ) { + $orderField = strtolower( $orderFields[$i] ); + $orderField = str_replace( ' asc', '', $orderField ); + $orderField = str_replace( ' desc', '', $orderField ); + $orderField = trim( $orderField ); + + if ( ! in_array( $orderField, $fields ) ) { + $q->get( $orderField ); + } + } + + $q->order( $this->_order ); + } + + $rows = $q + ->exec() + ->fetchAll(); + + // Remove any filtering entries that don't exist in the database (values might have changed) + if (isset($http['searchPanes'][$field->name()])) { + $values = array_column($rows, 'value'); + $selected = $http['searchPanes'][$field->name()]; + + for ($i=0 ; $iname()], $i, 1); + } + } + } + + // Apply filters to cascade tables + if ($viewCount || $cascade) { + $query = $db + ->query('select') + ->distinct(true) + ->table($table) + ->left_join($leftJoin); + + if ( $field->apply('get') && $field->getValue() === null ) { + $query->get($value." as value"); + $query->group_by($value); + + // We viewTotal is enabled, we need to do a count to get the number of records, + // If it isn't we still need to know it exists, but don't care about the cardinality + if ($viewCount) { + $query->get("COUNT(*) as count"); + } + else { + $query->get("(1) as count"); + } + } + + // Construct the where queries based upon the options selected by the user + foreach ($fields as $fieldOpt) { + $add = false; + $fieldName = $fieldOpt->name(); + + // If there is a last value set then a slightly different set of results is required for cascade + // That panes results are based off of the results when only considering the selections of all of the others + if (isset($http['searchPanesLast']) && $field->name() === $http['searchPanesLast']) { + if (isset($http['searchPanes'][$fieldName]) && $fieldName !== $http['searchPanesLast']) { + $add = true; + } + } + else if (isset($http['searchPanes']) && isset($http['searchPanes'][$fieldName])) { + $add = true; + } + + if ($add) { + $query->where( function ($q) use ($fieldOpt, $http, $fieldName) { + for($j=0, $jen=count($http['searchPanes'][$fieldName]); $j < $jen ; $j++) { + $q->or_where( + $fieldOpt->dbField(), + isset($http['searchPanes_null'][$fieldName][$j]) + ? null + : $http['searchPanes'][$fieldName][$j], + '=' + ); + } + }); + } + } + + $entriesRows = $query + ->exec() + ->fetchAll(); + + // Key by the value for fast lookup + $entriesKeys = array_column($entriesRows, 'value'); + $entries = array_combine($entriesKeys, $entriesRows); + } + + $out = array(); + + for ( $i=0, $ien=count($rows) ; $i<$ien ; $i++ ) { + $row = $rows[$i]; + $value = $row['value']; + $total = isset($row['total']) ? $row['total'] : null; + $count = $total; + + if ($entries !== null) { + $count = isset($entries[$value]) && isset($entries[$value]['count']) + ? $entries[$value]['count'] + : 0; + + // For when viewCount is enabled and viewTotal is not + // the total needs to be the same as the count! + if ($total === null) { + $total = $count; + } + } + + $out[] = array( + "label" => $formatter($row['label']), + "total" => $total, + "value" => $value, + "count" => $count + ); + } + + // Only sort if there was no SQL order field + if ( ! $this->_order ) { + usort( $out, function ( $a, $b ) { + $aLabel = $a['label']; + $bLabel = $b['label']; + + if ($aLabel === null) { + $aLabel = ''; + } + + if ($bLabel === null) { + $bLabel = ''; + } + + return is_numeric($aLabel) && is_numeric($bLabel) ? + ($aLabel*1) - ($bLabel*1) : + strcmp( $aLabel, $bLabel ); + } ); + } + + return $out; + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Upload.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Upload.php.txt new file mode 100644 index 00000000..4862e1dd --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Upload.php.txt @@ -0,0 +1,735 @@ +upload()} method. When Editor detects a file upload for that file the + * information provided for this instance is executed. + * + * The configuration is primarily driven through the {@see Upload->db()} and + * {@see Upload->action()} methods: + * + * * {@see Upload->db()} Describes how information about the uploaded file is to be + * stored on the database. + * * {@see Upload->action()} Describes where the file should be stored on the file system + * and provides the option of specifying a custom action when a file is + * uploaded. + * + * Both methods are optional - you can store the file on the server using the + * {@see Upload->db()} method only if you want to store the file in the database, or if + * you don't want to store relational data on the database us only + * {@see Upload->action()}. However, the majority of the time it is best to use + * both - store information about the file on the database for fast retrieval (using a + * {@see Editor->leftJoin()} for example) and the file on the file system for direct + * web access. + * + * @example + * Store information about a file in a table called `files` and the actual + * file in an `uploads` directory. + * ``` + * Field::inst( 'imageId' ) + * ->upload( + * Upload::inst( $_SERVER['DOCUMENT_ROOT'].'/uploads/__ID__.__EXTN__' ) + * ->db( 'files', 'id', array( + * 'webPath' => Upload::DB_WEB_PATH, + * 'fileName' => Upload::DB_FILE_NAME, + * 'fileSize' => Upload::DB_FILE_SIZE, + * 'systemPath' => Upload::DB_SYSTEM_PATH + * ) ) + * ->allowedExtensions( array( 'png', 'jpg' ), "Please upload an image file" ) + * ) + * ``` + * + * @example + * As above, but with PHP 5.4 (which allows chaining from new instances of a + * class) + * ``` + * newField( 'imageId' ) + * ->upload( + * new Upload( $_SERVER['DOCUMENT_ROOT'].'/uploads/__ID__.__EXTN__' ) + * ->db( 'files', 'id', array( + * 'webPath' => Upload::DB_WEB_PATH, + * 'fileName' => Upload::DB_FILE_NAME, + * 'fileSize' => Upload::DB_FILE_SIZE, + * 'systemPath' => Upload::DB_SYSTEM_PATH + * ) ) + * ->allowedExtensions( array( 'png', 'jpg' ), "Please upload an image file" ) + * ) + * ``` + */ +class Upload extends DataTables\Ext { + /* * * * * * * * * * * * * * * * * * * * * * * * * + * Constants + */ + + /** Database value option (`Db()`) - File content. This should be written to + * a blob. Typically this should be avoided and the file saved on the file + * system, but there are cases where it can be useful to store the file in + * the database. + */ + const DB_CONTENT = 'editor-content'; + + /** Database value option (`Db()`) - Content type */ + const DB_CONTENT_TYPE = 'editor-contentType'; + + /** Database value option (`Db()`) - File extension */ + const DB_EXTN = 'editor-extn'; + + /** Database value option (`Db()`) - File name (with extension) */ + const DB_FILE_NAME = 'editor-fileName'; + + /** Database value option (`Db()`) - File size (bytes) */ + const DB_FILE_SIZE = 'editor-fileSize'; + + /** Database value option (`Db()`) - MIME type */ + const DB_MIME_TYPE = 'editor-mimeType'; + + /** Database value option (`Db()`) - Full system path to the file */ + const DB_SYSTEM_PATH = 'editor-systemPath'; + + /** Database value option (`Db()`) - HTTP path to the file. This is derived + * from the system path by removing `$_SERVER['DOCUMENT_ROOT']`. If your + * images live outside of the document root a custom value would be to be + * used. + */ + const DB_WEB_PATH = 'editor-webPath'; + + /** Read from the database - don't write to it + */ + const DB_READ_ONLY = 'editor-readOnly'; + + + /* * * * * * * * * * * * * * * * * * * * * * * * * + * Private parameters + */ + + private $_action = null; + private $_dbCleanCallback = null; + private $_dbCleanTableField = null; + private $_dbTable = null; + private $_dbPKey = null; + private $_dbFields = null; + private $_dbFormat = null; + private $_extns = null; + private $_extnError = null; + private $_error = null; + private $_mode = 0644; + private $_validators = array(); + private $_where = array(); + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Constructor + */ + + /** + * Upload instance constructor + * @param string|callable $action Action to take on upload - this is applied + * directly to {@see Upload->action()}. + */ + function __construct( $action=null ) + { + if ( $action ) { + $this->action( $action ); + } + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * + * Public methods + */ + + /** + * Set the action to take when a file is uploaded. This can be either of: + * + * * A string - the value given is the full system path to where the + * uploaded file is written to. The value given can include three "macros" + * which are replaced by the script dependent on the uploaded file: + * * `__EXTN__` - the file extension + * * `__NAME__` - the uploaded file's name (including the extension) + * * `__ID__` - Database primary key value if the {@see Upload->db()} method is + * used. + * * A closure - if a function is given the responsibility of what to do + * with the uploaded file is transferred to this function. That will + * typically involve writing it to the file system so it can be used + * later. + * + * @param string|callable $action Action to take - see description above. + * @return self Current instance, used for chaining + */ + public function action ( $action ) + { + $this->_action = $action; + + return $this; + } + + + /** + * An array of valid file extensions that can be uploaded. This is for + * simple validation that the file is of the expected type - for example you + * might use `[ 'png', 'jpg', 'jpeg', 'gif' ]` for images. The check is + * case-insensitive. If no extensions are given, no validation is performed + * on the file extension. + * + * @param string[] $extn List of file extensions that are allowable for + * the upload + * @param string $error Error message if a file is uploaded that doesn't + * match the valid list of extensions. + * @return self Current instance, used for chaining + * @deprecated Use Validate::fileExtensions + */ + public function allowedExtensions ( $extn, $error="This file type cannot be uploaded" ) + { + $this->_extns = $extn; + $this->_extnError = $error; + + return $this; + } + + + /** + * Database configuration method. When used, this method will tell Editor + * what information you want written to a database on file upload, should + * you wish to store relational information about your file on the database + * (this is generally recommended). + * + * @param string $table The name of the table where the file information + * should be stored + * @param string $pkey Primary key column name. The `Upload` class + * requires that the database table have a single primary key so each + * row can be uniquely identified. + * @param array $fields A list of the fields to be written to on upload. + * The property names are the database columns and the values can be + * defined by the constants of this class. The value can also be a + * string or a closure function if you wish to send custom information + * to the database. + * @param callable Formatting function that can change the data obtained + * from the database. Only gets a single parameter passed in - the + * database row for the file that is read. + * @return self Current instance, used for chaining + */ + public function db ( $table, $pkey, $fields, $format=null ) + { + $this->_dbTable = $table; + $this->_dbPKey = $pkey; + $this->_dbFields = $fields; + $this->_dbFormat = $format; + + return $this; + } + + + /** + * Set a callback function that is used to remove files which no longer have + * a reference in a source table. + * + * @param callable $callback Function that will be executed on clean. It is + * given an array of information from the database about the orphaned + * rows, and can return true to indicate that the rows should be + * removed from the database. Any other return value (including none) + * will result in the records being retained. + * @return self Current instance, used for chaining + */ + public function dbClean( $tableField, $callback=null ) + { + // Argument swapping + if ( $callback === null ) { + $callback = $tableField; + $tableField = null; + } + + $this->_dbCleanCallback = $callback; + $this->_dbCleanTableField = $tableField; + + return $this; + } + + + /** + * Set the permissions on the file after it has been uploaded using + * chmod. + */ + public function mode( $m ) { + $this->_mode = $m; + + return $this; + } + + + /** + * Add a validation method to check file uploads. Multiple validators can be + * added by calling this method multiple times - they will be executed in + * sequence when a file has been uploaded. + * + * @param callable $fn Validation function. A PHP `$_FILES` parameter is + * passed in for the uploaded file and the return is either a string + * (validation failed and error message), or `null` (validation passed). + * @return self Current instance, used for chaining + */ + public function validator ( $fn ) + { + $this->_validators[] = $fn; + + return $this; + } + + + /** + * Add a condition to the data to be retrieved from the database. This + * must be given as a function to be executed (usually anonymous) and + * will be passed in a single argument, the `Query` object, to which + * conditions can be added. Multiple calls to this method can be made. + * + * @param callable $fn Where function. + * @return self Current instance, used for chaining + */ + public function where ( $fn ) + { + $this->_where[] = $fn; + + return $this; + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * + * Internal methods + */ + + /** + * Get database information data from the table + * + * @param \DataTables\Database $db Database + * @param number[] [$ids=null] Limit to a specific set of ids + * @return array Database information + * @internal + */ + public function data ( $db, $ids=null ) + { + if ( ! $this->_dbTable ) { + return null; + } + + // Select the details requested, for the columns requested + $q = $db + ->query( 'select' ) + ->table( $this->_dbTable ) + ->get( $this->_dbPKey ); + + foreach ( $this->_dbFields as $column => $prop ) { + if ( $prop !== self::DB_CONTENT ) { + $q->get( $column ); + } + } + + if ( $ids !== null ) { + $q->where_in( $this->_dbPKey, $ids ); + } + + for ( $i=0, $ien=count($this->_where) ; $i<$ien ; $i++ ) { + $q->where( $this->_where[$i] ); + } + + $result = $q->exec()->fetchAll(); + $out = array(); + + for ( $i=0, $ien=count($result) ; $i<$ien ; $i++ ) { + if ($this->_dbFormat) { + $this->_dbFormat( $result[$i] ); + } + + $out[ $result[$i][ $this->_dbPKey ] ] = $result[$i]; + } + + return $out; + } + + + /** + * Clean the database + * @param \DataTables\Editor $editor Calling Editor instance + * @param Field $field Host field + * @internal + */ + public function dbCleanExec ( $editor, $field ) + { + // Database and file system clean up BEFORE adding the new file to + // the db, otherwise it will be removed immediately + $tables = $editor->table(); + $this->_dbClean( $editor->db(), $tables[0], $field->dbField() ); + } + + + /** + * Get the set error message + * + * @return string Class error + * @internal + */ + public function error () + { + return $this->_error; + } + + + /** + * Execute an upload + * + * @param \DataTables\Editor $editor Calling Editor instance + * @return int Primary key value + * @internal + */ + public function exec ( $editor ) + { + $id = null; + $upload = $_FILES['upload']; + + // Validation - PHP standard validation + if ( $upload['error'] !== UPLOAD_ERR_OK ) { + if ( $upload['error'] === UPLOAD_ERR_INI_SIZE ) { + $this->_error = "File exceeds maximum file upload size"; + } + else { + $this->_error = "There was an error uploading the file (".$upload['error'].")"; + } + return false; + } + + // Validation - acceptable file extensions + if ( is_array( $this->_extns ) ) { + $extn = pathinfo($upload['name'], PATHINFO_EXTENSION); + + if ( in_array( strtolower($extn), array_map( 'strtolower', $this->_extns ) ) === false ) { + $this->_error = $this->_extnError; + return false; + } + } + + // Validation - custom callback + for ( $i=0, $ien=count($this->_validators) ; $i<$ien ; $i++ ) { + $res = $this->_validators[$i]( $upload ); + + if ( is_string( $res ) ) { + $this->_error = $res; + return false; + } + } + + // Database + if ( $this->_dbTable ) { + foreach ( $this->_dbFields as $column => $prop ) { + // We can't know what the path is, if it has moved into place + // by an external function - throw an error if this does happen + if ( ! is_string( $this->_action ) && + ($prop === self::DB_SYSTEM_PATH || $prop === self::DB_WEB_PATH ) + ) { + $this->_error = "Cannot set path information in database ". + "if a custom method is used to save the file."; + + return false; + } + } + + // Commit to the database + $id = $this->_dbExec( $upload, $editor->db() ); + } + + // Perform file system actions + return $this->_actionExec( $upload, $id ); + } + + + /** + * Get the primary key column for the table + * + * @return string Primary key column name + * @internal + */ + public function pkey () + { + return $this->_dbPKey; + } + + + /** + * Get the db table name + * + * @return string DB table name + * @internal + */ + public function table () + { + return $this->_dbTable; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * + * Private methods + */ + + /** + * Execute the configured action for the upload + * + * @param array $upload $_FILES['upload'] + * @param int $id Primary key value + * @return int File identifier - typically the primary key + */ + private function _actionExec ( $upload, $id ) + { + if ( ! is_string( $this->_action ) ) { + // Custom function + $action = $this->_action; + return $action( $upload, $id ); + } + + // Default action - move the file to the location specified by the + // action string + $to = $this->_path( $upload['name'], $id ); + $res = rename( $upload['tmp_name'], $to ); + + if ( $res === false ) { + $this->_error = "An error occurred while moving the uploaded file."; + return false; + } + + if ($this->_mode) { + chmod($to, $this->_mode); + } + + return $id !== null ? + $id : + $to; + } + + /** + * Perform the database clean by first getting the information about the + * orphaned rows and then calling the callback function. The callback can + * then instruct the rows to be removed through the return value. + * + * @param \DataTables\Database $db Database instance + * @param string $editorTable Editor Editor instance table name + * @param string $fieldName Host field's name + */ + private function _dbClean ( $db, $editorTable, $fieldName ) + { + $callback = $this->_dbCleanCallback; + + if ( ! $this->_dbTable || ! $callback ) { + return; + } + + // If there is a table / field that we should use to check if the value + // is in use, then use that. Otherwise we'll try to use the information + // from the Editor / Field instance. + if ( $this->_dbCleanTableField ) { + $fieldName = $this->_dbCleanTableField; + } + + $a = explode('.', $fieldName); + if ( count($a) === 1 ) { + $table = $editorTable; + $field = $a[0]; + } + else if ( count($a) === 2 ) { + $table = $a[0]; + $field = $a[1]; + } + else { + $table = $a[1]; + $field = $a[2]; + } + + // Select the details requested, for the columns requested + $q = $db + ->query( 'select' ) + ->table( $this->_dbTable ) + ->get( $this->_dbPKey ); + + foreach ( $this->_dbFields as $column => $prop ) { + if ( $prop !== self::DB_CONTENT ) { + $q->get( $column ); + } + } + + $q->where( $this->_dbPKey, '(SELECT '.$field.' FROM '.$table.' WHERE '.$field.' IS NOT NULL)', 'NOT IN', false ); + + $data = $q->exec()->fetchAll(); + + if ( count( $data ) === 0 ) { + return; + } + + $result = $callback( $data ); + + // Delete the selected rows, iff the developer says to do so with the + // returned value (i.e. acknowledge that the files have be removed from + // the file system) + if ( $result === true ) { + $qDelete = $db + ->query( 'delete' ) + ->table( $this->_dbTable ); + + for ( $i=0, $ien=count( $data ) ; $i<$ien ; $i++ ) { + $qDelete->or_where( $this->_dbPKey, $data[$i][ $this->_dbPKey ] ); + } + + $qDelete->exec(); + } + } + + /** + * Add a record to the database for a newly uploaded file + * + * @param array $upload $_FILES['upload'] + * @param \DataTables\Database $db Database instance + * @return int Primary key value for the newly uploaded file + */ + private function _dbExec ( $upload, $db ) + { + $pathFields = array(); + $insertedId = null; + + // Insert the details requested, for the columns requested + $q = $db + ->query( 'insert' ) + ->table( $this->_dbTable ) + ->pkey( $this->_dbPKey ); + + foreach ( $this->_dbFields as $column => $prop ) { + switch ( $prop ) { + case self::DB_READ_ONLY: + break; + + case self::DB_CONTENT: + $q->set( $column, file_get_contents($upload['tmp_name']) ); + break; + + case self::DB_CONTENT_TYPE: + case self::DB_MIME_TYPE: + $finfo = finfo_open(FILEINFO_MIME); + $mime = finfo_file($finfo, $upload['tmp_name']); + finfo_close($finfo); + + $q->set( $column, $mime ); + break; + + case self::DB_EXTN: + $extn = pathinfo($upload['name'], PATHINFO_EXTENSION); + $q->set( $column, $extn ); + break; + + case self::DB_FILE_NAME: + $q->set( $column, $upload['name'] ); + break; + + case self::DB_FILE_SIZE: + $q->set( $column, $upload['size'] ); + break; + + case self::DB_SYSTEM_PATH: + $pathFields[ $column ] = self::DB_SYSTEM_PATH; + $q->set( $column, '-' ); // Use a temporary value to avoid cases + break; // where the db will reject empty values + + case self::DB_WEB_PATH: + $pathFields[ $column ] = self::DB_WEB_PATH; + $q->set( $column, '-' ); // Use a temporary value (as above) + break; + + default: + $val = $prop; + + // Callable function - execute to get the value + if ( is_callable($prop) && is_object($prop) ) { + $val = $prop( $db, $upload ); + } + + // If the primary key value was set - use that + if ( $column === $this->_dbPKey ) { + $insertedId = $val; + } + + if (is_string($val) && ! empty($val)) { + // Allow for replacement of __ID__, etc when the value is a string + $pathFields[ $column ] = $val; + $q->set( $column, '-' ); // Use a temporary value (as above) + } + else { + $q->set( $column, $val ); + } + + break; + } + } + + $res = $q->exec(); + $id = $insertedId !== null + ? $insertedId + : $res->insertId(); + + // Update the newly inserted row with the path information. We have to + // use a second statement here as we don't know in advance what the + // database schema is and don't want to prescribe that certain triggers + // etc be created. It makes it a bit less efficient but much more + // compatible + if ( count( $pathFields ) ) { + // For this to operate the action must be a string, which is + // validated in the `exec` method + $path = $this->_path( $upload['name'], $id ); + $webPath = str_replace($_SERVER['DOCUMENT_ROOT'], '', $path); + $q = $db + ->query( 'update' ) + ->table( $this->_dbTable ) + ->where( $this->_dbPKey, $id ); + + foreach ( $pathFields as $column => $type ) { + $q->set( $column, $type === self::DB_WEB_PATH ? $webPath : $path ); + } + + $q->exec(); + } + + return $id; + } + + + /** + * Apply macros to a user specified path + * + * @param string $name File path + * @param int $id Primary key value for the file + * @return string Resolved path + */ + private function _path ( $name, $id ) + { + $extn = pathinfo( $name, PATHINFO_EXTENSION ); + + $to = $this->_action; + $to = str_replace( "__NAME__", $name, $to ); + $to = str_replace( "__ID__", $id, $to ); + $to = str_replace( "__EXTN__", $extn, $to ); + + return $to; + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Validate.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Validate.php.txt new file mode 100644 index 00000000..c97d749a --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/Validate.php.txt @@ -0,0 +1,1396 @@ +validator( Validate::required() ) + * ``` + * + * @example + * ``` + * // Don't require a field to be submitted, but if it is submitted, it + * // must be non-empty + * Field::inst( 'reg_date' )->validator( Validate::notEmpty() ) + * ``` + * + * @example + * ``` + * // Date validation + * Field::inst( 'reg_date' )->validator( Validate::dateFormat( 'D, d M y' ) ) + * ``` + * + * @example + * ``` + * // Date validation with a custom error message + * Field::inst( 'reg_date' )->validator( Validate::dateFormat( 'D, d M y', + * ValidateOptions::inst() + * ->message( 'Invalid date' ) + * ) ) + * ``` + * + * @example + * ``` + * // Require a non-empty e-mail address + * Field::inst( 'reg_date' )->validator( Validate::email( ValidateOptions::inst() + * ->empty( false ) + * ) ) + * ``` + * + * @example + * ``` + * // Custom validation - closure + * Field::inst( 'engine' )->validator( function($val, $data, $opts) { + * if ( ! preg_match( '/^1/', $val ) ) { + * return "Value must start with a 1"; + * } + * return true; + * } ) + * ``` + */ +class Validate { + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Internal functions + */ + + /** + * "Magic" method to automatically apply the required check to any of the + * static methods simply by adding '_required' or '_empty' to the end of the + * method's name, depending on if you need the field to be submitted or not. + * + * This is retained for backwards compatibility, but the validation options + * are now the recommended way of indicating that a field is required. + * + * @internal + * @param string $name Function name + * @param array $arguments Function arguments + * @return mixed|string + */ + public static function __callStatic( $name, $arguments ) { + if ( preg_match( '/_required$/', $name ) ) { + if ( $arguments[0] === null || $arguments[0] === '' ) { + return 'This field is required'; + } + + return call_user_func_array( + __NAMESPACE__.'\Validate::'.str_replace( '_required', '', $name ), + $arguments + ); + } + } + + + /** + * Extend the options from the user function and the validation function + * with core defaults. + * + * @internal + */ + public static function _extend( $userOpts, $prop, $fnOpts ) { + $cfg = array( + 'message' => 'Input not valid', + 'required' => false, + 'empty' => true, + 'optional' => true + ); + + if ( ! is_array( $userOpts ) ) { + if ( $prop ) { + $cfg[ $prop ] = $userOpts; + } + + // Not an array, but the non-array case has been handled above, so + // just an empty array + $userOpts = array(); + } + + // Merge into a single array - first array gets priority if there is a + // key clash, so user first, then function commands and finally the + // global options + $cfg = $userOpts + $fnOpts + $cfg; + + return $cfg; + } + + + /** + * Perform common validation using the configuration parameters + * + * @internal + */ + public static function _common( $val, $opts ) { + $optional = $opts->optional(); + $empty = $opts->allowEmpty(); + + // Error state tests + if ( ! $optional && $val === null ) { + // Value must be given + return false; + } + else if ( $empty === false && $val === '' ) { + // Value must not be empty + return false; + } + + // Validation passed states + if ( $optional && $val === null ) { + return true; + } + else if ( $empty === true && $val === '' ) { + return true; + } + + // Have the specific validation function perform its tests + return null; + } + + /** + * Convert the old style validation parameters into ValidateOptions + * + * @internal + */ + public static function _commonLegacy( $cfg ) { + $opts = new ValidateOptions(); + + if ( is_array( $cfg ) ) { + // `required` is a legacy shortcut for optional=false, empty=false + if ( isset( $cfg['required'] ) ) { + $opts->optional( false ); + $opts->allowEmpty( false ); + } + + if ( isset( $cfg['empty'] ) ) { + $opts->allowEmpty( $cfg['empty'] ); + } + + if ( isset( $cfg['message'] ) ) { + $opts->message( $cfg['message'] ); + } + + if ( isset( $cfg['optional'] ) ) { + $opts->optional( $cfg['optional'] ); + } + } + + return $opts; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Basic validation + */ + + /** + * No validation - all inputs are valid. + * @return callable Validation function + */ + public static function none() { + return function ( $val, $data, $field, $host ) { + return true; + }; + } + + + /** + * Basic validation - this is used to perform the validation provided by the + * validation options only. If the validation options pass (e.g. `required`, + * `empty` and `optional`) then the validation will pass regardless of the + * actual value. + * + * Note that there are two helper short-cut methods that provide the same + * function as this method, but are slightly shorter: + * + * ``` + * // Required: + * Validate::required() + * + * // is the same as + * Validate::basic( $val, $data, array( + * "required" => true + * ); + * ``` + * + * ``` + * // Optional, but not empty if given: + * Validate::notEmpty() + * + * // is the same as + * Validate::basic( $val, $data, array( + * "empty" => false + * ); + * ``` + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param array $opts Validation options. No additional options are + * available or required for this validation method. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + static function basic( $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts ) { + $common = Validate::_common( $val, $opts ); + + return $common === false ? + $opts->message() : + true; + }; + } + + + /** + * Required field - there must be a value and it must be a non-empty value + * + * This is a helper short-cut method which is the same as: + * + * ``` + * Validate::basic( $val, $data, array( + * "required" => true + * ); + * ``` + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param array $opts Validation options. No additional options are + * available or required for this validation method. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + static function required( $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + $opts->allowEmpty( false ); + $opts->optional( false ); + + return function ( $val, $data, $field, $host ) use ( $opts ) { + $common = Validate::_common( $val, $opts ); + + return $common === false ? + $opts->message() : + true; + }; + } + + + /** + * Optional field, but if given there must be a non-empty value + * + * This is a helper short-cut method which is the same as: + * + * ``` + * Validate::basic( $val, $data, array( + * "empty" => false + * ); + * ``` + * + * @param ValidateOptions $cfg Validation options + * @return callable Validation function + */ + static function notEmpty( $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + $opts->allowEmpty( false ); + + return function ( $val, $data, $field, $host ) use ( $opts ) { + $common = Validate::_common( $val, $opts ); + + return $common === false ? + $opts->message() : + true; + }; + } + + + /** + * Validate an input as a boolean value. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param array $opts Validation options. No additional options are + * available or required for this validation method. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function boolean( $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + if ( filter_var($val, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) === null ) { + return $opts->message(); + } + return true; + }; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Number validation methods + */ + + /** + * Check that any input is numeric. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param array $opts Validation options. Additional options: + * * `decimal`: is available to indicate what character should be used + * as the decimal + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function numeric ( $decimal=".", $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts, $decimal ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + if ( $decimal !== '.' ) { + $val = str_replace( $decimal, '.', $val ); + } + + return ! is_numeric( $val ) ? + $opts->message() : + true; + }; + } + + /** + * Check for a numeric input and that it is greater than a given value. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. Additional options: + * * `min`: indicate the minimum value. If only the default validation + * options are required, this parameter can be given as an integer + * value, which will be used as the minimum value. + * * `decimal`: is available to indicate what character should be used + * as the decimal + * separator (default '.'). + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function minNum ( $min, $decimal=".", $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts, $min, $decimal ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + $fn = Validate::numeric( $decimal, $opts ); + $numeric = $fn( $val, $data, $field, $host ); + + if ( $numeric !== true ) { + return $numeric; + } + + if ( $decimal !== '.' ) { + $val = str_replace( $decimal, '.', $val ); + } + + return $val < $min ? + $opts->message() : + true; + }; + } + + /** + * Check for a numeric input and that it is less than a given value. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. + * * `max`: indicate the maximum value. If only the default validation + * options are required, this parameter can be given as an integer + * value, which will be used as the maximum value. + * * `decimal`: is available to indicate what character should be used + * as the decimal + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function maxNum ( $max, $decimal=".", $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts, $max, $decimal ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + $fn = Validate::numeric( $decimal, $opts ); + $numeric = $fn( $val, $data, $field, $host ); + + if ( $numeric !== true ) { + return $numeric; + } + + if ( $decimal !== '.' ) { + $val = str_replace( $decimal, '.', $val ); + } + + return $val > $max ? + $opts->message() : + true; + }; + } + + + /** + * Check for a numeric input and that it is both greater and smaller than + * given numbers. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. Additional options: + * * `min`: indicate the minimum value. + * * `max`: indicate the maximum value. + * * `decimal`: is available to indicate what character should be used + * as the decimal + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function minMaxNum ( $min, $max, $decimal='.', $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts, $min, $max, $decimal ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + $fn = Validate::numeric( $decimal, $opts ); + $numeric = $fn( $val, $data, $field, $host ); + + if ( $numeric !== true ) { + return $numeric; + } + + $fn = Validate::minNum( $min, $decimal, $opts ); + $numeric = $fn( $val, $data, $field, $host ); + + if ( $numeric !== true ) { + return $numeric; + } + + $fn = Validate::maxNum( $max, $decimal, $opts ); + $numeric = $fn( $val, $data, $field, $host ); + + if ( $numeric !== true ) { + return $numeric; + } + + return true; + }; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * String validation methods + */ + + /** + * Validate an input as an e-mail address. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param array $opts Validation options. No additional options are + * available or required for this validation method. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function email( $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + return filter_var($val, FILTER_VALIDATE_EMAIL) !== false ? + true : + $opts->message(); + }; + } + + + /** + * Validate a string has a minimum length. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. The additional option of + * `min` is available for this method to indicate the minimum string + * length. If only the default validation options are required, this + * parameter can be given as an integer value, which will be used as the + * minimum string length. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function minLen( $min, $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $min, $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + $strlen = is_callable('mb_strlen') ? + 'mb_strlen' : + 'strlen'; + + return $strlen( $val ) < $min ? + $opts->message() : + true; + }; + } + + + /** + * Validate a string does not exceed a maximum length. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. The additional option of + * `max` is available for this method to indicate the maximum string + * length. If only the default validation options are required, this + * parameter can be given as an integer value, which will be used as the + * maximum string length. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function maxLen( $max, $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $max, $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + $strlen = is_callable('mb_strlen') ? + 'mb_strlen' : + 'strlen'; + + return $strlen( $val ) > $max ? + $opts->message() : + true; + }; + } + + /** + * Require a string with a certain minimum or maximum number of characters. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. The additional options of + * `min` and `max` are available for this method to indicate the minimum + * and maximum string lengths, respectively. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function minMaxLen( $min, $max, $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts, $min, $max ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + $fn = Validate::minLen( $min, $opts ); + $res = $fn( $val, $data, $field, $host ); + + if ( $res !== true ) { + return $res; + } + + $fn = Validate::maxLen( $max, $opts ); + $res = $fn( $val, $data, $field, $host ); + + if ( $res !== true ) { + return $res; + } + + return true; + }; + } + + + /** + * Validate as an IP address. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param array $opts Validation options. No additional options are + * available or required for this validation method. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function ip( $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + return filter_var($val, FILTER_VALIDATE_IP) !== false ? + true : + $opts->message(); + }; + } + + + /** + * Validate as an URL address. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param array $opts Validation options. No additional options are + * available or required for this validation method. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function url( $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + return filter_var($val, FILTER_VALIDATE_URL) !== false ? + true : + $opts->message(); + }; + } + + + /** + * Check if string could contain an XSS attack string + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. The additional options of + * `db` - database connection object, `table` - database table to use and + * `column` - the column to check this value against as value, are also + * available. These options are not required and if not given are + * automatically derived from the Editor and Field instances. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function xss ( $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + return $field->xssSafety( $val ) != $val ? + $opts->message() : + true; + }; + } + + + /** + * Confirm that the value submitted is in a list of allowable values + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. The additional options of + * `db` - database connection object, `table` - database table to use and + * `column` - the column to check this value against as value, are also + * available. These options are not required and if not given are + * automatically derived from the Editor and Field instances. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function values( $values, $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $values, $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + return in_array($val, $values) ? + true : + $opts->message(); + }; + } + + + /** + * Check if there are any tags in the submitted value + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. The additional options of + * `db` - database connection object, `table` - database table to use and + * `column` - the column to check this value against as value, are also + * available. These options are not required and if not given are + * automatically derived from the Editor and Field instances. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function noTags ( $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + return strip_tags( $val ) != $val ? + $opts->message() : + true; + }; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Date validation methods + */ + + /** + * Check that a valid date input is given + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param array|string $opts If given as a string, then $opts is the date + * format to check the validity of. If given as an array, then the + * date format is in the 'format' parameter, and the return error + * message in the 'message' parameter. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function dateFormat( $format, $cfg=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $format, $opts ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + $formatCreate = substr($format, 0, 1) !== '!' ? + '!'.$format : + $format; + + $date = \DateTime::createFromFormat( $formatCreate, $val ); + + return $date && $date->format( $format ) === $val ? + true : + $opts->message(); + }; + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Database validation methods + */ + + /** + * Check that the given value is unique in the database + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. The additional options of + * `db` - database connection object, `table` - database table to use and + * `column` - the column to check this value against as value, are also + * available. These options are not required and if not given are + * automatically derived from the Editor and Field instances. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function unique( $cfg=null, $column=null, $table=null, $db=null ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts, $column, $table, $db ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + $editor = $host['editor']; + + if ( ! $db ) { + $db = $host['db']; + } + + if ( ! $table ) { + $table = $editor->table(); // Returns an array, but `select` will take an array + } + + if ( ! $column ) { + $column = $field->dbField(); + } + + $query = $db + ->query( 'select', $table ) + ->get( $column ) + ->where( $column, $val ); + + // If doing an edit, then we need to also discount the current row, + // since it is of course already validly unique + if ( $host['action'] === 'edit' ) { + $cond = $editor->pkeyToArray( $host['id'], true ); + $query->where( $cond, null, '!=' ); + } + + $res = $query->exec(); + + return $res->count() === 0 ? + true : + $opts->message(); + }; + } + + /** + * Check that the given value is a value that is available in a database - + * i.e. a join primary key. This will attempt to automatically use the table + * name and value column from the field's `options` method (under the + * assumption that it will typically be used with a joined field), but the + * table and field can also be specified via the options. + * + * @param string $val The value to check for validity + * @param string[] $data The full data set submitted + * @param int|array $opts Validation options. The additional options of + * `db` - database connection object, `table` - database table to use and + * `column` - the column to check this value against as value, are also + * available. These options are not required and if not given are + * automatically derived from the Editor and Field instances. + * @param array $host Host information + * @return string|true true if the value is valid, a string with an error + * message otherwise. + */ + public static function dbValues( $cfg=null, $column=null, $table=null, $db=null, $values=array() ) { + $opts = ValidateOptions::select( $cfg ); + + return function ( $val, $data, $field, $host ) use ( $opts, $column, $table, $db, $values ) { + $common = Validate::_common( $val, $opts ); + + if ( $common !== null ) { + return $common === false ? + $opts->message() : + $common; + } + + // Allow local values to be defined - for example null + if ( in_array($val, $values) ) { + return true; + } + + $editor = $host['editor']; + $options = $field->options(); + + if ( ! $db ) { + $db = $host['db']; + } + + if ( ! $table ) { + $table = $options->table(); // Returns an array, but `select` will take an array + } + + if ( ! $column ) { + $column = $options->value(); + } + + if ( ! $table ) { + throw new \Exception('Table for database value check is not defined for field '.$field->name()); + } + + if ( ! $column ) { + throw new \Exception('Value column for database value check is not defined for field '.$field->name()); + } + + // Try / catch in case the submitted value can't be represented as the + // database type (e.g. an empty string as an integer) + try { + $count = $db + ->query( 'select', $table ) + ->get( $column ) + ->where( $column, $val ) + ->exec() + ->count(); + + return $count === 0 ? + $opts->message() : + true; + } + catch (\Exception $e) { + return $opts->message(); + } + }; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * File validation methods + */ + static function fileExtensions ( $extensions, $msg="This file type cannot be uploaded." ) { + return function ( $file ) use ( $extensions, $msg ) { + $extn = pathinfo($file['name'], PATHINFO_EXTENSION); + + for ( $i=0, $ien=count($extensions) ; $i<$ien ; $i++ ) { + if ( strtolower( $extn ) === strtolower( $extensions[$i] ) ) { + return true; + } + } + + return $msg; + }; + } + + static function fileSize ( $size, $msg="Uploaded file is too large." ) { + return function ( $file ) use ( $size, $msg ) { + return $file['size'] > $size ? + $msg : + true; + }; + } + + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Mjoin validation methods + */ + static function mjoinMinCount ( $count, $msg="Too few items." ) { + return function ( $editor, $action, $values ) use ( $count, $msg ) { + if ( $action === 'create' || $action === 'edit' ) { + return count($values) < $count ? + $msg : + true; + } + return true; + }; + } + + static function mjoinMaxCount ( $count, $msg="Too many items." ) { + return function ( $editor, $action, $values ) use ( $count, $msg ) { + if ( $action === 'create' || $action === 'edit' ) { + return count($values) > $count ? + $msg : + true; + } + return true; + }; + } + + + /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Internal functions + * These legacy methods are for backwards compatibility with the old way of + * using the validation methods. They basically do argument swapping. + */ + + /** + * @internal + */ + static function noneLegacy( $legacyOpts ) { + return Validate::none(); + } + + /** + * @internal + */ + static function basicLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array() ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::required( $opts ); + } + + /** + * @internal + */ + static function requiredLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "This field is required." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::required( $opts ); + } + + /** + * @internal + */ + static function notEmptyLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "This field is required." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::notEmpty( $opts ); + } + + /** + * @internal + */ + static function booleanLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "Please enter true or false." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::notEmpty( $opts ); + } + + /** + * @internal + */ + static function numericLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "This input must be given as a number." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return isset( $legacyOpts['decimal'] ) ? + Validate::numeric( $legacyOpts['decimal'], $opts ) : + Validate::numeric( '.', $opts ); + } + + /** + * @internal + */ + static function minNumLegacy( $legacyOpts ) { + $min = is_array($legacyOpts) ? $legacyOpts['min'] : $legacyOpts; + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "Number is too small, must be ".$min." or larger." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return isset( $legacyOpts['decimal'] ) ? + Validate::minNum( $min, $legacyOpts['decimal'], $opts ) : + Validate::minNum( $min, '.', $opts ); + } + + /** + * @internal + */ + static function maxNumLegacy( $legacyOpts ) { + $max = is_array($legacyOpts) ? $legacyOpts['max'] : $legacyOpts; + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "Number is too large, must be ".$max." or smaller." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return isset( $legacyOpts['decimal'] ) ? + Validate::maxNum( $max, $legacyOpts['decimal'], $opts ) : + Validate::maxNum( $max, '.', $opts ); + } + + /** + * @internal + */ + static function minMaxNumLegacy( $legacyOpts ) { + $min = $legacyOpts['min']; + $max = $legacyOpts['max']; + $cfg = Validate::_extend( $legacyOpts, null, array() ); + $opts = Validate::_commonLegacy( $cfg ); + + return isset( $legacyOpts['decimal'] ) ? + Validate::minMaxNum( $min, $max, $legacyOpts['decimal'], $opts ) : + Validate::minMaxNum( $min, $max, '.', $opts ); + } + + /** + * @internal + */ + static function emailLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "Please enter a valid e-mail address." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::email( $opts ); + } + + /** + * @internal + */ + static function minLenLegacy( $legacyOpts ) { + $min = is_array($legacyOpts) ? $legacyOpts['min'] : $legacyOpts; + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "The input is too short. ".$min." characters required." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::minLen( $min, $opts ); + } + + /** + * @internal + */ + static function maxLenLegacy( $legacyOpts ) { + $max = is_array($legacyOpts) ? $legacyOpts['max'] : $legacyOpts; + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "The input is too long. ".$max." characters maximum." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::maxLen( $max, $opts ); + } + + /** + * @internal + */ + static function minMaxLenLegacy( $legacyOpts ) { + $min = $legacyOpts['min']; + $max = $legacyOpts['max']; + $cfg = Validate::_extend( $legacyOpts, null, array() ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::minMaxLen( $min, $max, $opts ); + } + + /** + * @internal + */ + static function ipLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "Please enter a valid IP address." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::ip( $opts ); + } + + /** + * @internal + */ + static function urlLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "Please enter a valid URL." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::url( $opts ); + } + + /** + * @internal + */ + static function xssLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "This field contains potentially unsafe data." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::xss( $opts ); + } + + /** + * @internal + */ + static function valuesLegacy( $legacyOpts ) { + $values = isset($legacyOpts['valid']) ? $legacyOpts['valid'] : $legacyOpts; + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "This value is not valid." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::values( $values, $opts ); + } + + /** + * @internal + */ + static function noTagsLegacy( $legacyOpts ) { + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "This field may not contain HTML." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::noTags( $opts ); + } + + /** + * @internal + */ + static function dateFormatLegacy( $legacyOpts ) { + $format = is_array($legacyOpts) ? $legacyOpts['format'] : $legacyOpts; + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "Date is not in the expected format." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::dateFormat( $format, $opts ); + } + + /** + * @internal + */ + static function uniqueLegacy( $legacyOpts ) { + $table = isset( $legacyOpts['table'] ) ? $legacyOpts['table'] : null; + $column = isset( $legacyOpts['column'] ) ? $legacyOpts['column'] : null; + $db = isset( $legacyOpts['db'] ) ? $legacyOpts['db'] : null; + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "This field must have a unique value." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::unique( $opts, $column, $table, $db ); + } + + /** + * @internal + */ + static function dbValuesLegacy( $legacyOpts ) { + $table = isset( $legacyOpts['table'] ) ? $legacyOpts['table'] : null; + $column = isset( $legacyOpts['column'] ) ? $legacyOpts['column'] : null; + $db = isset( $legacyOpts['db'] ) ? $legacyOpts['db'] : null; + $values = isset( $legacyOpts['values'] ) ? $legacyOpts['values'] : array(); + $cfg = Validate::_extend( $legacyOpts, null, array( + 'message' => "This value is not valid." + ) ); + $opts = Validate::_commonLegacy( $cfg ); + + return Validate::dbValues( $opts, $column, $table, $db, $values ); + } +} + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/ValidateOptions.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/ValidateOptions.php.txt new file mode 100644 index 00000000..027ddcc8 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Editor/ValidateOptions.php.txt @@ -0,0 +1,99 @@ +allowEmpty( $opts['empty'] ); + } + if ( isset( $opts['message'] ) ) { + $this->message( $opts['message'] ); + } + if ( isset( $opts['optional'] ) ) { + $this->optional( $opts['optional'] ); + } + } + + return $this; + } + + /** + * Get / set the error message to use if validation fails + * @param string $msg Error message to use. If not given, the currently + * set message will be returned. + * @return ValidateOptions|string Self if setting, message if getting. + */ + public function message ( $msg=null ) { + if ( $msg === null ) { + return $this->_message; + } + + $this->_message = $msg; + return $this; + } + + /** + * Get / set the field empty option + * @param boolean $empty `false` if the field is not allowed to be + * empty. `true` if it can be. + * @return ValidateOptions|boolean Self if setting, current value if getting. + */ + public function allowEmpty ( $empty=null ) { + if ( $empty === null ) { + return $this->_empty; + } + + $this->_empty = $empty; + return $this; + } + + /** + * Get / set the field optional option + * @param boolean $optional `false` if the field does not need to be + * submitted. `true` if it must be. + * @return ValidateOptions|boolean Self if setting, current value if getting. + */ + public function optional ( $optional=null ) { + if ( $optional === null ) { + return $this->_optional; + } + + $this->_optional = $optional; + return $this; + } + + + /** + * @internal + */ + static public function select ( $user ) { + if ( $user ) { + return $user; + } + + return new ValidateOptions(); + } +} \ No newline at end of file diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/Ext.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Ext.php.txt new file mode 100644 index 00000000..4ebf6a67 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/Ext.php.txt @@ -0,0 +1,222 @@ +newInstance() : + $rc->newInstanceArgs( $args ); + } + + /** + * Static method to instantiate a new instance of a class (shorthand of + * 'instantiate'). + * + * This method performs exactly the same actions as the 'instantiate' + * static method, but is simply shorter and easier to type! + * @return \DataTables\Editor|\DataTables\Editor\Field|\DataTables\Editor\Join|\DataTables\Editor\Upload class + * @static + */ + public static function inst () + { + $rc = new \ReflectionClass( get_called_class() ); + $args = func_get_args(); + + return count( $args ) === 0 ? + $rc->newInstance() : + $rc->newInstanceArgs( $args ); + } + + /** + * Common getter / setter function for DataTables classes. + * + * This getter / setter method makes building getter / setting methods + * easier, by abstracting everything to a single function call. + * @param mixed &$prop The property to set + * @param mixed $val The value to set - if given as null, then we assume + * that the function is being used as a getter. + * @param boolean $array Treat the target property as an array or not + * (default false). If used as an array, then values passed in are added + * to the $prop array. + * @return self|mixed Class instance if setting (allowing chaining), or + * the value requested if getting. + */ + protected function _getSet( &$prop, $val, $array=false ) + { + // Get + if ( $val === null ) { + return $prop; + } + + // Set + if ( $array ) { + // Property is an array, merge or add to array + is_array( $val ) ? + $prop = array_merge( $prop, $val ) : + $prop[] = $val; + } + else { + // Property is just a value + $prop = $val; + } + + return $this; + } + + /** + * Determine if a property is available in a data set (allowing `null` to be + * a valid value) + * @param string $name Javascript dotted object name to write to + * @param array $data Data source array to read from + * @return boolean true if present, false otherwise + * @private + */ + protected function _propExists ( $name, $data ) + { + if ( strpos($name, '.') === false ) { + return isset( $data[ $name ] ); + } + + $names = explode( '.', $name ); + $inner = $data; + + for ( $i=0 ; $ixss()` method. The Vanilla forums wrapper is used + * to provide sensible defaults and a clean interface for HtmLawed. + * + * Changes: + * + * * Add `DataTables/HtmLawed` namespace to this and htmLawed - this is to ensure + * that if htmLawed is included by any other aspect of the site it will not + * result in a conflict. + * * Use the OOP version of htmLawed (required a single updated to call it) to + * make the namespacing relatively easy. + * * Change the name of the Vanilla class so it don't conflict with the + * htmLawed OOP class + * * Update all `htmLawed::` references to `\DataTables\HtmLawed\HtmLawed::` in + * the htmLawed file (to allow callbacks to operate correctly) + * * Updated Vanilla wrapper to operate on PHP 5.3 + * + * HtmLawed: + * http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/ + * Copyright: Santosh Patnaik + * License: Dual licensed with LGPL 3 and GPL 2+ + * + * Vanilla wrapper for HtmLawed: + * https://github.com/vanilla/htmlawed/ + * Author: Todd Burry + * Copyright: 2009-2014 Vanilla Forums Inc. + * License: LGPL-3.0 + */ + +namespace DataTables\HtmLawed; + +/** + * A class wrapper for the htmLawed library. + */ +class Htmlaw { + /// Methods /// + + public static $defaultConfig = array( + 'anti_link_spam' => array('`.`', ''), + 'comment' => 1, + 'cdata' => 3, + 'css_expression' => 1, + 'deny_attribute' => 'on*', + 'unique_ids' => 0, + 'elements' => '*-applet-form-input-textarea-iframe-script-style-embed-object', + 'keep_bad' => 1, + 'schemes' => 'classid:clsid; href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; style: nil; *:file, http, https', // clsid allowed in class + 'valid_xhtml' => 0, + 'direct_list_nest' => 1, + 'balance' => 1 + ); + + public static $defaultSpec = array( + 'object=-classid-type, -codebase', + 'embed=type(oneof=application/x-shockwave-flash)' + ); + + /** + * Filters a string of html with the htmLawed library. + * + * @param string $html The text to filter. + * @param array|null $config Config settings for the array. + * @param string|array|null $spec A specification to further limit the allowed attribute values in the html. + * @return string Returns the filtered html. + * @see http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/htmLawed_README.htm + */ + public static function filter($html, array $config = null, $spec = null) { + if ($config === null) { + $config = self::$defaultConfig; + } + + if (isset($config['spec']) && !$spec) { + $spec = $config['spec']; + } + + if ($spec === null) { + $spec = static::$defaultSpec; + } + + return Htmlawed::hl($html, $config, $spec); + } + + + /** + * Filter a string of html so that it can be put into an rss feed. + * + * @param $html The html text to fitlter. + * @return string Returns the filtered html. + * @see Htmlawed::filter(). + */ + public static function filterRSS($html) { + $config = array( + 'anti_link_spam' => array('`.`', ''), + 'comment' => 1, + 'cdata' => 3, + 'css_expression' => 1, + 'deny_attribute' => 'on*,style,class', + 'elements' => '*-applet-form-input-textarea-iframe-script-style-object-embed-comment-link-listing-meta-noscript-plaintext-xmp', + 'keep_bad' => 0, + 'schemes' => 'classid:clsid; href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; style: nil; *:file, http, https', // clsid allowed in class + 'valid_xml' => 2, + 'balance' => 1 + ); + $spec = static::$defaultSpec; + + $result = static::filter($html, $config, $spec); + + return $result; + } +} diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/HtmLawed/Htmlawed.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/HtmLawed/Htmlawed.php.txt new file mode 100644 index 00000000..e69de29b diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/bootstrap.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/bootstrap.html new file mode 100644 index 00000000..01fd4730 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/bootstrap.html @@ -0,0 +1,167 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                              +

                                                              Editor PHP 2.1.3

                                                              + + + + + +
                                                              + +
                                                              +
                                                              + + + + +
                                                              +
                                                                +
                                                              + +
                                                              +

                                                              Bootstrap.php

                                                              + +

                                                              DataTables PHP libraries.

                                                              + +

                                                              PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                              +
                                                              + + +
                                                              + Tags + +
                                                              +
                                                              +
                                                              + author +
                                                              +
                                                              + +

                                                              SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                              +
                                                              + +
                                                              +
                                                              + + + + + + + + + + + + +
                                                              +
                                                              +
                                                              +
                                                              +

                                                              Search results

                                                              + +
                                                              +
                                                              +
                                                                +
                                                                +
                                                                +
                                                                +
                                                                +
                                                                + + +
                                                                + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/composer.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/composer.html new file mode 100644 index 00000000..4108fdbd --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/composer.html @@ -0,0 +1,197 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                +

                                                                Editor PHP 2.1.3

                                                                + + + + + +
                                                                + +
                                                                +
                                                                + + + + +
                                                                +
                                                                  +
                                                                + +
                                                                +

                                                                composer.php

                                                                + + +
                                                                + + + + + + + + +

                                                                + Table of Contents + +

                                                                + +
                                                                +
                                                                + DATATABLES + +  = \true +
                                                                +
                                                                + +
                                                                + + + + +
                                                                +

                                                                + Constants + +

                                                                +
                                                                +

                                                                + DATATABLES + +

                                                                + + + + + + public + mixed + DATATABLES + = \true + + + +
                                                                + +
                                                                + + + +
                                                                +
                                                                + + +
                                                                +
                                                                +
                                                                +
                                                                +

                                                                Search results

                                                                + +
                                                                +
                                                                +
                                                                  +
                                                                  +
                                                                  +
                                                                  +
                                                                  +
                                                                  + + +
                                                                  + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/composer.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/composer.php.txt new file mode 100644 index 00000000..e5916e1f --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/composer.php.txt @@ -0,0 +1,12 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                  +

                                                                  Editor PHP 2.1.3

                                                                  + + + + + +
                                                                  + +
                                                                  +
                                                                  + + + + +
                                                                  +
                                                                    +
                                                                  + +
                                                                  +

                                                                  config.php

                                                                  + + +
                                                                  + + + + + + + + + + + + + + +
                                                                  +
                                                                  +
                                                                  +
                                                                  +

                                                                  Search results

                                                                  + +
                                                                  +
                                                                  +
                                                                    +
                                                                    +
                                                                    +
                                                                    +
                                                                    +
                                                                    + + +
                                                                    + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/config.php.txt b/ci4/app/ThirdParty/DatatablesEditor/docs/files/config.php.txt new file mode 100644 index 00000000..28214332 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/config.php.txt @@ -0,0 +1,30 @@ + "Mysql", // Database type: "Mysql", "Postgres", "Sqlserver", "Sqlite" or "Oracle" + "user" => "", // Database user name + "pass" => "", // Database password + "host" => "localhost", // Database host + "port" => "", // Database connection port (can be left empty for default) + "db" => "", // Database name + "dsn" => "", // PHP DSN extra information. Set as `charset=utf8mb4` if you are using MySQL + "pdoAttr" => array() // PHP PDO attributes array. See the PHP documentation for all options +); + + +// This is included for the development and deploy environment used on the DataTables +// server. You can delete this block - it just includes my own user/pass without making +// them public! +if ( is_file($_SERVER['DOCUMENT_ROOT']."/datatables/pdo.php") ) { + include( $_SERVER['DOCUMENT_ROOT']."/datatables/pdo.php" ); +} +// /End development include + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-db2query.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-db2query.html new file mode 100644 index 00000000..63146c75 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-db2query.html @@ -0,0 +1,161 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                    +

                                                                    Editor PHP 2.1.3

                                                                    + + + + + +
                                                                    + +
                                                                    +
                                                                    + + + + +
                                                                    +
                                                                      +
                                                                    + +
                                                                    +

                                                                    Db2Query.php

                                                                    + +

                                                                    DB2 database driver for DataTables libraries.

                                                                    + +

                                                                    BETA! Feedback welcome

                                                                    +
                                                                    + + + + + + +

                                                                    + Interfaces, Classes, Traits and Enums + +

                                                                    + +
                                                                    + +
                                                                    Db2Query
                                                                    +
                                                                    DB2 driver for DataTables Database Query class
                                                                    + + +
                                                                    + + + + + + + + +
                                                                    +
                                                                    +
                                                                    +
                                                                    +

                                                                    Search results

                                                                    + +
                                                                    +
                                                                    +
                                                                      +
                                                                      +
                                                                      +
                                                                      +
                                                                      +
                                                                      + + +
                                                                      + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-db2result.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-db2result.html new file mode 100644 index 00000000..13134750 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-db2result.html @@ -0,0 +1,179 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                      +

                                                                      Editor PHP 2.1.3

                                                                      + + + + + +
                                                                      + +
                                                                      +
                                                                      + + + + +
                                                                      +
                                                                        +
                                                                      + +
                                                                      +

                                                                      Db2Result.php

                                                                      + +

                                                                      SQL Server driver for DataTables PHP libraries +BETA! Feedback welcome

                                                                      + +

                                                                      @author SpryMedia

                                                                      +
                                                                      + + +
                                                                      + Tags + +
                                                                      +
                                                                      +
                                                                      + copyright +
                                                                      +
                                                                      + +

                                                                      2013 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                      +
                                                                      + +
                                                                      +
                                                                      + + + + +

                                                                      + Interfaces, Classes, Traits and Enums + +

                                                                      + +
                                                                      + +
                                                                      Db2Result
                                                                      +
                                                                      SQL Server driver for DataTables Database Result class
                                                                      + + +
                                                                      + + + + + + + + +
                                                                      +
                                                                      +
                                                                      +
                                                                      +

                                                                      Search results

                                                                      + +
                                                                      +
                                                                      +
                                                                        +
                                                                        +
                                                                        +
                                                                        +
                                                                        +
                                                                        + + +
                                                                        + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-firebirdquery.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-firebirdquery.html new file mode 100644 index 00000000..0a30c207 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-firebirdquery.html @@ -0,0 +1,179 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                        +

                                                                        Editor PHP 2.1.3

                                                                        + + + + + +
                                                                        + +
                                                                        +
                                                                        + + + + +
                                                                        +
                                                                          +
                                                                        + +
                                                                        +

                                                                        FirebirdQuery.php

                                                                        + +

                                                                        DataTables PHP libraries.

                                                                        + +

                                                                        PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                        +
                                                                        + + +
                                                                        + Tags + +
                                                                        +
                                                                        +
                                                                        + author +
                                                                        +
                                                                        + +

                                                                        SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                        +
                                                                        + +
                                                                        +
                                                                        + + + + +

                                                                        + Interfaces, Classes, Traits and Enums + +

                                                                        + +
                                                                        + +
                                                                        FirebirdQuery
                                                                        +
                                                                        Firebird driver for DataTables Database Query class
                                                                        + + +
                                                                        + + + + + + + + +
                                                                        +
                                                                        +
                                                                        +
                                                                        +

                                                                        Search results

                                                                        + +
                                                                        +
                                                                        +
                                                                          +
                                                                          +
                                                                          +
                                                                          +
                                                                          +
                                                                          + + +
                                                                          + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-firebirdresult.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-firebirdresult.html new file mode 100644 index 00000000..7d7aa771 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-firebirdresult.html @@ -0,0 +1,179 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                          +

                                                                          Editor PHP 2.1.3

                                                                          + + + + + +
                                                                          + +
                                                                          +
                                                                          + + + + +
                                                                          +
                                                                            +
                                                                          + +
                                                                          +

                                                                          FirebirdResult.php

                                                                          + +

                                                                          DataTables PHP libraries.

                                                                          + +

                                                                          PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                          +
                                                                          + + +
                                                                          + Tags + +
                                                                          +
                                                                          +
                                                                          + author +
                                                                          +
                                                                          + +

                                                                          SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                          +
                                                                          + +
                                                                          +
                                                                          + + + + +

                                                                          + Interfaces, Classes, Traits and Enums + +

                                                                          + +
                                                                          + +
                                                                          FirebirdResult
                                                                          +
                                                                          Firebird driver for DataTables Database Result class
                                                                          + + +
                                                                          + + + + + + + + +
                                                                          +
                                                                          +
                                                                          +
                                                                          +

                                                                          Search results

                                                                          + +
                                                                          +
                                                                          +
                                                                            +
                                                                            +
                                                                            +
                                                                            +
                                                                            +
                                                                            + + +
                                                                            + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-mysqlquery.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-mysqlquery.html new file mode 100644 index 00000000..63bffcbb --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-mysqlquery.html @@ -0,0 +1,179 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                            +

                                                                            Editor PHP 2.1.3

                                                                            + + + + + +
                                                                            + +
                                                                            +
                                                                            + + + + +
                                                                            +
                                                                              +
                                                                            + +
                                                                            +

                                                                            MysqlQuery.php

                                                                            + +

                                                                            DataTables PHP libraries.

                                                                            + +

                                                                            PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                            +
                                                                            + + +
                                                                            + Tags + +
                                                                            +
                                                                            +
                                                                            + author +
                                                                            +
                                                                            + +

                                                                            SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                            +
                                                                            + +
                                                                            +
                                                                            + + + + +

                                                                            + Interfaces, Classes, Traits and Enums + +

                                                                            + +
                                                                            + +
                                                                            MysqlQuery
                                                                            +
                                                                            MySQL driver for DataTables Database Query class
                                                                            + + +
                                                                            + + + + + + + + +
                                                                            +
                                                                            +
                                                                            +
                                                                            +

                                                                            Search results

                                                                            + +
                                                                            +
                                                                            +
                                                                              +
                                                                              +
                                                                              +
                                                                              +
                                                                              +
                                                                              + + +
                                                                              + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-mysqlresult.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-mysqlresult.html new file mode 100644 index 00000000..85c75e60 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-mysqlresult.html @@ -0,0 +1,179 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                              +

                                                                              Editor PHP 2.1.3

                                                                              + + + + + +
                                                                              + +
                                                                              +
                                                                              + + + + +
                                                                              +
                                                                                +
                                                                              + +
                                                                              +

                                                                              MysqlResult.php

                                                                              + +

                                                                              DataTables PHP libraries.

                                                                              + +

                                                                              PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                              +
                                                                              + + +
                                                                              + Tags + +
                                                                              +
                                                                              +
                                                                              + author +
                                                                              +
                                                                              + +

                                                                              SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                              +
                                                                              + +
                                                                              +
                                                                              + + + + +

                                                                              + Interfaces, Classes, Traits and Enums + +

                                                                              + +
                                                                              + +
                                                                              MysqlResult
                                                                              +
                                                                              MySQL driver for DataTables Database Result class
                                                                              + + +
                                                                              + + + + + + + + +
                                                                              +
                                                                              +
                                                                              +
                                                                              +

                                                                              Search results

                                                                              + +
                                                                              +
                                                                              +
                                                                                +
                                                                                +
                                                                                +
                                                                                +
                                                                                +
                                                                                + + +
                                                                                + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-oraclequery.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-oraclequery.html new file mode 100644 index 00000000..b4f18560 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-oraclequery.html @@ -0,0 +1,180 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                +

                                                                                Editor PHP 2.1.3

                                                                                + + + + + +
                                                                                + +
                                                                                +
                                                                                + + + + +
                                                                                +
                                                                                  +
                                                                                + +
                                                                                +

                                                                                OracleQuery.php

                                                                                + +

                                                                                Oracle database driver for DataTables libraries.

                                                                                + +

                                                                                Note that this software uses the oci_* methods in PHP and NOT the Oracle PDO +driver, which is poorly supported.

                                                                                +
                                                                                + + +
                                                                                + Tags + +
                                                                                +
                                                                                +
                                                                                + author +
                                                                                +
                                                                                + +

                                                                                SpryMedia +@copyright 2014 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                +
                                                                                + +
                                                                                +
                                                                                + + + + +

                                                                                + Interfaces, Classes, Traits and Enums + +

                                                                                + +
                                                                                + +
                                                                                OracleQuery
                                                                                +
                                                                                Oracle driver for DataTables Database Query class
                                                                                + + +
                                                                                + + + + + + + + +
                                                                                +
                                                                                +
                                                                                +
                                                                                +

                                                                                Search results

                                                                                + +
                                                                                +
                                                                                +
                                                                                  +
                                                                                  +
                                                                                  +
                                                                                  +
                                                                                  +
                                                                                  + + +
                                                                                  + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-oracleresult.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-oracleresult.html new file mode 100644 index 00000000..4c937299 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-oracleresult.html @@ -0,0 +1,178 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                  +

                                                                                  Editor PHP 2.1.3

                                                                                  + + + + + +
                                                                                  + +
                                                                                  +
                                                                                  + + + + +
                                                                                  +
                                                                                    +
                                                                                  + +
                                                                                  +

                                                                                  OracleResult.php

                                                                                  + +

                                                                                  Oracle database driver for Editor

                                                                                  + +

                                                                                  @author SpryMedia

                                                                                  +
                                                                                  + + +
                                                                                  + Tags + +
                                                                                  +
                                                                                  +
                                                                                  + copyright +
                                                                                  +
                                                                                  + +

                                                                                  2014 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                  +
                                                                                  + +
                                                                                  +
                                                                                  + + + + +

                                                                                  + Interfaces, Classes, Traits and Enums + +

                                                                                  + +
                                                                                  + +
                                                                                  OracleResult
                                                                                  +
                                                                                  MySQL driver for DataTables Database Result class
                                                                                  + + +
                                                                                  + + + + + + + + +
                                                                                  +
                                                                                  +
                                                                                  +
                                                                                  +

                                                                                  Search results

                                                                                  + +
                                                                                  +
                                                                                  +
                                                                                    +
                                                                                    +
                                                                                    +
                                                                                    +
                                                                                    +
                                                                                    + + +
                                                                                    + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-postgresquery.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-postgresquery.html new file mode 100644 index 00000000..156f2ff2 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-postgresquery.html @@ -0,0 +1,179 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                    +

                                                                                    Editor PHP 2.1.3

                                                                                    + + + + + +
                                                                                    + +
                                                                                    +
                                                                                    + + + + +
                                                                                    +
                                                                                      +
                                                                                    + +
                                                                                    +

                                                                                    PostgresQuery.php

                                                                                    + +

                                                                                    DataTables PHP libraries.

                                                                                    + +

                                                                                    PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                    +
                                                                                    + + +
                                                                                    + Tags + +
                                                                                    +
                                                                                    +
                                                                                    + author +
                                                                                    +
                                                                                    + +

                                                                                    SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                    +
                                                                                    + +
                                                                                    +
                                                                                    + + + + +

                                                                                    + Interfaces, Classes, Traits and Enums + +

                                                                                    + +
                                                                                    + +
                                                                                    PostgresQuery
                                                                                    +
                                                                                    Postgres driver for DataTables Database Query class
                                                                                    + + +
                                                                                    + + + + + + + + +
                                                                                    +
                                                                                    +
                                                                                    +
                                                                                    +

                                                                                    Search results

                                                                                    + +
                                                                                    +
                                                                                    +
                                                                                      +
                                                                                      +
                                                                                      +
                                                                                      +
                                                                                      +
                                                                                      + + +
                                                                                      + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-postgresresult.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-postgresresult.html new file mode 100644 index 00000000..d7536980 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-postgresresult.html @@ -0,0 +1,179 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                      +

                                                                                      Editor PHP 2.1.3

                                                                                      + + + + + +
                                                                                      + +
                                                                                      +
                                                                                      + + + + +
                                                                                      +
                                                                                        +
                                                                                      + +
                                                                                      +

                                                                                      PostgresResult.php

                                                                                      + +

                                                                                      DataTables PHP libraries.

                                                                                      + +

                                                                                      PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                      +
                                                                                      + + +
                                                                                      + Tags + +
                                                                                      +
                                                                                      +
                                                                                      + author +
                                                                                      +
                                                                                      + +

                                                                                      SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                      +
                                                                                      + +
                                                                                      +
                                                                                      + + + + +

                                                                                      + Interfaces, Classes, Traits and Enums + +

                                                                                      + +
                                                                                      + +
                                                                                      PostgresResult
                                                                                      +
                                                                                      Postgres driver for DataTables Database Result class
                                                                                      + + +
                                                                                      + + + + + + + + +
                                                                                      +
                                                                                      +
                                                                                      +
                                                                                      +

                                                                                      Search results

                                                                                      + +
                                                                                      +
                                                                                      +
                                                                                        +
                                                                                        +
                                                                                        +
                                                                                        +
                                                                                        +
                                                                                        + + +
                                                                                        + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-sqlitequery.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-sqlitequery.html new file mode 100644 index 00000000..9288b447 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-sqlitequery.html @@ -0,0 +1,179 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                        +

                                                                                        Editor PHP 2.1.3

                                                                                        + + + + + +
                                                                                        + +
                                                                                        +
                                                                                        + + + + +
                                                                                        +
                                                                                          +
                                                                                        + +
                                                                                        +

                                                                                        SqliteQuery.php

                                                                                        + +

                                                                                        DataTables PHP libraries.

                                                                                        + +

                                                                                        PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                        +
                                                                                        + + +
                                                                                        + Tags + +
                                                                                        +
                                                                                        +
                                                                                        + author +
                                                                                        +
                                                                                        + +

                                                                                        SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                        +
                                                                                        + +
                                                                                        +
                                                                                        + + + + +

                                                                                        + Interfaces, Classes, Traits and Enums + +

                                                                                        + +
                                                                                        + +
                                                                                        SqliteQuery
                                                                                        +
                                                                                        SQLite3 driver for DataTables Database Query class
                                                                                        + + +
                                                                                        + + + + + + + + +
                                                                                        +
                                                                                        +
                                                                                        +
                                                                                        +

                                                                                        Search results

                                                                                        + +
                                                                                        +
                                                                                        +
                                                                                          +
                                                                                          +
                                                                                          +
                                                                                          +
                                                                                          +
                                                                                          + + +
                                                                                          + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-sqliteresult.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-sqliteresult.html new file mode 100644 index 00000000..9f0ac8f4 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-sqliteresult.html @@ -0,0 +1,179 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                          +

                                                                                          Editor PHP 2.1.3

                                                                                          + + + + + +
                                                                                          + +
                                                                                          +
                                                                                          + + + + +
                                                                                          +
                                                                                            +
                                                                                          + +
                                                                                          +

                                                                                          SqliteResult.php

                                                                                          + +

                                                                                          DataTables PHP libraries.

                                                                                          + +

                                                                                          PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                          +
                                                                                          + + +
                                                                                          + Tags + +
                                                                                          +
                                                                                          +
                                                                                          + author +
                                                                                          +
                                                                                          + +

                                                                                          SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                          +
                                                                                          + +
                                                                                          +
                                                                                          + + + + +

                                                                                          + Interfaces, Classes, Traits and Enums + +

                                                                                          + +
                                                                                          + +
                                                                                          SqliteResult
                                                                                          +
                                                                                          Sqlite driver for DataTables Database Result class
                                                                                          + + +
                                                                                          + + + + + + + + +
                                                                                          +
                                                                                          +
                                                                                          +
                                                                                          +

                                                                                          Search results

                                                                                          + +
                                                                                          +
                                                                                          +
                                                                                            +
                                                                                            +
                                                                                            +
                                                                                            +
                                                                                            +
                                                                                            + + +
                                                                                            + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-sqlserverquery.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-sqlserverquery.html new file mode 100644 index 00000000..7f7be1dd --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-sqlserverquery.html @@ -0,0 +1,178 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                            +

                                                                                            Editor PHP 2.1.3

                                                                                            + + + + + +
                                                                                            + +
                                                                                            +
                                                                                            + + + + +
                                                                                            +
                                                                                              +
                                                                                            + +
                                                                                            +

                                                                                            SqlserverQuery.php

                                                                                            + +

                                                                                            SQL Server driver for DataTables PHP libraries

                                                                                            + +

                                                                                            @author SpryMedia

                                                                                            +
                                                                                            + + +
                                                                                            + Tags + +
                                                                                            +
                                                                                            +
                                                                                            + copyright +
                                                                                            +
                                                                                            + +

                                                                                            2013 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                            +
                                                                                            + +
                                                                                            +
                                                                                            + + + + +

                                                                                            + Interfaces, Classes, Traits and Enums + +

                                                                                            + +
                                                                                            + +
                                                                                            SqlserverQuery
                                                                                            +
                                                                                            SQL Server driver for DataTables Database Query class
                                                                                            + + +
                                                                                            + + + + + + + + +
                                                                                            +
                                                                                            +
                                                                                            +
                                                                                            +

                                                                                            Search results

                                                                                            + +
                                                                                            +
                                                                                            +
                                                                                              +
                                                                                              +
                                                                                              +
                                                                                              +
                                                                                              +
                                                                                              + + +
                                                                                              + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-sqlserverresult.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-sqlserverresult.html new file mode 100644 index 00000000..ef7a6b41 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-driver-sqlserverresult.html @@ -0,0 +1,178 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                              +

                                                                                              Editor PHP 2.1.3

                                                                                              + + + + + +
                                                                                              + +
                                                                                              +
                                                                                              + + + + +
                                                                                              +
                                                                                                +
                                                                                              + +
                                                                                              +

                                                                                              SqlserverResult.php

                                                                                              + +

                                                                                              SQL Server driver for DataTables PHP libraries

                                                                                              + +

                                                                                              @author SpryMedia

                                                                                              +
                                                                                              + + +
                                                                                              + Tags + +
                                                                                              +
                                                                                              +
                                                                                              + copyright +
                                                                                              +
                                                                                              + +

                                                                                              2013 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                              +
                                                                                              + +
                                                                                              +
                                                                                              + + + + +

                                                                                              + Interfaces, Classes, Traits and Enums + +

                                                                                              + +
                                                                                              + +
                                                                                              SqlserverResult
                                                                                              +
                                                                                              SQL Server driver for DataTables Database Result class
                                                                                              + + +
                                                                                              + + + + + + + + +
                                                                                              +
                                                                                              +
                                                                                              +
                                                                                              +

                                                                                              Search results

                                                                                              + +
                                                                                              +
                                                                                              +
                                                                                                +
                                                                                                +
                                                                                                +
                                                                                                +
                                                                                                +
                                                                                                + + +
                                                                                                + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-query.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-query.html new file mode 100644 index 00000000..6d8d09b6 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-query.html @@ -0,0 +1,179 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                +

                                                                                                Editor PHP 2.1.3

                                                                                                + + + + + +
                                                                                                + +
                                                                                                +
                                                                                                + + + + +
                                                                                                +
                                                                                                  +
                                                                                                + +
                                                                                                +

                                                                                                Query.php

                                                                                                + +

                                                                                                DataTables PHP libraries.

                                                                                                + +

                                                                                                PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                +
                                                                                                + + +
                                                                                                + Tags + +
                                                                                                +
                                                                                                +
                                                                                                + author +
                                                                                                +
                                                                                                + +

                                                                                                SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                +
                                                                                                + +
                                                                                                +
                                                                                                + + + + +

                                                                                                + Interfaces, Classes, Traits and Enums + +

                                                                                                + +
                                                                                                + +
                                                                                                Query
                                                                                                +
                                                                                                Perform an individual query on the database.
                                                                                                + + +
                                                                                                + + + + + + + + +
                                                                                                +
                                                                                                +
                                                                                                +
                                                                                                +

                                                                                                Search results

                                                                                                + +
                                                                                                +
                                                                                                +
                                                                                                  +
                                                                                                  +
                                                                                                  +
                                                                                                  +
                                                                                                  +
                                                                                                  + + +
                                                                                                  + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-result.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-result.html new file mode 100644 index 00000000..e52c6ffb --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database-result.html @@ -0,0 +1,179 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                  +

                                                                                                  Editor PHP 2.1.3

                                                                                                  + + + + + +
                                                                                                  + +
                                                                                                  +
                                                                                                  + + + + +
                                                                                                  +
                                                                                                    +
                                                                                                  + +
                                                                                                  +

                                                                                                  Result.php

                                                                                                  + +

                                                                                                  DataTables PHP libraries.

                                                                                                  + +

                                                                                                  PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                  +
                                                                                                  + + +
                                                                                                  + Tags + +
                                                                                                  +
                                                                                                  +
                                                                                                  + author +
                                                                                                  +
                                                                                                  + +

                                                                                                  SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                  +
                                                                                                  + +
                                                                                                  +
                                                                                                  + + + + +

                                                                                                  + Interfaces, Classes, Traits and Enums + +

                                                                                                  + +
                                                                                                  + +
                                                                                                  Result
                                                                                                  +
                                                                                                  Result object given by a {@see Query} performed on a database.
                                                                                                  + + +
                                                                                                  + + + + + + + + +
                                                                                                  +
                                                                                                  +
                                                                                                  +
                                                                                                  +

                                                                                                  Search results

                                                                                                  + +
                                                                                                  +
                                                                                                  +
                                                                                                    +
                                                                                                    +
                                                                                                    +
                                                                                                    +
                                                                                                    +
                                                                                                    + + +
                                                                                                    + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/database.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database.html new file mode 100644 index 00000000..92527d15 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/database.html @@ -0,0 +1,179 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                    +

                                                                                                    Editor PHP 2.1.3

                                                                                                    + + + + + +
                                                                                                    + +
                                                                                                    +
                                                                                                    + + + + +
                                                                                                    +
                                                                                                      +
                                                                                                    + +
                                                                                                    +

                                                                                                    Database.php

                                                                                                    + +

                                                                                                    DataTables PHP libraries.

                                                                                                    + +

                                                                                                    PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                    +
                                                                                                    + + +
                                                                                                    + Tags + +
                                                                                                    +
                                                                                                    +
                                                                                                    + author +
                                                                                                    +
                                                                                                    + +

                                                                                                    SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                    +
                                                                                                    + +
                                                                                                    +
                                                                                                    + + + + +

                                                                                                    + Interfaces, Classes, Traits and Enums + +

                                                                                                    + +
                                                                                                    + +
                                                                                                    Database
                                                                                                    +
                                                                                                    DataTables Database connection object.
                                                                                                    + + +
                                                                                                    + + + + + + + + +
                                                                                                    +
                                                                                                    +
                                                                                                    +
                                                                                                    +

                                                                                                    Search results

                                                                                                    + +
                                                                                                    +
                                                                                                    +
                                                                                                      +
                                                                                                      +
                                                                                                      +
                                                                                                      +
                                                                                                      +
                                                                                                      + + +
                                                                                                      + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/datatables.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/datatables.html new file mode 100644 index 00000000..56fa573c --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/datatables.html @@ -0,0 +1,237 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                      +

                                                                                                      Editor PHP 2.1.3

                                                                                                      + + + + + +
                                                                                                      + +
                                                                                                      +
                                                                                                      + + + + +
                                                                                                      +
                                                                                                        +
                                                                                                      + +
                                                                                                      +

                                                                                                      DataTables.php

                                                                                                      + +

                                                                                                      DataTables PHP libraries.

                                                                                                      + +

                                                                                                      PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                      +
                                                                                                      + + +
                                                                                                      + Tags + +
                                                                                                      +
                                                                                                      +
                                                                                                      + author +
                                                                                                      +
                                                                                                      + +

                                                                                                      SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                      +
                                                                                                      + +
                                                                                                      +
                                                                                                      + + + + + + +

                                                                                                      + Table of Contents + +

                                                                                                      + +
                                                                                                      +
                                                                                                      + DATATABLES + +  = \true +
                                                                                                      +
                                                                                                      DataTables PHP libraries.
                                                                                                      + +
                                                                                                      + + + + +
                                                                                                      +

                                                                                                      + Constants + +

                                                                                                      +
                                                                                                      +

                                                                                                      + DATATABLES + +

                                                                                                      + + + +

                                                                                                      DataTables PHP libraries.

                                                                                                      + + + public + mixed + DATATABLES + = \true + + + +

                                                                                                      PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                      +
                                                                                                      + +
                                                                                                      + + +
                                                                                                      + Tags + +
                                                                                                      +
                                                                                                      +
                                                                                                      + author +
                                                                                                      +
                                                                                                      + +

                                                                                                      SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                      +
                                                                                                      + +
                                                                                                      +
                                                                                                      + +
                                                                                                      +
                                                                                                      + + +
                                                                                                      +
                                                                                                      +
                                                                                                      +
                                                                                                      +

                                                                                                      Search results

                                                                                                      + +
                                                                                                      +
                                                                                                      +
                                                                                                        +
                                                                                                        +
                                                                                                        +
                                                                                                        +
                                                                                                        +
                                                                                                        + + +
                                                                                                        + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-field.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-field.html new file mode 100644 index 00000000..dfb1b3a6 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-field.html @@ -0,0 +1,179 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                        +

                                                                                                        Editor PHP 2.1.3

                                                                                                        + + + + + +
                                                                                                        + +
                                                                                                        +
                                                                                                        + + + + +
                                                                                                        +
                                                                                                          +
                                                                                                        + +
                                                                                                        +

                                                                                                        Field.php

                                                                                                        + +

                                                                                                        DataTables PHP libraries.

                                                                                                        + +

                                                                                                        PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                        +
                                                                                                        + + +
                                                                                                        + Tags + +
                                                                                                        +
                                                                                                        +
                                                                                                        + author +
                                                                                                        +
                                                                                                        + +

                                                                                                        SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                        +
                                                                                                        + +
                                                                                                        +
                                                                                                        + + + + +

                                                                                                        + Interfaces, Classes, Traits and Enums + +

                                                                                                        + +
                                                                                                        + +
                                                                                                        Field
                                                                                                        +
                                                                                                        Field definitions for the DataTables Editor.
                                                                                                        + + +
                                                                                                        + + + + + + + + +
                                                                                                        +
                                                                                                        +
                                                                                                        +
                                                                                                        +

                                                                                                        Search results

                                                                                                        + +
                                                                                                        +
                                                                                                        +
                                                                                                          +
                                                                                                          +
                                                                                                          +
                                                                                                          +
                                                                                                          +
                                                                                                          + + +
                                                                                                          + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-format.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-format.html new file mode 100644 index 00000000..0ac7c428 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-format.html @@ -0,0 +1,179 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                          +

                                                                                                          Editor PHP 2.1.3

                                                                                                          + + + + + +
                                                                                                          + +
                                                                                                          +
                                                                                                          + + + + +
                                                                                                          +
                                                                                                            +
                                                                                                          + +
                                                                                                          +

                                                                                                          Format.php

                                                                                                          + +

                                                                                                          DataTables PHP libraries.

                                                                                                          + +

                                                                                                          PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                          +
                                                                                                          + + +
                                                                                                          + Tags + +
                                                                                                          +
                                                                                                          +
                                                                                                          + author +
                                                                                                          +
                                                                                                          + +

                                                                                                          SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                          +
                                                                                                          + +
                                                                                                          +
                                                                                                          + + + + +

                                                                                                          + Interfaces, Classes, Traits and Enums + +

                                                                                                          + +
                                                                                                          + +
                                                                                                          Format
                                                                                                          +
                                                                                                          Formatter methods for the DataTables Editor
                                                                                                          + + +
                                                                                                          + + + + + + + + +
                                                                                                          +
                                                                                                          +
                                                                                                          +
                                                                                                          +

                                                                                                          Search results

                                                                                                          + +
                                                                                                          +
                                                                                                          +
                                                                                                            +
                                                                                                            +
                                                                                                            +
                                                                                                            +
                                                                                                            +
                                                                                                            + + +
                                                                                                            + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-join.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-join.html new file mode 100644 index 00000000..984548c7 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-join.html @@ -0,0 +1,179 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                            +

                                                                                                            Editor PHP 2.1.3

                                                                                                            + + + + + +
                                                                                                            + +
                                                                                                            +
                                                                                                            + + + + +
                                                                                                            +
                                                                                                              +
                                                                                                            + +
                                                                                                            +

                                                                                                            Join.php

                                                                                                            + +

                                                                                                            DataTables PHP libraries.

                                                                                                            + +

                                                                                                            PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                            +
                                                                                                            + + +
                                                                                                            + Tags + +
                                                                                                            +
                                                                                                            +
                                                                                                            + author +
                                                                                                            +
                                                                                                            + +

                                                                                                            SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                            +
                                                                                                            + +
                                                                                                            +
                                                                                                            + + + + +

                                                                                                            + Interfaces, Classes, Traits and Enums + +

                                                                                                            + +
                                                                                                            + +
                                                                                                            Join
                                                                                                            +
                                                                                                            Join table class for DataTables Editor.
                                                                                                            + + +
                                                                                                            + + + + + + + + +
                                                                                                            +
                                                                                                            +
                                                                                                            +
                                                                                                            +

                                                                                                            Search results

                                                                                                            + +
                                                                                                            +
                                                                                                            +
                                                                                                              +
                                                                                                              +
                                                                                                              +
                                                                                                              +
                                                                                                              +
                                                                                                              + + +
                                                                                                              + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-mjoin.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-mjoin.html new file mode 100644 index 00000000..8a6c8a41 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-mjoin.html @@ -0,0 +1,182 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                              +

                                                                                                              Editor PHP 2.1.3

                                                                                                              + + + + + +
                                                                                                              + +
                                                                                                              +
                                                                                                              + + + + +
                                                                                                              +
                                                                                                                +
                                                                                                              + +
                                                                                                              +

                                                                                                              Mjoin.php

                                                                                                              + +

                                                                                                              DataTables PHP libraries.

                                                                                                              + +

                                                                                                              PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                              +
                                                                                                              + + +
                                                                                                              + Tags + +
                                                                                                              +
                                                                                                              +
                                                                                                              + author +
                                                                                                              +
                                                                                                              + +

                                                                                                              SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                              +
                                                                                                              + +
                                                                                                              +
                                                                                                              + + + + +

                                                                                                              + Interfaces, Classes, Traits and Enums + +

                                                                                                              + +
                                                                                                              + +
                                                                                                              Mjoin
                                                                                                              +
                                                                                                              The `Mjoin` class extends the `Join` class with the join data type set to +'array', whereas the `Join` default is `object` which has been rendered +obsolete by the `Editor->leftJoin()` method. The API API is otherwise +identical.
                                                                                                              + + +
                                                                                                              + + + + + + + + +
                                                                                                              +
                                                                                                              +
                                                                                                              +
                                                                                                              +

                                                                                                              Search results

                                                                                                              + +
                                                                                                              +
                                                                                                              +
                                                                                                                +
                                                                                                                +
                                                                                                                +
                                                                                                                +
                                                                                                                +
                                                                                                                + + +
                                                                                                                + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-options.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-options.html new file mode 100644 index 00000000..34ef0b4b --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-options.html @@ -0,0 +1,180 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                +

                                                                                                                Editor PHP 2.1.3

                                                                                                                + + + + + +
                                                                                                                + +
                                                                                                                +
                                                                                                                + + + + +
                                                                                                                +
                                                                                                                  +
                                                                                                                + +
                                                                                                                +

                                                                                                                Options.php

                                                                                                                + +

                                                                                                                DataTables PHP libraries.

                                                                                                                + +

                                                                                                                PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                                +
                                                                                                                + + +
                                                                                                                + Tags + +
                                                                                                                +
                                                                                                                +
                                                                                                                + author +
                                                                                                                +
                                                                                                                + +

                                                                                                                SpryMedia +@copyright 2016 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                                +
                                                                                                                + +
                                                                                                                +
                                                                                                                + + + + +

                                                                                                                + Interfaces, Classes, Traits and Enums + +

                                                                                                                + +
                                                                                                                + +
                                                                                                                Options
                                                                                                                +
                                                                                                                The Options class provides a convenient method of specifying where Editor +should get the list of options for a `select`, `radio` or `checkbox` field.
                                                                                                                + + +
                                                                                                                + + + + + + + + +
                                                                                                                +
                                                                                                                +
                                                                                                                +
                                                                                                                +

                                                                                                                Search results

                                                                                                                + +
                                                                                                                +
                                                                                                                +
                                                                                                                  +
                                                                                                                  +
                                                                                                                  +
                                                                                                                  +
                                                                                                                  +
                                                                                                                  + + +
                                                                                                                  + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-searchbuilderoptions.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-searchbuilderoptions.html new file mode 100644 index 00000000..31cdf905 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-searchbuilderoptions.html @@ -0,0 +1,180 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                  +

                                                                                                                  Editor PHP 2.1.3

                                                                                                                  + + + + + +
                                                                                                                  + +
                                                                                                                  +
                                                                                                                  + + + + +
                                                                                                                  +
                                                                                                                    +
                                                                                                                  + +
                                                                                                                  +

                                                                                                                  SearchBuilderOptions.php

                                                                                                                  + +

                                                                                                                  DataTables PHP libraries.

                                                                                                                  + +

                                                                                                                  PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                                  +
                                                                                                                  + + +
                                                                                                                  + Tags + +
                                                                                                                  +
                                                                                                                  +
                                                                                                                  + author +
                                                                                                                  +
                                                                                                                  + +

                                                                                                                  SpryMedia +@copyright 2016 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                                  +
                                                                                                                  + +
                                                                                                                  +
                                                                                                                  + + + + +

                                                                                                                  + Interfaces, Classes, Traits and Enums + +

                                                                                                                  + +
                                                                                                                  + +
                                                                                                                  SearchBuilderOptions
                                                                                                                  +
                                                                                                                  The Options class provides a convenient method of specifying where Editor +should get the list of options for a `select`, `radio` or `checkbox` field.
                                                                                                                  + + +
                                                                                                                  + + + + + + + + +
                                                                                                                  +
                                                                                                                  +
                                                                                                                  +
                                                                                                                  +

                                                                                                                  Search results

                                                                                                                  + +
                                                                                                                  +
                                                                                                                  +
                                                                                                                    +
                                                                                                                    +
                                                                                                                    +
                                                                                                                    +
                                                                                                                    +
                                                                                                                    + + +
                                                                                                                    + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-searchpaneoptions.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-searchpaneoptions.html new file mode 100644 index 00000000..573ae11e --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-searchpaneoptions.html @@ -0,0 +1,180 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                    +

                                                                                                                    Editor PHP 2.1.3

                                                                                                                    + + + + + +
                                                                                                                    + +
                                                                                                                    +
                                                                                                                    + + + + +
                                                                                                                    +
                                                                                                                      +
                                                                                                                    + +
                                                                                                                    +

                                                                                                                    SearchPaneOptions.php

                                                                                                                    + +

                                                                                                                    DataTables PHP libraries.

                                                                                                                    + +

                                                                                                                    PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                                    +
                                                                                                                    + + +
                                                                                                                    + Tags + +
                                                                                                                    +
                                                                                                                    +
                                                                                                                    + author +
                                                                                                                    +
                                                                                                                    + +

                                                                                                                    SpryMedia +@copyright 2016 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                                    +
                                                                                                                    + +
                                                                                                                    +
                                                                                                                    + + + + +

                                                                                                                    + Interfaces, Classes, Traits and Enums + +

                                                                                                                    + +
                                                                                                                    + +
                                                                                                                    SearchPaneOptions
                                                                                                                    +
                                                                                                                    The Options class provides a convenient method of specifying where Editor +should get the list of options for a `select`, `radio` or `checkbox` field.
                                                                                                                    + + +
                                                                                                                    + + + + + + + + +
                                                                                                                    +
                                                                                                                    +
                                                                                                                    +
                                                                                                                    +

                                                                                                                    Search results

                                                                                                                    + +
                                                                                                                    +
                                                                                                                    +
                                                                                                                      +
                                                                                                                      +
                                                                                                                      +
                                                                                                                      +
                                                                                                                      +
                                                                                                                      + + +
                                                                                                                      + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-upload.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-upload.html new file mode 100644 index 00000000..865ee10b --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-upload.html @@ -0,0 +1,181 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                      +

                                                                                                                      Editor PHP 2.1.3

                                                                                                                      + + + + + +
                                                                                                                      + +
                                                                                                                      +
                                                                                                                      + + + + +
                                                                                                                      +
                                                                                                                        +
                                                                                                                      + +
                                                                                                                      +

                                                                                                                      Upload.php

                                                                                                                      + +

                                                                                                                      DataTables PHP libraries.

                                                                                                                      + +

                                                                                                                      PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                                      +
                                                                                                                      + + +
                                                                                                                      + Tags + +
                                                                                                                      +
                                                                                                                      +
                                                                                                                      + author +
                                                                                                                      +
                                                                                                                      + +

                                                                                                                      SpryMedia +@copyright 2015 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                                      +
                                                                                                                      + +
                                                                                                                      +
                                                                                                                      + + + + +

                                                                                                                      + Interfaces, Classes, Traits and Enums + +

                                                                                                                      + +
                                                                                                                      + +
                                                                                                                      Upload
                                                                                                                      +
                                                                                                                      Upload class for Editor. This class provides the ability to easily specify +file upload information, specifically how the file should be recorded on +the server (database and file system).
                                                                                                                      + + +
                                                                                                                      + + + + + + + + +
                                                                                                                      +
                                                                                                                      +
                                                                                                                      +
                                                                                                                      +

                                                                                                                      Search results

                                                                                                                      + +
                                                                                                                      +
                                                                                                                      +
                                                                                                                        +
                                                                                                                        +
                                                                                                                        +
                                                                                                                        +
                                                                                                                        +
                                                                                                                        + + +
                                                                                                                        + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-validate.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-validate.html new file mode 100644 index 00000000..d22711c9 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-validate.html @@ -0,0 +1,179 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                        +

                                                                                                                        Editor PHP 2.1.3

                                                                                                                        + + + + + +
                                                                                                                        + +
                                                                                                                        +
                                                                                                                        + + + + +
                                                                                                                        +
                                                                                                                          +
                                                                                                                        + +
                                                                                                                        +

                                                                                                                        Validate.php

                                                                                                                        + +

                                                                                                                        DataTables PHP libraries.

                                                                                                                        + +

                                                                                                                        PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                                        +
                                                                                                                        + + +
                                                                                                                        + Tags + +
                                                                                                                        +
                                                                                                                        +
                                                                                                                        + author +
                                                                                                                        +
                                                                                                                        + +

                                                                                                                        SpryMedia +@copyright 2012-2014 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                                        +
                                                                                                                        + +
                                                                                                                        +
                                                                                                                        + + + + +

                                                                                                                        + Interfaces, Classes, Traits and Enums + +

                                                                                                                        + +
                                                                                                                        + +
                                                                                                                        Validate
                                                                                                                        +
                                                                                                                        Validation methods for DataTables Editor fields.
                                                                                                                        + + +
                                                                                                                        + + + + + + + + +
                                                                                                                        +
                                                                                                                        +
                                                                                                                        +
                                                                                                                        +

                                                                                                                        Search results

                                                                                                                        + +
                                                                                                                        +
                                                                                                                        +
                                                                                                                          +
                                                                                                                          +
                                                                                                                          +
                                                                                                                          +
                                                                                                                          +
                                                                                                                          + + +
                                                                                                                          + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-validateoptions.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-validateoptions.html new file mode 100644 index 00000000..7b9f6e70 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor-validateoptions.html @@ -0,0 +1,179 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                          +

                                                                                                                          Editor PHP 2.1.3

                                                                                                                          + + + + + +
                                                                                                                          + +
                                                                                                                          +
                                                                                                                          + + + + +
                                                                                                                          +
                                                                                                                            +
                                                                                                                          + +
                                                                                                                          +

                                                                                                                          ValidateOptions.php

                                                                                                                          + +

                                                                                                                          DataTables PHP libraries.

                                                                                                                          + +

                                                                                                                          PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                                          +
                                                                                                                          + + +
                                                                                                                          + Tags + +
                                                                                                                          +
                                                                                                                          +
                                                                                                                          + author +
                                                                                                                          +
                                                                                                                          + +

                                                                                                                          SpryMedia +@copyright 2012-2014 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                                          +
                                                                                                                          + +
                                                                                                                          +
                                                                                                                          + + + + +

                                                                                                                          + Interfaces, Classes, Traits and Enums + +

                                                                                                                          + +
                                                                                                                          + +
                                                                                                                          ValidateOptions
                                                                                                                          +
                                                                                                                          Common validation options that can be specified for all validation methods.
                                                                                                                          + + +
                                                                                                                          + + + + + + + + +
                                                                                                                          +
                                                                                                                          +
                                                                                                                          +
                                                                                                                          +

                                                                                                                          Search results

                                                                                                                          + +
                                                                                                                          +
                                                                                                                          +
                                                                                                                            +
                                                                                                                            +
                                                                                                                            +
                                                                                                                            +
                                                                                                                            +
                                                                                                                            + + +
                                                                                                                            + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor.html new file mode 100644 index 00000000..6291d754 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/editor.html @@ -0,0 +1,180 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                            +

                                                                                                                            Editor PHP 2.1.3

                                                                                                                            + + + + + +
                                                                                                                            + +
                                                                                                                            +
                                                                                                                            + + + + +
                                                                                                                            +
                                                                                                                              +
                                                                                                                            + +
                                                                                                                            +

                                                                                                                            Editor.php

                                                                                                                            + +

                                                                                                                            DataTables PHP libraries.

                                                                                                                            + +

                                                                                                                            PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                                            +
                                                                                                                            + + +
                                                                                                                            + Tags + +
                                                                                                                            +
                                                                                                                            +
                                                                                                                            + author +
                                                                                                                            +
                                                                                                                            + +

                                                                                                                            SpryMedia +@version VERSION +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                                            +
                                                                                                                            + +
                                                                                                                            +
                                                                                                                            + + + + +

                                                                                                                            + Interfaces, Classes, Traits and Enums + +

                                                                                                                            + +
                                                                                                                            + +
                                                                                                                            Editor
                                                                                                                            +
                                                                                                                            DataTables Editor base class for creating editable tables.
                                                                                                                            + + +
                                                                                                                            + + + + + + + + +
                                                                                                                            +
                                                                                                                            +
                                                                                                                            +
                                                                                                                            +

                                                                                                                            Search results

                                                                                                                            + +
                                                                                                                            +
                                                                                                                            +
                                                                                                                              +
                                                                                                                              +
                                                                                                                              +
                                                                                                                              +
                                                                                                                              +
                                                                                                                              + + +
                                                                                                                              + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/ext.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/ext.html new file mode 100644 index 00000000..55c115d9 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/ext.html @@ -0,0 +1,179 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                              +

                                                                                                                              Editor PHP 2.1.3

                                                                                                                              + + + + + +
                                                                                                                              + +
                                                                                                                              +
                                                                                                                              + + + + +
                                                                                                                              +
                                                                                                                                +
                                                                                                                              + +
                                                                                                                              +

                                                                                                                              Ext.php

                                                                                                                              + +

                                                                                                                              DataTables PHP libraries.

                                                                                                                              + +

                                                                                                                              PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                                              +
                                                                                                                              + + +
                                                                                                                              + Tags + +
                                                                                                                              +
                                                                                                                              +
                                                                                                                              + author +
                                                                                                                              +
                                                                                                                              + +

                                                                                                                              SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                                              +
                                                                                                                              + +
                                                                                                                              +
                                                                                                                              + + + + +

                                                                                                                              + Interfaces, Classes, Traits and Enums + +

                                                                                                                              + +
                                                                                                                              + +
                                                                                                                              Ext
                                                                                                                              +
                                                                                                                              Base class for DataTables classes.
                                                                                                                              + + +
                                                                                                                              + + + + + + + + +
                                                                                                                              +
                                                                                                                              +
                                                                                                                              +
                                                                                                                              +

                                                                                                                              Search results

                                                                                                                              + +
                                                                                                                              +
                                                                                                                              +
                                                                                                                                +
                                                                                                                                +
                                                                                                                                +
                                                                                                                                +
                                                                                                                                +
                                                                                                                                + + +
                                                                                                                                + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/htmlawed-htmlaw.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/htmlawed-htmlaw.html new file mode 100644 index 00000000..a2d0d16d --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/htmlawed-htmlaw.html @@ -0,0 +1,184 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                +

                                                                                                                                Editor PHP 2.1.3

                                                                                                                                + + + + + +
                                                                                                                                + +
                                                                                                                                +
                                                                                                                                + + + + +
                                                                                                                                +
                                                                                                                                  +
                                                                                                                                + +
                                                                                                                                +

                                                                                                                                Htmlaw.php

                                                                                                                                + +

                                                                                                                                HtmLawed is used here to provide protection against XSS attacks with Editor +input - see the `Field->xss()` method. The Vanilla forums wrapper is used +to provide sensible defaults and a clean interface for HtmLawed.

                                                                                                                                + +

                                                                                                                                Changes:

                                                                                                                                +
                                                                                                                                  +
                                                                                                                                • Add DataTables/HtmLawed namespace to this and htmLawed - this is to ensure +that if htmLawed is included by any other aspect of the site it will not +result in a conflict.
                                                                                                                                • +
                                                                                                                                • Use the OOP version of htmLawed (required a single updated to call it) to +make the namespacing relatively easy.
                                                                                                                                • +
                                                                                                                                • Change the name of the Vanilla class so it don't conflict with the +htmLawed OOP class
                                                                                                                                • +
                                                                                                                                • Update all htmLawed:: references to \DataTables\HtmLawed\HtmLawed:: in +the htmLawed file (to allow callbacks to operate correctly)
                                                                                                                                • +
                                                                                                                                • Updated Vanilla wrapper to operate on PHP 5.3
                                                                                                                                • +
                                                                                                                                +

                                                                                                                                HtmLawed: +http://www.bioinformatics.org/phplabware/internal_utilities/htmLawed/ +Copyright: Santosh Patnaik +License: Dual licensed with LGPL 3 and GPL 2+

                                                                                                                                +

                                                                                                                                Vanilla wrapper for HtmLawed: +https://github.com/vanilla/htmlawed/ +Author: Todd Burry todd@vanillaforums.com +Copyright: 2009-2014 Vanilla Forums Inc. +License: LGPL-3.0

                                                                                                                                +
                                                                                                                                + + + + + + +

                                                                                                                                + Interfaces, Classes, Traits and Enums + +

                                                                                                                                + +
                                                                                                                                + +
                                                                                                                                Htmlaw
                                                                                                                                +
                                                                                                                                A class wrapper for the htmLawed library.
                                                                                                                                + + +
                                                                                                                                + + + + + + + + +
                                                                                                                                +
                                                                                                                                +
                                                                                                                                +
                                                                                                                                +

                                                                                                                                Search results

                                                                                                                                + +
                                                                                                                                +
                                                                                                                                +
                                                                                                                                  +
                                                                                                                                  +
                                                                                                                                  +
                                                                                                                                  +
                                                                                                                                  +
                                                                                                                                  + + +
                                                                                                                                  + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/files/htmlawed-htmlawed.html b/ci4/app/ThirdParty/DatatablesEditor/docs/files/htmlawed-htmlawed.html new file mode 100644 index 00000000..643c3d95 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/files/htmlawed-htmlawed.html @@ -0,0 +1,147 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                  +

                                                                                                                                  Editor PHP 2.1.3

                                                                                                                                  + + + + + +
                                                                                                                                  + +
                                                                                                                                  +
                                                                                                                                  + + + + +
                                                                                                                                  +
                                                                                                                                    +
                                                                                                                                  + +
                                                                                                                                  +

                                                                                                                                  Htmlawed.php

                                                                                                                                  + + +
                                                                                                                                  + + + + + + + + + + + + + + +
                                                                                                                                  +
                                                                                                                                  +
                                                                                                                                  +
                                                                                                                                  +

                                                                                                                                  Search results

                                                                                                                                  + +
                                                                                                                                  +
                                                                                                                                  +
                                                                                                                                    +
                                                                                                                                    +
                                                                                                                                    +
                                                                                                                                    +
                                                                                                                                    +
                                                                                                                                    + + +
                                                                                                                                    + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/graphs/classes.html b/ci4/app/ThirdParty/DatatablesEditor/docs/graphs/classes.html new file mode 100644 index 00000000..0d3e581d --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/graphs/classes.html @@ -0,0 +1,124 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + +
                                                                                                                                    +

                                                                                                                                    Editor PHP 2.1.3

                                                                                                                                    + + + + + +
                                                                                                                                    + +
                                                                                                                                    +
                                                                                                                                    + + + + +
                                                                                                                                    +
                                                                                                                                    + +
                                                                                                                                    + +
                                                                                                                                    +
                                                                                                                                    +
                                                                                                                                    +

                                                                                                                                    Search results

                                                                                                                                    + +
                                                                                                                                    +
                                                                                                                                    +
                                                                                                                                      +
                                                                                                                                      +
                                                                                                                                      +
                                                                                                                                      +
                                                                                                                                      +
                                                                                                                                      + + +
                                                                                                                                      + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/index.html b/ci4/app/ThirdParty/DatatablesEditor/docs/index.html new file mode 100644 index 00000000..dfa96aaa --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/index.html @@ -0,0 +1,258 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                      +

                                                                                                                                      Editor PHP 2.1.3

                                                                                                                                      + + + + + +
                                                                                                                                      + +
                                                                                                                                      +
                                                                                                                                      + + + + +
                                                                                                                                      +

                                                                                                                                      Documentation

                                                                                                                                      + + +

                                                                                                                                      + Packages + +

                                                                                                                                      + +
                                                                                                                                      +
                                                                                                                                      Application
                                                                                                                                      +
                                                                                                                                      + +

                                                                                                                                      + Namespaces + +

                                                                                                                                      + +
                                                                                                                                      +
                                                                                                                                      DataTables
                                                                                                                                      +
                                                                                                                                      + + + +

                                                                                                                                      + Table of Contents + +

                                                                                                                                      + +
                                                                                                                                      +
                                                                                                                                      + DATATABLES + +  = \true +
                                                                                                                                      +
                                                                                                                                      + +
                                                                                                                                      + DATATABLES + +  = \true +
                                                                                                                                      +
                                                                                                                                      DataTables PHP libraries.
                                                                                                                                      + +
                                                                                                                                      + + +
                                                                                                                                      +

                                                                                                                                      + Constants + +

                                                                                                                                      +
                                                                                                                                      +

                                                                                                                                      + DATATABLES + +

                                                                                                                                      + + + + + + public + mixed + DATATABLES + = \true + + + +
                                                                                                                                      + +
                                                                                                                                      + + + +
                                                                                                                                      +
                                                                                                                                      +

                                                                                                                                      + DATATABLES + +

                                                                                                                                      + + + +

                                                                                                                                      DataTables PHP libraries.

                                                                                                                                      + + + public + mixed + DATATABLES + = \true + + + +

                                                                                                                                      PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                                                      +
                                                                                                                                      + +
                                                                                                                                      + + +
                                                                                                                                      + Tags + +
                                                                                                                                      +
                                                                                                                                      +
                                                                                                                                      + author +
                                                                                                                                      +
                                                                                                                                      + +

                                                                                                                                      SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                                                      +
                                                                                                                                      + +
                                                                                                                                      +
                                                                                                                                      + +
                                                                                                                                      +
                                                                                                                                      + + +
                                                                                                                                      +
                                                                                                                                      +
                                                                                                                                      +

                                                                                                                                      Search results

                                                                                                                                      + +
                                                                                                                                      +
                                                                                                                                      +
                                                                                                                                        +
                                                                                                                                        +
                                                                                                                                        +
                                                                                                                                        +
                                                                                                                                        +
                                                                                                                                        + + +
                                                                                                                                        + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/indices/files.html b/ci4/app/ThirdParty/DatatablesEditor/docs/indices/files.html new file mode 100644 index 00000000..d81532c5 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/indices/files.html @@ -0,0 +1,206 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                        +

                                                                                                                                        Editor PHP 2.1.3

                                                                                                                                        + + + + + +
                                                                                                                                        + +
                                                                                                                                        +
                                                                                                                                        + + + + + +
                                                                                                                                        + + +
                                                                                                                                        + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/js/search.js b/ci4/app/ThirdParty/DatatablesEditor/docs/js/search.js new file mode 100644 index 00000000..093d6d03 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/js/search.js @@ -0,0 +1,173 @@ +// Search module for phpDocumentor +// +// This module is a wrapper around fuse.js that will use a given index and attach itself to a +// search form and to a search results pane identified by the following data attributes: +// +// 1. data-search-form +// 2. data-search-results +// +// The data-search-form is expected to have a single input element of type 'search' that will trigger searching for +// a series of results, were the data-search-results pane is expected to have a direct UL child that will be populated +// with rendered results. +// +// The search has various stages, upon loading this stage the data-search-form receives the CSS class +// 'phpdocumentor-search--enabled'; this indicates that JS is allowed and indices are being loaded. It is recommended +// to hide the form by default and show it when it receives this class to achieve progressive enhancement for this +// feature. +// +// After loading this module, it is expected to load a search index asynchronously, for example: +// +// +// +// In this script the generated index should attach itself to the search module using the `appendIndex` function. By +// doing it like this the page will continue loading, unhindered by the loading of the search. +// +// After the page has fully loaded, and all these deferred indexes loaded, the initialization of the search module will +// be called and the form will receive the class 'phpdocumentor-search--active', indicating search is ready. At this +// point, the input field will also have it's 'disabled' attribute removed. +var Search = (function () { + var fuse; + var index = []; + var options = { + shouldSort: true, + threshold: 0.6, + location: 0, + distance: 100, + maxPatternLength: 32, + minMatchCharLength: 1, + keys: [ + "fqsen", + "name", + "summary", + "url" + ] + }; + + // Credit David Walsh (https://davidwalsh.name/javascript-debounce-function) + // Returns a function, that, as long as it continues to be invoked, will not + // be triggered. The function will be called after it stops being called for + // N milliseconds. If `immediate` is passed, trigger the function on the + // leading edge, instead of the trailing. + function debounce(func, wait, immediate) { + var timeout; + + return function executedFunction() { + var context = this; + var args = arguments; + + var later = function () { + timeout = null; + if (!immediate) func.apply(context, args); + }; + + var callNow = immediate && !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + if (callNow) func.apply(context, args); + }; + } + + function close() { + // Start scroll prevention: https://css-tricks.com/prevent-page-scrolling-when-a-modal-is-open/ + const scrollY = document.body.style.top; + document.body.style.position = ''; + document.body.style.top = ''; + window.scrollTo(0, parseInt(scrollY || '0') * -1); + // End scroll prevention + + var form = document.querySelector('[data-search-form]'); + var searchResults = document.querySelector('[data-search-results]'); + + form.classList.toggle('phpdocumentor-search--has-results', false); + searchResults.classList.add('phpdocumentor-search-results--hidden'); + var searchField = document.querySelector('[data-search-form] input[type="search"]'); + searchField.blur(); + } + + function search(event) { + // Start scroll prevention: https://css-tricks.com/prevent-page-scrolling-when-a-modal-is-open/ + document.body.style.position = 'fixed'; + document.body.style.top = `-${window.scrollY}px`; + // End scroll prevention + + // prevent enter's from autosubmitting + event.stopPropagation(); + + var form = document.querySelector('[data-search-form]'); + var searchResults = document.querySelector('[data-search-results]'); + var searchResultEntries = document.querySelector('[data-search-results] .phpdocumentor-search-results__entries'); + + searchResultEntries.innerHTML = ''; + + if (!event.target.value) { + close(); + return; + } + + form.classList.toggle('phpdocumentor-search--has-results', true); + searchResults.classList.remove('phpdocumentor-search-results--hidden'); + var results = fuse.search(event.target.value, {limit: 25}); + + results.forEach(function (result) { + var entry = document.createElement("li"); + entry.classList.add("phpdocumentor-search-results__entry"); + entry.innerHTML += '

                                                                                                                                        ' + result.name + "

                                                                                                                                        \n"; + entry.innerHTML += '' + result.fqsen + "\n"; + entry.innerHTML += '
                                                                                                                                        ' + result.summary + '
                                                                                                                                        '; + searchResultEntries.appendChild(entry) + }); + } + + function appendIndex(added) { + index = index.concat(added); + + // re-initialize search engine when appending an index after initialisation + if (typeof fuse !== 'undefined') { + fuse = new Fuse(index, options); + } + } + + function init() { + fuse = new Fuse(index, options); + + var form = document.querySelector('[data-search-form]'); + var searchField = document.querySelector('[data-search-form] input[type="search"]'); + + var closeButton = document.querySelector('.phpdocumentor-search-results__close'); + closeButton.addEventListener('click', function() { close() }.bind(this)); + + var searchResults = document.querySelector('[data-search-results]'); + searchResults.addEventListener('click', function() { close() }.bind(this)); + + form.classList.add('phpdocumentor-search--active'); + + searchField.setAttribute('placeholder', 'Search (Press "/" to focus)'); + searchField.removeAttribute('disabled'); + searchField.addEventListener('keyup', debounce(search, 300)); + + window.addEventListener('keyup', function (event) { + if (event.key === '/') { + searchField.focus(); + } + if (event.code === 'Escape') { + close(); + } + }.bind(this)); + } + + return { + appendIndex, + init + } +})(); + +window.addEventListener('DOMContentLoaded', function () { + var form = document.querySelector('[data-search-form]'); + + // When JS is supported; show search box. Must be before including the search for it to take effect immediately + form.classList.add('phpdocumentor-search--enabled'); +}); + +window.addEventListener('load', function () { + Search.init(); +}); diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/js/searchIndex.js b/ci4/app/ThirdParty/DatatablesEditor/docs/js/searchIndex.js new file mode 100644 index 00000000..36a03f75 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/js/searchIndex.js @@ -0,0 +1,1744 @@ +Search.appendIndex( + [ + { + "fqsen": "\\DATATABLES", + "name": "DATATABLES", + "summary": "DataTables\u0020PHP\u0020libraries.", + "url": "namespaces/default.html#constant_DATATABLES" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\Db2Query", + "name": "Db2Query", + "summary": "DB2\u0020driver\u0020for\u0020DataTables\u0020Database\u0020Query\u0020class", + "url": "classes/DataTables-Database-Driver-Db2Query.html" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\Db2Query\u003A\u003Aconnect\u0028\u0029", + "name": "connect", + "summary": "Database\u0020connection\u0020\u002D\u0020override\u0020by\u0020the\u0020database\u0020driver.", + "url": "classes/DataTables-Database-Driver-Db2Query.html#method_connect" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\Db2Query\u003A\u003Atransaction\u0028\u0029", + "name": "transaction", + "summary": "Start\u0020a\u0020database\u0020transaction", + "url": "classes/DataTables-Database-Driver-Db2Query.html#method_transaction" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\Db2Query\u003A\u003Acommit\u0028\u0029", + "name": "commit", + "summary": "Commit\u0020a\u0020transaction.", + "url": "classes/DataTables-Database-Driver-Db2Query.html#method_commit" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\Db2Query\u003A\u003Arollback\u0028\u0029", + "name": "rollback", + "summary": "Rollback\u0020the\u0020database\u0020state\u0020to\u0020the\u0020start\u0020of\u0020the\u0020transaction.", + "url": "classes/DataTables-Database-Driver-Db2Query.html#method_rollback" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\Db2Query\u003A\u003A_prepare\u0028\u0029", + "name": "_prepare", + "summary": "Prepare\u0020the\u0020SQL\u0020query\u0020by\u0020populating\u0020the\u0020bound\u0020variables.", + "url": "classes/DataTables-Database-Driver-Db2Query.html#method__prepare" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\Db2Query\u003A\u003A_exec\u0028\u0029", + "name": "_exec", + "summary": "", + "url": "classes/DataTables-Database-Driver-Db2Query.html#method__exec" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\Db2Query\u003A\u003A_build_table\u0028\u0029", + "name": "_build_table", + "summary": "", + "url": "classes/DataTables-Database-Driver-Db2Query.html#method__build_table" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\Db2Query\u003A\u003A\u0024_identifier_limiter", + "name": "_identifier_limiter", + "summary": "", + "url": "classes/DataTables-Database-Driver-Db2Query.html#property__identifier_limiter" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\Db2Query\u003A\u003A\u0024_field_quote", + "name": "_field_quote", + "summary": "", + "url": "classes/DataTables-Database-Driver-Db2Query.html#property__field_quote" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\Db2Result", + "name": "Db2Result", + "summary": "SQL\u0020Server\u0020driver\u0020for\u0020DataTables\u0020Database\u0020Result\u0020class", + "url": "classes/DataTables-Database-Driver-Db2Result.html" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\Db2Result\u003A\u003A__construct\u0028\u0029", + "name": "__construct", + "summary": "", + "url": "classes/DataTables-Database-Driver-Db2Result.html#method___construct" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\Db2Result\u003A\u003Acount\u0028\u0029", + "name": "count", + "summary": "Count\u0020the\u0020number\u0020of\u0020rows\u0020in\u0020the\u0020result\u0020set.", + "url": "classes/DataTables-Database-Driver-Db2Result.html#method_count" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\Db2Result\u003A\u003Afetch\u0028\u0029", + "name": "fetch", + "summary": "Get\u0020the\u0020next\u0020row\u0020in\u0020a\u0020result\u0020set", + "url": "classes/DataTables-Database-Driver-Db2Result.html#method_fetch" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\Db2Result\u003A\u003AfetchAll\u0028\u0029", + "name": "fetchAll", + "summary": "Get\u0020all\u0020rows\u0020in\u0020the\u0020result\u0020set", + "url": "classes/DataTables-Database-Driver-Db2Result.html#method_fetchAll" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\Db2Result\u003A\u003AinsertId\u0028\u0029", + "name": "insertId", + "summary": "After\u0020an\u0020INSERT\u0020query,\u0020get\u0020the\u0020ID\u0020that\u0020was\u0020inserted.", + "url": "classes/DataTables-Database-Driver-Db2Result.html#method_insertId" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\FirebirdQuery", + "name": "FirebirdQuery", + "summary": "Firebird\u0020driver\u0020for\u0020DataTables\u0020Database\u0020Query\u0020class", + "url": "classes/DataTables-Database-Driver-FirebirdQuery.html" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\FirebirdQuery\u003A\u003Aconnect\u0028\u0029", + "name": "connect", + "summary": "Database\u0020connection\u0020\u002D\u0020override\u0020by\u0020the\u0020database\u0020driver.", + "url": "classes/DataTables-Database-Driver-FirebirdQuery.html#method_connect" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\FirebirdQuery\u003A\u003A_prepare\u0028\u0029", + "name": "_prepare", + "summary": "Prepare\u0020the\u0020SQL\u0020query\u0020by\u0020populating\u0020the\u0020bound\u0020variables.", + "url": "classes/DataTables-Database-Driver-FirebirdQuery.html#method__prepare" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\FirebirdQuery\u003A\u003A_exec\u0028\u0029", + "name": "_exec", + "summary": "", + "url": "classes/DataTables-Database-Driver-FirebirdQuery.html#method__exec" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\FirebirdQuery\u003A\u003A\u0024_identifier_limiter", + "name": "_identifier_limiter", + "summary": "", + "url": "classes/DataTables-Database-Driver-FirebirdQuery.html#property__identifier_limiter" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\FirebirdQuery\u003A\u003A\u0024_field_quote", + "name": "_field_quote", + "summary": "", + "url": "classes/DataTables-Database-Driver-FirebirdQuery.html#property__field_quote" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\FirebirdQuery\u003A\u003A\u0024_supportsAsAlias", + "name": "_supportsAsAlias", + "summary": "", + "url": "classes/DataTables-Database-Driver-FirebirdQuery.html#property__supportsAsAlias" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\FirebirdQuery\u003A\u003A\u0024_pkeyInsertedTo", + "name": "_pkeyInsertedTo", + "summary": "", + "url": "classes/DataTables-Database-Driver-FirebirdQuery.html#property__pkeyInsertedTo" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\FirebirdResult", + "name": "FirebirdResult", + "summary": "Firebird\u0020driver\u0020for\u0020DataTables\u0020Database\u0020Result\u0020class", + "url": "classes/DataTables-Database-Driver-FirebirdResult.html" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\FirebirdResult\u003A\u003A__construct\u0028\u0029", + "name": "__construct", + "summary": "", + "url": "classes/DataTables-Database-Driver-FirebirdResult.html#method___construct" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\FirebirdResult\u003A\u003Acount\u0028\u0029", + "name": "count", + "summary": "Count\u0020the\u0020number\u0020of\u0020rows\u0020in\u0020the\u0020result\u0020set.", + "url": "classes/DataTables-Database-Driver-FirebirdResult.html#method_count" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\FirebirdResult\u003A\u003Afetch\u0028\u0029", + "name": "fetch", + "summary": "Get\u0020the\u0020next\u0020row\u0020in\u0020a\u0020result\u0020set", + "url": "classes/DataTables-Database-Driver-FirebirdResult.html#method_fetch" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\FirebirdResult\u003A\u003AfetchAll\u0028\u0029", + "name": "fetchAll", + "summary": "Get\u0020all\u0020rows\u0020in\u0020the\u0020result\u0020set", + "url": "classes/DataTables-Database-Driver-FirebirdResult.html#method_fetchAll" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\FirebirdResult\u003A\u003AinsertId\u0028\u0029", + "name": "insertId", + "summary": "After\u0020an\u0020INSERT\u0020query,\u0020get\u0020the\u0020ID\u0020that\u0020was\u0020inserted.", + "url": "classes/DataTables-Database-Driver-FirebirdResult.html#method_insertId" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\MysqlQuery", + "name": "MysqlQuery", + "summary": "MySQL\u0020driver\u0020for\u0020DataTables\u0020Database\u0020Query\u0020class", + "url": "classes/DataTables-Database-Driver-MysqlQuery.html" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\MysqlQuery\u003A\u003Aconnect\u0028\u0029", + "name": "connect", + "summary": "Database\u0020connection\u0020\u002D\u0020override\u0020by\u0020the\u0020database\u0020driver.", + "url": "classes/DataTables-Database-Driver-MysqlQuery.html#method_connect" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\MysqlQuery\u003A\u003A_prepare\u0028\u0029", + "name": "_prepare", + "summary": "Prepare\u0020the\u0020SQL\u0020query\u0020by\u0020populating\u0020the\u0020bound\u0020variables.", + "url": "classes/DataTables-Database-Driver-MysqlQuery.html#method__prepare" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\MysqlQuery\u003A\u003A_exec\u0028\u0029", + "name": "_exec", + "summary": "", + "url": "classes/DataTables-Database-Driver-MysqlQuery.html#method__exec" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\MysqlResult", + "name": "MysqlResult", + "summary": "MySQL\u0020driver\u0020for\u0020DataTables\u0020Database\u0020Result\u0020class", + "url": "classes/DataTables-Database-Driver-MysqlResult.html" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\MysqlResult\u003A\u003A__construct\u0028\u0029", + "name": "__construct", + "summary": "", + "url": "classes/DataTables-Database-Driver-MysqlResult.html#method___construct" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\MysqlResult\u003A\u003Acount\u0028\u0029", + "name": "count", + "summary": "Count\u0020the\u0020number\u0020of\u0020rows\u0020in\u0020the\u0020result\u0020set.", + "url": "classes/DataTables-Database-Driver-MysqlResult.html#method_count" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\MysqlResult\u003A\u003Afetch\u0028\u0029", + "name": "fetch", + "summary": "Get\u0020the\u0020next\u0020row\u0020in\u0020a\u0020result\u0020set", + "url": "classes/DataTables-Database-Driver-MysqlResult.html#method_fetch" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\MysqlResult\u003A\u003AfetchAll\u0028\u0029", + "name": "fetchAll", + "summary": "Get\u0020all\u0020rows\u0020in\u0020the\u0020result\u0020set", + "url": "classes/DataTables-Database-Driver-MysqlResult.html#method_fetchAll" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\MysqlResult\u003A\u003AinsertId\u0028\u0029", + "name": "insertId", + "summary": "After\u0020an\u0020INSERT\u0020query,\u0020get\u0020the\u0020ID\u0020that\u0020was\u0020inserted.", + "url": "classes/DataTables-Database-Driver-MysqlResult.html#method_insertId" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\OracleQuery", + "name": "OracleQuery", + "summary": "Oracle\u0020driver\u0020for\u0020DataTables\u0020Database\u0020Query\u0020class", + "url": "classes/DataTables-Database-Driver-OracleQuery.html" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\OracleQuery\u003A\u003Aconnect\u0028\u0029", + "name": "connect", + "summary": "Database\u0020connection\u0020\u002D\u0020override\u0020by\u0020the\u0020database\u0020driver.", + "url": "classes/DataTables-Database-Driver-OracleQuery.html#method_connect" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\OracleQuery\u003A\u003Atransaction\u0028\u0029", + "name": "transaction", + "summary": "Start\u0020a\u0020database\u0020transaction", + "url": "classes/DataTables-Database-Driver-OracleQuery.html#method_transaction" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\OracleQuery\u003A\u003Acommit\u0028\u0029", + "name": "commit", + "summary": "Commit\u0020a\u0020transaction.", + "url": "classes/DataTables-Database-Driver-OracleQuery.html#method_commit" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\OracleQuery\u003A\u003Arollback\u0028\u0029", + "name": "rollback", + "summary": "Rollback\u0020the\u0020database\u0020state\u0020to\u0020the\u0020start\u0020of\u0020the\u0020transaction.", + "url": "classes/DataTables-Database-Driver-OracleQuery.html#method_rollback" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\OracleQuery\u003A\u003A_prepare\u0028\u0029", + "name": "_prepare", + "summary": "Prepare\u0020the\u0020SQL\u0020query\u0020by\u0020populating\u0020the\u0020bound\u0020variables.", + "url": "classes/DataTables-Database-Driver-OracleQuery.html#method__prepare" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\OracleQuery\u003A\u003A_exec\u0028\u0029", + "name": "_exec", + "summary": "", + "url": "classes/DataTables-Database-Driver-OracleQuery.html#method__exec" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\OracleQuery\u003A\u003A_build_table\u0028\u0029", + "name": "_build_table", + "summary": "", + "url": "classes/DataTables-Database-Driver-OracleQuery.html#method__build_table" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\OracleQuery\u003A\u003A_build_limit\u0028\u0029", + "name": "_build_limit", + "summary": "Create\u0020the\u0020LIMIT\u0020\/\u0020OFFSET\u0020string", + "url": "classes/DataTables-Database-Driver-OracleQuery.html#method__build_limit" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\OracleQuery\u003A\u003A\u0024_identifier_limiter", + "name": "_identifier_limiter", + "summary": "", + "url": "classes/DataTables-Database-Driver-OracleQuery.html#property__identifier_limiter" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\OracleQuery\u003A\u003A\u0024_field_quote", + "name": "_field_quote", + "summary": "", + "url": "classes/DataTables-Database-Driver-OracleQuery.html#property__field_quote" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\OracleQuery\u003A\u003A\u0024_supportsAsAlias", + "name": "_supportsAsAlias", + "summary": "", + "url": "classes/DataTables-Database-Driver-OracleQuery.html#property__supportsAsAlias" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\OracleResult", + "name": "OracleResult", + "summary": "MySQL\u0020driver\u0020for\u0020DataTables\u0020Database\u0020Result\u0020class", + "url": "classes/DataTables-Database-Driver-OracleResult.html" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\OracleResult\u003A\u003A__construct\u0028\u0029", + "name": "__construct", + "summary": "", + "url": "classes/DataTables-Database-Driver-OracleResult.html#method___construct" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\OracleResult\u003A\u003Acount\u0028\u0029", + "name": "count", + "summary": "Count\u0020the\u0020number\u0020of\u0020rows\u0020in\u0020the\u0020result\u0020set.", + "url": "classes/DataTables-Database-Driver-OracleResult.html#method_count" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\OracleResult\u003A\u003Afetch\u0028\u0029", + "name": "fetch", + "summary": "Get\u0020the\u0020next\u0020row\u0020in\u0020a\u0020result\u0020set", + "url": "classes/DataTables-Database-Driver-OracleResult.html#method_fetch" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\OracleResult\u003A\u003AfetchAll\u0028\u0029", + "name": "fetchAll", + "summary": "Get\u0020all\u0020rows\u0020in\u0020the\u0020result\u0020set", + "url": "classes/DataTables-Database-Driver-OracleResult.html#method_fetchAll" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\OracleResult\u003A\u003AinsertId\u0028\u0029", + "name": "insertId", + "summary": "After\u0020an\u0020INSERT\u0020query,\u0020get\u0020the\u0020ID\u0020that\u0020was\u0020inserted.", + "url": "classes/DataTables-Database-Driver-OracleResult.html#method_insertId" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\PostgresQuery", + "name": "PostgresQuery", + "summary": "Postgres\u0020driver\u0020for\u0020DataTables\u0020Database\u0020Query\u0020class", + "url": "classes/DataTables-Database-Driver-PostgresQuery.html" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\PostgresQuery\u003A\u003Aconnect\u0028\u0029", + "name": "connect", + "summary": "Database\u0020connection\u0020\u002D\u0020override\u0020by\u0020the\u0020database\u0020driver.", + "url": "classes/DataTables-Database-Driver-PostgresQuery.html#method_connect" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\PostgresQuery\u003A\u003A_prepare\u0028\u0029", + "name": "_prepare", + "summary": "Prepare\u0020the\u0020SQL\u0020query\u0020by\u0020populating\u0020the\u0020bound\u0020variables.", + "url": "classes/DataTables-Database-Driver-PostgresQuery.html#method__prepare" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\PostgresQuery\u003A\u003A_exec\u0028\u0029", + "name": "_exec", + "summary": "", + "url": "classes/DataTables-Database-Driver-PostgresQuery.html#method__exec" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\PostgresQuery\u003A\u003A\u0024_identifier_limiter", + "name": "_identifier_limiter", + "summary": "", + "url": "classes/DataTables-Database-Driver-PostgresQuery.html#property__identifier_limiter" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\PostgresQuery\u003A\u003A\u0024_field_quote", + "name": "_field_quote", + "summary": "", + "url": "classes/DataTables-Database-Driver-PostgresQuery.html#property__field_quote" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\PostgresResult", + "name": "PostgresResult", + "summary": "Postgres\u0020driver\u0020for\u0020DataTables\u0020Database\u0020Result\u0020class", + "url": "classes/DataTables-Database-Driver-PostgresResult.html" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\PostgresResult\u003A\u003A__construct\u0028\u0029", + "name": "__construct", + "summary": "", + "url": "classes/DataTables-Database-Driver-PostgresResult.html#method___construct" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\PostgresResult\u003A\u003Acount\u0028\u0029", + "name": "count", + "summary": "Count\u0020the\u0020number\u0020of\u0020rows\u0020in\u0020the\u0020result\u0020set.", + "url": "classes/DataTables-Database-Driver-PostgresResult.html#method_count" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\PostgresResult\u003A\u003Afetch\u0028\u0029", + "name": "fetch", + "summary": "Get\u0020the\u0020next\u0020row\u0020in\u0020a\u0020result\u0020set", + "url": "classes/DataTables-Database-Driver-PostgresResult.html#method_fetch" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\PostgresResult\u003A\u003AfetchAll\u0028\u0029", + "name": "fetchAll", + "summary": "Get\u0020all\u0020rows\u0020in\u0020the\u0020result\u0020set", + "url": "classes/DataTables-Database-Driver-PostgresResult.html#method_fetchAll" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\PostgresResult\u003A\u003AinsertId\u0028\u0029", + "name": "insertId", + "summary": "After\u0020an\u0020INSERT\u0020query,\u0020get\u0020the\u0020ID\u0020that\u0020was\u0020inserted.", + "url": "classes/DataTables-Database-Driver-PostgresResult.html#method_insertId" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqliteQuery", + "name": "SqliteQuery", + "summary": "SQLite3\u0020driver\u0020for\u0020DataTables\u0020Database\u0020Query\u0020class", + "url": "classes/DataTables-Database-Driver-SqliteQuery.html" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqliteQuery\u003A\u003Aconnect\u0028\u0029", + "name": "connect", + "summary": "Database\u0020connection\u0020\u002D\u0020override\u0020by\u0020the\u0020database\u0020driver.", + "url": "classes/DataTables-Database-Driver-SqliteQuery.html#method_connect" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqliteQuery\u003A\u003A_prepare\u0028\u0029", + "name": "_prepare", + "summary": "Prepare\u0020the\u0020SQL\u0020query\u0020by\u0020populating\u0020the\u0020bound\u0020variables.", + "url": "classes/DataTables-Database-Driver-SqliteQuery.html#method__prepare" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqliteQuery\u003A\u003A_exec\u0028\u0029", + "name": "_exec", + "summary": "", + "url": "classes/DataTables-Database-Driver-SqliteQuery.html#method__exec" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqliteQuery\u003A\u003A\u0024_identifier_limiter", + "name": "_identifier_limiter", + "summary": "", + "url": "classes/DataTables-Database-Driver-SqliteQuery.html#property__identifier_limiter" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqliteResult", + "name": "SqliteResult", + "summary": "Sqlite\u0020driver\u0020for\u0020DataTables\u0020Database\u0020Result\u0020class", + "url": "classes/DataTables-Database-Driver-SqliteResult.html" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqliteResult\u003A\u003A__construct\u0028\u0029", + "name": "__construct", + "summary": "", + "url": "classes/DataTables-Database-Driver-SqliteResult.html#method___construct" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqliteResult\u003A\u003Acount\u0028\u0029", + "name": "count", + "summary": "Count\u0020the\u0020number\u0020of\u0020rows\u0020in\u0020the\u0020result\u0020set.", + "url": "classes/DataTables-Database-Driver-SqliteResult.html#method_count" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqliteResult\u003A\u003Afetch\u0028\u0029", + "name": "fetch", + "summary": "Get\u0020the\u0020next\u0020row\u0020in\u0020a\u0020result\u0020set", + "url": "classes/DataTables-Database-Driver-SqliteResult.html#method_fetch" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqliteResult\u003A\u003AfetchAll\u0028\u0029", + "name": "fetchAll", + "summary": "Get\u0020all\u0020rows\u0020in\u0020the\u0020result\u0020set", + "url": "classes/DataTables-Database-Driver-SqliteResult.html#method_fetchAll" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqliteResult\u003A\u003AinsertId\u0028\u0029", + "name": "insertId", + "summary": "After\u0020an\u0020INSERT\u0020query,\u0020get\u0020the\u0020ID\u0020that\u0020was\u0020inserted.", + "url": "classes/DataTables-Database-Driver-SqliteResult.html#method_insertId" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqlserverQuery", + "name": "SqlserverQuery", + "summary": "SQL\u0020Server\u0020driver\u0020for\u0020DataTables\u0020Database\u0020Query\u0020class", + "url": "classes/DataTables-Database-Driver-SqlserverQuery.html" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqlserverQuery\u003A\u003Aconnect\u0028\u0029", + "name": "connect", + "summary": "Database\u0020connection\u0020\u002D\u0020override\u0020by\u0020the\u0020database\u0020driver.", + "url": "classes/DataTables-Database-Driver-SqlserverQuery.html#method_connect" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqlserverQuery\u003A\u003A_prepare\u0028\u0029", + "name": "_prepare", + "summary": "Prepare\u0020the\u0020SQL\u0020query\u0020by\u0020populating\u0020the\u0020bound\u0020variables.", + "url": "classes/DataTables-Database-Driver-SqlserverQuery.html#method__prepare" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqlserverQuery\u003A\u003A_exec\u0028\u0029", + "name": "_exec", + "summary": "", + "url": "classes/DataTables-Database-Driver-SqlserverQuery.html#method__exec" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqlserverQuery\u003A\u003A_build_limit\u0028\u0029", + "name": "_build_limit", + "summary": "Create\u0020the\u0020LIMIT\u0020\/\u0020OFFSET\u0020string", + "url": "classes/DataTables-Database-Driver-SqlserverQuery.html#method__build_limit" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqlserverQuery\u003A\u003A\u0024_identifier_limiter", + "name": "_identifier_limiter", + "summary": "", + "url": "classes/DataTables-Database-Driver-SqlserverQuery.html#property__identifier_limiter" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqlserverResult", + "name": "SqlserverResult", + "summary": "SQL\u0020Server\u0020driver\u0020for\u0020DataTables\u0020Database\u0020Result\u0020class", + "url": "classes/DataTables-Database-Driver-SqlserverResult.html" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqlserverResult\u003A\u003A__construct\u0028\u0029", + "name": "__construct", + "summary": "", + "url": "classes/DataTables-Database-Driver-SqlserverResult.html#method___construct" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqlserverResult\u003A\u003Acount\u0028\u0029", + "name": "count", + "summary": "Count\u0020the\u0020number\u0020of\u0020rows\u0020in\u0020the\u0020result\u0020set.", + "url": "classes/DataTables-Database-Driver-SqlserverResult.html#method_count" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqlserverResult\u003A\u003Afetch\u0028\u0029", + "name": "fetch", + "summary": "Get\u0020the\u0020next\u0020row\u0020in\u0020a\u0020result\u0020set", + "url": "classes/DataTables-Database-Driver-SqlserverResult.html#method_fetch" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqlserverResult\u003A\u003AfetchAll\u0028\u0029", + "name": "fetchAll", + "summary": "Get\u0020all\u0020rows\u0020in\u0020the\u0020result\u0020set", + "url": "classes/DataTables-Database-Driver-SqlserverResult.html#method_fetchAll" + }, { + "fqsen": "\\DataTables\\Database\\Driver\\SqlserverResult\u003A\u003AinsertId\u0028\u0029", + "name": "insertId", + "summary": "After\u0020an\u0020INSERT\u0020query,\u0020get\u0020the\u0020ID\u0020that\u0020was\u0020inserted.", + "url": "classes/DataTables-Database-Driver-SqlserverResult.html#method_insertId" + }, { + "fqsen": "\\DataTables\\Database\\Query", + "name": "Query", + "summary": "Perform\u0020an\u0020individual\u0020query\u0020on\u0020the\u0020database.", + "url": "classes/DataTables-Database-Query.html" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003A__construct\u0028\u0029", + "name": "__construct", + "summary": "Query\u0020instance\u0020constructor.", + "url": "classes/DataTables-Database-Query.html#method___construct" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Acommit\u0028\u0029", + "name": "commit", + "summary": "Commit\u0020a\u0020transaction.", + "url": "classes/DataTables-Database-Query.html#method_commit" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Aconnect\u0028\u0029", + "name": "connect", + "summary": "Database\u0020connection\u0020\u002D\u0020override\u0020by\u0020the\u0020database\u0020driver.", + "url": "classes/DataTables-Database-Query.html#method_connect" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Atransaction\u0028\u0029", + "name": "transaction", + "summary": "Start\u0020a\u0020database\u0020transaction", + "url": "classes/DataTables-Database-Query.html#method_transaction" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Arollback\u0028\u0029", + "name": "rollback", + "summary": "Rollback\u0020the\u0020database\u0020state\u0020to\u0020the\u0020start\u0020of\u0020the\u0020transaction.", + "url": "classes/DataTables-Database-Query.html#method_rollback" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003AdsnPostfix\u0028\u0029", + "name": "dsnPostfix", + "summary": "Common\u0020helper\u0020for\u0020the\u0020drivers\u0020to\u0020handle\u0020a\u0020PDO\u0020DSN\u0020postfix", + "url": "classes/DataTables-Database-Query.html#method_dsnPostfix" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Abind\u0028\u0029", + "name": "bind", + "summary": "Safely\u0020bind\u0020an\u0020input\u0020value\u0020to\u0020a\u0020parameter.\u0020This\u0020is\u0020evaluated\u0020when\u0020the\nquery\u0020is\u0020executed.\u0020This\u0020allows\u0020user\u0020input\u0020to\u0020be\u0020safely\u0020executed\u0020without\nrisk\u0020of\u0020an\u0020SQL\u0020injection\u0020attack.", + "url": "classes/DataTables-Database-Query.html#method_bind" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Adatabase\u0028\u0029", + "name": "database", + "summary": "Get\u0020the\u0020Database\u0020host\u0020for\u0020this\u0020query\u0020instance", + "url": "classes/DataTables-Database-Query.html#method_database" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Adistinct\u0028\u0029", + "name": "distinct", + "summary": "Set\u0020a\u0020distinct\u0020flag\u0020for\u0020a\u0020\u0060select\u0060\u0020query.\u0020Note\u0020that\u0020this\u0020has\u0020no\u0020effect\u0020on\nany\u0020of\u0020the\u0020other\u0020query\u0020types.", + "url": "classes/DataTables-Database-Query.html#method_distinct" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Aexec\u0028\u0029", + "name": "exec", + "summary": "Execute\u0020the\u0020query.", + "url": "classes/DataTables-Database-Query.html#method_exec" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Aget\u0028\u0029", + "name": "get", + "summary": "Get\u0020fields.", + "url": "classes/DataTables-Database-Query.html#method_get" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Ajoin\u0028\u0029", + "name": "join", + "summary": "Perform\u0020a\u0020JOIN\u0020operation", + "url": "classes/DataTables-Database-Query.html#method_join" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Aleft_join\u0028\u0029", + "name": "left_join", + "summary": "Add\u0020a\u0020left\u0020join,\u0020with\u0020common\u0020logic\u0020for\u0020handling\u0020binding\u0020or\u0020not", + "url": "classes/DataTables-Database-Query.html#method_left_join" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Alimit\u0028\u0029", + "name": "limit", + "summary": "Limit\u0020the\u0020result\u0020set\u0020to\u0020a\u0020certain\u0020size.", + "url": "classes/DataTables-Database-Query.html#method_limit" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Agroup_by\u0028\u0029", + "name": "group_by", + "summary": "Group\u0020the\u0020results\u0020by\u0020the\u0020values\u0020in\u0020a\u0020field", + "url": "classes/DataTables-Database-Query.html#method_group_by" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Apkey\u0028\u0029", + "name": "pkey", + "summary": "Get\u0020\/\u0020set\u0020the\u0020primary\u0020key\u0020column\u0020name\u0028s\u0029\u0020so\u0020they\u0020can\u0020be\u0020easily\u0020returned\nafter\u0020an\u0020insert.", + "url": "classes/DataTables-Database-Query.html#method_pkey" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Atable\u0028\u0029", + "name": "table", + "summary": "Set\u0020table\u0028s\u0029\u0020to\u0020perform\u0020the\u0020query\u0020on.", + "url": "classes/DataTables-Database-Query.html#method_table" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Aoffset\u0028\u0029", + "name": "offset", + "summary": "Offset\u0020the\u0020return\u0020set\u0020by\u0020a\u0020given\u0020number\u0020of\u0020records\u0020\u0028useful\u0020for\u0020paging\u0029.", + "url": "classes/DataTables-Database-Query.html#method_offset" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Aorder\u0028\u0029", + "name": "order", + "summary": "Order\u0020by", + "url": "classes/DataTables-Database-Query.html#method_order" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Aset\u0028\u0029", + "name": "set", + "summary": "Set\u0020fields\u0020to\u0020a\u0020given\u0020value.", + "url": "classes/DataTables-Database-Query.html#method_set" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Awhere\u0028\u0029", + "name": "where", + "summary": "Where\u0020query\u0020\u002D\u0020multiple\u0020conditions\u0020are\u0020bound\u0020as\u0020ANDs.", + "url": "classes/DataTables-Database-Query.html#method_where" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Aand_where\u0028\u0029", + "name": "and_where", + "summary": "Add\u0020addition\u0020where\u0020conditions\u0020to\u0020the\u0020query\u0020with\u0020an\u0020AND\u0020operator.\u0020An\u0020alias\nof\u0020\u0060where\u0060\u0020for\u0020naming\u0020consistency.", + "url": "classes/DataTables-Database-Query.html#method_and_where" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Aor_where\u0028\u0029", + "name": "or_where", + "summary": "Add\u0020addition\u0020where\u0020conditions\u0020to\u0020the\u0020query\u0020with\u0020an\u0020OR\u0020operator.", + "url": "classes/DataTables-Database-Query.html#method_or_where" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Awhere_group\u0028\u0029", + "name": "where_group", + "summary": "Provide\u0020grouping\u0020for\u0020WHERE\u0020conditions.\u0020Use\u0020it\u0020with\u0020a\u0020callback\u0020function\u0020to\nautomatically\u0020group\u0020any\u0020conditions\u0020applied\u0020inside\u0020the\u0020method.", + "url": "classes/DataTables-Database-Query.html#method_where_group" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003Awhere_in\u0028\u0029", + "name": "where_in", + "summary": "Provide\u0020a\u0020method\u0020that\u0020can\u0020be\u0020used\u0020to\u0020perform\u0020a\u0020\u0060WHERE\u0020...\u0020IN\u0020\u0028...\u0029\u0060\u0020query\nwith\u0020bound\u0020values\u0020and\u0020parameters.", + "url": "classes/DataTables-Database-Query.html#method_where_in" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003A_build_limit\u0028\u0029", + "name": "_build_limit", + "summary": "Create\u0020the\u0020LIMIT\u0020\/\u0020OFFSET\u0020string", + "url": "classes/DataTables-Database-Query.html#method__build_limit" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003A_escape_field\u0028\u0029", + "name": "_escape_field", + "summary": "Escape\u0020quotes\u0020in\u0020a\u0020field\u0020identifier", + "url": "classes/DataTables-Database-Query.html#method__escape_field" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003A_prepare\u0028\u0029", + "name": "_prepare", + "summary": "Prepare\u0020the\u0020SQL\u0020query\u0020by\u0020populating\u0020the\u0020bound\u0020variables.", + "url": "classes/DataTables-Database-Query.html#method__prepare" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003A\u0024_supportsAsAlias", + "name": "_supportsAsAlias", + "summary": "", + "url": "classes/DataTables-Database-Query.html#property__supportsAsAlias" + }, { + "fqsen": "\\DataTables\\Database\\Query\u003A\u003A\u0024_whereInCnt", + "name": "_whereInCnt", + "summary": "", + "url": "classes/DataTables-Database-Query.html#property__whereInCnt" + }, { + "fqsen": "\\DataTables\\Database\\Result", + "name": "Result", + "summary": "Result\u0020object\u0020given\u0020by\u0020a\u0020\u007B\u0040see\u0020Query\u007D\u0020performed\u0020on\u0020a\u0020database.", + "url": "classes/DataTables-Database-Result.html" + }, { + "fqsen": "\\DataTables\\Database\\Result\u003A\u003Acount\u0028\u0029", + "name": "count", + "summary": "Count\u0020the\u0020number\u0020of\u0020rows\u0020in\u0020the\u0020result\u0020set.", + "url": "classes/DataTables-Database-Result.html#method_count" + }, { + "fqsen": "\\DataTables\\Database\\Result\u003A\u003Afetch\u0028\u0029", + "name": "fetch", + "summary": "Get\u0020the\u0020next\u0020row\u0020in\u0020a\u0020result\u0020set", + "url": "classes/DataTables-Database-Result.html#method_fetch" + }, { + "fqsen": "\\DataTables\\Database\\Result\u003A\u003AfetchAll\u0028\u0029", + "name": "fetchAll", + "summary": "Get\u0020all\u0020rows\u0020in\u0020the\u0020result\u0020set", + "url": "classes/DataTables-Database-Result.html#method_fetchAll" + }, { + "fqsen": "\\DataTables\\Database\\Result\u003A\u003AinsertId\u0028\u0029", + "name": "insertId", + "summary": "After\u0020an\u0020INSERT\u0020query,\u0020get\u0020the\u0020ID\u0020that\u0020was\u0020inserted.", + "url": "classes/DataTables-Database-Result.html#method_insertId" + }, { + "fqsen": "\\DataTables\\Database", + "name": "Database", + "summary": "DataTables\u0020Database\u0020connection\u0020object.", + "url": "classes/DataTables-Database.html" + }, { + "fqsen": "\\DataTables\\Database\u003A\u003A__construct\u0028\u0029", + "name": "__construct", + "summary": "Database\u0020instance\u0020constructor.", + "url": "classes/DataTables-Database.html#method___construct" + }, { + "fqsen": "\\DataTables\\Database\u003A\u003Aany\u0028\u0029", + "name": "any", + "summary": "Determine\u0020if\u0020there\u0020is\u0020any\u0020data\u0020in\u0020the\u0020table\u0020that\u0020matches\u0020the\u0020query\ncondition", + "url": "classes/DataTables-Database.html#method_any" + }, { + "fqsen": "\\DataTables\\Database\u003A\u003Acommit\u0028\u0029", + "name": "commit", + "summary": "Commit\u0020a\u0020database\u0020transaction.", + "url": "classes/DataTables-Database.html#method_commit" + }, { + "fqsen": "\\DataTables\\Database\u003A\u003Acount\u0028\u0029", + "name": "count", + "summary": "Get\u0020a\u0020count\u0020from\u0020a\u0020table.", + "url": "classes/DataTables-Database.html#method_count" + }, { + "fqsen": "\\DataTables\\Database\u003A\u003Adebug\u0028\u0029", + "name": "debug", + "summary": "Get\u0020\/\u0020set\u0020debug\u0020mode.", + "url": "classes/DataTables-Database.html#method_debug" + }, { + "fqsen": "\\DataTables\\Database\u003A\u003Adelete\u0028\u0029", + "name": "delete", + "summary": "Perform\u0020a\u0020delete\u0020query\u0020on\u0020a\u0020table.", + "url": "classes/DataTables-Database.html#method_delete" + }, { + "fqsen": "\\DataTables\\Database\u003A\u003Ainsert\u0028\u0029", + "name": "insert", + "summary": "Insert\u0020data\u0020into\u0020a\u0020table.", + "url": "classes/DataTables-Database.html#method_insert" + }, { + "fqsen": "\\DataTables\\Database\u003A\u003Apush\u0028\u0029", + "name": "push", + "summary": "Update\u0020or\u0020Insert\u0020data.\u0020When\u0020doing\u0020an\u0020insert,\u0020the\u0020where\u0020condition\u0020is\nadded\u0020as\u0020a\u0020set\u0020field", + "url": "classes/DataTables-Database.html#method_push" + }, { + "fqsen": "\\DataTables\\Database\u003A\u003Aquery\u0028\u0029", + "name": "query", + "summary": "Create\u0020a\u0020query\u0020object\u0020to\u0020build\u0020a\u0020database\u0020query.", + "url": "classes/DataTables-Database.html#method_query" + }, { + "fqsen": "\\DataTables\\Database\u003A\u003Aquote\u0028\u0029", + "name": "quote", + "summary": "Quote\u0020a\u0020string\u0020for\u0020a\u0020quote.\u0020Note\u0020you\u0020should\u0020generally\u0020use\u0020a\u0020bind\u0021", + "url": "classes/DataTables-Database.html#method_quote" + }, { + "fqsen": "\\DataTables\\Database\u003A\u003Araw\u0028\u0029", + "name": "raw", + "summary": "Create\u0020a\u0020\u0060Query\u0060\u0020object\u0020that\u0020will\u0020execute\u0020a\u0020custom\u0020SQL\u0020query.\u0020This\u0020is\nsimilar\u0020to\u0020the\u0020\u0060sql\u0060\u0020method,\u0020but\u0020in\u0020this\u0020case\u0020you\u0020must\u0020call\u0020the\u0020\u0060exec\u0028\u0029\u0060\nmethod\u0020of\u0020the\u0020returned\u0020\u0060Query\u0060\u0020object\u0020manually.\u0020This\u0020can\u0020be\u0020useful\u0020if\u0020you\nwish\u0020to\u0020bind\u0020parameters\u0020using\u0020the\u0020query\u0020\u0060bind\u0060\u0020method\u0020to\u0020ensure\u0020data\u0020is\nproperly\u0020escaped.", + "url": "classes/DataTables-Database.html#method_raw" + }, { + "fqsen": "\\DataTables\\Database\u003A\u003Aresource\u0028\u0029", + "name": "resource", + "summary": "Get\u0020the\u0020database\u0020resource\u0020connector.\u0020This\u0020is\u0020typically\u0020a\u0020PDO\u0020object.", + "url": "classes/DataTables-Database.html#method_resource" + }, { + "fqsen": "\\DataTables\\Database\u003A\u003Arollback\u0028\u0029", + "name": "rollback", + "summary": "Rollback\u0020the\u0020database\u0020state\u0020to\u0020the\u0020start\u0020of\u0020the\u0020transaction.", + "url": "classes/DataTables-Database.html#method_rollback" + }, { + "fqsen": "\\DataTables\\Database\u003A\u003Aselect\u0028\u0029", + "name": "select", + "summary": "Select\u0020data\u0020from\u0020a\u0020table.", + "url": "classes/DataTables-Database.html#method_select" + }, { + "fqsen": "\\DataTables\\Database\u003A\u003AselectDistinct\u0028\u0029", + "name": "selectDistinct", + "summary": "Select\u0020distinct\u0020data\u0020from\u0020a\u0020table.", + "url": "classes/DataTables-Database.html#method_selectDistinct" + }, { + "fqsen": "\\DataTables\\Database\u003A\u003Asql\u0028\u0029", + "name": "sql", + "summary": "Execute\u0020an\u0020raw\u0020SQL\u0020query\u0020\u002D\u0020i.e.\u0020give\u0020the\u0020method\u0020your\u0020own\u0020SQL,\u0020rather\nthan\u0020having\u0020the\u0020Database\u0020classes\u0020building\u0020it\u0020for\u0020you.", + "url": "classes/DataTables-Database.html#method_sql" + }, { + "fqsen": "\\DataTables\\Database\u003A\u003Atransaction\u0028\u0029", + "name": "transaction", + "summary": "Start\u0020a\u0020new\u0020database\u0020transaction.", + "url": "classes/DataTables-Database.html#method_transaction" + }, { + "fqsen": "\\DataTables\\Database\u003A\u003Atype\u0028\u0029", + "name": "type", + "summary": "Get\u0020the\u0020database\u0020type\u0020\u0028e.g.\u0020Postgres,\u0020Mysql,\u0020etc\u0029", + "url": "classes/DataTables-Database.html#method_type" + }, { + "fqsen": "\\DataTables\\Database\u003A\u003Aupdate\u0028\u0029", + "name": "update", + "summary": "Update\u0020data.", + "url": "classes/DataTables-Database.html#method_update" + }, { + "fqsen": "\\DataTables\\Editor\\Field", + "name": "Field", + "summary": "Field\u0020definitions\u0020for\u0020the\u0020DataTables\u0020Editor.", + "url": "classes/DataTables-Editor-Field.html" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003A__construct\u0028\u0029", + "name": "__construct", + "summary": "Field\u0020instance\u0020constructor.", + "url": "classes/DataTables-Editor-Field.html#method___construct" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003AdbField\u0028\u0029", + "name": "dbField", + "summary": "Get\u0020\/\u0020set\u0020the\u0020DB\u0020field\u0020name.", + "url": "classes/DataTables-Editor-Field.html#method_dbField" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003Aget\u0028\u0029", + "name": "get", + "summary": "Get\u0020\/\u0020set\u0020the\u0020\u0027get\u0027\u0020property\u0020of\u0020the\u0020field.", + "url": "classes/DataTables-Editor-Field.html#method_get" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003AgetFormatter\u0028\u0029", + "name": "getFormatter", + "summary": "Get\u0020formatter\u0020for\u0020the\u0020field\u0027s\u0020data.", + "url": "classes/DataTables-Editor-Field.html#method_getFormatter" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003AgetValue\u0028\u0029", + "name": "getValue", + "summary": "Get\u0020\/\u0020set\u0020a\u0020get\u0020value.\u0020If\u0020given,\u0020then\u0020this\u0020value\u0020is\u0020used\u0020to\u0020send\u0020to\u0020the\nclient\u002Dside,\u0020regardless\u0020of\u0020what\u0020value\u0020is\u0020held\u0020by\u0020the\u0020database.", + "url": "classes/DataTables-Editor-Field.html#method_getValue" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003Aname\u0028\u0029", + "name": "name", + "summary": "Get\u0020\/\u0020set\u0020the\u0020\u0027name\u0027\u0020property\u0020of\u0020the\u0020field.", + "url": "classes/DataTables-Editor-Field.html#method_name" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003Aoptions\u0028\u0029", + "name": "options", + "summary": "Get\u0020a\u0020list\u0020of\u0020values\u0020that\u0020can\u0020be\u0020used\u0020for\u0020the\u0020options\u0020list\u0020in\u0020radio,\nselect\u0020and\u0020checkbox\u0020inputs\u0020from\u0020the\u0020database\u0020for\u0020this\u0020field.", + "url": "classes/DataTables-Editor-Field.html#method_options" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003AsearchPaneOptions\u0028\u0029", + "name": "searchPaneOptions", + "summary": "Get\u0020a\u0020list\u0020of\u0020values\u0020that\u0020can\u0020be\u0020used\u0020for\u0020the\u0020options\u0020list\u0020in\u0020SearchPanes", + "url": "classes/DataTables-Editor-Field.html#method_searchPaneOptions" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003AsearchBuilderOptions\u0028\u0029", + "name": "searchBuilderOptions", + "summary": "Get\u0020a\u0020list\u0020of\u0020values\u0020that\u0020can\u0020be\u0020used\u0020for\u0020the\u0020options\u0020list\u0020in\u0020SearchBuilder", + "url": "classes/DataTables-Editor-Field.html#method_searchBuilderOptions" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003Aset\u0028\u0029", + "name": "set", + "summary": "Get\u0020\/\u0020set\u0020the\u0020\u0027set\u0027\u0020property\u0020of\u0020the\u0020field.", + "url": "classes/DataTables-Editor-Field.html#method_set" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003AsetFormatter\u0028\u0029", + "name": "setFormatter", + "summary": "Set\u0020formatter\u0020for\u0020the\u0020field\u0027s\u0020data.", + "url": "classes/DataTables-Editor-Field.html#method_setFormatter" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003AsetValue\u0028\u0029", + "name": "setValue", + "summary": "Get\u0020\/\u0020set\u0020a\u0020set\u0020value.\u0020If\u0020given,\u0020then\u0020this\u0020value\u0020is\u0020used\u0020to\u0020write\u0020to\u0020the\ndatabase\u0020regardless\u0020of\u0020what\u0020data\u0020is\u0020sent\u0020from\u0020the\u0020client\u002Dside.", + "url": "classes/DataTables-Editor-Field.html#method_setValue" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003Aupload\u0028\u0029", + "name": "upload", + "summary": "Get\u0020\/\u0020set\u0020the\u0020upload\u0020class\u0020for\u0020this\u0020field.", + "url": "classes/DataTables-Editor-Field.html#method_upload" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003Avalidator\u0028\u0029", + "name": "validator", + "summary": "Get\u0020\/\u0020set\u0020the\u0020\u0027validator\u0027\u0020of\u0020the\u0020field.", + "url": "classes/DataTables-Editor-Field.html#method_validator" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003Axss\u0028\u0029", + "name": "xss", + "summary": "Set\u0020a\u0020formatting\u0020method\u0020that\u0020will\u0020be\u0020used\u0020for\u0020XSS\u0020checking\u0020\/\u0020removal.", + "url": "classes/DataTables-Editor-Field.html#method_xss" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003Aapply\u0028\u0029", + "name": "apply", + "summary": "Check\u0020to\u0020see\u0020if\u0020a\u0020field\u0020should\u0020be\u0020used\u0020for\u0020a\u0020particular\u0020action\u0020\u0028get\u0020or\u0020set\u0029.", + "url": "classes/DataTables-Editor-Field.html#method_apply" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003Aval\u0028\u0029", + "name": "val", + "summary": "Get\u0020the\u0020value\u0020of\u0020the\u0020field,\u0020taking\u0020into\u0020account\u0020if\u0020it\u0020is\u0020coming\u0020from\u0020the\nDB\u0020or\u0020from\u0020a\u0020POST.\u0020If\u0020formatting\u0020has\u0020been\u0020specified\u0020for\u0020this\u0020field,\u0020it\nwill\u0020be\u0020applied\u0020here.", + "url": "classes/DataTables-Editor-Field.html#method_val" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003AxssSafety\u0028\u0029", + "name": "xssSafety", + "summary": "Perform\u0020XSS\u0020prevention\u0020on\u0020an\u0020input.", + "url": "classes/DataTables-Editor-Field.html#method_xssSafety" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003ASET_NONE", + "name": "SET_NONE", + "summary": "Set\u0020option\u0020flag\u0020\u0028\u0060set\u0028\u0029\u0060\u0029\u0020\u002D\u0020do\u0020not\u0020set\u0020data", + "url": "classes/DataTables-Editor-Field.html#constant_SET_NONE" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003ASET_BOTH", + "name": "SET_BOTH", + "summary": "Set\u0020option\u0020flag\u0020\u0028\u0060set\u0028\u0029\u0060\u0029\u0020\u002D\u0020write\u0020to\u0020database\u0020on\u0020both\u0020create\u0020and\u0020edit", + "url": "classes/DataTables-Editor-Field.html#constant_SET_BOTH" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003ASET_CREATE", + "name": "SET_CREATE", + "summary": "Set\u0020option\u0020flag\u0020\u0028\u0060set\u0028\u0029\u0060\u0029\u0020\u002D\u0020write\u0020to\u0020database\u0020only\u0020on\u0020create", + "url": "classes/DataTables-Editor-Field.html#constant_SET_CREATE" + }, { + "fqsen": "\\DataTables\\Editor\\Field\u003A\u003ASET_EDIT", + "name": "SET_EDIT", + "summary": "Set\u0020option\u0020flag\u0020\u0028\u0060set\u0028\u0029\u0060\u0029\u0020\u002D\u0020write\u0020to\u0020database\u0020only\u0020on\u0020edit", + "url": "classes/DataTables-Editor-Field.html#constant_SET_EDIT" + }, { + "fqsen": "\\DataTables\\Editor\\Format", + "name": "Format", + "summary": "Formatter\u0020methods\u0020for\u0020the\u0020DataTables\u0020Editor", + "url": "classes/DataTables-Editor-Format.html" + }, { + "fqsen": "\\DataTables\\Editor\\Format\u003A\u003AdateSqlToFormat\u0028\u0029", + "name": "dateSqlToFormat", + "summary": "Convert\u0020from\u0020SQL\u0020date\u0020\/\u0020date\u0020time\u0020format\u0020to\u0020a\u0020format\u0020given\u0020by\u0020the\u0020options\nparameter.", + "url": "classes/DataTables-Editor-Format.html#method_dateSqlToFormat" + }, { + "fqsen": "\\DataTables\\Editor\\Format\u003A\u003AdateFormatToSql\u0028\u0029", + "name": "dateFormatToSql", + "summary": "Convert\u0020from\u0020a\u0020format\u0020given\u0020by\u0020the\u0020options\u0020parameter\u0020to\u0020a\u0020format\u0020that\nSQL\u0020servers\u0020will\u0020recognise\u0020as\u0020a\u0020date.", + "url": "classes/DataTables-Editor-Format.html#method_dateFormatToSql" + }, { + "fqsen": "\\DataTables\\Editor\\Format\u003A\u003Adatetime\u0028\u0029", + "name": "datetime", + "summary": "Convert\u0020from\u0020one\u0020date\u0020time\u0020format\u0020to\u0020another", + "url": "classes/DataTables-Editor-Format.html#method_datetime" + }, { + "fqsen": "\\DataTables\\Editor\\Format\u003A\u003Aexplode\u0028\u0029", + "name": "explode", + "summary": "Convert\u0020a\u0020string\u0020of\u0020values\u0020into\u0020an\u0020array\u0020for\u0020use\u0020with\u0020checkboxes.", + "url": "classes/DataTables-Editor-Format.html#method_explode" + }, { + "fqsen": "\\DataTables\\Editor\\Format\u003A\u003Aimplode\u0028\u0029", + "name": "implode", + "summary": "Convert\u0020an\u0020array\u0020of\u0020values\u0020from\u0020a\u0020checkbox\u0020into\u0020a\u0020string\u0020which\u0020can\u0020be\nused\u0020to\u0020store\u0020in\u0020a\u0020text\u0020field\u0020in\u0020a\u0020database.", + "url": "classes/DataTables-Editor-Format.html#method_implode" + }, { + "fqsen": "\\DataTables\\Editor\\Format\u003A\u003AnullEmpty\u0028\u0029", + "name": "nullEmpty", + "summary": "Convert\u0020an\u0020empty\u0020string\u0020to\u0020\u0060null\u0060.\u0020Null\u0020values\u0020are\u0020very\u0020useful\u0020in\ndatabases,\u0020but\u0020HTTP\u0020variables\u0020have\u0020no\u0020way\u0020of\u0020representing\u0020\u0060null\u0060\u0020as\u0020a\nvalue,\u0020often\u0020leading\u0020to\u0020an\u0020empty\u0020string\u0020and\u0020null\u0020overlapping.\u0020This\u0020method\nwill\u0020check\u0020the\u0020value\u0020to\u0020operate\u0020on\u0020and\u0020return\u0020null\u0020if\u0020it\u0020is\u0020empty.", + "url": "classes/DataTables-Editor-Format.html#method_nullEmpty" + }, { + "fqsen": "\\DataTables\\Editor\\Format\u003A\u003AifEmpty\u0028\u0029", + "name": "ifEmpty", + "summary": "Formatter\u0020that\u0020can\u0020be\u0020used\u0020to\u0020specify\u0020what\u0020value\u0020should\u0020be\u0020used\u0020if\u0020an\nempty\u0020value\u0020is\u0020submitted\u0020by\u0020the\u0020client\u002Dside\u0020\u0028e.g.\u0020null,\u00200,\u0020\u0027Not\u0020set\u0027,\netc\u0029", + "url": "classes/DataTables-Editor-Format.html#method_ifEmpty" + }, { + "fqsen": "\\DataTables\\Editor\\Format\u003A\u003AfromDecimalChar\u0028\u0029", + "name": "fromDecimalChar", + "summary": "Convert\u0020a\u0020number\u0020from\u0020using\u0020any\u0020character\u0020other\u0020than\u0020a\u0020period\u0020\u0028dot\u0029\u0020to\none\u0020which\u0020does\u0020use\u0020a\u0020period.\u0020This\u0020is\u0020useful\u0020for\u0020allowing\u0020numeric\u0020user\ninput\u0020in\u0020regions\u0020where\u0020a\u0020comma\u0020is\u0020used\u0020as\u0020the\u0020decimal\u0020character.\u0020Use\u0020with\na\u0020set\u0020formatter.", + "url": "classes/DataTables-Editor-Format.html#method_fromDecimalChar" + }, { + "fqsen": "\\DataTables\\Editor\\Format\u003A\u003AtoDecimalChar\u0028\u0029", + "name": "toDecimalChar", + "summary": "Convert\u0020a\u0020number\u0020with\u0020a\u0020period\u0020\u0028dot\u0029\u0020as\u0020the\u0020decimal\u0020character\u0020to\u0020use\na\u0020different\u0020character\u0020\u0028typically\u0020a\u0020comma\u0029.\u0020Use\u0020with\u0020a\u0020get\u0020formatter.", + "url": "classes/DataTables-Editor-Format.html#method_toDecimalChar" + }, { + "fqsen": "\\DataTables\\Editor\\Format\u003A\u003ADATE_ISO_8601", + "name": "DATE_ISO_8601", + "summary": "Date\u0020format\u003A\u00202012\u002D03\u002D09.\u0020jQuery\u0020UI\u0020equivalent\u0020format\u003A\u0020yy\u002Dmm\u002Ddd", + "url": "classes/DataTables-Editor-Format.html#constant_DATE_ISO_8601" + }, { + "fqsen": "\\DataTables\\Editor\\Format\u003A\u003ADATE_ISO_822", + "name": "DATE_ISO_822", + "summary": "Date\u0020format\u003A\u0020Fri,\u00209\u0020Mar\u002012.\u0020jQuery\u0020UI\u0020equivalent\u0020format\u003A\u0020D,\u0020d\u0020M\u0020y", + "url": "classes/DataTables-Editor-Format.html#constant_DATE_ISO_822" + }, { + "fqsen": "\\DataTables\\Editor\\Format\u003A\u003ADATE_ISO_850", + "name": "DATE_ISO_850", + "summary": "Date\u0020format\u003A\u0020Friday,\u002009\u002DMar\u002D12.\u0020\u0020jQuery\u0020UI\u0020equivalent\u0020format\u003A\u0020DD,\u0020dd\u002DM\u002Dy", + "url": "classes/DataTables-Editor-Format.html#constant_DATE_ISO_850" + }, { + "fqsen": "\\DataTables\\Editor\\Format\u003A\u003ADATE_ISO_1036", + "name": "DATE_ISO_1036", + "summary": "Date\u0020format\u003A\u0020Fri,\u00209\u0020Mar\u002012.\u0020jQuery\u0020UI\u0020equivalent\u0020format\u003A\u0020D,\u0020d\u0020M\u0020y", + "url": "classes/DataTables-Editor-Format.html#constant_DATE_ISO_1036" + }, { + "fqsen": "\\DataTables\\Editor\\Format\u003A\u003ADATE_ISO_1123", + "name": "DATE_ISO_1123", + "summary": "Date\u0020format\u003A\u0020Fri,\u00209\u0020Mar\u00202012.\u0020jQuery\u0020UI\u0020equivalent\u0020format\u003A\u0020D,\u0020d\u0020M\u0020yy", + "url": "classes/DataTables-Editor-Format.html#constant_DATE_ISO_1123" + }, { + "fqsen": "\\DataTables\\Editor\\Format\u003A\u003ADATE_ISO_2822", + "name": "DATE_ISO_2822", + "summary": "Date\u0020format\u003A\u0020Fri,\u00209\u0020Mar\u00202012.\u0020jQuery\u0020UI\u0020equivalent\u0020format\u003A\u0020D,\u0020d\u0020M\u0020yy", + "url": "classes/DataTables-Editor-Format.html#constant_DATE_ISO_2822" + }, { + "fqsen": "\\DataTables\\Editor\\Format\u003A\u003ADATE_USA", + "name": "DATE_USA", + "summary": "Date\u0020format\u003A\u0020March\u002D.\u0020jQuery\u0020UI\u0020equivalent\u0020format\u003A\u0020D,\u0020d\u0020M\u0020yy", + "url": "classes/DataTables-Editor-Format.html#constant_DATE_USA" + }, { + "fqsen": "\\DataTables\\Editor\\Format\u003A\u003ADATE_TIMESTAMP", + "name": "DATE_TIMESTAMP", + "summary": "Date\u0020format\u003A\u00201331251200.\u0020jQuery\u0020UI\u0020equivalent\u0020format\u003A\u0020\u0040", + "url": "classes/DataTables-Editor-Format.html#constant_DATE_TIMESTAMP" + }, { + "fqsen": "\\DataTables\\Editor\\Format\u003A\u003ADATE_EPOCH", + "name": "DATE_EPOCH", + "summary": "Date\u0020format\u003A\u00201331251200.\u0020jQuery\u0020UI\u0020equivalent\u0020format\u003A\u0020\u0040", + "url": "classes/DataTables-Editor-Format.html#constant_DATE_EPOCH" + }, { + "fqsen": "\\DataTables\\Editor\\Join", + "name": "Join", + "summary": "Join\u0020table\u0020class\u0020for\u0020DataTables\u0020Editor.", + "url": "classes/DataTables-Editor-Join.html" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003A__construct\u0028\u0029", + "name": "__construct", + "summary": "Join\u0020instance\u0020constructor.", + "url": "classes/DataTables-Editor-Join.html#method___construct" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003AaliasParentTable\u0028\u0029", + "name": "aliasParentTable", + "summary": "Get\u0020\/\u0020set\u0020parent\u0020table\u0020alias.", + "url": "classes/DataTables-Editor-Join.html#method_aliasParentTable" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003Afield\u0028\u0029", + "name": "field", + "summary": "Get\u0020\/\u0020set\u0020field\u0020instances.", + "url": "classes/DataTables-Editor-Join.html#method_field" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003Afields\u0028\u0029", + "name": "fields", + "summary": "Get\u0020\/\u0020set\u0020field\u0020instances.", + "url": "classes/DataTables-Editor-Join.html#method_fields" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003Aget\u0028\u0029", + "name": "get", + "summary": "Get\u0020\/\u0020set\u0020get\u0020attribute.", + "url": "classes/DataTables-Editor-Join.html#method_get" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003Ajoin\u0028\u0029", + "name": "join", + "summary": "Get\u0020\/\u0020set\u0020join\u0020properties.", + "url": "classes/DataTables-Editor-Join.html#method_join" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003AleftJoin\u0028\u0029", + "name": "leftJoin", + "summary": "Set\u0020up\u0020a\u0020left\u0020join\u0020operation\u0020for\u0020the\u0020Mjoined\u0020data", + "url": "classes/DataTables-Editor-Join.html#method_leftJoin" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003Alink\u0028\u0029", + "name": "link", + "summary": "Create\u0020a\u0020join\u0020link\u0020between\u0020two\u0020tables.\u0020The\u0020order\u0020of\u0020the\u0020fields\u0020does\u0020not\nmatter,\u0020but\u0020each\u0020field\u0020must\u0020contain\u0020the\u0020table\u0020name\u0020as\u0020well\u0020as\u0020the\u0020field\nname.", + "url": "classes/DataTables-Editor-Join.html#method_link" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003Aorder\u0028\u0029", + "name": "order", + "summary": "Specify\u0020the\u0020property\u0020that\u0020the\u0020data\u0020will\u0020be\u0020sorted\u0020by.", + "url": "classes/DataTables-Editor-Join.html#method_order" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003Aname\u0028\u0029", + "name": "name", + "summary": "Get\u0020\/\u0020set\u0020name.", + "url": "classes/DataTables-Editor-Join.html#method_name" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003Aset\u0028\u0029", + "name": "set", + "summary": "Get\u0020\/\u0020set\u0020set\u0020attribute.", + "url": "classes/DataTables-Editor-Join.html#method_set" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003Atable\u0028\u0029", + "name": "table", + "summary": "Get\u0020\/\u0020set\u0020join\u0020table\u0020name.", + "url": "classes/DataTables-Editor-Join.html#method_table" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003Atype\u0028\u0029", + "name": "type", + "summary": "Get\u0020\/\u0020set\u0020the\u0020join\u0020type.", + "url": "classes/DataTables-Editor-Join.html#method_type" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003Avalidator\u0028\u0029", + "name": "validator", + "summary": "Set\u0020a\u0020validator\u0020for\u0020the\u0020array\u0020of\u0020data\u0020\u0028not\u0020on\u0020a\u0020field\u0020basis\u0029", + "url": "classes/DataTables-Editor-Join.html#method_validator" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003Awhere\u0028\u0029", + "name": "where", + "summary": "Where\u0020condition\u0020to\u0020add\u0020to\u0020the\u0020query\u0020used\u0020to\u0020get\u0020data\u0020from\u0020the\u0020database.", + "url": "classes/DataTables-Editor-Join.html#method_where" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003AwhereSet\u0028\u0029", + "name": "whereSet", + "summary": "Get\u0020\/\u0020set\u0020if\u0020the\u0020WHERE\u0020conditions\u0020should\u0020be\u0020included\u0020in\u0020the\u0020create\u0020and\nedit\u0020actions.", + "url": "classes/DataTables-Editor-Join.html#method_whereSet" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003Adata\u0028\u0029", + "name": "data", + "summary": "Get\u0020data", + "url": "classes/DataTables-Editor-Join.html#method_data" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003Acreate\u0028\u0029", + "name": "create", + "summary": "Create\u0020a\u0020row.", + "url": "classes/DataTables-Editor-Join.html#method_create" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003Aupdate\u0028\u0029", + "name": "update", + "summary": "Update\u0020a\u0020row.", + "url": "classes/DataTables-Editor-Join.html#method_update" + }, { + "fqsen": "\\DataTables\\Editor\\Join\u003A\u003Aremove\u0028\u0029", + "name": "remove", + "summary": "Delete\u0020rows", + "url": "classes/DataTables-Editor-Join.html#method_remove" + }, { + "fqsen": "\\DataTables\\Editor\\Mjoin", + "name": "Mjoin", + "summary": "The\u0020\u0060Mjoin\u0060\u0020class\u0020extends\u0020the\u0020\u0060Join\u0060\u0020class\u0020with\u0020the\u0020join\u0020data\u0020type\u0020set\u0020to\n\u0027array\u0027,\u0020whereas\u0020the\u0020\u0060Join\u0060\u0020default\u0020is\u0020\u0060object\u0060\u0020which\u0020has\u0020been\u0020rendered\nobsolete\u0020by\u0020the\u0020\u0060Editor\u002D\u003EleftJoin\u0028\u0029\u0060\u0020method.\u0020The\u0020API\u0020API\u0020is\u0020otherwise\nidentical.", + "url": "classes/DataTables-Editor-Mjoin.html" + }, { + "fqsen": "\\DataTables\\Editor\\Mjoin\u003A\u003A__construct\u0028\u0029", + "name": "__construct", + "summary": "Join\u0020instance\u0020constructor.", + "url": "classes/DataTables-Editor-Mjoin.html#method___construct" + }, { + "fqsen": "\\DataTables\\Editor\\Options", + "name": "Options", + "summary": "The\u0020Options\u0020class\u0020provides\u0020a\u0020convenient\u0020method\u0020of\u0020specifying\u0020where\u0020Editor\nshould\u0020get\u0020the\u0020list\u0020of\u0020options\u0020for\u0020a\u0020\u0060select\u0060,\u0020\u0060radio\u0060\u0020or\u0020\u0060checkbox\u0060\u0020field.", + "url": "classes/DataTables-Editor-Options.html" + }, { + "fqsen": "\\DataTables\\Editor\\Options\u003A\u003Aadd\u0028\u0029", + "name": "add", + "summary": "Add\u0020extra\u0020options\u0020to\u0020the\u0020list,\u0020in\u0020addition\u0020to\u0020any\u0020obtained\u0020from\u0020the\u0020database", + "url": "classes/DataTables-Editor-Options.html#method_add" + }, { + "fqsen": "\\DataTables\\Editor\\Options\u003A\u003Alabel\u0028\u0029", + "name": "label", + "summary": "Get\u0020\/\u0020set\u0020the\u0020column\u0028s\u0029\u0020to\u0020use\u0020as\u0020the\u0020label\u0020value\u0020of\u0020the\u0020options", + "url": "classes/DataTables-Editor-Options.html#method_label" + }, { + "fqsen": "\\DataTables\\Editor\\Options\u003A\u003AleftJoin\u0028\u0029", + "name": "leftJoin", + "summary": "Set\u0020up\u0020a\u0020left\u0020join\u0020operation\u0020for\u0020the\u0020options", + "url": "classes/DataTables-Editor-Options.html#method_leftJoin" + }, { + "fqsen": "\\DataTables\\Editor\\Options\u003A\u003Alimit\u0028\u0029", + "name": "limit", + "summary": "Get\u0020\/\u0020set\u0020the\u0020LIMIT\u0020clause\u0020to\u0020limit\u0020the\u0020number\u0020of\u0020records\u0020returned.", + "url": "classes/DataTables-Editor-Options.html#method_limit" + }, { + "fqsen": "\\DataTables\\Editor\\Options\u003A\u003Aorder\u0028\u0029", + "name": "order", + "summary": "Get\u0020\/\u0020set\u0020the\u0020ORDER\u0020BY\u0020clause\u0020to\u0020use\u0020in\u0020the\u0020SQL.\u0020If\u0020this\u0020option\u0020is\u0020not\nprovided\u0020the\u0020ordering\u0020will\u0020be\u0020based\u0020on\u0020the\u0020rendered\u0020output,\u0020either\nnumerically\u0020or\u0020alphabetically\u0020based\u0020on\u0020the\u0020data\u0020returned\u0020by\u0020the\u0020renderer.", + "url": "classes/DataTables-Editor-Options.html#method_order" + }, { + "fqsen": "\\DataTables\\Editor\\Options\u003A\u003Arender\u0028\u0029", + "name": "render", + "summary": "Get\u0020\/\u0020set\u0020the\u0020label\u0020renderer.\u0020The\u0020renderer\u0020can\u0020be\u0020used\u0020to\u0020combine\nmultiple\u0020database\u0020columns\u0020into\u0020a\u0020single\u0020string\u0020that\u0020is\u0020shown\u0020as\u0020the\u0020label\nto\u0020the\u0020end\u0020user\u0020in\u0020the\u0020list\u0020of\u0020options.", + "url": "classes/DataTables-Editor-Options.html#method_render" + }, { + "fqsen": "\\DataTables\\Editor\\Options\u003A\u003Atable\u0028\u0029", + "name": "table", + "summary": "Get\u0020\/\u0020set\u0020the\u0020database\u0020table\u0020from\u0020which\u0020to\u0020gather\u0020the\u0020options\u0020for\u0020the\nlist.", + "url": "classes/DataTables-Editor-Options.html#method_table" + }, { + "fqsen": "\\DataTables\\Editor\\Options\u003A\u003Avalue\u0028\u0029", + "name": "value", + "summary": "Get\u0020\/\u0020set\u0020the\u0020column\u0020name\u0020to\u0020use\u0020for\u0020the\u0020value\u0020in\u0020the\u0020options\u0020list.\u0020This\nwould\u0020normally\u0020be\u0020the\u0020primary\u0020key\u0020for\u0020the\u0020table.", + "url": "classes/DataTables-Editor-Options.html#method_value" + }, { + "fqsen": "\\DataTables\\Editor\\Options\u003A\u003Awhere\u0028\u0029", + "name": "where", + "summary": "Get\u0020\/\u0020set\u0020the\u0020method\u0020to\u0020use\u0020for\u0020a\u0020WHERE\u0020condition\u0020if\u0020it\u0020is\u0020to\u0020be\napplied\u0020to\u0020the\u0020query\u0020to\u0020get\u0020the\u0020options.", + "url": "classes/DataTables-Editor-Options.html#method_where" + }, { + "fqsen": "\\DataTables\\Editor\\SearchBuilderOptions", + "name": "SearchBuilderOptions", + "summary": "The\u0020Options\u0020class\u0020provides\u0020a\u0020convenient\u0020method\u0020of\u0020specifying\u0020where\u0020Editor\nshould\u0020get\u0020the\u0020list\u0020of\u0020options\u0020for\u0020a\u0020\u0060select\u0060,\u0020\u0060radio\u0060\u0020or\u0020\u0060checkbox\u0060\u0020field.", + "url": "classes/DataTables-Editor-SearchBuilderOptions.html" + }, { + "fqsen": "\\DataTables\\Editor\\SearchBuilderOptions\u003A\u003Alabel\u0028\u0029", + "name": "label", + "summary": "Get\u0020\/\u0020set\u0020the\u0020column\u0028s\u0029\u0020to\u0020use\u0020as\u0020the\u0020label\u0020value\u0020of\u0020the\u0020options", + "url": "classes/DataTables-Editor-SearchBuilderOptions.html#method_label" + }, { + "fqsen": "\\DataTables\\Editor\\SearchBuilderOptions\u003A\u003Aorder\u0028\u0029", + "name": "order", + "summary": "Get\u0020\/\u0020set\u0020the\u0020ORDER\u0020BY\u0020clause\u0020to\u0020use\u0020in\u0020the\u0020SQL.\u0020If\u0020this\u0020option\u0020is\u0020not\nprovided\u0020the\u0020ordering\u0020will\u0020be\u0020based\u0020on\u0020the\u0020rendered\u0020output,\u0020either\nnumerically\u0020or\u0020alphabetically\u0020based\u0020on\u0020the\u0020data\u0020returned\u0020by\u0020the\u0020renderer.", + "url": "classes/DataTables-Editor-SearchBuilderOptions.html#method_order" + }, { + "fqsen": "\\DataTables\\Editor\\SearchBuilderOptions\u003A\u003Arender\u0028\u0029", + "name": "render", + "summary": "Get\u0020\/\u0020set\u0020the\u0020label\u0020renderer.\u0020The\u0020renderer\u0020can\u0020be\u0020used\u0020to\u0020combine\nmultiple\u0020database\u0020columns\u0020into\u0020a\u0020single\u0020string\u0020that\u0020is\u0020shown\u0020as\u0020the\u0020label\nto\u0020the\u0020end\u0020user\u0020in\u0020the\u0020list\u0020of\u0020options.", + "url": "classes/DataTables-Editor-SearchBuilderOptions.html#method_render" + }, { + "fqsen": "\\DataTables\\Editor\\SearchBuilderOptions\u003A\u003Atable\u0028\u0029", + "name": "table", + "summary": "Get\u0020\/\u0020set\u0020the\u0020database\u0020table\u0020from\u0020which\u0020to\u0020gather\u0020the\u0020options\u0020for\u0020the\nlist.", + "url": "classes/DataTables-Editor-SearchBuilderOptions.html#method_table" + }, { + "fqsen": "\\DataTables\\Editor\\SearchBuilderOptions\u003A\u003Avalue\u0028\u0029", + "name": "value", + "summary": "Get\u0020\/\u0020set\u0020the\u0020column\u0020name\u0020to\u0020use\u0020for\u0020the\u0020value\u0020in\u0020the\u0020options\u0020list.\u0020This\nwould\u0020normally\u0020be\u0020the\u0020primary\u0020key\u0020for\u0020the\u0020table.", + "url": "classes/DataTables-Editor-SearchBuilderOptions.html#method_value" + }, { + "fqsen": "\\DataTables\\Editor\\SearchBuilderOptions\u003A\u003Awhere\u0028\u0029", + "name": "where", + "summary": "Get\u0020\/\u0020set\u0020the\u0020method\u0020to\u0020use\u0020for\u0020a\u0020WHERE\u0020condition\u0020if\u0020it\u0020is\u0020to\u0020be\napplied\u0020to\u0020the\u0020query\u0020to\u0020get\u0020the\u0020options.", + "url": "classes/DataTables-Editor-SearchBuilderOptions.html#method_where" + }, { + "fqsen": "\\DataTables\\Editor\\SearchBuilderOptions\u003A\u003AleftJoin\u0028\u0029", + "name": "leftJoin", + "summary": "Get\u0020\/\u0020set\u0020the\u0020array\u0020values\u0020used\u0020for\u0020a\u0020leftJoin\u0020condition\u0020if\u0020it\u0020is\u0020to\u0020be\napplied\u0020to\u0020the\u0020query\u0020to\u0020get\u0020the\u0020options.", + "url": "classes/DataTables-Editor-SearchBuilderOptions.html#method_leftJoin" + }, { + "fqsen": "\\DataTables\\Editor\\SearchPaneOptions", + "name": "SearchPaneOptions", + "summary": "The\u0020Options\u0020class\u0020provides\u0020a\u0020convenient\u0020method\u0020of\u0020specifying\u0020where\u0020Editor\nshould\u0020get\u0020the\u0020list\u0020of\u0020options\u0020for\u0020a\u0020\u0060select\u0060,\u0020\u0060radio\u0060\u0020or\u0020\u0060checkbox\u0060\u0020field.", + "url": "classes/DataTables-Editor-SearchPaneOptions.html" + }, { + "fqsen": "\\DataTables\\Editor\\SearchPaneOptions\u003A\u003Alabel\u0028\u0029", + "name": "label", + "summary": "Get\u0020\/\u0020set\u0020the\u0020column\u0028s\u0029\u0020to\u0020use\u0020as\u0020the\u0020label\u0020value\u0020of\u0020the\u0020options", + "url": "classes/DataTables-Editor-SearchPaneOptions.html#method_label" + }, { + "fqsen": "\\DataTables\\Editor\\SearchPaneOptions\u003A\u003Aorder\u0028\u0029", + "name": "order", + "summary": "Get\u0020\/\u0020set\u0020the\u0020ORDER\u0020BY\u0020clause\u0020to\u0020use\u0020in\u0020the\u0020SQL.\u0020If\u0020this\u0020option\u0020is\u0020not\nprovided\u0020the\u0020ordering\u0020will\u0020be\u0020based\u0020on\u0020the\u0020rendered\u0020output,\u0020either\nnumerically\u0020or\u0020alphabetically\u0020based\u0020on\u0020the\u0020data\u0020returned\u0020by\u0020the\u0020renderer.", + "url": "classes/DataTables-Editor-SearchPaneOptions.html#method_order" + }, { + "fqsen": "\\DataTables\\Editor\\SearchPaneOptions\u003A\u003Arender\u0028\u0029", + "name": "render", + "summary": "Get\u0020\/\u0020set\u0020the\u0020label\u0020renderer.\u0020The\u0020renderer\u0020can\u0020be\u0020used\u0020to\u0020combine\nmultiple\u0020database\u0020columns\u0020into\u0020a\u0020single\u0020string\u0020that\u0020is\u0020shown\u0020as\u0020the\u0020label\nto\u0020the\u0020end\u0020user\u0020in\u0020the\u0020list\u0020of\u0020options.", + "url": "classes/DataTables-Editor-SearchPaneOptions.html#method_render" + }, { + "fqsen": "\\DataTables\\Editor\\SearchPaneOptions\u003A\u003Atable\u0028\u0029", + "name": "table", + "summary": "Get\u0020\/\u0020set\u0020the\u0020database\u0020table\u0020from\u0020which\u0020to\u0020gather\u0020the\u0020options\u0020for\u0020the\nlist.", + "url": "classes/DataTables-Editor-SearchPaneOptions.html#method_table" + }, { + "fqsen": "\\DataTables\\Editor\\SearchPaneOptions\u003A\u003Avalue\u0028\u0029", + "name": "value", + "summary": "Get\u0020\/\u0020set\u0020the\u0020column\u0020name\u0020to\u0020use\u0020for\u0020the\u0020value\u0020in\u0020the\u0020options\u0020list.\u0020This\nwould\u0020normally\u0020be\u0020the\u0020primary\u0020key\u0020for\u0020the\u0020table.", + "url": "classes/DataTables-Editor-SearchPaneOptions.html#method_value" + }, { + "fqsen": "\\DataTables\\Editor\\SearchPaneOptions\u003A\u003Awhere\u0028\u0029", + "name": "where", + "summary": "Get\u0020\/\u0020set\u0020the\u0020method\u0020to\u0020use\u0020for\u0020a\u0020WHERE\u0020condition\u0020if\u0020it\u0020is\u0020to\u0020be\napplied\u0020to\u0020the\u0020query\u0020to\u0020get\u0020the\u0020options.", + "url": "classes/DataTables-Editor-SearchPaneOptions.html#method_where" + }, { + "fqsen": "\\DataTables\\Editor\\SearchPaneOptions\u003A\u003AleftJoin\u0028\u0029", + "name": "leftJoin", + "summary": "Get\u0020\/\u0020set\u0020the\u0020array\u0020values\u0020used\u0020for\u0020a\u0020leftJoin\u0020condition\u0020if\u0020it\u0020is\u0020to\u0020be\napplied\u0020to\u0020the\u0020query\u0020to\u0020get\u0020the\u0020options.", + "url": "classes/DataTables-Editor-SearchPaneOptions.html#method_leftJoin" + }, { + "fqsen": "\\DataTables\\Editor\\Upload", + "name": "Upload", + "summary": "Upload\u0020class\u0020for\u0020Editor.\u0020This\u0020class\u0020provides\u0020the\u0020ability\u0020to\u0020easily\u0020specify\nfile\u0020upload\u0020information,\u0020specifically\u0020how\u0020the\u0020file\u0020should\u0020be\u0020recorded\u0020on\nthe\u0020server\u0020\u0028database\u0020and\u0020file\u0020system\u0029.", + "url": "classes/DataTables-Editor-Upload.html" + }, { + "fqsen": "\\DataTables\\Editor\\Upload\u003A\u003A__construct\u0028\u0029", + "name": "__construct", + "summary": "Upload\u0020instance\u0020constructor", + "url": "classes/DataTables-Editor-Upload.html#method___construct" + }, { + "fqsen": "\\DataTables\\Editor\\Upload\u003A\u003Aaction\u0028\u0029", + "name": "action", + "summary": "Set\u0020the\u0020action\u0020to\u0020take\u0020when\u0020a\u0020file\u0020is\u0020uploaded.\u0020This\u0020can\u0020be\u0020either\u0020of\u003A", + "url": "classes/DataTables-Editor-Upload.html#method_action" + }, { + "fqsen": "\\DataTables\\Editor\\Upload\u003A\u003AallowedExtensions\u0028\u0029", + "name": "allowedExtensions", + "summary": "An\u0020array\u0020of\u0020valid\u0020file\u0020extensions\u0020that\u0020can\u0020be\u0020uploaded.\u0020This\u0020is\u0020for\nsimple\u0020validation\u0020that\u0020the\u0020file\u0020is\u0020of\u0020the\u0020expected\u0020type\u0020\u002D\u0020for\u0020example\u0020you\nmight\u0020use\u0020\u0060\u005B\u0020\u0027png\u0027,\u0020\u0027jpg\u0027,\u0020\u0027jpeg\u0027,\u0020\u0027gif\u0027\u0020\u005D\u0060\u0020for\u0020images.\u0020The\u0020check\u0020is\ncase\u002Dinsensitive.\u0020If\u0020no\u0020extensions\u0020are\u0020given,\u0020no\u0020validation\u0020is\u0020performed\non\u0020the\u0020file\u0020extension.", + "url": "classes/DataTables-Editor-Upload.html#method_allowedExtensions" + }, { + "fqsen": "\\DataTables\\Editor\\Upload\u003A\u003Adb\u0028\u0029", + "name": "db", + "summary": "Database\u0020configuration\u0020method.\u0020When\u0020used,\u0020this\u0020method\u0020will\u0020tell\u0020Editor\nwhat\u0020information\u0020you\u0020want\u0020written\u0020to\u0020a\u0020database\u0020on\u0020file\u0020upload,\u0020should\nyou\u0020wish\u0020to\u0020store\u0020relational\u0020information\u0020about\u0020your\u0020file\u0020on\u0020the\u0020database\n\u0028this\u0020is\u0020generally\u0020recommended\u0029.", + "url": "classes/DataTables-Editor-Upload.html#method_db" + }, { + "fqsen": "\\DataTables\\Editor\\Upload\u003A\u003AdbClean\u0028\u0029", + "name": "dbClean", + "summary": "Set\u0020a\u0020callback\u0020function\u0020that\u0020is\u0020used\u0020to\u0020remove\u0020files\u0020which\u0020no\u0020longer\u0020have\na\u0020reference\u0020in\u0020a\u0020source\u0020table.", + "url": "classes/DataTables-Editor-Upload.html#method_dbClean" + }, { + "fqsen": "\\DataTables\\Editor\\Upload\u003A\u003Amode\u0028\u0029", + "name": "mode", + "summary": "Set\u0020the\u0020permissions\u0020on\u0020the\u0020file\u0020after\u0020it\u0020has\u0020been\u0020uploaded\u0020using\nchmod.", + "url": "classes/DataTables-Editor-Upload.html#method_mode" + }, { + "fqsen": "\\DataTables\\Editor\\Upload\u003A\u003Avalidator\u0028\u0029", + "name": "validator", + "summary": "Add\u0020a\u0020validation\u0020method\u0020to\u0020check\u0020file\u0020uploads.\u0020Multiple\u0020validators\u0020can\u0020be\nadded\u0020by\u0020calling\u0020this\u0020method\u0020multiple\u0020times\u0020\u002D\u0020they\u0020will\u0020be\u0020executed\u0020in\nsequence\u0020when\u0020a\u0020file\u0020has\u0020been\u0020uploaded.", + "url": "classes/DataTables-Editor-Upload.html#method_validator" + }, { + "fqsen": "\\DataTables\\Editor\\Upload\u003A\u003Awhere\u0028\u0029", + "name": "where", + "summary": "Add\u0020a\u0020condition\u0020to\u0020the\u0020data\u0020to\u0020be\u0020retrieved\u0020from\u0020the\u0020database.\u0020This\nmust\u0020be\u0020given\u0020as\u0020a\u0020function\u0020to\u0020be\u0020executed\u0020\u0028usually\u0020anonymous\u0029\u0020and\nwill\u0020be\u0020passed\u0020in\u0020a\u0020single\u0020argument,\u0020the\u0020\u0060Query\u0060\u0020object,\u0020to\u0020which\nconditions\u0020can\u0020be\u0020added.\u0020Multiple\u0020calls\u0020to\u0020this\u0020method\u0020can\u0020be\u0020made.", + "url": "classes/DataTables-Editor-Upload.html#method_where" + }, { + "fqsen": "\\DataTables\\Editor\\Upload\u003A\u003ADB_CONTENT", + "name": "DB_CONTENT", + "summary": "Database\u0020value\u0020option\u0020\u0028\u0060Db\u0028\u0029\u0060\u0029\u0020\u002D\u0020File\u0020content.\u0020This\u0020should\u0020be\u0020written\u0020to\na\u0020blob.\u0020Typically\u0020this\u0020should\u0020be\u0020avoided\u0020and\u0020the\u0020file\u0020saved\u0020on\u0020the\u0020file\nsystem,\u0020but\u0020there\u0020are\u0020cases\u0020where\u0020it\u0020can\u0020be\u0020useful\u0020to\u0020store\u0020the\u0020file\u0020in\nthe\u0020database.", + "url": "classes/DataTables-Editor-Upload.html#constant_DB_CONTENT" + }, { + "fqsen": "\\DataTables\\Editor\\Upload\u003A\u003ADB_CONTENT_TYPE", + "name": "DB_CONTENT_TYPE", + "summary": "Database\u0020value\u0020option\u0020\u0028\u0060Db\u0028\u0029\u0060\u0029\u0020\u002D\u0020Content\u0020type", + "url": "classes/DataTables-Editor-Upload.html#constant_DB_CONTENT_TYPE" + }, { + "fqsen": "\\DataTables\\Editor\\Upload\u003A\u003ADB_EXTN", + "name": "DB_EXTN", + "summary": "Database\u0020value\u0020option\u0020\u0028\u0060Db\u0028\u0029\u0060\u0029\u0020\u002D\u0020File\u0020extension", + "url": "classes/DataTables-Editor-Upload.html#constant_DB_EXTN" + }, { + "fqsen": "\\DataTables\\Editor\\Upload\u003A\u003ADB_FILE_NAME", + "name": "DB_FILE_NAME", + "summary": "Database\u0020value\u0020option\u0020\u0028\u0060Db\u0028\u0029\u0060\u0029\u0020\u002D\u0020File\u0020name\u0020\u0028with\u0020extension\u0029", + "url": "classes/DataTables-Editor-Upload.html#constant_DB_FILE_NAME" + }, { + "fqsen": "\\DataTables\\Editor\\Upload\u003A\u003ADB_FILE_SIZE", + "name": "DB_FILE_SIZE", + "summary": "Database\u0020value\u0020option\u0020\u0028\u0060Db\u0028\u0029\u0060\u0029\u0020\u002D\u0020File\u0020size\u0020\u0028bytes\u0029", + "url": "classes/DataTables-Editor-Upload.html#constant_DB_FILE_SIZE" + }, { + "fqsen": "\\DataTables\\Editor\\Upload\u003A\u003ADB_MIME_TYPE", + "name": "DB_MIME_TYPE", + "summary": "Database\u0020value\u0020option\u0020\u0028\u0060Db\u0028\u0029\u0060\u0029\u0020\u002D\u0020MIME\u0020type", + "url": "classes/DataTables-Editor-Upload.html#constant_DB_MIME_TYPE" + }, { + "fqsen": "\\DataTables\\Editor\\Upload\u003A\u003ADB_SYSTEM_PATH", + "name": "DB_SYSTEM_PATH", + "summary": "Database\u0020value\u0020option\u0020\u0028\u0060Db\u0028\u0029\u0060\u0029\u0020\u002D\u0020Full\u0020system\u0020path\u0020to\u0020the\u0020file", + "url": "classes/DataTables-Editor-Upload.html#constant_DB_SYSTEM_PATH" + }, { + "fqsen": "\\DataTables\\Editor\\Upload\u003A\u003ADB_WEB_PATH", + "name": "DB_WEB_PATH", + "summary": "Database\u0020value\u0020option\u0020\u0028\u0060Db\u0028\u0029\u0060\u0029\u0020\u002D\u0020HTTP\u0020path\u0020to\u0020the\u0020file.\u0020This\u0020is\u0020derived\nfrom\u0020the\u0020system\u0020path\u0020by\u0020removing\u0020\u0060\u0024_SERVER\u005B\u0027DOCUMENT_ROOT\u0027\u005D\u0060.\u0020If\u0020your\nimages\u0020live\u0020outside\u0020of\u0020the\u0020document\u0020root\u0020a\u0020custom\u0020value\u0020would\u0020be\u0020to\u0020be\nused.", + "url": "classes/DataTables-Editor-Upload.html#constant_DB_WEB_PATH" + }, { + "fqsen": "\\DataTables\\Editor\\Upload\u003A\u003ADB_READ_ONLY", + "name": "DB_READ_ONLY", + "summary": "Read\u0020from\u0020the\u0020database\u0020\u002D\u0020don\u0027t\u0020write\u0020to\u0020it", + "url": "classes/DataTables-Editor-Upload.html#constant_DB_READ_ONLY" + }, { + "fqsen": "\\DataTables\\Editor\\Validate", + "name": "Validate", + "summary": "Validation\u0020methods\u0020for\u0020DataTables\u0020Editor\u0020fields.", + "url": "classes/DataTables-Editor-Validate.html" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003A_extend\u0028\u0029", + "name": "_extend", + "summary": "Extend\u0020the\u0020options\u0020from\u0020the\u0020user\u0020function\u0020and\u0020the\u0020validation\u0020function\nwith\u0020core\u0020defaults.", + "url": "classes/DataTables-Editor-Validate.html#method__extend" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003A_common\u0028\u0029", + "name": "_common", + "summary": "Perform\u0020common\u0020validation\u0020using\u0020the\u0020configuration\u0020parameters", + "url": "classes/DataTables-Editor-Validate.html#method__common" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003A_commonLegacy\u0028\u0029", + "name": "_commonLegacy", + "summary": "Convert\u0020the\u0020old\u0020style\u0020validation\u0020parameters\u0020into\u0020ValidateOptions", + "url": "classes/DataTables-Editor-Validate.html#method__commonLegacy" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003Anone\u0028\u0029", + "name": "none", + "summary": "No\u0020validation\u0020\u002D\u0020all\u0020inputs\u0020are\u0020valid.", + "url": "classes/DataTables-Editor-Validate.html#method_none" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003Abasic\u0028\u0029", + "name": "basic", + "summary": "Basic\u0020validation\u0020\u002D\u0020this\u0020is\u0020used\u0020to\u0020perform\u0020the\u0020validation\u0020provided\u0020by\u0020the\nvalidation\u0020options\u0020only.\u0020If\u0020the\u0020validation\u0020options\u0020pass\u0020\u0028e.g.\u0020\u0060required\u0060,\n\u0060empty\u0060\u0020and\u0020\u0060optional\u0060\u0029\u0020then\u0020the\u0020validation\u0020will\u0020pass\u0020regardless\u0020of\u0020the\nactual\u0020value.", + "url": "classes/DataTables-Editor-Validate.html#method_basic" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003Arequired\u0028\u0029", + "name": "required", + "summary": "Required\u0020field\u0020\u002D\u0020there\u0020must\u0020be\u0020a\u0020value\u0020and\u0020it\u0020must\u0020be\u0020a\u0020non\u002Dempty\u0020value", + "url": "classes/DataTables-Editor-Validate.html#method_required" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003AnotEmpty\u0028\u0029", + "name": "notEmpty", + "summary": "Optional\u0020field,\u0020but\u0020if\u0020given\u0020there\u0020must\u0020be\u0020a\u0020non\u002Dempty\u0020value", + "url": "classes/DataTables-Editor-Validate.html#method_notEmpty" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003Aboolean\u0028\u0029", + "name": "boolean", + "summary": "Validate\u0020an\u0020input\u0020as\u0020a\u0020boolean\u0020value.", + "url": "classes/DataTables-Editor-Validate.html#method_boolean" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003Anumeric\u0028\u0029", + "name": "numeric", + "summary": "Check\u0020that\u0020any\u0020input\u0020is\u0020numeric.", + "url": "classes/DataTables-Editor-Validate.html#method_numeric" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003AminNum\u0028\u0029", + "name": "minNum", + "summary": "Check\u0020for\u0020a\u0020numeric\u0020input\u0020and\u0020that\u0020it\u0020is\u0020greater\u0020than\u0020a\u0020given\u0020value.", + "url": "classes/DataTables-Editor-Validate.html#method_minNum" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003AmaxNum\u0028\u0029", + "name": "maxNum", + "summary": "Check\u0020for\u0020a\u0020numeric\u0020input\u0020and\u0020that\u0020it\u0020is\u0020less\u0020than\u0020a\u0020given\u0020value.", + "url": "classes/DataTables-Editor-Validate.html#method_maxNum" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003AminMaxNum\u0028\u0029", + "name": "minMaxNum", + "summary": "Check\u0020for\u0020a\u0020numeric\u0020input\u0020and\u0020that\u0020it\u0020is\u0020both\u0020greater\u0020and\u0020smaller\u0020than\ngiven\u0020numbers.", + "url": "classes/DataTables-Editor-Validate.html#method_minMaxNum" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003Aemail\u0028\u0029", + "name": "email", + "summary": "Validate\u0020an\u0020input\u0020as\u0020an\u0020e\u002Dmail\u0020address.", + "url": "classes/DataTables-Editor-Validate.html#method_email" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003AminLen\u0028\u0029", + "name": "minLen", + "summary": "Validate\u0020a\u0020string\u0020has\u0020a\u0020minimum\u0020length.", + "url": "classes/DataTables-Editor-Validate.html#method_minLen" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003AmaxLen\u0028\u0029", + "name": "maxLen", + "summary": "Validate\u0020a\u0020string\u0020does\u0020not\u0020exceed\u0020a\u0020maximum\u0020length.", + "url": "classes/DataTables-Editor-Validate.html#method_maxLen" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003AminMaxLen\u0028\u0029", + "name": "minMaxLen", + "summary": "Require\u0020a\u0020string\u0020with\u0020a\u0020certain\u0020minimum\u0020or\u0020maximum\u0020number\u0020of\u0020characters.", + "url": "classes/DataTables-Editor-Validate.html#method_minMaxLen" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003Aip\u0028\u0029", + "name": "ip", + "summary": "Validate\u0020as\u0020an\u0020IP\u0020address.", + "url": "classes/DataTables-Editor-Validate.html#method_ip" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003Aurl\u0028\u0029", + "name": "url", + "summary": "Validate\u0020as\u0020an\u0020URL\u0020address.", + "url": "classes/DataTables-Editor-Validate.html#method_url" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003Axss\u0028\u0029", + "name": "xss", + "summary": "Check\u0020if\u0020string\u0020could\u0020contain\u0020an\u0020XSS\u0020attack\u0020string", + "url": "classes/DataTables-Editor-Validate.html#method_xss" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003Avalues\u0028\u0029", + "name": "values", + "summary": "Confirm\u0020that\u0020the\u0020value\u0020submitted\u0020is\u0020in\u0020a\u0020list\u0020of\u0020allowable\u0020values", + "url": "classes/DataTables-Editor-Validate.html#method_values" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003AnoTags\u0028\u0029", + "name": "noTags", + "summary": "Check\u0020if\u0020there\u0020are\u0020any\u0020tags\u0020in\u0020the\u0020submitted\u0020value", + "url": "classes/DataTables-Editor-Validate.html#method_noTags" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003AdateFormat\u0028\u0029", + "name": "dateFormat", + "summary": "Check\u0020that\u0020a\u0020valid\u0020date\u0020input\u0020is\u0020given", + "url": "classes/DataTables-Editor-Validate.html#method_dateFormat" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003Aunique\u0028\u0029", + "name": "unique", + "summary": "Check\u0020that\u0020the\u0020given\u0020value\u0020is\u0020unique\u0020in\u0020the\u0020database", + "url": "classes/DataTables-Editor-Validate.html#method_unique" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003AdbValues\u0028\u0029", + "name": "dbValues", + "summary": "Check\u0020that\u0020the\u0020given\u0020value\u0020is\u0020a\u0020value\u0020that\u0020is\u0020available\u0020in\u0020a\u0020database\u0020\u002D\ni.e.\u0020a\u0020join\u0020primary\u0020key.\u0020This\u0020will\u0020attempt\u0020to\u0020automatically\u0020use\u0020the\u0020table\nname\u0020and\u0020value\u0020column\u0020from\u0020the\u0020field\u0027s\u0020\u0060options\u0060\u0020method\u0020\u0028under\u0020the\nassumption\u0020that\u0020it\u0020will\u0020typically\u0020be\u0020used\u0020with\u0020a\u0020joined\u0020field\u0029,\u0020but\u0020the\ntable\u0020and\u0020field\u0020can\u0020also\u0020be\u0020specified\u0020via\u0020the\u0020options.", + "url": "classes/DataTables-Editor-Validate.html#method_dbValues" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003AfileExtensions\u0028\u0029", + "name": "fileExtensions", + "summary": "", + "url": "classes/DataTables-Editor-Validate.html#method_fileExtensions" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003AfileSize\u0028\u0029", + "name": "fileSize", + "summary": "", + "url": "classes/DataTables-Editor-Validate.html#method_fileSize" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003AmjoinMinCount\u0028\u0029", + "name": "mjoinMinCount", + "summary": "", + "url": "classes/DataTables-Editor-Validate.html#method_mjoinMinCount" + }, { + "fqsen": "\\DataTables\\Editor\\Validate\u003A\u003AmjoinMaxCount\u0028\u0029", + "name": "mjoinMaxCount", + "summary": "", + "url": "classes/DataTables-Editor-Validate.html#method_mjoinMaxCount" + }, { + "fqsen": "\\DataTables\\Editor\\ValidateOptions", + "name": "ValidateOptions", + "summary": "Common\u0020validation\u0020options\u0020that\u0020can\u0020be\u0020specified\u0020for\u0020all\u0020validation\u0020methods.", + "url": "classes/DataTables-Editor-ValidateOptions.html" + }, { + "fqsen": "\\DataTables\\Editor\\ValidateOptions\u003A\u003A__construct\u0028\u0029", + "name": "__construct", + "summary": "", + "url": "classes/DataTables-Editor-ValidateOptions.html#method___construct" + }, { + "fqsen": "\\DataTables\\Editor\\ValidateOptions\u003A\u003Amessage\u0028\u0029", + "name": "message", + "summary": "Get\u0020\/\u0020set\u0020the\u0020error\u0020message\u0020to\u0020use\u0020if\u0020validation\u0020fails", + "url": "classes/DataTables-Editor-ValidateOptions.html#method_message" + }, { + "fqsen": "\\DataTables\\Editor\\ValidateOptions\u003A\u003AallowEmpty\u0028\u0029", + "name": "allowEmpty", + "summary": "Get\u0020\/\u0020set\u0020the\u0020field\u0020empty\u0020option", + "url": "classes/DataTables-Editor-ValidateOptions.html#method_allowEmpty" + }, { + "fqsen": "\\DataTables\\Editor\\ValidateOptions\u003A\u003Aoptional\u0028\u0029", + "name": "optional", + "summary": "Get\u0020\/\u0020set\u0020the\u0020field\u0020optional\u0020option", + "url": "classes/DataTables-Editor-ValidateOptions.html#method_optional" + }, { + "fqsen": "\\DataTables\\Editor", + "name": "Editor", + "summary": "DataTables\u0020Editor\u0020base\u0020class\u0020for\u0020creating\u0020editable\u0020tables.", + "url": "classes/DataTables-Editor.html" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003Aaction\u0028\u0029", + "name": "action", + "summary": "Determine\u0020the\u0020request\u0020type\u0020from\u0020an\u0020HTTP\u0020request.", + "url": "classes/DataTables-Editor.html#method_action" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003A__construct\u0028\u0029", + "name": "__construct", + "summary": "Constructor.", + "url": "classes/DataTables-Editor.html#method___construct" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003AactionName\u0028\u0029", + "name": "actionName", + "summary": "Get\u0020\/\u0020set\u0020the\u0020action\u0020name\u0020to\u0020read\u0020in\u0020HTTP\u0020parameters.\u0020This\u0020can\u0020be\u0020useful\nto\u0020set\u0020if\u0020you\u0020are\u0020using\u0020a\u0020framework\u0020that\u0020uses\u0020the\u0020default\u0020name\u0020of\u0020\u0060action\u0060\nfor\u0020something\u0020else\u0020\u0028e.g.\u0020WordPress\u0029.", + "url": "classes/DataTables-Editor.html#method_actionName" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003Adata\u0028\u0029", + "name": "data", + "summary": "Get\u0020the\u0020data\u0020constructed\u0020in\u0020this\u0020instance.", + "url": "classes/DataTables-Editor.html#method_data" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003Adb\u0028\u0029", + "name": "db", + "summary": "Get\u0020\/\u0020set\u0020the\u0020DB\u0020connection\u0020instance", + "url": "classes/DataTables-Editor.html#method_db" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003Adebug\u0028\u0029", + "name": "debug", + "summary": "Get\u0020\/\u0020set\u0020debug\u0020mode\u0020and\u0020set\u0020a\u0020debug\u0020message.", + "url": "classes/DataTables-Editor.html#method_debug" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003Afield\u0028\u0029", + "name": "field", + "summary": "Get\u0020\/\u0020set\u0020field\u0020instance.", + "url": "classes/DataTables-Editor.html#method_field" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003Afields\u0028\u0029", + "name": "fields", + "summary": "Get\u0020\/\u0020set\u0020field\u0020instances.", + "url": "classes/DataTables-Editor.html#method_fields" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003AidPrefix\u0028\u0029", + "name": "idPrefix", + "summary": "Get\u0020\/\u0020set\u0020the\u0020DOM\u0020prefix.", + "url": "classes/DataTables-Editor.html#method_idPrefix" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003AinData\u0028\u0029", + "name": "inData", + "summary": "Get\u0020the\u0020data\u0020that\u0020is\u0020being\u0020processed\u0020by\u0020the\u0020Editor\u0020instance.\u0020This\u0020is\u0020only\nuseful\u0020once\u0020the\u0020\u0060process\u0028\u0029\u0060\u0020method\u0020has\u0020been\u0020called,\u0020and\u0020is\u0020available\u0020for\nuse\u0020in\u0020validation\u0020and\u0020formatter\u0020methods.", + "url": "classes/DataTables-Editor.html#method_inData" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003Ajoin\u0028\u0029", + "name": "join", + "summary": "Get\u0020\/\u0020set\u0020join\u0020instances.\u0020Note\u0020that\u0020for\u0020the\u0020majority\u0020of\u0020use\u0020cases\u0020you\nwill\u0020want\u0020to\u0020use\u0020the\u0020\u0060leftJoin\u0028\u0029\u0060\u0020method.\u0020It\u0020is\u0020significantly\u0020easier\nto\u0020use\u0020if\u0020you\u0020are\u0020just\u0020doing\u0020a\u0020simple\u0020left\u0020join\u0021", + "url": "classes/DataTables-Editor.html#method_join" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003Ajson\u0028\u0029", + "name": "json", + "summary": "Get\u0020the\u0020JSON\u0020for\u0020the\u0020data\u0020constructed\u0020in\u0020this\u0020instance.", + "url": "classes/DataTables-Editor.html#method_json" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003Ajsonp\u0028\u0029", + "name": "jsonp", + "summary": "Echo\u0020out\u0020JSONP\u0020for\u0020the\u0020data\u0020constructed\u0020and\u0020processed\u0020in\u0020this\u0020instance.", + "url": "classes/DataTables-Editor.html#method_jsonp" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003AleftJoin\u0028\u0029", + "name": "leftJoin", + "summary": "Add\u0020a\u0020left\u0020join\u0020condition\u0020to\u0020the\u0020Editor\u0020instance,\u0020allowing\u0020it\u0020to\u0020operate\nover\u0020multiple\u0020tables.\u0020Multiple\u0020\u0060leftJoin\u0028\u0029\u0060\u0020calls\u0020can\u0020be\u0020made\u0020for\u0020a\nsingle\u0020Editor\u0020instance\u0020to\u0020join\u0020multiple\u0020tables.", + "url": "classes/DataTables-Editor.html#method_leftJoin" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003AleftJoinRemove\u0028\u0029", + "name": "leftJoinRemove", + "summary": "Indicate\u0020if\u0020a\u0020remove\u0020should\u0020be\u0020performed\u0020on\u0020left\u0020joined\u0020tables\u0020when\u0020deleting\nfrom\u0020the\u0020parent\u0020row.\u0020Note\u0020that\u0020this\u0020is\u0020disabled\u0020by\u0020default\u0020and\u0020will\u0020be\nremoved\u0020completely\u0020in\u0020v2.\u0020Use\u0020\u0060ON\u0020DELETE\u0020CASCADE\u0060\u0020in\u0020your\u0020database\u0020instead.", + "url": "classes/DataTables-Editor.html#method_leftJoinRemove" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003Aon\u0028\u0029", + "name": "on", + "summary": "Add\u0020an\u0020event\u0020listener.\u0020The\u0020\u0060Editor\u0060\u0020class\u0020will\u0020trigger\u0020an\u0020number\u0020of\nevents\u0020that\u0020some\u0020action\u0020can\u0020be\u0020taken\u0020on.", + "url": "classes/DataTables-Editor.html#method_on" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003Apkey\u0028\u0029", + "name": "pkey", + "summary": "Get\u0020\/\u0020set\u0020the\u0020primary\u0020key.", + "url": "classes/DataTables-Editor.html#method_pkey" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003ApkeyToValue\u0028\u0029", + "name": "pkeyToValue", + "summary": "Convert\u0020a\u0020primary\u0020key\u0020array\u0020of\u0020field\u0020values\u0020to\u0020a\u0020combined\u0020value.", + "url": "classes/DataTables-Editor.html#method_pkeyToValue" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003ApkeyToArray\u0028\u0029", + "name": "pkeyToArray", + "summary": "Convert\u0020a\u0020primary\u0020key\u0020combined\u0020value\u0020to\u0020an\u0020array\u0020of\u0020field\u0020values.", + "url": "classes/DataTables-Editor.html#method_pkeyToArray" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003Aprocess\u0028\u0029", + "name": "process", + "summary": "Process\u0020a\u0020request\u0020from\u0020the\u0020Editor\u0020client\u002Dside\u0020to\u0020get\u0020\/\u0020set\u0020data.", + "url": "classes/DataTables-Editor.html#method_process" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003AreadTable\u0028\u0029", + "name": "readTable", + "summary": "The\u0020CRUD\u0020read\u0020table\u0020name.\u0020If\u0020this\u0020method\u0020is\u0020used,\u0020Editor\u0020will\u0020create\u0020from\u0020the\ntable\u0020name\u0028s\u0029\u0020given\u0020rather\u0020than\u0020those\u0020given\u0020by\u0020\u0060Editor\u002D\u003Etable\u0028\u0029\u0060.\u0020This\u0020can\u0020be\na\u0020useful\u0020distinction\u0020to\u0020allow\u0020a\u0020read\u0020from\u0020a\u0020VIEW\u0020\u0028which\u0020could\u0020make\u0020use\u0020of\u0020a\ncomplex\u0020SELECT\u0029\u0020while\u0020writing\u0020to\u0020a\u0020different\u0020table.", + "url": "classes/DataTables-Editor.html#method_readTable" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003Atable\u0028\u0029", + "name": "table", + "summary": "Get\u0020\/\u0020set\u0020the\u0020table\u0020name.", + "url": "classes/DataTables-Editor.html#method_table" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003Atransaction\u0028\u0029", + "name": "transaction", + "summary": "Get\u0020\/\u0020set\u0020transaction\u0020support.", + "url": "classes/DataTables-Editor.html#method_transaction" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003AtryCatch\u0028\u0029", + "name": "tryCatch", + "summary": "Enable\u0020\/\u0020try\u0020catch\u0020when\u0020\u0060process\u0028\u0029\u0060\u0020is\u0020called.\u0020Disabling\u0020this\u0020can\u0020be\nuseful\u0020for\u0020debugging,\u0020but\u0020is\u0020not\u0020recommended\u0020for\u0020production.", + "url": "classes/DataTables-Editor.html#method_tryCatch" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003Avalidate\u0028\u0029", + "name": "validate", + "summary": "Perform\u0020validation\u0020on\u0020a\u0020data\u0020set.", + "url": "classes/DataTables-Editor.html#method_validate" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003Avalidator\u0028\u0029", + "name": "validator", + "summary": "Get\u0020\/\u0020set\u0020a\u0020global\u0020validator\u0020that\u0020will\u0020be\u0020triggered\u0020for\u0020the\u0020create,\u0020edit\nand\u0020remove\u0020actions\u0020performed\u0020from\u0020the\u0020client\u002Dside.\u0020Multiple\u0020validators\ncan\u0020be\u0020added.", + "url": "classes/DataTables-Editor.html#method_validator" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003Awhere\u0028\u0029", + "name": "where", + "summary": "Where\u0020condition\u0020to\u0020add\u0020to\u0020the\u0020query\u0020used\u0020to\u0020get\u0020data\u0020from\u0020the\u0020database.", + "url": "classes/DataTables-Editor.html#method_where" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003AwhereSet\u0028\u0029", + "name": "whereSet", + "summary": "Get\u0020\/\u0020set\u0020if\u0020the\u0020WHERE\u0020conditions\u0020should\u0020be\u0020included\u0020in\u0020the\u0020create\u0020and\nedit\u0020actions.", + "url": "classes/DataTables-Editor.html#method_whereSet" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003Awrite\u0028\u0029", + "name": "write", + "summary": "", + "url": "classes/DataTables-Editor.html#method_write" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003A_ssp_field\u0028\u0029", + "name": "_ssp_field", + "summary": "Convert\u0020a\u0020column\u0020index\u0020to\u0020a\u0020database\u0020field\u0020name\u0020\u002D\u0020used\u0020for\u0020server\u002Dside\nprocessing\u0020requests.", + "url": "classes/DataTables-Editor.html#method__ssp_field" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003AACTION_READ", + "name": "ACTION_READ", + "summary": "Request\u0020type\u0020\u002D\u0020read", + "url": "classes/DataTables-Editor.html#constant_ACTION_READ" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003AACTION_CREATE", + "name": "ACTION_CREATE", + "summary": "Request\u0020type\u0020\u002D\u0020create", + "url": "classes/DataTables-Editor.html#constant_ACTION_CREATE" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003AACTION_EDIT", + "name": "ACTION_EDIT", + "summary": "Request\u0020type\u0020\u002D\u0020edit", + "url": "classes/DataTables-Editor.html#constant_ACTION_EDIT" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003AACTION_DELETE", + "name": "ACTION_DELETE", + "summary": "Request\u0020type\u0020\u002D\u0020delete", + "url": "classes/DataTables-Editor.html#constant_ACTION_DELETE" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003AACTION_UPLOAD", + "name": "ACTION_UPLOAD", + "summary": "Request\u0020type\u0020\u002D\u0020upload", + "url": "classes/DataTables-Editor.html#constant_ACTION_UPLOAD" + }, { + "fqsen": "\\DataTables\\Editor\u003A\u003A\u0024version", + "name": "version", + "summary": "", + "url": "classes/DataTables-Editor.html#property_version" + }, { + "fqsen": "\\DataTables\\Ext", + "name": "Ext", + "summary": "Base\u0020class\u0020for\u0020DataTables\u0020classes.", + "url": "classes/DataTables-Ext.html" + }, { + "fqsen": "\\DataTables\\Ext\u003A\u003Ainstantiate\u0028\u0029", + "name": "instantiate", + "summary": "Static\u0020method\u0020to\u0020instantiate\u0020a\u0020new\u0020instance\u0020of\u0020a\u0020class.", + "url": "classes/DataTables-Ext.html#method_instantiate" + }, { + "fqsen": "\\DataTables\\Ext\u003A\u003Ainst\u0028\u0029", + "name": "inst", + "summary": "Static\u0020method\u0020to\u0020instantiate\u0020a\u0020new\u0020instance\u0020of\u0020a\u0020class\u0020\u0028shorthand\u0020of\n\u0027instantiate\u0027\u0029.", + "url": "classes/DataTables-Ext.html#method_inst" + }, { + "fqsen": "\\DataTables\\Ext\u003A\u003A_getSet\u0028\u0029", + "name": "_getSet", + "summary": "Common\u0020getter\u0020\/\u0020setter\u0020function\u0020for\u0020DataTables\u0020classes.", + "url": "classes/DataTables-Ext.html#method__getSet" + }, { + "fqsen": "\\DataTables\\Ext\u003A\u003A_propExists\u0028\u0029", + "name": "_propExists", + "summary": "Determine\u0020if\u0020a\u0020property\u0020is\u0020available\u0020in\u0020a\u0020data\u0020set\u0020\u0028allowing\u0020\u0060null\u0060\u0020to\u0020be\na\u0020valid\u0020value\u0029", + "url": "classes/DataTables-Ext.html#method__propExists" + }, { + "fqsen": "\\DataTables\\Ext\u003A\u003A_readProp\u0028\u0029", + "name": "_readProp", + "summary": "Read\u0020a\u0020value\u0020from\u0020a\u0020data\u0020structure,\u0020using\u0020Javascript\u0020dotted\u0020object\nnotation.\u0020This\u0020is\u0020the\u0020inverse\u0020of\u0020the\u0020\u0060_writeProp\u0060\u0020method\u0020and\u0020provides\nthe\u0020same\u0020support,\u0020matching\u0020DataTables\u0027\u0020ability\u0020to\u0020read\u0020nested\u0020JSON\ndata\u0020objects.", + "url": "classes/DataTables-Ext.html#method__readProp" + }, { + "fqsen": "\\DataTables\\Ext\u003A\u003A_writeProp\u0028\u0029", + "name": "_writeProp", + "summary": "Write\u0020the\u0020field\u0027s\u0020value\u0020to\u0020an\u0020array\u0020structure,\u0020using\u0020Javascript\u0020dotted\nobject\u0020notation\u0020to\u0020indicate\u0020JSON\u0020data\u0020structure.\u0020For\u0020example\u0020\u0060name.first\u0060\ngives\u0020the\u0020data\u0020structure\u003A\u0020\u0060name\u003A\u0020\u007B\u0020first\u003A\u0020...\u0020\u007D\u0060.\u0020This\u0020matches\u0020DataTables\nown\u0020ability\u0020to\u0020do\u0020this\u0020on\u0020the\u0020client\u002Dside,\u0020although\u0020this\u0020doesn\u0027t\nimplement\u0020implement\u0020quite\u0020such\u0020a\u0020complex\u0020structure\u0020\u0028no\u0020array\u0020\/\u0020function\nsupport\u0029.", + "url": "classes/DataTables-Ext.html#method__writeProp" + }, { + "fqsen": "\\DataTables\\HtmLawed\\Htmlaw", + "name": "Htmlaw", + "summary": "A\u0020class\u0020wrapper\u0020for\u0020the\u0020htmLawed\u0020library.", + "url": "classes/DataTables-HtmLawed-Htmlaw.html" + }, { + "fqsen": "\\DataTables\\HtmLawed\\Htmlaw\u003A\u003Afilter\u0028\u0029", + "name": "filter", + "summary": "Filters\u0020a\u0020string\u0020of\u0020html\u0020with\u0020the\u0020htmLawed\u0020library.", + "url": "classes/DataTables-HtmLawed-Htmlaw.html#method_filter" + }, { + "fqsen": "\\DataTables\\HtmLawed\\Htmlaw\u003A\u003AfilterRSS\u0028\u0029", + "name": "filterRSS", + "summary": "Filter\u0020a\u0020string\u0020of\u0020html\u0020so\u0020that\u0020it\u0020can\u0020be\u0020put\u0020into\u0020an\u0020rss\u0020feed.", + "url": "classes/DataTables-HtmLawed-Htmlaw.html#method_filterRSS" + }, { + "fqsen": "\\DataTables\\HtmLawed\\Htmlaw\u003A\u003A\u0024defaultConfig", + "name": "defaultConfig", + "summary": "", + "url": "classes/DataTables-HtmLawed-Htmlaw.html#property_defaultConfig" + }, { + "fqsen": "\\DataTables\\HtmLawed\\Htmlaw\u003A\u003A\u0024defaultSpec", + "name": "defaultSpec", + "summary": "", + "url": "classes/DataTables-HtmLawed-Htmlaw.html#property_defaultSpec" + }, { + "fqsen": "\\", + "name": "\\", + "summary": "", + "url": "namespaces/default.html" + }, { + "fqsen": "\\DataTables", + "name": "DataTables", + "summary": "", + "url": "namespaces/datatables.html" + }, { + "fqsen": "\\DataTables\\Database\\Driver", + "name": "Driver", + "summary": "", + "url": "namespaces/datatables-database-driver.html" + }, { + "fqsen": "\\DataTables\\Database", + "name": "Database", + "summary": "", + "url": "namespaces/datatables-database.html" + }, { + "fqsen": "\\DataTables\\Editor", + "name": "Editor", + "summary": "", + "url": "namespaces/datatables-editor.html" + }, { + "fqsen": "\\DataTables\\HtmLawed", + "name": "HtmLawed", + "summary": "", + "url": "namespaces/datatables-htmlawed.html" + } ] +); diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables-database-driver.html b/ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables-database-driver.html new file mode 100644 index 00000000..5f40a240 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables-database-driver.html @@ -0,0 +1,179 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                        +

                                                                                                                                        Editor PHP 2.1.3

                                                                                                                                        + + + + + +
                                                                                                                                        + +
                                                                                                                                        +
                                                                                                                                        + + + + +
                                                                                                                                        + + +
                                                                                                                                        +

                                                                                                                                        Driver

                                                                                                                                        + + + +

                                                                                                                                        + Interfaces, Classes, Traits and Enums + +

                                                                                                                                        + +
                                                                                                                                        + +
                                                                                                                                        Db2Query
                                                                                                                                        +
                                                                                                                                        DB2 driver for DataTables Database Query class
                                                                                                                                        +
                                                                                                                                        Db2Result
                                                                                                                                        +
                                                                                                                                        SQL Server driver for DataTables Database Result class
                                                                                                                                        +
                                                                                                                                        FirebirdQuery
                                                                                                                                        +
                                                                                                                                        Firebird driver for DataTables Database Query class
                                                                                                                                        +
                                                                                                                                        FirebirdResult
                                                                                                                                        +
                                                                                                                                        Firebird driver for DataTables Database Result class
                                                                                                                                        +
                                                                                                                                        MysqlQuery
                                                                                                                                        +
                                                                                                                                        MySQL driver for DataTables Database Query class
                                                                                                                                        +
                                                                                                                                        MysqlResult
                                                                                                                                        +
                                                                                                                                        MySQL driver for DataTables Database Result class
                                                                                                                                        +
                                                                                                                                        OracleQuery
                                                                                                                                        +
                                                                                                                                        Oracle driver for DataTables Database Query class
                                                                                                                                        +
                                                                                                                                        OracleResult
                                                                                                                                        +
                                                                                                                                        MySQL driver for DataTables Database Result class
                                                                                                                                        +
                                                                                                                                        PostgresQuery
                                                                                                                                        +
                                                                                                                                        Postgres driver for DataTables Database Query class
                                                                                                                                        +
                                                                                                                                        PostgresResult
                                                                                                                                        +
                                                                                                                                        Postgres driver for DataTables Database Result class
                                                                                                                                        +
                                                                                                                                        SqliteQuery
                                                                                                                                        +
                                                                                                                                        SQLite3 driver for DataTables Database Query class
                                                                                                                                        +
                                                                                                                                        SqliteResult
                                                                                                                                        +
                                                                                                                                        Sqlite driver for DataTables Database Result class
                                                                                                                                        +
                                                                                                                                        SqlserverQuery
                                                                                                                                        +
                                                                                                                                        SQL Server driver for DataTables Database Query class
                                                                                                                                        +
                                                                                                                                        SqlserverResult
                                                                                                                                        +
                                                                                                                                        SQL Server driver for DataTables Database Result class
                                                                                                                                        + + +
                                                                                                                                        + + + + + + +
                                                                                                                                        +
                                                                                                                                        +
                                                                                                                                        +
                                                                                                                                        +

                                                                                                                                        Search results

                                                                                                                                        + +
                                                                                                                                        +
                                                                                                                                        +
                                                                                                                                          +
                                                                                                                                          +
                                                                                                                                          +
                                                                                                                                          +
                                                                                                                                          +
                                                                                                                                          + + +
                                                                                                                                          + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables-database.html b/ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables-database.html new file mode 100644 index 00000000..9cb29cb6 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables-database.html @@ -0,0 +1,162 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                          +

                                                                                                                                          Editor PHP 2.1.3

                                                                                                                                          + + + + + +
                                                                                                                                          + +
                                                                                                                                          +
                                                                                                                                          + + + + +
                                                                                                                                          + + +
                                                                                                                                          +

                                                                                                                                          Database

                                                                                                                                          + + +

                                                                                                                                          + Namespaces + +

                                                                                                                                          + +
                                                                                                                                          +
                                                                                                                                          Driver
                                                                                                                                          +
                                                                                                                                          + +

                                                                                                                                          + Interfaces, Classes, Traits and Enums + +

                                                                                                                                          + +
                                                                                                                                          + +
                                                                                                                                          Query
                                                                                                                                          +
                                                                                                                                          Perform an individual query on the database.
                                                                                                                                          +
                                                                                                                                          Result
                                                                                                                                          +
                                                                                                                                          Result object given by a {@see Query} performed on a database.
                                                                                                                                          + + +
                                                                                                                                          + + + + + + +
                                                                                                                                          +
                                                                                                                                          +
                                                                                                                                          +
                                                                                                                                          +

                                                                                                                                          Search results

                                                                                                                                          + +
                                                                                                                                          +
                                                                                                                                          +
                                                                                                                                            +
                                                                                                                                            +
                                                                                                                                            +
                                                                                                                                            +
                                                                                                                                            +
                                                                                                                                            + + +
                                                                                                                                            + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables-editor.html b/ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables-editor.html new file mode 100644 index 00000000..1d3c0262 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables-editor.html @@ -0,0 +1,178 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                            +

                                                                                                                                            Editor PHP 2.1.3

                                                                                                                                            + + + + + +
                                                                                                                                            + +
                                                                                                                                            +
                                                                                                                                            + + + + +
                                                                                                                                            + + +
                                                                                                                                            +

                                                                                                                                            Editor

                                                                                                                                            + + + +

                                                                                                                                            + Interfaces, Classes, Traits and Enums + +

                                                                                                                                            + +
                                                                                                                                            + +
                                                                                                                                            Field
                                                                                                                                            +
                                                                                                                                            Field definitions for the DataTables Editor.
                                                                                                                                            +
                                                                                                                                            Format
                                                                                                                                            +
                                                                                                                                            Formatter methods for the DataTables Editor
                                                                                                                                            +
                                                                                                                                            Join
                                                                                                                                            +
                                                                                                                                            Join table class for DataTables Editor.
                                                                                                                                            +
                                                                                                                                            Mjoin
                                                                                                                                            +
                                                                                                                                            The `Mjoin` class extends the `Join` class with the join data type set to +'array', whereas the `Join` default is `object` which has been rendered +obsolete by the `Editor->leftJoin()` method. The API API is otherwise +identical.
                                                                                                                                            +
                                                                                                                                            Options
                                                                                                                                            +
                                                                                                                                            The Options class provides a convenient method of specifying where Editor +should get the list of options for a `select`, `radio` or `checkbox` field.
                                                                                                                                            +
                                                                                                                                            SearchBuilderOptions
                                                                                                                                            +
                                                                                                                                            The Options class provides a convenient method of specifying where Editor +should get the list of options for a `select`, `radio` or `checkbox` field.
                                                                                                                                            +
                                                                                                                                            SearchPaneOptions
                                                                                                                                            +
                                                                                                                                            The Options class provides a convenient method of specifying where Editor +should get the list of options for a `select`, `radio` or `checkbox` field.
                                                                                                                                            +
                                                                                                                                            Upload
                                                                                                                                            +
                                                                                                                                            Upload class for Editor. This class provides the ability to easily specify +file upload information, specifically how the file should be recorded on +the server (database and file system).
                                                                                                                                            +
                                                                                                                                            Validate
                                                                                                                                            +
                                                                                                                                            Validation methods for DataTables Editor fields.
                                                                                                                                            +
                                                                                                                                            ValidateOptions
                                                                                                                                            +
                                                                                                                                            Common validation options that can be specified for all validation methods.
                                                                                                                                            + + +
                                                                                                                                            + + + + + + +
                                                                                                                                            +
                                                                                                                                            +
                                                                                                                                            +
                                                                                                                                            +

                                                                                                                                            Search results

                                                                                                                                            + +
                                                                                                                                            +
                                                                                                                                            +
                                                                                                                                              +
                                                                                                                                              +
                                                                                                                                              +
                                                                                                                                              +
                                                                                                                                              +
                                                                                                                                              + + +
                                                                                                                                              + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables-htmlawed.html b/ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables-htmlawed.html new file mode 100644 index 00000000..61275fbb --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables-htmlawed.html @@ -0,0 +1,152 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                              +

                                                                                                                                              Editor PHP 2.1.3

                                                                                                                                              + + + + + +
                                                                                                                                              + +
                                                                                                                                              +
                                                                                                                                              + + + + +
                                                                                                                                              + + +
                                                                                                                                              +

                                                                                                                                              HtmLawed

                                                                                                                                              + + + +

                                                                                                                                              + Interfaces, Classes, Traits and Enums + +

                                                                                                                                              + +
                                                                                                                                              + +
                                                                                                                                              Htmlaw
                                                                                                                                              +
                                                                                                                                              A class wrapper for the htmLawed library.
                                                                                                                                              + + +
                                                                                                                                              + + + + + + +
                                                                                                                                              +
                                                                                                                                              +
                                                                                                                                              +
                                                                                                                                              +

                                                                                                                                              Search results

                                                                                                                                              + +
                                                                                                                                              +
                                                                                                                                              +
                                                                                                                                                +
                                                                                                                                                +
                                                                                                                                                +
                                                                                                                                                +
                                                                                                                                                +
                                                                                                                                                + + +
                                                                                                                                                + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables.html b/ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables.html new file mode 100644 index 00000000..c2c6ae91 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/datatables.html @@ -0,0 +1,165 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                +

                                                                                                                                                Editor PHP 2.1.3

                                                                                                                                                + + + + + +
                                                                                                                                                + +
                                                                                                                                                +
                                                                                                                                                + + + + +
                                                                                                                                                +
                                                                                                                                                  +
                                                                                                                                                + +
                                                                                                                                                +

                                                                                                                                                DataTables

                                                                                                                                                + + +

                                                                                                                                                + Namespaces + +

                                                                                                                                                + +
                                                                                                                                                +
                                                                                                                                                Database
                                                                                                                                                +
                                                                                                                                                Editor
                                                                                                                                                +
                                                                                                                                                HtmLawed
                                                                                                                                                +
                                                                                                                                                + +

                                                                                                                                                + Interfaces, Classes, Traits and Enums + +

                                                                                                                                                + +
                                                                                                                                                + +
                                                                                                                                                Database
                                                                                                                                                +
                                                                                                                                                DataTables Database connection object.
                                                                                                                                                +
                                                                                                                                                Editor
                                                                                                                                                +
                                                                                                                                                DataTables Editor base class for creating editable tables.
                                                                                                                                                +
                                                                                                                                                Ext
                                                                                                                                                +
                                                                                                                                                Base class for DataTables classes.
                                                                                                                                                + + +
                                                                                                                                                + + + + + + +
                                                                                                                                                +
                                                                                                                                                +
                                                                                                                                                +
                                                                                                                                                +

                                                                                                                                                Search results

                                                                                                                                                + +
                                                                                                                                                +
                                                                                                                                                +
                                                                                                                                                  +
                                                                                                                                                  +
                                                                                                                                                  +
                                                                                                                                                  +
                                                                                                                                                  +
                                                                                                                                                  + + +
                                                                                                                                                  + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/default.html b/ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/default.html new file mode 100644 index 00000000..173417b2 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/namespaces/default.html @@ -0,0 +1,254 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                  +

                                                                                                                                                  Editor PHP 2.1.3

                                                                                                                                                  + + + + + +
                                                                                                                                                  + +
                                                                                                                                                  +
                                                                                                                                                  + + + + +
                                                                                                                                                  +
                                                                                                                                                    +
                                                                                                                                                  + +
                                                                                                                                                  +

                                                                                                                                                  API Documentation

                                                                                                                                                  + + +

                                                                                                                                                  + Namespaces + +

                                                                                                                                                  + +
                                                                                                                                                  +
                                                                                                                                                  DataTables
                                                                                                                                                  +
                                                                                                                                                  + + + +

                                                                                                                                                  + Table of Contents + +

                                                                                                                                                  + +
                                                                                                                                                  +
                                                                                                                                                  + DATATABLES + +  = \true +
                                                                                                                                                  +
                                                                                                                                                  + +
                                                                                                                                                  + DATATABLES + +  = \true +
                                                                                                                                                  +
                                                                                                                                                  DataTables PHP libraries.
                                                                                                                                                  + +
                                                                                                                                                  + + +
                                                                                                                                                  +

                                                                                                                                                  + Constants + +

                                                                                                                                                  +
                                                                                                                                                  +

                                                                                                                                                  + DATATABLES + +

                                                                                                                                                  + + + + + + public + mixed + DATATABLES + = \true + + + +
                                                                                                                                                  + +
                                                                                                                                                  + + + +
                                                                                                                                                  +
                                                                                                                                                  +

                                                                                                                                                  + DATATABLES + +

                                                                                                                                                  + + + +

                                                                                                                                                  DataTables PHP libraries.

                                                                                                                                                  + + + public + mixed + DATATABLES + = \true + + + +

                                                                                                                                                  PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                                                                  +
                                                                                                                                                  + +
                                                                                                                                                  + + +
                                                                                                                                                  + Tags + +
                                                                                                                                                  +
                                                                                                                                                  +
                                                                                                                                                  + author +
                                                                                                                                                  +
                                                                                                                                                  + +

                                                                                                                                                  SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                                                                  +
                                                                                                                                                  + +
                                                                                                                                                  +
                                                                                                                                                  + +
                                                                                                                                                  +
                                                                                                                                                  + + +
                                                                                                                                                  +
                                                                                                                                                  +
                                                                                                                                                  +
                                                                                                                                                  +

                                                                                                                                                  Search results

                                                                                                                                                  + +
                                                                                                                                                  +
                                                                                                                                                  +
                                                                                                                                                    +
                                                                                                                                                    +
                                                                                                                                                    +
                                                                                                                                                    +
                                                                                                                                                    +
                                                                                                                                                    + + +
                                                                                                                                                    + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/packages/Application.html b/ci4/app/ThirdParty/DatatablesEditor/docs/packages/Application.html new file mode 100644 index 00000000..878a3a90 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/packages/Application.html @@ -0,0 +1,324 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                    +

                                                                                                                                                    Editor PHP 2.1.3

                                                                                                                                                    + + + + + +
                                                                                                                                                    + +
                                                                                                                                                    +
                                                                                                                                                    + + + + +
                                                                                                                                                    +
                                                                                                                                                      +
                                                                                                                                                    + +
                                                                                                                                                    +

                                                                                                                                                    Application

                                                                                                                                                    + + + +

                                                                                                                                                    + Interfaces, Classes, Traits and Enums + +

                                                                                                                                                    + +
                                                                                                                                                    + +
                                                                                                                                                    Db2Query
                                                                                                                                                    +
                                                                                                                                                    DB2 driver for DataTables Database Query class
                                                                                                                                                    +
                                                                                                                                                    Db2Result
                                                                                                                                                    +
                                                                                                                                                    SQL Server driver for DataTables Database Result class
                                                                                                                                                    +
                                                                                                                                                    FirebirdQuery
                                                                                                                                                    +
                                                                                                                                                    Firebird driver for DataTables Database Query class
                                                                                                                                                    +
                                                                                                                                                    FirebirdResult
                                                                                                                                                    +
                                                                                                                                                    Firebird driver for DataTables Database Result class
                                                                                                                                                    +
                                                                                                                                                    MysqlQuery
                                                                                                                                                    +
                                                                                                                                                    MySQL driver for DataTables Database Query class
                                                                                                                                                    +
                                                                                                                                                    MysqlResult
                                                                                                                                                    +
                                                                                                                                                    MySQL driver for DataTables Database Result class
                                                                                                                                                    +
                                                                                                                                                    OracleQuery
                                                                                                                                                    +
                                                                                                                                                    Oracle driver for DataTables Database Query class
                                                                                                                                                    +
                                                                                                                                                    OracleResult
                                                                                                                                                    +
                                                                                                                                                    MySQL driver for DataTables Database Result class
                                                                                                                                                    +
                                                                                                                                                    PostgresQuery
                                                                                                                                                    +
                                                                                                                                                    Postgres driver for DataTables Database Query class
                                                                                                                                                    +
                                                                                                                                                    PostgresResult
                                                                                                                                                    +
                                                                                                                                                    Postgres driver for DataTables Database Result class
                                                                                                                                                    +
                                                                                                                                                    SqliteQuery
                                                                                                                                                    +
                                                                                                                                                    SQLite3 driver for DataTables Database Query class
                                                                                                                                                    +
                                                                                                                                                    SqliteResult
                                                                                                                                                    +
                                                                                                                                                    Sqlite driver for DataTables Database Result class
                                                                                                                                                    +
                                                                                                                                                    SqlserverQuery
                                                                                                                                                    +
                                                                                                                                                    SQL Server driver for DataTables Database Query class
                                                                                                                                                    +
                                                                                                                                                    SqlserverResult
                                                                                                                                                    +
                                                                                                                                                    SQL Server driver for DataTables Database Result class
                                                                                                                                                    +
                                                                                                                                                    Query
                                                                                                                                                    +
                                                                                                                                                    Perform an individual query on the database.
                                                                                                                                                    +
                                                                                                                                                    Result
                                                                                                                                                    +
                                                                                                                                                    Result object given by a {@see Query} performed on a database.
                                                                                                                                                    +
                                                                                                                                                    Database
                                                                                                                                                    +
                                                                                                                                                    DataTables Database connection object.
                                                                                                                                                    +
                                                                                                                                                    Field
                                                                                                                                                    +
                                                                                                                                                    Field definitions for the DataTables Editor.
                                                                                                                                                    +
                                                                                                                                                    Format
                                                                                                                                                    +
                                                                                                                                                    Formatter methods for the DataTables Editor
                                                                                                                                                    +
                                                                                                                                                    Join
                                                                                                                                                    +
                                                                                                                                                    Join table class for DataTables Editor.
                                                                                                                                                    +
                                                                                                                                                    Mjoin
                                                                                                                                                    +
                                                                                                                                                    The `Mjoin` class extends the `Join` class with the join data type set to +'array', whereas the `Join` default is `object` which has been rendered +obsolete by the `Editor->leftJoin()` method. The API API is otherwise +identical.
                                                                                                                                                    +
                                                                                                                                                    Options
                                                                                                                                                    +
                                                                                                                                                    The Options class provides a convenient method of specifying where Editor +should get the list of options for a `select`, `radio` or `checkbox` field.
                                                                                                                                                    +
                                                                                                                                                    SearchBuilderOptions
                                                                                                                                                    +
                                                                                                                                                    The Options class provides a convenient method of specifying where Editor +should get the list of options for a `select`, `radio` or `checkbox` field.
                                                                                                                                                    +
                                                                                                                                                    SearchPaneOptions
                                                                                                                                                    +
                                                                                                                                                    The Options class provides a convenient method of specifying where Editor +should get the list of options for a `select`, `radio` or `checkbox` field.
                                                                                                                                                    +
                                                                                                                                                    Upload
                                                                                                                                                    +
                                                                                                                                                    Upload class for Editor. This class provides the ability to easily specify +file upload information, specifically how the file should be recorded on +the server (database and file system).
                                                                                                                                                    +
                                                                                                                                                    Validate
                                                                                                                                                    +
                                                                                                                                                    Validation methods for DataTables Editor fields.
                                                                                                                                                    +
                                                                                                                                                    ValidateOptions
                                                                                                                                                    +
                                                                                                                                                    Common validation options that can be specified for all validation methods.
                                                                                                                                                    +
                                                                                                                                                    Editor
                                                                                                                                                    +
                                                                                                                                                    DataTables Editor base class for creating editable tables.
                                                                                                                                                    +
                                                                                                                                                    Ext
                                                                                                                                                    +
                                                                                                                                                    Base class for DataTables classes.
                                                                                                                                                    +
                                                                                                                                                    Htmlaw
                                                                                                                                                    +
                                                                                                                                                    A class wrapper for the htmLawed library.
                                                                                                                                                    + + +
                                                                                                                                                    + + +

                                                                                                                                                    + Table of Contents + +

                                                                                                                                                    + +
                                                                                                                                                    +
                                                                                                                                                    + DATATABLES + +  = \true +
                                                                                                                                                    +
                                                                                                                                                    + +
                                                                                                                                                    + DATATABLES + +  = \true +
                                                                                                                                                    +
                                                                                                                                                    DataTables PHP libraries.
                                                                                                                                                    + +
                                                                                                                                                    + + +
                                                                                                                                                    +

                                                                                                                                                    + Constants + +

                                                                                                                                                    +
                                                                                                                                                    +

                                                                                                                                                    + DATATABLES + +

                                                                                                                                                    + + + + + + public + mixed + DATATABLES + = \true + + + +
                                                                                                                                                    + +
                                                                                                                                                    + + + +
                                                                                                                                                    +
                                                                                                                                                    +

                                                                                                                                                    + DATATABLES + +

                                                                                                                                                    + + + +

                                                                                                                                                    DataTables PHP libraries.

                                                                                                                                                    + + + public + mixed + DATATABLES + = \true + + + +

                                                                                                                                                    PHP libraries for DataTables and DataTables Editor, utilising PHP 5.3+.

                                                                                                                                                    +
                                                                                                                                                    + +
                                                                                                                                                    + + +
                                                                                                                                                    + Tags + +
                                                                                                                                                    +
                                                                                                                                                    +
                                                                                                                                                    + author +
                                                                                                                                                    +
                                                                                                                                                    + +

                                                                                                                                                    SpryMedia +@copyright 2012 SpryMedia ( http://sprymedia.co.uk ) +@license http://editor.datatables.net/license DataTables Editor +@link http://editor.datatables.net

                                                                                                                                                    +
                                                                                                                                                    + +
                                                                                                                                                    +
                                                                                                                                                    + +
                                                                                                                                                    +
                                                                                                                                                    + + +
                                                                                                                                                    +
                                                                                                                                                    +
                                                                                                                                                    +
                                                                                                                                                    +

                                                                                                                                                    Search results

                                                                                                                                                    + +
                                                                                                                                                    +
                                                                                                                                                    +
                                                                                                                                                      +
                                                                                                                                                      +
                                                                                                                                                      +
                                                                                                                                                      +
                                                                                                                                                      +
                                                                                                                                                      + + +
                                                                                                                                                      + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/packages/default.html b/ci4/app/ThirdParty/DatatablesEditor/docs/packages/default.html new file mode 100644 index 00000000..e66b366b --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/packages/default.html @@ -0,0 +1,147 @@ + + + + + Editor PHP 2.1.3 + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                      +

                                                                                                                                                      Editor PHP 2.1.3

                                                                                                                                                      + + + + + +
                                                                                                                                                      + +
                                                                                                                                                      +
                                                                                                                                                      + + + + +
                                                                                                                                                      +
                                                                                                                                                        +
                                                                                                                                                      + +
                                                                                                                                                      +

                                                                                                                                                      API Documentation

                                                                                                                                                      + +

                                                                                                                                                      + Packages + +

                                                                                                                                                      + +
                                                                                                                                                      +
                                                                                                                                                      Application
                                                                                                                                                      +
                                                                                                                                                      + + + + + + + + +
                                                                                                                                                      +
                                                                                                                                                      +
                                                                                                                                                      +
                                                                                                                                                      +

                                                                                                                                                      Search results

                                                                                                                                                      + +
                                                                                                                                                      +
                                                                                                                                                      +
                                                                                                                                                        +
                                                                                                                                                        +
                                                                                                                                                        +
                                                                                                                                                        +
                                                                                                                                                        +
                                                                                                                                                        + + +
                                                                                                                                                        + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/reports/deprecated.html b/ci4/app/ThirdParty/DatatablesEditor/docs/reports/deprecated.html new file mode 100644 index 00000000..5a0e2229 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/reports/deprecated.html @@ -0,0 +1,155 @@ + + + + + Editor PHP 2.1.3 » Deprecated elements + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                        +

                                                                                                                                                        Editor PHP 2.1.3

                                                                                                                                                        + + + + + +
                                                                                                                                                        + +
                                                                                                                                                        +
                                                                                                                                                        + + + + +
                                                                                                                                                        + + +
                                                                                                                                                        +

                                                                                                                                                        Deprecated

                                                                                                                                                        + +

                                                                                                                                                        Table of Contents

                                                                                                                                                        + + + + +
                                                                                                                                                        Editor/Upload.php
                                                                                                                                                        + + +

                                                                                                                                                        Upload.php

                                                                                                                                                        + + + + + + + + + + + +
                                                                                                                                                        LineElementReason
                                                                                                                                                        201Upload::allowedExtensions()

                                                                                                                                                        Use Validate::fileExtensions

                                                                                                                                                        +
                                                                                                                                                        +
                                                                                                                                                        +
                                                                                                                                                        +
                                                                                                                                                        +
                                                                                                                                                        +

                                                                                                                                                        Search results

                                                                                                                                                        + +
                                                                                                                                                        +
                                                                                                                                                        +
                                                                                                                                                          +
                                                                                                                                                          +
                                                                                                                                                          +
                                                                                                                                                          +
                                                                                                                                                          +
                                                                                                                                                          + + +
                                                                                                                                                          + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/reports/errors.html b/ci4/app/ThirdParty/DatatablesEditor/docs/reports/errors.html new file mode 100644 index 00000000..99058b4e --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/reports/errors.html @@ -0,0 +1,160 @@ + + + + + Editor PHP 2.1.3 » Compilation errors + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                          +

                                                                                                                                                          Editor PHP 2.1.3

                                                                                                                                                          + + + + + +
                                                                                                                                                          + +
                                                                                                                                                          +
                                                                                                                                                          + + + + +
                                                                                                                                                          + + +
                                                                                                                                                          +

                                                                                                                                                          Errors

                                                                                                                                                          + +

                                                                                                                                                          Table of Contents

                                                                                                                                                          + + + + + +
                                                                                                                                                          HtmLawed/Htmlaw.php1
                                                                                                                                                          + + + +

                                                                                                                                                          Htmlaw.php

                                                                                                                                                          + + + + + + + + + + + + + + + +
                                                                                                                                                          TypeLineDescription
                                                                                                                                                          ERROR0Tag "see" with body "@see Htmlawed::filter()." has error "\DataTables\HtmLawed\Htmlawed::filter()." is not a valid Fqsen.
                                                                                                                                                          +
                                                                                                                                                          +
                                                                                                                                                          +
                                                                                                                                                          +
                                                                                                                                                          +

                                                                                                                                                          Search results

                                                                                                                                                          + +
                                                                                                                                                          +
                                                                                                                                                          +
                                                                                                                                                            +
                                                                                                                                                            +
                                                                                                                                                            +
                                                                                                                                                            +
                                                                                                                                                            +
                                                                                                                                                            + + +
                                                                                                                                                            + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/docs/reports/markers.html b/ci4/app/ThirdParty/DatatablesEditor/docs/reports/markers.html new file mode 100644 index 00000000..ba326fb2 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/docs/reports/markers.html @@ -0,0 +1,159 @@ + + + + + Editor PHP 2.1.3 » Markers + + + + + + + + + + + + + + + + + + + + + +
                                                                                                                                                            +

                                                                                                                                                            Editor PHP 2.1.3

                                                                                                                                                            + + + + + +
                                                                                                                                                            + +
                                                                                                                                                            +
                                                                                                                                                            + + + + +
                                                                                                                                                            + + +
                                                                                                                                                            +

                                                                                                                                                            Markers

                                                                                                                                                            + +

                                                                                                                                                            Table of Contents

                                                                                                                                                            + + + + + +
                                                                                                                                                            Editor/Join.php1
                                                                                                                                                            + + +

                                                                                                                                                            Join.php

                                                                                                                                                            + + + + + + + + + + + + + + + +
                                                                                                                                                            TypeLineDescription
                                                                                                                                                            TODO854should be create or edit
                                                                                                                                                            +
                                                                                                                                                            +
                                                                                                                                                            +
                                                                                                                                                            +
                                                                                                                                                            +

                                                                                                                                                            Search results

                                                                                                                                                            + +
                                                                                                                                                            +
                                                                                                                                                            +
                                                                                                                                                              +
                                                                                                                                                              +
                                                                                                                                                              +
                                                                                                                                                              +
                                                                                                                                                              +
                                                                                                                                                              + + +
                                                                                                                                                              + + + + + + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/phpdoc.dist.xml b/ci4/app/ThirdParty/DatatablesEditor/phpdoc.dist.xml new file mode 100644 index 00000000..0bf9ba20 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/phpdoc.dist.xml @@ -0,0 +1,17 @@ + + + Editor - PHP server-side + + docs/ + + + + public + protected + + + diff --git a/ci4/app/ThirdParty/DatatablesEditor/phpstan-baseline.neon b/ci4/app/ThirdParty/DatatablesEditor/phpstan-baseline.neon new file mode 100644 index 00000000..878e3a52 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/phpstan-baseline.neon @@ -0,0 +1,405 @@ +parameters: + ignoreErrors: + - + message: "#^Variable \\$sql_details might not be defined\\.$#" + count: 1 + path: Bootstrap.php + + - + message: "#^Access to an undefined property DataTables\\\\Database\\:\\:\\$query_driver\\.$#" + count: 5 + path: Database.php + + - + message: "#^Access to an undefined property DataTables\\\\Database\\:\\:\\$type\\.$#" + count: 1 + path: Database.php + + - + message: "#^Cannot call method quote\\(\\) on resource\\.$#" + count: 1 + path: Database.php + + - + message: "#^Default value of the parameter \\#2 \\$field \\(string\\) of method DataTables\\\\Database\\:\\:select\\(\\) is incompatible with type array\\.$#" + count: 1 + path: Database.php + + - + message: "#^Default value of the parameter \\#2 \\$field \\(string\\) of method DataTables\\\\Database\\:\\:selectDistinct\\(\\) is incompatible with type array\\.$#" + count: 1 + path: Database.php + + - + message: "#^Default value of the parameter \\#2 \\$type \\(int\\) of method DataTables\\\\Database\\:\\:quote\\(\\) is incompatible with type string\\.$#" + count: 1 + path: Database.php + + - + message: "#^Default value of the parameter \\#3 \\$pkey \\(string\\) of method DataTables\\\\Database\\:\\:insert\\(\\) is incompatible with type array\\.$#" + count: 1 + path: Database.php + + - + message: "#^Default value of the parameter \\#4 \\$pkey \\(string\\) of method DataTables\\\\Database\\:\\:push\\(\\) is incompatible with type array\\.$#" + count: 1 + path: Database.php + + - + message: "#^PHPDoc tag @param references unknown parameter\\: \\$_$#" + count: 1 + path: Database.php + + - + message: "#^Call to method resource\\(\\) on an unknown class DataTables\\\\Database\\\\DataTable\\.$#" + count: 2 + path: Database/Driver/Db2Query.php + + - + message: "#^Class DataTables\\\\Database\\\\Driver\\\\Db2Result constructor invoked with 3 parameters, 2 required\\.$#" + count: 1 + path: Database/Driver/Db2Query.php + + - + message: "#^Binary operation \"\\.\" between non\\-empty\\-string and DataTables\\\\Database\\\\Query results in an error\\.$#" + count: 1 + path: Database/Driver/FirebirdQuery.php + + - + message: "#^Call to method debugInfo\\(\\) on an unknown class DataTables\\\\Database\\\\DataTable\\.$#" + count: 1 + path: Database/Driver/FirebirdQuery.php + + - + message: "#^Call to method resource\\(\\) on an unknown class DataTables\\\\Database\\\\DataTable\\.$#" + count: 2 + path: Database/Driver/FirebirdQuery.php + + - + message: "#^Binary operation \"\\.\" between non\\-empty\\-string and DataTables\\\\Database\\\\Query results in an error\\.$#" + count: 1 + path: Database/Driver/MysqlQuery.php + + - + message: "#^Call to method debugInfo\\(\\) on an unknown class DataTables\\\\Database\\\\DataTable\\.$#" + count: 1 + path: Database/Driver/MysqlQuery.php + + - + message: "#^Call to method resource\\(\\) on an unknown class DataTables\\\\Database\\\\DataTable\\.$#" + count: 2 + path: Database/Driver/MysqlQuery.php + + - + message: "#^Call to method debugInfo\\(\\) on an unknown class DataTables\\\\Database\\\\DataTable\\.$#" + count: 1 + path: Database/Driver/OracleQuery.php + + - + message: "#^Call to method resource\\(\\) on an unknown class DataTables\\\\Database\\\\DataTable\\.$#" + count: 2 + path: Database/Driver/OracleQuery.php + + - + message: "#^Binary operation \"\\.\" between non\\-empty\\-string and DataTables\\\\Database\\\\Query results in an error\\.$#" + count: 1 + path: Database/Driver/PostgresQuery.php + + - + message: "#^Call to method debugInfo\\(\\) on an unknown class DataTables\\\\Database\\\\DataTable\\.$#" + count: 1 + path: Database/Driver/PostgresQuery.php + + - + message: "#^Call to method resource\\(\\) on an unknown class DataTables\\\\Database\\\\DataTable\\.$#" + count: 2 + path: Database/Driver/PostgresQuery.php + + - + message: "#^Binary operation \"\\.\" between non\\-empty\\-string and DataTables\\\\Database\\\\Query results in an error\\.$#" + count: 1 + path: Database/Driver/SqliteQuery.php + + - + message: "#^Call to method debugInfo\\(\\) on an unknown class DataTables\\\\Database\\\\DataTable\\.$#" + count: 1 + path: Database/Driver/SqliteQuery.php + + - + message: "#^Call to method getMessage\\(\\) on an unknown class DataTables\\\\Database\\\\Driver\\\\PDOException\\.$#" + count: 1 + path: Database/Driver/SqliteQuery.php + + - + message: "#^Call to method resource\\(\\) on an unknown class DataTables\\\\Database\\\\DataTable\\.$#" + count: 2 + path: Database/Driver/SqliteQuery.php + + - + message: "#^Caught class DataTables\\\\Database\\\\Driver\\\\PDOException not found\\.$#" + count: 1 + path: Database/Driver/SqliteQuery.php + + - + message: "#^Binary operation \"\\.\" between non\\-empty\\-string and DataTables\\\\Database\\\\Query results in an error\\.$#" + count: 2 + path: Database/Driver/SqlserverQuery.php + + - + message: "#^Call to method debugInfo\\(\\) on an unknown class DataTables\\\\Database\\\\DataTable\\.$#" + count: 1 + path: Database/Driver/SqlserverQuery.php + + - + message: "#^Call to method getMessage\\(\\) on an unknown class DataTables\\\\Database\\\\Driver\\\\PDOException\\.$#" + count: 1 + path: Database/Driver/SqlserverQuery.php + + - + message: "#^Call to method resource\\(\\) on an unknown class DataTables\\\\Database\\\\DataTable\\.$#" + count: 2 + path: Database/Driver/SqlserverQuery.php + + - + message: "#^Caught class DataTables\\\\Database\\\\Driver\\\\PDOException not found\\.$#" + count: 1 + path: Database/Driver/SqlserverQuery.php + + - + message: "#^Access to an undefined property DataTables\\\\Database\\\\Query\\:\\:\\$_dbHost\\.$#" + count: 3 + path: Database/Query.php + + - + message: "#^Method DataTables\\\\Database\\\\Query\\:\\:_where_group\\(\\) should return string but return statement is missing\\.$#" + count: 1 + path: Database/Query.php + + - + message: "#^Method DataTables\\\\Database\\\\Query\\:\\:database\\(\\) has invalid return type DataTables\\\\Database\\\\DataTable\\.$#" + count: 1 + path: Database/Query.php + + - + message: "#^PHPDoc tag @param has invalid value \\(\\$where\\)\\: Unexpected token \"\\$where\", expected type at offset 81$#" + count: 1 + path: Database/Query.php + + - + message: "#^PHPDoc tag @param has invalid value \\(array Values\\)\\: Unexpected token \"Values\", expected variable at offset 295$#" + count: 1 + path: Database/Query.php + + - + message: + """ + #^PHPDoc tag @param has invalid value \\(string Conditional operator to use to join to the + preceding condition\\. Default `AND`\\.\\)\\: Unexpected token "Conditional", expected variable at offset 321$# + """ + count: 1 + path: Database/Query.php + + - + message: "#^PHPDoc tag @param has invalid value \\(string Field name\\)\\: Unexpected token \"Field\", expected variable at offset 266$#" + count: 1 + path: Database/Query.php + + - + message: "#^PHPDoc tag @param has invalid value \\(string The field of which the values are to be grouped\\)\\: Unexpected token \"The\", expected variable at offset 69$#" + count: 1 + path: Database/Query.php + + - + message: "#^PHPDoc tag @param references unknown parameter\\: \\$db$#" + count: 1 + path: Database/Query.php + + - + message: "#^PHPDoc tag @param has invalid value \\(int PDO row fetch style \\- PDO\\:\\:FETCH_ASSOC is the default\\)\\: Unexpected token \"PDO\", expected variable at offset 55$#" + count: 1 + path: Database/Result.php + + - + message: "#^PHPDoc tag @param has invalid value \\(int PDO row fetch style \\- PDO\\:\\:FETCH_ASSOC is the default\\)\\: Unexpected token \"PDO\", expected variable at offset 57$#" + count: 1 + path: Database/Result.php + + - + message: "#^Anonymous function has an unused use \\$fields\\.$#" + count: 1 + path: Editor.php + + - + message: "#^Method DataTables\\\\Editor\\:\\:validator\\(\\) has invalid return type DataTables\\\\callback\\.$#" + count: 1 + path: Editor.php + + - + message: "#^PHPDoc tag @param has invalid value \\(int JSON encode option https\\://www\\.php\\.net/manual/en/json\\.constants\\.php\\)\\: Unexpected token \"JSON\", expected variable at offset 311$#" + count: 1 + path: Editor.php + + - + message: "#^PHPDoc tag @param has invalid value \\(number\\[\\] \\[\\$id\\=null\\] Limit to a specific set of ids\\)\\: Unexpected token \"\\[\", expected variable at offset 256$#" + count: 1 + path: Editor.php + + - + message: "#^PHPDoc tag @param has invalid value \\(string Value to set\\. If not given, then used as a getter\\.\\)\\: Unexpected token \"Value\", expected variable at offset 220$#" + count: 1 + path: Editor.php + + - + message: + """ + #^PHPDoc tag @param has invalid value \\(string \\[\\$limitTable\\=null\\] Limit the data gathering to a single + table only\\)\\: Unexpected token "\\[", expected variable at offset 161$# + """ + count: 1 + path: Editor.php + + - + message: "#^PHPDoc tag @param has invalid value \\(string \\[\\$path\\=null\\] Set an output path to log debug information\\)\\: Unexpected token \"\\[\", expected variable at offset 735$#" + count: 1 + path: Editor.php + + - + message: "#^Property DataTables\\\\Editor\\:\\:\\$_validator has unknown class DataTables\\\\callback as its type\\.$#" + count: 1 + path: Editor.php + + - + message: "#^Cannot call method value\\(\\) on array\\\\|DataTables\\\\Editor\\|DataTables\\\\Editor\\\\Join\\|string\\.$#" + count: 1 + path: Editor/Field.php + + - + message: "#^Method DataTables\\\\Editor\\\\Field\\:\\:searchPaneOptionsExec\\(\\) has invalid return type DataTables\\\\Editor\\\\IOption\\.$#" + count: 1 + path: Editor/Field.php + + - + message: "#^Method DataTables\\\\Editor\\\\Field\\:\\:searchPaneOptionsExec\\(\\) has invalid return type DataTables\\\\Editor\\\\Promise\\.$#" + count: 1 + path: Editor/Field.php + + - + message: "#^Parameter \\$field of method DataTables\\\\Editor\\\\Field\\:\\:searchPaneOptionsExec\\(\\) has invalid type DataTables\\\\Field\\.$#" + count: 1 + path: Editor/Field.php + + - + message: "#^Parameter \\$fields of method DataTables\\\\Editor\\\\Field\\:\\:searchPaneOptionsExec\\(\\) has invalid type DataTables\\\\Field\\.$#" + count: 1 + path: Editor/Field.php + + - + message: "#^Parameter \\$http of method DataTables\\\\Editor\\\\Field\\:\\:searchPaneOptionsExec\\(\\) has invalid type DataTables\\\\DTRequest\\.$#" + count: 1 + path: Editor/Field.php + + - + message: "#^Parameter \\$leftJoin of method DataTables\\\\Editor\\\\Field\\:\\:searchPaneOptionsExec\\(\\) has invalid type DataTables\\\\Editor\\\\any\\.$#" + count: 1 + path: Editor/Field.php + + - + message: "#^PHPDoc tag @param references unknown parameter\\: \\$data$#" + count: 9 + path: Editor/Format.php + + - + message: "#^PHPDoc tag @param references unknown parameter\\: \\$opts$#" + count: 9 + path: Editor/Format.php + + - + message: "#^PHPDoc tag @param references unknown parameter\\: \\$val$#" + count: 9 + path: Editor/Format.php + + - + message: "#^Static method DataTables\\\\Editor\\\\Format\\:\\:nullEmpty\\(\\) invoked with 1 parameter, 0 required\\.$#" + count: 1 + path: Editor/Format.php + + - + message: "#^PHPDoc tag @param references unknown parameter\\: \\$order$#" + count: 1 + path: Editor/Join.php + + - + message: "#^Variable \\$readField might not be defined\\.$#" + count: 2 + path: Editor/Join.php + + - + message: "#^Call to method query\\(\\) on an unknown class DataTables\\\\Editor\\\\Database\\.$#" + count: 1 + path: Editor/Options.php + + - + message: "#^Parameter \\$db of method DataTables\\\\Editor\\\\Options\\:\\:exec\\(\\) has invalid type DataTables\\\\Editor\\\\Database\\.$#" + count: 1 + path: Editor/Options.php + + - + message: "#^Property DataTables\\\\Editor\\\\Options\\:\\:\\$_where has unknown class DataTables\\\\Editor\\\\callback as its type\\.$#" + count: 1 + path: Editor/Options.php + + - + message: "#^Cannot call method join\\(\\) on string\\.$#" + count: 2 + path: Editor/SearchPaneOptions.php + + - + message: "#^Cannot call method where\\(\\) on string\\.$#" + count: 1 + path: Editor/SearchPaneOptions.php + + - + message: "#^PHPDoc tag @param references unknown parameter\\: \\$db$#" + count: 1 + path: Editor/SearchPaneOptions.php + + - + message: "#^Property DataTables\\\\Editor\\\\SearchPaneOptions\\:\\:\\$_where has unknown class DataTables\\\\Editor\\\\callback as its type\\.$#" + count: 1 + path: Editor/SearchPaneOptions.php + + - + message: "#^PHPDoc tag @param has invalid value \\(number\\[\\] \\[\\$ids\\=null\\] Limit to a specific set of ids\\)\\: Unexpected token \"\\[\", expected variable at offset 122$#" + count: 1 + path: Editor/Upload.php + + - + message: "#^Method DataTables\\\\Editor\\\\Validate\\:\\:__callStatic\\(\\) should return mixed but return statement is missing\\.$#" + count: 1 + path: Editor/Validate.php + + - + message: "#^PHPDoc tag @param references unknown parameter\\: \\$data$#" + count: 19 + path: Editor/Validate.php + + - + message: "#^PHPDoc tag @param references unknown parameter\\: \\$host$#" + count: 19 + path: Editor/Validate.php + + - + message: "#^PHPDoc tag @param references unknown parameter\\: \\$opts$#" + count: 19 + path: Editor/Validate.php + + - + message: "#^PHPDoc tag @param references unknown parameter\\: \\$val$#" + count: 19 + path: Editor/Validate.php + + - + message: "#^PHPDoc tag @param has invalid value \\(\\$html The html text to fitlter\\.\\)\\: Unexpected token \"\\$html\", expected type at offset 96$#" + count: 1 + path: HtmLawed/Htmlaw.php + diff --git a/ci4/app/ThirdParty/DatatablesEditor/phpstan.neon.dist b/ci4/app/ThirdParty/DatatablesEditor/phpstan.neon.dist new file mode 100644 index 00000000..ec11ae03 --- /dev/null +++ b/ci4/app/ThirdParty/DatatablesEditor/phpstan.neon.dist @@ -0,0 +1,28 @@ +includes: + - phpstan-baseline.neon + +parameters: + level: 2 + paths: + - ./ + excludePaths: + - vendor/ + + treatPhpDocTypesAsCertain: false + + # some extra rules + checkAlwaysTrueCheckTypeFunctionCall: true + checkAlwaysTrueInstanceof: true + checkAlwaysTrueStrictComparison: true + checkExplicitMixedMissingReturn: true + checkFunctionNameCase: true + reportMaybesInMethodSignatures: true + reportStaticMethodSignatures: true + checkTooWideReturnTypesInProtectedAndPublicMethods: true + + ignoreErrors: + # - '~^Unsafe usage of new static\(\)\.$~' + + - + message: '~^.+$~' + path: HtmLawed/Htmlawed.php