class-import-detector.php 728 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * WPSEO plugin file.
  4. *
  5. * @package WPSEO\Admin\Import\Plugins
  6. */
  7. /**
  8. * Class WPSEO_Import_Plugins_Detector.
  9. *
  10. * Class with functionality to detect whether we should import from another SEO plugin.
  11. */
  12. class WPSEO_Import_Plugins_Detector {
  13. /**
  14. * Plugins we need to import from.
  15. *
  16. * @var array
  17. */
  18. public $needs_import = [];
  19. /**
  20. * Detects whether we need to import anything.
  21. */
  22. public function detect() {
  23. foreach ( WPSEO_Plugin_Importers::get() as $importer_class ) {
  24. $importer = new $importer_class();
  25. $detect = new WPSEO_Import_Plugin( $importer, 'detect' );
  26. if ( $detect->status->status ) {
  27. $this->needs_import[ $importer_class ] = $importer->get_plugin_name();
  28. }
  29. }
  30. }
  31. }