Text_Plain_Sql.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * Text Plain SQL Transformations plugin for phpMyAdmin
  4. */
  5. declare(strict_types=1);
  6. namespace PhpMyAdmin\Plugins\Transformations\Output;
  7. use PhpMyAdmin\Plugins\Transformations\Abs\SQLTransformationsPlugin;
  8. use PhpMyAdmin\ResponseRenderer;
  9. /**
  10. * Handles the sql transformation for text plain
  11. */
  12. class Text_Plain_Sql extends SQLTransformationsPlugin
  13. {
  14. public function __construct()
  15. {
  16. if (empty($GLOBALS['cfg']['CodemirrorEnable'])) {
  17. return;
  18. }
  19. $response = ResponseRenderer::getInstance();
  20. $scripts = $response->getHeader()
  21. ->getScripts();
  22. $scripts->addFile('vendor/codemirror/lib/codemirror.js');
  23. $scripts->addFile('vendor/codemirror/mode/sql/sql.js');
  24. $scripts->addFile('vendor/codemirror/addon/runmode/runmode.js');
  25. $scripts->addFile('functions.js');
  26. }
  27. /**
  28. * Gets the plugin`s MIME type
  29. *
  30. * @return string
  31. */
  32. public static function getMIMEType()
  33. {
  34. return 'Text';
  35. }
  36. /**
  37. * Gets the plugin`s MIME subtype
  38. *
  39. * @return string
  40. */
  41. public static function getMIMESubtype()
  42. {
  43. return 'Plain';
  44. }
  45. }