IOTransformationsPlugin.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /**
  3. * Abstract class for the I/O transformations plugins
  4. */
  5. declare(strict_types=1);
  6. namespace PhpMyAdmin\Plugins;
  7. /**
  8. * Provides a common interface that will have to be implemented
  9. * by all of the Input/Output transformations plugins.
  10. */
  11. abstract class IOTransformationsPlugin extends TransformationsPlugin
  12. {
  13. /**
  14. * Specifies whether transformation was successful or not.
  15. *
  16. * @var bool
  17. */
  18. protected $success = true;
  19. /**
  20. * To store the error message in case of failed transformations.
  21. *
  22. * @var string
  23. */
  24. protected $error = '';
  25. /**
  26. * Returns the html for input field to override default textarea.
  27. * Note: Return empty string if default textarea is required.
  28. *
  29. * @param array $column column details
  30. * @param int $row_id row number
  31. * @param string $column_name_appendix the name attribute
  32. * @param array $options transformation options
  33. * @param string $value Current field value
  34. * @param string $text_dir text direction
  35. * @param int $tabindex tab index
  36. * @param int $tabindex_for_value offset for the values tabindex
  37. * @param int $idindex id index
  38. *
  39. * @return string the html for input field
  40. */
  41. public function getInputHtml(
  42. array $column,
  43. $row_id,
  44. $column_name_appendix,
  45. array $options,
  46. $value,
  47. $text_dir,
  48. $tabindex,
  49. $tabindex_for_value,
  50. $idindex
  51. ) {
  52. return '';
  53. }
  54. /**
  55. * Returns the array of scripts (filename) required for plugin
  56. * initialization and handling
  57. *
  58. * @return array javascripts to be included
  59. */
  60. public function getScripts()
  61. {
  62. return [];
  63. }
  64. /**
  65. * Returns the error message
  66. *
  67. * @return string error
  68. */
  69. public function getError()
  70. {
  71. return $this->error;
  72. }
  73. /**
  74. * Returns the success status
  75. *
  76. * @return bool
  77. */
  78. public function isSuccess()
  79. {
  80. return $this->success;
  81. }
  82. /**
  83. * Resets the object properties
  84. *
  85. * @return void
  86. */
  87. public function reset()
  88. {
  89. $this->success = true;
  90. $this->error = '';
  91. }
  92. }