TEMPLATE_ABSTRACT 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. // vim: expandtab sw=4 ts=4 sts=4:
  3. /**
  4. * This file contains the basic structure for an abstract class defining a
  5. * transformation.
  6. * For instructions, read the documentation
  7. *
  8. * @package PhpMyAdmin-Transformations
  9. * @subpackage [TransformationName]
  10. */
  11. namespace PhpMyAdmin\Plugins\Transformations\Abs;
  12. use PhpMyAdmin\Plugins\IOTransformationsPlugin;
  13. if (! defined('PHPMYADMIN')) {
  14. exit;
  15. }
  16. /**
  17. * Provides common methods for all of the [TransformationName] transformations plugins.
  18. *
  19. * @package PhpMyAdmin
  20. */
  21. abstract class [TransformationName]TransformationsPlugin
  22. extends IOTransformationsPlugin
  23. {
  24. /**
  25. * Gets the transformation description of the specific plugin
  26. *
  27. * @return string
  28. */
  29. public static function getInfo()
  30. {
  31. return __(
  32. 'Description of the transformation.'
  33. );
  34. }
  35. /**
  36. * Does the actual work of each specific transformations plugin.
  37. *
  38. * @param string $buffer text to be transformed
  39. * @param array $options transformation options
  40. * @param string $meta meta information
  41. *
  42. * @return void
  43. */
  44. public function applyTransformation($buffer, $options = array(), $meta = '')
  45. {
  46. // possibly use a global transform and feed it with special options
  47. // further operations on $buffer using the $options[] array.
  48. // You can evaluate the propagated $meta Object. It's contained fields are described in https://www.php.net/mysql_fetch_field.
  49. // This stored information can be used to get the field information about the transformed field.
  50. // $meta->mimetype contains the original MimeType of the field (i.e. 'text/plain', 'image/jpeg' etc.)
  51. return $buffer;
  52. }
  53. /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
  54. /**
  55. * Gets the TransformationName of the specific plugin
  56. *
  57. * @return string
  58. */
  59. public static function getName()
  60. {
  61. return "[TransformationName]";
  62. }
  63. }
  64. ?>