Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wordpres.../src/services/importin...
File: importable-detector-service.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Services\Importing;
[2] Fix | Delete
[3] Fix | Delete
use Yoast\WP\SEO\Actions\Importing\Importing_Action_Interface;
[4] Fix | Delete
[5] Fix | Delete
/**
[6] Fix | Delete
* Detects if any data from other SEO plugins is available for importing.
[7] Fix | Delete
*/
[8] Fix | Delete
class Importable_Detector_Service {
[9] Fix | Delete
[10] Fix | Delete
/**
[11] Fix | Delete
* All known import actions
[12] Fix | Delete
*
[13] Fix | Delete
* @var array|Importing_Action_Interface[]
[14] Fix | Delete
*/
[15] Fix | Delete
protected $importers;
[16] Fix | Delete
[17] Fix | Delete
/**
[18] Fix | Delete
* Importable_Detector_Service constructor.
[19] Fix | Delete
*
[20] Fix | Delete
* @param Importing_Action_Interface ...$importers All of the known importers.
[21] Fix | Delete
*/
[22] Fix | Delete
public function __construct( Importing_Action_Interface ...$importers ) {
[23] Fix | Delete
$this->importers = $importers;
[24] Fix | Delete
}
[25] Fix | Delete
[26] Fix | Delete
/**
[27] Fix | Delete
* Returns the detected importers that have data to work with.
[28] Fix | Delete
*
[29] Fix | Delete
* @param string|null $plugin The plugin name of the importer.
[30] Fix | Delete
* @param string|null $type The type of the importer.
[31] Fix | Delete
*
[32] Fix | Delete
* @return array The detected importers that have data to work with.
[33] Fix | Delete
*/
[34] Fix | Delete
public function detect_importers( $plugin = null, $type = null ) {
[35] Fix | Delete
$detectors = $this->filter_actions( $this->importers, $plugin, $type );
[36] Fix | Delete
[37] Fix | Delete
$detected = [];
[38] Fix | Delete
foreach ( $detectors as $detector ) {
[39] Fix | Delete
if ( $detector->is_enabled() && $detector->get_type() !== 'cleanup' && ! $detector->get_completed() && $detector->get_limited_unindexed_count( 1 ) > 0 ) {
[40] Fix | Delete
$detected[ $detector->get_plugin() ][] = $detector->get_type();
[41] Fix | Delete
}
[42] Fix | Delete
}
[43] Fix | Delete
[44] Fix | Delete
return $detected;
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
/**
[48] Fix | Delete
* Returns the detected cleanups that have data to work with.
[49] Fix | Delete
*
[50] Fix | Delete
* @param string|null $plugin The plugin name of the cleanup.
[51] Fix | Delete
*
[52] Fix | Delete
* @return array The detected importers that have data to work with.
[53] Fix | Delete
*/
[54] Fix | Delete
public function detect_cleanups( $plugin = null ) {
[55] Fix | Delete
$detectors = $this->filter_actions( $this->importers, $plugin, 'cleanup' );
[56] Fix | Delete
[57] Fix | Delete
$detected = [];
[58] Fix | Delete
foreach ( $detectors as $detector ) {
[59] Fix | Delete
if ( $detector->is_enabled() && ! $detector->get_completed() && $detector->get_limited_unindexed_count( 1 ) > 0 ) {
[60] Fix | Delete
$detected[ $detector->get_plugin() ][] = $detector->get_type();
[61] Fix | Delete
}
[62] Fix | Delete
}
[63] Fix | Delete
[64] Fix | Delete
return $detected;
[65] Fix | Delete
}
[66] Fix | Delete
[67] Fix | Delete
/**
[68] Fix | Delete
* Filters all import actions from a list that do not match the given Plugin or Type.
[69] Fix | Delete
*
[70] Fix | Delete
* @param Importing_Action_Interface[] $all_actions The complete list of actions.
[71] Fix | Delete
* @param string|null $plugin The Plugin name whose actions to keep.
[72] Fix | Delete
* @param string|null $type The type of actions to keep.
[73] Fix | Delete
*
[74] Fix | Delete
* @return array
[75] Fix | Delete
*/
[76] Fix | Delete
public function filter_actions( $all_actions, $plugin = null, $type = null ) {
[77] Fix | Delete
return \array_filter(
[78] Fix | Delete
$all_actions,
[79] Fix | Delete
static function ( $action ) use ( $plugin, $type ) {
[80] Fix | Delete
return $action->is_compatible_with( $plugin, $type );
[81] Fix | Delete
}
[82] Fix | Delete
);
[83] Fix | Delete
}
[84] Fix | Delete
}
[85] Fix | Delete
[86] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function