Skip to content

Commit 83bc123

Browse files
committed
Detect extensions using Requires Plugins header
1 parent 773eb78 commit 83bc123

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

plugins/optimization-detective/helper.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,19 @@ function od_render_extensions_action_link( $links ) {
236236
*/
237237
function od_check_installed_extensions(): array {
238238
$installed_plugins = get_plugins();
239+
$installed_extensions = array();
240+
241+
foreach ( $installed_plugins as $plugin_slug => $plugin_data ) {
242+
if ( isset( $plugin_data['RequiresPlugins'] ) && 'optimization-detective' === $plugin_data['RequiresPlugins'] ) {
243+
$installed_extensions[] = $plugin_slug;
244+
}
245+
}
246+
247+
// Check for plugins without Requires Plugins header but known to be extensions.
239248
$extensions = array(
240-
'image-prioritizer/load.php',
241249
'embed-optimizer/load.php',
242250
);
243-
$installed_extensions = array_intersect( $extensions, array_keys( $installed_plugins ) );
251+
$installed_extensions = array_merge( $installed_extensions, array_intersect( $extensions, array_keys( $installed_plugins ) ) );
244252

245253
return $installed_extensions;
246254
}

0 commit comments

Comments
 (0)