Overview

Namespaces

  • Budovy
  • Kdyby
    • BootstrapFormRenderer
      • DI
      • Latte
  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Diagnostics
      • Extensions
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
      • Diagnostics
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • PhpGenerator
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
  • NetteModule
  • Nextras
    • Datagrid
  • None
  • PHP
  • Tester
    • CodeCoverage
    • Runner
      • Output
  • Vodacek
    • Forms
      • Controls
  • WebLoader
    • Filter
    • Nette

Classes

  • AdminerAutocomplete
  • AdminerPlugin

Exceptions

  • UnknownPeriod

Functions

  • adminer_object
  • callback
  • dump
  • id
  • test
  • Overview
  • Namespace
  • Class
  • Tree
  1: <?php
  2: 
  3: /** Adminer customization allowing usage of plugins
  4: * @link http://www.adminer.org/plugins/#use
  5: * @author Jakub Vrana, http://www.vrana.cz/
  6: * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
  7: * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
  8: */
  9: class AdminerPlugin extends Adminer {
 10:     /** @access protected */
 11:     var $plugins;
 12: 
 13:     function _findRootClass($class) { // is_subclass_of(string, string) is available since PHP 5.0.3
 14:         do {
 15:             $return = $class;
 16:         } while ($class = get_parent_class($class));
 17:         return $return;
 18:     }
 19: 
 20:     /** Register plugins
 21:     * @param array object instances or null to register all classes starting by 'Adminer'
 22:     */
 23:     function AdminerPlugin($plugins) {
 24:         if ($plugins === null) {
 25:             $plugins = array();
 26:             foreach (get_declared_classes() as $class) {
 27:                 if (preg_match('~^Adminer.~i', $class) && strcasecmp($this->_findRootClass($class), 'Adminer')) { // can use interface since PHP 5
 28:                     $plugins[$class] = new $class;
 29:                 }
 30:             }
 31:         }
 32:         $this->plugins = $plugins;
 33:         // it is possible to use ReflectionObject in PHP 5 to find out which plugins defines which methods at once
 34:     }
 35: 
 36:     function _callParent($function, $args) {
 37:         switch (count($args)) { // call_user_func_array(array('parent', $function), $args) works since PHP 5
 38:             case 0: return parent::$function();
 39:             case 1: return parent::$function($args[0]);
 40:             case 2: return parent::$function($args[0], $args[1]);
 41:             case 3: return parent::$function($args[0], $args[1], $args[2]);
 42:             case 4: return parent::$function($args[0], $args[1], $args[2], $args[3]);
 43:             case 5: return parent::$function($args[0], $args[1], $args[2], $args[3], $args[4]);
 44:             case 6: return parent::$function($args[0], $args[1], $args[2], $args[3], $args[4], $args[5]);
 45:             default: trigger_error('Too many parameters.', E_USER_WARNING);
 46:         }
 47:     }
 48: 
 49:     function _applyPlugin($function, $args) {
 50:         foreach ($this->plugins as $plugin) {
 51:             if (method_exists($plugin, $function)) {
 52:                 switch (count($args)) { // call_user_func_array() doesn't work well with references
 53:                     case 0: $return = $plugin->$function(); break;
 54:                     case 1: $return = $plugin->$function($args[0]); break;
 55:                     case 2: $return = $plugin->$function($args[0], $args[1]); break;
 56:                     case 3: $return = $plugin->$function($args[0], $args[1], $args[2]); break;
 57:                     case 4: $return = $plugin->$function($args[0], $args[1], $args[2], $args[3]); break;
 58:                     case 5: $return = $plugin->$function($args[0], $args[1], $args[2], $args[3], $args[4]); break;
 59:                     case 6: $return = $plugin->$function($args[0], $args[1], $args[2], $args[3], $args[4], $args[5]); break;
 60:                     default: trigger_error('Too many parameters.', E_USER_WARNING);
 61:                 }
 62:                 if ($return !== null) {
 63:                     return $return;
 64:                 }
 65:             }
 66:         }
 67:         return $this->_callParent($function, $args);
 68:     }
 69: 
 70:     function _appendPlugin($function, $args) {
 71:         $return = $this->_callParent($function, $args);
 72:         foreach ($this->plugins as $plugin) {
 73:             if (method_exists($plugin, $function)) {
 74:                 $return += call_user_func_array(array($plugin, $function), $args);
 75:             }
 76:         }
 77:         return $return;
 78:     }
 79: 
 80:     // appendPlugin
 81: 
 82:     function dumpFormat() {
 83:         $args = func_get_args();
 84:         return $this->_appendPlugin(__FUNCTION__, $args);
 85:     }
 86: 
 87:     function dumpOutput() {
 88:         $args = func_get_args();
 89:         return $this->_appendPlugin(__FUNCTION__, $args);
 90:     }
 91: 
 92:     function editFunctions() {
 93:         $args = func_get_args();
 94:         return $this->_appendPlugin(__FUNCTION__, $args);
 95:     }
 96: 
 97:     // applyPlugin
 98: 
 99:     function name() {
100:         $args = func_get_args();
101:         return $this->_applyPlugin(__FUNCTION__, $args);
102:     }
103: 
104:     function credentials() {
105:         $args = func_get_args();
106:         return $this->_applyPlugin(__FUNCTION__, $args);
107:     }
108: 
109:     function permanentLogin() {
110:         $args = func_get_args();
111:         return $this->_applyPlugin(__FUNCTION__, $args);
112:     }
113: 
114:     function database() {
115:         $args = func_get_args();
116:         return $this->_applyPlugin(__FUNCTION__, $args);
117:     }
118: 
119:     function databases() {
120:         $args = func_get_args();
121:         return $this->_applyPlugin(__FUNCTION__, $args);
122:     }
123: 
124:     function queryTimeout() {
125:         $args = func_get_args();
126:         return $this->_applyPlugin(__FUNCTION__, $args);
127:     }
128: 
129:     function headers() {
130:         $args = func_get_args();
131:         return $this->_applyPlugin(__FUNCTION__, $args);
132:     }
133: 
134:     function head() {
135:         $args = func_get_args();
136:         return $this->_applyPlugin(__FUNCTION__, $args);
137:     }
138: 
139:     function loginForm() {
140:         $args = func_get_args();
141:         return $this->_applyPlugin(__FUNCTION__, $args);
142:     }
143: 
144:     function login() {
145:         $args = func_get_args();
146:         return $this->_applyPlugin(__FUNCTION__, $args);
147:     }
148: 
149:     function tableName() {
150:         $args = func_get_args();
151:         return $this->_applyPlugin(__FUNCTION__, $args);
152:     }
153: 
154:     function fieldName() {
155:         $args = func_get_args();
156:         return $this->_applyPlugin(__FUNCTION__, $args);
157:     }
158: 
159:     function selectLinks() {
160:         $args = func_get_args();
161:         return $this->_applyPlugin(__FUNCTION__, $args);
162:     }
163: 
164:     function foreignKeys() {
165:         $args = func_get_args();
166:         return $this->_applyPlugin(__FUNCTION__, $args);
167:     }
168: 
169:     function backwardKeys() {
170:         $args = func_get_args();
171:         return $this->_applyPlugin(__FUNCTION__, $args);
172:     }
173: 
174:     function backwardKeysPrint() {
175:         $args = func_get_args();
176:         return $this->_applyPlugin(__FUNCTION__, $args);
177:     }
178: 
179:     function selectQuery() {
180:         $args = func_get_args();
181:         return $this->_applyPlugin(__FUNCTION__, $args);
182:     }
183: 
184:     function rowDescription() {
185:         $args = func_get_args();
186:         return $this->_applyPlugin(__FUNCTION__, $args);
187:     }
188: 
189:     function rowDescriptions() {
190:         $args = func_get_args();
191:         return $this->_applyPlugin(__FUNCTION__, $args);
192:     }
193: 
194:     function selectLink() {
195:         $args = func_get_args();
196:         return $this->_applyPlugin(__FUNCTION__, $args);
197:     }
198: 
199:     function selectVal() {
200:         $args = func_get_args();
201:         return $this->_applyPlugin(__FUNCTION__, $args);
202:     }
203: 
204:     function editVal() {
205:         $args = func_get_args();
206:         return $this->_applyPlugin(__FUNCTION__, $args);
207:     }
208: 
209:     function selectColumnsPrint() {
210:         $args = func_get_args();
211:         return $this->_applyPlugin(__FUNCTION__, $args);
212:     }
213: 
214:     function selectSearchPrint() {
215:         $args = func_get_args();
216:         return $this->_applyPlugin(__FUNCTION__, $args);
217:     }
218: 
219:     function selectOrderPrint() {
220:         $args = func_get_args();
221:         return $this->_applyPlugin(__FUNCTION__, $args);
222:     }
223: 
224:     function selectLimitPrint() {
225:         $args = func_get_args();
226:         return $this->_applyPlugin(__FUNCTION__, $args);
227:     }
228: 
229:     function selectLengthPrint() {
230:         $args = func_get_args();
231:         return $this->_applyPlugin(__FUNCTION__, $args);
232:     }
233: 
234:     function selectActionPrint() {
235:         $args = func_get_args();
236:         return $this->_applyPlugin(__FUNCTION__, $args);
237:     }
238: 
239:     function selectCommandPrint() {
240:         $args = func_get_args();
241:         return $this->_applyPlugin(__FUNCTION__, $args);
242:     }
243: 
244:     function selectImportPrint() {
245:         $args = func_get_args();
246:         return $this->_applyPlugin(__FUNCTION__, $args);
247:     }
248: 
249:     function selectEmailPrint() {
250:         $args = func_get_args();
251:         return $this->_applyPlugin(__FUNCTION__, $args);
252:     }
253: 
254:     function selectColumnsProcess() {
255:         $args = func_get_args();
256:         return $this->_applyPlugin(__FUNCTION__, $args);
257:     }
258: 
259:     function selectSearchProcess() {
260:         $args = func_get_args();
261:         return $this->_applyPlugin(__FUNCTION__, $args);
262:     }
263: 
264:     function selectOrderProcess() {
265:         $args = func_get_args();
266:         return $this->_applyPlugin(__FUNCTION__, $args);
267:     }
268: 
269:     function selectLimitProcess() {
270:         $args = func_get_args();
271:         return $this->_applyPlugin(__FUNCTION__, $args);
272:     }
273: 
274:     function selectLengthProcess() {
275:         $args = func_get_args();
276:         return $this->_applyPlugin(__FUNCTION__, $args);
277:     }
278: 
279:     function selectEmailProcess() {
280:         $args = func_get_args();
281:         return $this->_applyPlugin(__FUNCTION__, $args);
282:     }
283: 
284:     function selectQueryBuild() {
285:         $args = func_get_args();
286:         return $this->_applyPlugin(__FUNCTION__, $args);
287:     }
288: 
289:     function messageQuery() {
290:         $args = func_get_args();
291:         return $this->_applyPlugin(__FUNCTION__, $args);
292:     }
293: 
294:     function editInput() {
295:         $args = func_get_args();
296:         return $this->_applyPlugin(__FUNCTION__, $args);
297:     }
298: 
299:     function processInput() {
300:         $args = func_get_args();
301:         return $this->_applyPlugin(__FUNCTION__, $args);
302:     }
303: 
304:     function dumpDatabase() {
305:         $args = func_get_args();
306:         return $this->_applyPlugin(__FUNCTION__, $args);
307:     }
308: 
309:     function dumpTable() {
310:         $args = func_get_args();
311:         return $this->_applyPlugin(__FUNCTION__, $args);
312:     }
313: 
314:     function dumpData() {
315:         $args = func_get_args();
316:         return $this->_applyPlugin(__FUNCTION__, $args);
317:     }
318: 
319:     function dumpFilename() {
320:         $args = func_get_args();
321:         return $this->_applyPlugin(__FUNCTION__, $args);
322:     }
323: 
324:     function dumpHeaders() {
325:         $args = func_get_args();
326:         return $this->_applyPlugin(__FUNCTION__, $args);
327:     }
328: 
329:     function homepage() {
330:         $args = func_get_args();
331:         return $this->_applyPlugin(__FUNCTION__, $args);
332:     }
333: 
334:     function navigation() {
335:         $args = func_get_args();
336:         return $this->_applyPlugin(__FUNCTION__, $args);
337:     }
338: 
339:     function databasesPrint() {
340:         $args = func_get_args();
341:         return $this->_applyPlugin(__FUNCTION__, $args);
342:     }
343: 
344:     function tablesPrint() {
345:         $args = func_get_args();
346:         return $this->_applyPlugin(__FUNCTION__, $args);
347:     }
348: 
349: }
350: 
API documentation generated by ApiGen 2.8.0