FormattedTransformationsPlugin.class.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Abstract class for the formatted transformations plugins
  5. *
  6. * @package PhpMyAdmin-Transformations
  7. * @subpackage Formatted
  8. */
  9. if (! defined('PHPMYADMIN')) {
  10. exit;
  11. }
  12. /* Get the transformations interface */
  13. require_once 'libraries/plugins/TransformationsPlugin.class.php';
  14. /**
  15. * Provides common methods for all of the formatted transformations plugins.
  16. *
  17. * @package PhpMyAdmin
  18. */
  19. abstract class FormattedTransformationsPlugin extends TransformationsPlugin
  20. {
  21. /**
  22. * Gets the transformation description of the specific plugin
  23. *
  24. * @return string
  25. */
  26. public static function getInfo()
  27. {
  28. return __(
  29. 'Displays the contents of the column as-is, without running it'
  30. . ' through htmlspecialchars(). That is, the column is assumed'
  31. . ' to contain valid HTML.'
  32. );
  33. }
  34. /**
  35. * Does the actual work of each specific transformations plugin.
  36. *
  37. * @param string $buffer text to be transformed
  38. * @param array $options transformation options
  39. * @param string $meta meta information
  40. *
  41. * @return void
  42. */
  43. public function applyTransformation($buffer, $options = array(), $meta = '')
  44. {
  45. return '<iframe srcdoc="'
  46. . strtr($buffer, '"', '\'')
  47. . '" sandbox=""></iframe>';
  48. }
  49. /**
  50. * This method is called when any PluginManager to which the observer
  51. * is attached calls PluginManager::notify()
  52. *
  53. * @param SplSubject $subject The PluginManager notifying the observer
  54. * of an update.
  55. *
  56. * @todo implement
  57. * @return void
  58. */
  59. public function update (SplSubject $subject)
  60. {
  61. ;
  62. }
  63. /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
  64. /**
  65. * Gets the transformation name of the specific plugin
  66. *
  67. * @return string
  68. */
  69. public static function getName()
  70. {
  71. return "Formatted";
  72. }
  73. }
  74. ?>