Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

49 Zeilen
1.5KB

  1. <?php
  2. namespace Config;
  3. use CodeIgniter\Events\Events;
  4. use CodeIgniter\Exceptions\FrameworkException;
  5. /*
  6. * --------------------------------------------------------------------
  7. * Application Events
  8. * --------------------------------------------------------------------
  9. * Events allow you to tap into the execution of the program without
  10. * modifying or extending core files. This file provides a central
  11. * location to define your events, though they can always be added
  12. * at run-time, also, if needed.
  13. *
  14. * You create code that can execute by subscribing to events with
  15. * the 'on()' method. This accepts any form of callable, including
  16. * Closures, that will be executed when the event is triggered.
  17. *
  18. * Example:
  19. * Events::on('create', [$myInstance, 'myMethod']);
  20. */
  21. Events::on('pre_system', static function () {
  22. if (ENVIRONMENT !== 'testing') {
  23. if (ini_get('zlib.output_compression')) {
  24. throw FrameworkException::forEnabledZlibOutputCompression();
  25. }
  26. while (ob_get_level() > 0) {
  27. ob_end_flush();
  28. }
  29. ob_start(static fn ($buffer) => $buffer);
  30. }
  31. /*
  32. * --------------------------------------------------------------------
  33. * Debug Toolbar Listeners.
  34. * --------------------------------------------------------------------
  35. * If you delete, they will no longer be collected.
  36. */
  37. if (CI_DEBUG && ! is_cli()) {
  38. Events::on('DBQuery', 'CodeIgniter\Debug\Toolbar\Collectors\Database::collect');
  39. Services::toolbar()->respond();
  40. }
  41. });