ImageLinkTransformationsPlugin.class.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Abstract class for the link transformations plugins
  5. *
  6. * @package PhpMyAdmin-Transformations
  7. * @subpackage Link
  8. */
  9. if (! defined('PHPMYADMIN')) {
  10. exit;
  11. }
  12. /* Get the transformations interface */
  13. require_once 'libraries/plugins/TransformationsPlugin.class.php';
  14. /* For PMA_transformation_global_html_replace */
  15. require_once 'libraries/transformations.lib.php';
  16. /**
  17. * Provides common methods for all of the link transformations plugins.
  18. *
  19. * @package PhpMyAdmin
  20. */
  21. abstract class ImageLinkTransformationsPlugin extends TransformationsPlugin
  22. {
  23. /**
  24. * Gets the transformation description of the specific plugin
  25. *
  26. * @return string
  27. */
  28. public static function getInfo()
  29. {
  30. return __(
  31. 'Displays a link to download this image.'
  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 '<a href="transformation_wrapper.php'
  46. . $options['wrapper_link'] . '" alt="' . htmlspecialchars($buffer) . '">[BLOB]</a>';
  47. }
  48. /**
  49. * This method is called when any PluginManager to which the observer
  50. * is attached calls PluginManager::notify()
  51. *
  52. * @param SplSubject $subject The PluginManager notifying the observer
  53. * of an update.
  54. *
  55. * @todo implement
  56. * @return void
  57. */
  58. public function update (SplSubject $subject)
  59. {
  60. ;
  61. }
  62. /* ~~~~~~~~~~~~~~~~~~~~ Getters and Setters ~~~~~~~~~~~~~~~~~~~~ */
  63. /**
  64. * Gets the transformation name of the specific plugin
  65. *
  66. * @return string
  67. */
  68. public static function getName()
  69. {
  70. return "Link";
  71. }
  72. }
  73. ?>