Yoast_Plugin_Conflict::check_plugin_conflicts
Checks for given $plugin_sections for conflicts.
Метод класса: Yoast_Plugin_Conflict{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$Yoast_Plugin_Conflict = new Yoast_Plugin_Conflict(); $Yoast_Plugin_Conflict->check_plugin_conflicts( $plugin_sections );
- $plugin_sections(массив) (обязательный)
- Set of sections.
Код Yoast_Plugin_Conflict::check_plugin_conflicts() Yoast Plugin Conflict::check plugin conflicts Yoast 28.0
public function check_plugin_conflicts( $plugin_sections ) {
foreach ( $plugin_sections as $plugin_section => $readable_plugin_section ) {
// Check for conflicting plugins and show error if there are conflicts.
if ( $this->check_for_conflicts( $plugin_section ) ) {
$this->set_error( $plugin_section, $readable_plugin_section );
}
}
// List of all active sections.
$sections = array_keys( $plugin_sections );
// List of all sections.
$all_plugin_sections = array_keys( $this->plugins );
/*
* Get all sections that are inactive.
* These plugins need to be cleared.
*
* This happens when Sitemaps or OpenGraph implementations toggle active/disabled.
*/
$inactive_sections = array_diff( $all_plugin_sections, $sections );
if ( ! empty( $inactive_sections ) ) {
foreach ( $inactive_sections as $section ) {
array_walk( $this->plugins[ $section ], [ $this, 'clear_error' ] );
}
}
// For active sections clear errors for inactive plugins.
foreach ( $sections as $section ) {
// By default, clear errors for all plugins of the section.
$inactive_plugins = $this->plugins[ $section ];
// If there are active plugins, filter them from being cleared.
if ( isset( $this->active_conflicting_plugins[ $section ] ) ) {
$inactive_plugins = array_diff( $this->plugins[ $section ], $this->active_conflicting_plugins[ $section ] );
}
array_walk( $inactive_plugins, [ $this, 'clear_error' ] );
}
}