| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package Polylang |
| 4 |
*/ |
| 5 |
|
| 6 |
/** |
| 7 |
* Container for 3rd party plugins ( and themes ) integrations. |
| 8 |
* This class is available as soon as the plugin is loaded. |
| 9 |
* |
| 10 |
* @since 1.0 |
| 11 |
* @since 2.8 Renamed from PLL_Plugins_Compat to PLL_Integrations. |
| 12 |
*/ |
| 13 |
#[AllowDynamicProperties] |
| 14 |
class PLL_Integrations { |
| 15 |
/** |
| 16 |
* Singleton instance. |
| 17 |
* |
| 18 |
* @var PLL_Integrations|null |
| 19 |
*/ |
| 20 |
protected static $instance = null; |
| 21 |
|
| 22 |
/** |
| 23 |
* Constructor. |
| 24 |
* |
| 25 |
* @since 1.0 |
| 26 |
*/ |
| 27 |
protected function __construct() {} |
| 28 |
|
| 29 |
/** |
| 30 |
* Returns the single instance of the class. |
| 31 |
* |
| 32 |
* @since 1.7 |
| 33 |
* |
| 34 |
* @return self |
| 35 |
*/ |
| 36 |
public static function instance(): self { |
| 37 |
if ( null === self::$instance ) { |
| 38 |
self::$instance = new self(); |
| 39 |
self::$instance->init(); |
| 40 |
} |
| 41 |
|
| 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 |
$load_scripts = require __DIR__ . '/integration-build.php'; |
| 54 |
|
| 55 |
foreach ( $load_scripts as $load_script ) { |
| 56 |
require_once __DIR__ . "/{$load_script}/load.php"; |
| 57 |
} |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
class_alias( 'PLL_Integrations', 'PLL_Plugins_Compat' ); // For Backward compatibility. |
| 62 |
|