class-link-installer.php 1020 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. * WPSEO plugin file.
  4. *
  5. * @package WPSEO\Admin\Links
  6. */
  7. /**
  8. * Represents installer for the link module.
  9. */
  10. class WPSEO_Link_Installer {
  11. /**
  12. * Installable objects.
  13. *
  14. * @var WPSEO_Installable[]
  15. */
  16. protected $installables = [];
  17. /**
  18. * Sets the installables.
  19. */
  20. public function __construct() {
  21. $this->installables = [
  22. new WPSEO_Link_Storage(),
  23. new WPSEO_Meta_Storage(),
  24. ];
  25. }
  26. /**
  27. * Runs the installation of the link module.
  28. */
  29. public function install() {
  30. foreach ( $this->get_installables() as $installable ) {
  31. $installable->install();
  32. }
  33. }
  34. /**
  35. * Adds a installable object to the installer.
  36. *
  37. * @param WPSEO_Installable $installable The installable object.
  38. */
  39. public function add_installable( WPSEO_Installable $installable ) {
  40. $this->installables[] = $installable;
  41. }
  42. /**
  43. * Returns the installable objects.
  44. *
  45. * @return WPSEO_Installable[] The installables to use.
  46. */
  47. protected function get_installables() {
  48. return $this->installables;
  49. }
  50. }