• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wp-graphql / wp-graphql / 18762476176

23 Oct 2025 09:26PM UTC coverage: 84.639% (+0.06%) from 84.584%
18762476176

push

github

actions-user
chore: update changeset for PR #3429

15924 of 18814 relevant lines covered (84.64%)

261.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

90.0
/src/Data/Loader/PluginLoader.php
1
<?php
2

3
namespace WPGraphQL\Data\Loader;
4

5
use WPGraphQL\Model\Plugin;
6

7
/**
8
 * Class PluginLoader
9
 *
10
 * @package WPGraphQL\Data\Loader
11
 */
12
class PluginLoader extends AbstractDataLoader {
13

14
        /**
15
         * {@inheritDoc}
16
         *
17
         * @param array<string,mixed> $entry The plugin data
18
         *
19
         * @return \WPGraphQL\Model\Plugin
20
         * @throws \Exception
21
         */
22
        protected function get_model( $entry, $key ) {
7✔
23
                return new Plugin( $entry );
7✔
24
        }
25

26
        /**
27
         * {@inheritDoc}
28
         *
29
         * @param string[] $keys Array of plugin names to load
30
         *
31
         * @return array<string,array<string,mixed>|null>
32
         * @throws \Exception
33
         */
34
        public function loadKeys( array $keys ) {
8✔
35
                if ( empty( $keys ) ) {
8✔
36
                        return $keys;
×
37
                }
38

39
                if ( ! function_exists( 'get_plugins' ) ) {
8✔
40
                        require_once ABSPATH . 'wp-admin/includes/plugin.php';
×
41
                }
42

43
                // This is missing must use and drop in plugins, so we need to fetch and merge them separately.
44
                $site_plugins   = apply_filters( 'all_plugins', get_plugins() );
8✔
45
                $mu_plugins     = apply_filters( 'show_advanced_plugins', true, 'mustuse' ) ? get_mu_plugins() : [];
8✔
46
                $dropin_plugins = apply_filters( 'show_advanced_plugins', true, 'dropins' ) ? get_dropins() : [];
8✔
47

48
                $plugins = array_merge( $site_plugins, $mu_plugins, $dropin_plugins );
8✔
49

50
                $loaded = [];
8✔
51
                if ( ! empty( $plugins ) ) {
8✔
52
                        foreach ( $keys as $key ) {
8✔
53
                                if ( isset( $plugins[ $key ] ) ) {
8✔
54
                                        $plugin         = $plugins[ $key ];
7✔
55
                                        $plugin['Path'] = $key;
7✔
56
                                        $loaded[ $key ] = $plugin;
7✔
57
                                } else {
58
                                        $loaded[ $key ] = null;
1✔
59
                                }
60
                        }
61
                }
62

63
                return $loaded;
8✔
64
        }
65
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc