SchemaPlugin.class.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * Abstract class for the schema export plugins
  5. *
  6. * @package PhpMyAdmin
  7. */
  8. if (! defined('PHPMYADMIN')) {
  9. exit;
  10. }
  11. /**
  12. * Provides a common interface that will have to be implemented by all of the
  13. * schema export plugins. Some of the plugins will also implement other public
  14. * methods, but those are not declared here, because they are not implemented
  15. * by all export plugins.
  16. *
  17. * @package PhpMyAdmin
  18. */
  19. abstract class SchemaPlugin
  20. {
  21. /**
  22. * SchemaPluginProperties object containing
  23. * the specific schema export plugin type properties
  24. *
  25. * @var SchemaPluginProperties
  26. */
  27. protected $properties;
  28. /**
  29. * Gets the export specific format plugin properties
  30. *
  31. * @return SchemaPluginProperties
  32. */
  33. public function getProperties()
  34. {
  35. return $this->properties;
  36. }
  37. /**
  38. * Sets the export plugins properties and is implemented by
  39. * each schema export plugin
  40. *
  41. * @return void
  42. */
  43. protected abstract function setProperties();
  44. /**
  45. * Exports the schema into the specified format.
  46. *
  47. * @param string $db database name
  48. *
  49. * @return bool Whether it succeeded
  50. */
  51. public abstract function exportSchema($db);
  52. /**
  53. * Adds export options common to all plugins.
  54. *
  55. * @param OptionsPropertyMainGroup $propertyGroup property group
  56. *
  57. * @return void
  58. */
  59. protected function addCommonOptions(OptionsPropertyMainGroup $propertyGroup)
  60. {
  61. $leaf = new BoolPropertyItem();
  62. $leaf->setName('show_color');
  63. $leaf->setText(__('Show color'));
  64. $propertyGroup->addProperty($leaf);
  65. $leaf = new BoolPropertyItem();
  66. $leaf->setName('show_keys');
  67. $leaf->setText(__('Only show keys'));
  68. $propertyGroup->addProperty($leaf);
  69. }
  70. }