TEMPLATE_ABSTRACT 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. if (! defined('PHPMYADMIN')) {
  12. exit;
  13. }
  14. /* Get the transformations interface */
  15. require_once 'libraries/plugins/TransformationsPlugin.class.php';
  16. /**
  17. * Provides common methods for all of the [TransformationName] transformations plugins.
  18. *
  19. * @package PhpMyAdmin
  20. */
  21. abstract class [TransformationName]TransformationsPlugin
  22. extends TransformationsPlugin
  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 http://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. /**
  54. * This method is called when any PluginManager to which the observer
  55. * is attached calls PluginManager::notify()
  56. *
  57. * @param SplSubject $subject The PluginManager notifying the observer
  58. * of an update.
  59. *
  60. * @todo implement
  61. * @return void
  62. */
  63. public function update (SplSubject $subject)
  64. {
  65. ;
  66. }
  67. /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
  68. /**
  69. * Gets the TransformationName of the specific plugin
  70. *
  71. * @return string
  72. */
  73. public static function getName()
  74. {
  75. return "[TransformationName]";
  76. }
  77. }
  78. ?>