Skip to content

Commit 6377fdc

Browse files
committed
Connectors: Fix docblock and simplify is_installed condition
1 parent 7523d4d commit 6377fdc

2 files changed

Lines changed: 9 additions & 13 deletions

File tree

src/wp-includes/class-wp-connector-registry.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ final class WP_Connector_Registry {
110110
* @type array $plugin {
111111
* Optional. Plugin data for install/activate UI.
112112
*
113-
* @type string $file The plugin's main file path relative to the plugins
114-
* directory (e.g. 'my-plugin/my-plugin.php' or 'hello.php').
113+
* @type string $file The plugin's main file path relative to the plugins
114+
* directory (e.g. 'my-plugin/my-plugin.php' or 'hello.php').
115115
* @type callable $is_active Optional callback to determine whether the plugin
116116
* is active. Receives no arguments and must return bool.
117117
* }

src/wp-includes/connectors.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ function wp_is_connector_registered( string $id ): bool {
5858
* @type array $plugin {
5959
* Optional. Plugin data for install/activate UI.
6060
*
61-
* @type string $file The plugin's main file path relative to the plugins
62-
* directory (e.g. 'my-plugin/my-plugin.php' or 'hello.php').
61+
* @type string $file The plugin's main file path relative to the plugins
62+
* directory (e.g. 'my-plugin/my-plugin.php' or 'hello.php').
6363
* @type callable $is_active Optional callback to determine whether the plugin
64-
* is active. Receives no arguments and must return bool.
64+
* is active. Receives no arguments and must return bool.
6565
* }
6666
* }
6767
* @phpstan-return ?array{
@@ -122,10 +122,10 @@ function wp_get_connector( string $id ): ?array {
122122
* @type array $plugin {
123123
* Optional. Plugin data for install/activate UI.
124124
*
125-
* @type string $file The plugin's main file path relative to the plugins
126-
* directory (e.g. 'my-plugin/my-plugin.php' or 'hello.php').
125+
* @type string $file The plugin's main file path relative to the plugins
126+
* directory (e.g. 'my-plugin/my-plugin.php' or 'hello.php').
127127
* @type callable $is_active Optional callback to determine whether the plugin
128-
* is active. Receives no arguments and must return bool.
128+
* is active. Receives no arguments and must return bool.
129129
* }
130130
* }
131131
* }
@@ -710,11 +710,7 @@ function _wp_connectors_get_connector_script_module_data( array $data ): array {
710710
$is_activated = is_plugin_active( $file );
711711
}
712712

713-
if ( $is_activated ) {
714-
$is_installed = true;
715-
} else {
716-
$is_installed = file_exists( WP_PLUGIN_DIR . '/' . $file );
717-
}
713+
$is_installed = $is_activated || file_exists( WP_PLUGIN_DIR . '/' . $file );
718714

719715
$connector_out['plugin'] = array(
720716
'file' => $file,

0 commit comments

Comments
 (0)