Text_Plain_SqlEditor.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /**
  3. * SQL editing with syntax highlighted CodeMirror editor
  4. */
  5. declare(strict_types=1);
  6. namespace PhpMyAdmin\Plugins\Transformations\Input;
  7. use PhpMyAdmin\Plugins\Transformations\Abs\CodeMirrorEditorTransformationPlugin;
  8. use function __;
  9. /**
  10. * SQL editing with syntax highlighted CodeMirror editor
  11. */
  12. class Text_Plain_SqlEditor extends CodeMirrorEditorTransformationPlugin
  13. {
  14. /**
  15. * Gets the transformation description of the specific plugin
  16. *
  17. * @return string
  18. */
  19. public static function getInfo()
  20. {
  21. return __('Syntax highlighted CodeMirror editor for SQL.');
  22. }
  23. /**
  24. * Returns the array of scripts (filename) required for plugin
  25. * initialization and handling
  26. *
  27. * @return array javascripts to be included
  28. */
  29. public function getScripts()
  30. {
  31. $scripts = [];
  32. if ($GLOBALS['cfg']['CodemirrorEnable']) {
  33. $scripts[] = 'vendor/codemirror/lib/codemirror.js';
  34. $scripts[] = 'vendor/codemirror/mode/sql/sql.js';
  35. $scripts[] = 'transformations/sql_editor.js';
  36. }
  37. return $scripts;
  38. }
  39. /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
  40. /**
  41. * Gets the transformation name of the specific plugin
  42. *
  43. * @return string
  44. */
  45. public static function getName()
  46. {
  47. return 'SQL';
  48. }
  49. /**
  50. * Gets the plugin`s MIME type
  51. *
  52. * @return string
  53. */
  54. public static function getMIMEType()
  55. {
  56. return 'Text';
  57. }
  58. /**
  59. * Gets the plugin`s MIME subtype
  60. *
  61. * @return string
  62. */
  63. public static function getMIMESubtype()
  64. {
  65. return 'Plain';
  66. }
  67. }