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/wp-conte.../plugins/wordpres.../src/actions/importin...
File: deactivate-conflicting-plugins-action.php
<?php
[0] Fix | Delete
[1] Fix | Delete
namespace Yoast\WP\SEO\Actions\Importing;
[2] Fix | Delete
[3] Fix | Delete
use Yoast\WP\SEO\Conditionals\Updated_Importer_Framework_Conditional;
[4] Fix | Delete
use Yoast\WP\SEO\Config\Conflicting_Plugins;
[5] Fix | Delete
use Yoast\WP\SEO\Helpers\Import_Cursor_Helper;
[6] Fix | Delete
use Yoast\WP\SEO\Helpers\Options_Helper;
[7] Fix | Delete
use Yoast\WP\SEO\Helpers\Sanitization_Helper;
[8] Fix | Delete
use Yoast\WP\SEO\Services\Importing\Aioseo\Aioseo_Replacevar_Service;
[9] Fix | Delete
use Yoast\WP\SEO\Services\Importing\Aioseo\Aioseo_Robots_Provider_Service;
[10] Fix | Delete
use Yoast\WP\SEO\Services\Importing\Aioseo\Aioseo_Robots_Transformer_Service;
[11] Fix | Delete
use Yoast\WP\SEO\Services\Importing\Conflicting_Plugins_Service;
[12] Fix | Delete
[13] Fix | Delete
/**
[14] Fix | Delete
* Deactivates plug-ins that cause conflicts with Yoast SEO.
[15] Fix | Delete
*/
[16] Fix | Delete
class Deactivate_Conflicting_Plugins_Action extends Abstract_Aioseo_Importing_Action {
[17] Fix | Delete
[18] Fix | Delete
/**
[19] Fix | Delete
* The plugin the class deals with.
[20] Fix | Delete
*
[21] Fix | Delete
* @var string
[22] Fix | Delete
*/
[23] Fix | Delete
public const PLUGIN = 'conflicting-plugins';
[24] Fix | Delete
[25] Fix | Delete
/**
[26] Fix | Delete
* The type the class deals with.
[27] Fix | Delete
*
[28] Fix | Delete
* @var string
[29] Fix | Delete
*/
[30] Fix | Delete
public const TYPE = 'deactivation';
[31] Fix | Delete
[32] Fix | Delete
/**
[33] Fix | Delete
* The replacevar handler.
[34] Fix | Delete
*
[35] Fix | Delete
* @var Aioseo_Replacevar_Service
[36] Fix | Delete
*/
[37] Fix | Delete
protected $replacevar_handler;
[38] Fix | Delete
[39] Fix | Delete
/**
[40] Fix | Delete
* Knows all plugins that might possibly conflict.
[41] Fix | Delete
*
[42] Fix | Delete
* @var Conflicting_Plugins_Service
[43] Fix | Delete
*/
[44] Fix | Delete
protected $conflicting_plugins;
[45] Fix | Delete
[46] Fix | Delete
/**
[47] Fix | Delete
* The list of conflicting plugins
[48] Fix | Delete
*
[49] Fix | Delete
* @var array
[50] Fix | Delete
*/
[51] Fix | Delete
protected $detected_plugins;
[52] Fix | Delete
[53] Fix | Delete
/**
[54] Fix | Delete
* Class constructor.
[55] Fix | Delete
*
[56] Fix | Delete
* @param Import_Cursor_Helper $import_cursor The import cursor helper.
[57] Fix | Delete
* @param Options_Helper $options The options helper.
[58] Fix | Delete
* @param Sanitization_Helper $sanitization The sanitization helper.
[59] Fix | Delete
* @param Aioseo_Replacevar_Service $replacevar_handler The replacevar handler.
[60] Fix | Delete
* @param Aioseo_Robots_Provider_Service $robots_provider The robots provider service.
[61] Fix | Delete
* @param Aioseo_Robots_Transformer_Service $robots_transformer The robots transfomer service.
[62] Fix | Delete
* @param Conflicting_Plugins_Service $conflicting_plugins_service The Conflicting plugins Service.
[63] Fix | Delete
*/
[64] Fix | Delete
public function __construct(
[65] Fix | Delete
Import_Cursor_Helper $import_cursor,
[66] Fix | Delete
Options_Helper $options,
[67] Fix | Delete
Sanitization_Helper $sanitization,
[68] Fix | Delete
Aioseo_Replacevar_Service $replacevar_handler,
[69] Fix | Delete
Aioseo_Robots_Provider_Service $robots_provider,
[70] Fix | Delete
Aioseo_Robots_Transformer_Service $robots_transformer,
[71] Fix | Delete
Conflicting_Plugins_Service $conflicting_plugins_service
[72] Fix | Delete
) {
[73] Fix | Delete
parent::__construct( $import_cursor, $options, $sanitization, $replacevar_handler, $robots_provider, $robots_transformer );
[74] Fix | Delete
[75] Fix | Delete
$this->conflicting_plugins = $conflicting_plugins_service;
[76] Fix | Delete
$this->detected_plugins = [];
[77] Fix | Delete
}
[78] Fix | Delete
[79] Fix | Delete
/**
[80] Fix | Delete
* Get the total number of conflicting plugins.
[81] Fix | Delete
*
[82] Fix | Delete
* @return int
[83] Fix | Delete
*/
[84] Fix | Delete
public function get_total_unindexed() {
[85] Fix | Delete
return \count( $this->get_detected_plugins() );
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
/**
[89] Fix | Delete
* Returns whether the updated importer framework is enabled.
[90] Fix | Delete
*
[91] Fix | Delete
* @return bool True if the updated importer framework is enabled.
[92] Fix | Delete
*/
[93] Fix | Delete
public function is_enabled() {
[94] Fix | Delete
$updated_importer_framework_conditional = \YoastSEO()->classes->get( Updated_Importer_Framework_Conditional::class );
[95] Fix | Delete
[96] Fix | Delete
return $updated_importer_framework_conditional->is_met();
[97] Fix | Delete
}
[98] Fix | Delete
[99] Fix | Delete
/**
[100] Fix | Delete
* Deactivate conflicting plugins.
[101] Fix | Delete
*
[102] Fix | Delete
* @return array
[103] Fix | Delete
*/
[104] Fix | Delete
public function index() {
[105] Fix | Delete
$detected_plugins = $this->get_detected_plugins();
[106] Fix | Delete
$this->conflicting_plugins->deactivate_conflicting_plugins( $detected_plugins );
[107] Fix | Delete
[108] Fix | Delete
// We need to conform to the interface, so we report that no indexables were created.
[109] Fix | Delete
return [];
[110] Fix | Delete
}
[111] Fix | Delete
[112] Fix | Delete
/**
[113] Fix | Delete
* {@inheritDoc}
[114] Fix | Delete
*/
[115] Fix | Delete
public function get_limit() {
[116] Fix | Delete
return \count( Conflicting_Plugins::all_plugins() );
[117] Fix | Delete
}
[118] Fix | Delete
[119] Fix | Delete
/**
[120] Fix | Delete
* Returns the total number of unindexed objects up to a limit.
[121] Fix | Delete
*
[122] Fix | Delete
* @param int $limit The maximum.
[123] Fix | Delete
*
[124] Fix | Delete
* @return int The total number of unindexed objects.
[125] Fix | Delete
*/
[126] Fix | Delete
public function get_limited_unindexed_count( $limit ) {
[127] Fix | Delete
$count = \count( $this->get_detected_plugins() );
[128] Fix | Delete
return ( $count <= $limit ) ? $count : $limit;
[129] Fix | Delete
}
[130] Fix | Delete
[131] Fix | Delete
/**
[132] Fix | Delete
* Returns all detected plugins.
[133] Fix | Delete
*
[134] Fix | Delete
* @return array The detected plugins.
[135] Fix | Delete
*/
[136] Fix | Delete
protected function get_detected_plugins() {
[137] Fix | Delete
// The active plugins won't change much. We can reuse the result for the duration of the request.
[138] Fix | Delete
if ( \count( $this->detected_plugins ) < 1 ) {
[139] Fix | Delete
$this->detected_plugins = $this->conflicting_plugins->detect_conflicting_plugins();
[140] Fix | Delete
}
[141] Fix | Delete
return $this->detected_plugins;
[142] Fix | Delete
}
[143] Fix | Delete
}
[144] Fix | Delete
[145] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function