PluginProbe
Polylang / 3.7.7
Polylang v3.7.7
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
← All changes | integrations/integrations.php +23 -12 2.83.7.7 View file →
@@ -9,15 +9,16 @@
9 9 *
10 10 * @since 1.0
11 11 * @since 2.8 Renamed from PLL_Plugins_Compat to PLL_Integrations.
12 12 */
13 +#[AllowDynamicProperties]
13 14 class PLL_Integrations {
14 15 /**
15 16 * Singleton instance.
16 17 *
17 - * @var PLL_Integrations
18 + * @var PLL_Integrations|null
18 19 */
19 - protected static $instance;
20 + protected static $instance = null;
20 21
21 22 /**
22 23 * Constructor.
23 24 *
@@ -22,28 +23,38 @@
22 23 * Constructor.
23 24 *
24 25 * @since 1.0
25 26 */
26 - protected function __construct() {
27 - // Loads external integrations.
28 - foreach ( glob( __DIR__ . '/*/load.php', GLOB_NOSORT ) as $load_script ) { // phpcs:ignore WordPressVIPMinimum.Variables.VariableAnalysis.UnusedVariable
29 - require_once $load_script; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingVariable
30 - }
31 - }
27 + protected function __construct() {}
32 28
33 29 /**
34 - * Access to the single instance of the class.
30 + * Returns the single instance of the class.
35 31 *
36 32 * @since 1.7
37 33 *
38 - * @return object
34 + * @return self
39 35 */
40 - public static function instance() {
41 - if ( empty( self::$instance ) ) {
36 + public static function instance(): self {
37 + if ( null === self::$instance ) {
42 38 self::$instance = new self();
39 + self::$instance->init();
43 40 }
44 41
45 42 return self::$instance;
43 + }
44 +
45 + /**
46 + * Requires integrations.
47 + *
48 + * @since 3.7
49 + *
50 + * @return void
51 + */
52 + protected function init(): void {
53 + // Loads external integrations.
54 + foreach ( glob( __DIR__ . '/*/load.php', GLOB_NOSORT ) as $load_script ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
55 + require_once $load_script; // phpcs:ignore WordPressVIPMinimum.Files.IncludingFile.UsingVariable
56 + }
46 57 }
47 58 }
48 59
49 60 class_alias( 'PLL_Integrations', 'PLL_Plugins_Compat' ); // For Backward compatibility.