-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Account for one-off plugin naming exceptions #9
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions 🐙
@@ -146,6 +146,24 @@ protected function load_plugins(): void { | |||
$paths[] = "$folder/$sanitized_plugin/$sanitized_plugin.php"; | |||
$paths[] = "$folder/$sanitized_plugin/plugin.php"; | |||
$paths[] = "$folder/$sanitized_plugin.php"; | |||
|
|||
if ( 0 === strpos( $sanitized_plugin, 'wordpress-' ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if ( 0 === strpos( $sanitized_plugin, 'wordpress-' ) ) { | |
if ( str_starts_with( $sanitized_plugin, 'wordpress-' ) ) { |
|
||
if ( 0 === strpos( $sanitized_plugin, 'wordpress-' ) ) { | ||
$paths[] = "$folder/" . substr( $sanitized_plugin, 10 ) . "/$sanitized_plugin.php"; | ||
} elseif ( 0 === strpos( $sanitized_plugin, 'wp-' ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} elseif ( 0 === strpos( $sanitized_plugin, 'wp-' ) ) { | |
} elseif ( str_starts_with( $sanitized_plugin, 'wp-' ) ) { |
// Plugin-specific exceptions that don't follow the standard pattern. | ||
$paths = array_merge( | ||
$paths, | ||
(array) match ( $sanitized_plugin ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(array) match ( $sanitized_plugin ) { | |
match ( $sanitized_plugin ) { |
Cast may be redundant here?
Account for
wordpress-fieldmanager
having a main plugin file offieldmanager.php
. Also account for some other one-off plugins that don't follow the standard. Borrows work from Reflector (internal to Alley project).