his->proxy->call_function( 'get_plugins' ) );
// Try to match plugin_basename().
$plugin_basename = $this->proxy->call_function( 'plugin_basename', $plugin_file );
if ( in_array( $plugin_basename, $wp_plugins, true ) ) {
return $plugin_basename;
}
// Try to match by the my-file/my-file.php (dir + file name), then by my-file.php (file name only).
$plugin_file = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $plugin_file );
$file_name_parts = explode( DIRECTORY_SEPARATOR, $plugin_file );
$file_name = array_pop( $file_name_parts );
$directory_name = array_pop( $file_name_parts );
$full_matches = array();
$partial_matches = array();
foreach ( $wp_plugins as $wp_plugin ) {
if ( false !== strpos( $wp_plugin, $directory_name . DIRECTORY_SEPARATOR . $file_name ) ) {
$full_matches[] = $wp_plugin;
}
if ( false !== strpos( $wp_plugin, $file_name ) ) {
$partial_matches[] = $wp_plugin;
}
}
if ( 1 === count( $full_matches ) ) {
return $full_matches[0];
}
if ( 1 === count( $partial_matches ) ) {
return $partial_matches[0];
}
return false;
}
/**
* Handle plugin activation and deactivation by clearing the WooCommerce aware plugin ids cache.
*/
private function handle_plugin_de_activation(): void {
$this->woocommerce_aware_plugins = null;
$this->woocommerce_aware_active_plugins = null;
}
/**
* Util function to generate warning string for incompatible features based on active plugins.
*
* @param string $feature_id Feature id.
* @param array $plugin_feature_info Array of plugin feature info. See FeaturesControllers->get_compatible_plugins_for_feature() for details.
*
* @return string Warning string.
*/
public function generate_incompatible_plugin_feature_warning( string $feature_id, array $plugin_feature_info ) : string {
$feature_warning = '';
$incompatibles = array_merge( $plugin_feature_info['incompatible'], $plugin_feature_info['uncertain'] );
$incompatibles = array_filter( $incompatibles, 'is_plugin_active' );
$incompatible_count = count( $incompatibles );
if ( $incompatible_count > 0 ) {
if ( 1 === $incompatible_count ) {
/* translators: %s = printable plugin name */
$feature_warning = sprintf( __( '⚠ 1 Incompatible plugin detected (%s).', 'woocommerce' ), $this->get_plugin_name( $incompatibles[0] ) );
} elseif ( 2 === $incompatible_count ) {
$feature_warning = sprintf(
/* translators: %1\$s, %2\$s = printable plugin names */
__( '⚠ 2 Incompatible plugins detected (%1$s and %2$s).', 'woocommerce' ),
$this->get_plugin_name( $incompatibles[0] ),
$this->get_plugin_name( $incompatibles[1] )
);
} else {
$feature_warning = sprintf(
/* translators: %1\$s, %2\$s = printable plugin names, %3\$d = plugins count */
_n(
'⚠ Incompatible plugins detected (%1$s, %2$s and %3$d other).',
'⚠ Incompatible plugins detected (%1$s and %2$s plugins and %3$d others).',
$incompatible_count - 2,
'woocommerce'
),
$this->get_plugin_name( $incompatibles[0] ),
$this->get_plugin_name( $incompatibles[1] ),
$incompatible_count - 2
);
}
$incompatible_plugins_url = add_query_arg(
array(
'plugin_status' => 'incompatible_with_feature',
'feature_id' => $feature_id,
),
admin_url( 'plugins.php' )
);
$extra_desc_tip = '
' . sprintf(
/* translators: %1$s opening link tag %2$s closing link tag. */
__( '%1$sView and manage%2$s', 'woocommerce' ),
'',
''
);
$feature_warning .= $extra_desc_tip;
}
return $feature_warning;
}
}
' => __DIR__ . '/../..' . '/admin/views/class-yoast-input-select.php',
'Yoast_Input_Validation' => __DIR__ . '/../..' . '/admin/class-yoast-input-validation.php',
'Yoast_Integration_Toggles' => __DIR__ . '/../..' . '/admin/views/class-yoast-integration-toggles.php',
'Yoast_Network_Admin' => __DIR__ . '/../..' . '/admin/class-yoast-network-admin.php',
'Yoast_Network_Settings_API' => __DIR__ . '/../..' . '/admin/class-yoast-network-settings-api.php',
'Yoast_Notification' => __DIR__ . '/../..' . '/admin/class-yoast-notification.php',
'Yoast_Notification_Center' => __DIR__ . '/../..' . '/admin/class-yoast-notification-center.php',
'Yoast_Notifications' => __DIR__ . '/../..' . '/admin/class-yoast-notifications.php',
'Yoast_Plugin_Conflict' => __DIR__ . '/../..' . '/admin/class-yoast-plugin-conflict.php',
'Yoast_Plugin_Conflict_Ajax' => __DIR__ . '/../..' . '/admin/ajax/class-yoast-plugin-conflict-ajax.php',
'Yoast_View_Utils' => __DIR__ . '/../..' . '/src/deprecated/admin/views/class-view-utils.php',
);
public static function getInitializer(ClassLoader $loader)
{
return \Closure::bind(function () use ($loader) {
$loader->prefixLengthsPsr4 = ComposerStaticInit6e5332cbefe9d196df3afd4f6dd6a543::$prefixLengthsPsr4;
$loader->prefixDirsPsr4 = ComposerStaticInit6e5332cbefe9d196df3afd4f6dd6a543::$prefixDirsPsr4;
$loader->classMap = ComposerStaticInit6e5332cbefe9d196df3afd4f6dd6a543::$classMap;
}, null, ClassLoader::class);
}
}