PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.1
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.1
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / src / services / importing / importable-detector.php

importable-detector.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.1, at src/services/importing/importable-detector.php

51 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Yoast\WP\SEO\Services\Importing;
4
5 use Yoast\WP\SEO\Actions\Importing\Importing_Action_Interface;
6
7 /**
8 * Detects if any data from other SEO plugins is available for importing.
9 */
10 class Importable_Detector {
11
12 use Importer_Action_Filter_Trait;
13
14 /**
15 * All known import actions
16 *
17 * @var array|Importing_Action_Interface[]
18 */
19 protected $importers;
20
21 /**
22 * Importable_Detector constructor.
23 *
24 * @param Importing_Action_Interface ...$importers All of the known importers.
25 */
26 public function __construct( Importing_Action_Interface ...$importers ) {
27 $this->importers = $importers;
28 }
29
30 /**
31 * Returns the detected importers that have data to work with.
32 *
33 * @param string $plugin The plugin name of the importer.
34 * @param string $type The type of the importer.
35 *
36 * @return array The detected importers that have data to work with.
37 */
38 public function detect( $plugin = null, $type = null ) {
39 $detectors = $this->filter_actions( $this->importers, $plugin, $type );
40
41 $detected = [];
42 foreach ( $detectors as $detector ) {
43 if ( $detector->is_enabled() && ! $detector->get_completed() && $detector->get_limited_unindexed_count( 1 ) > 0 ) {
44 $detected[ $detector->get_plugin() ][] = $detector->get_type();
45 }
46 }
47
48 return $detected;
49 }
50 }
51