class-link-installer.php 996 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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. /** @var WPSEO_Installable[] */
  12. protected $installables = array();
  13. /**
  14. * Sets the installables.
  15. */
  16. public function __construct() {
  17. $this->installables = array(
  18. new WPSEO_Link_Storage(),
  19. new WPSEO_Meta_Storage(),
  20. );
  21. }
  22. /**
  23. * Runs the installation of the link module.
  24. */
  25. public function install() {
  26. foreach ( $this->get_installables() as $installable ) {
  27. $installable->install();
  28. }
  29. }
  30. /**
  31. * Adds a installable object to the installer.
  32. *
  33. * @param WPSEO_Installable $installable The installable object.
  34. */
  35. public function add_installable( WPSEO_Installable $installable ) {
  36. $this->installables[] = $installable;
  37. }
  38. /**
  39. * Returns the installable objects.
  40. *
  41. * @return WPSEO_Installable[] The installables to use.
  42. */
  43. protected function get_installables() {
  44. return $this->installables;
  45. }
  46. }