| 1 |
<?php |
| 2 |
/** |
| 3 |
* The file that defines the core plugin class |
| 4 |
* |
| 5 |
* A class definition that includes attributes and functions used across both the |
| 6 |
* public-facing side of the site and the admin area. |
| 7 |
* |
| 8 |
* @link http://rextheme.com/ |
| 9 |
* @since 8.0.0 |
| 10 |
* |
| 11 |
* @package Wpvr |
| 12 |
* @subpackage Wpvr/includes |
| 13 |
*/ |
| 14 |
|
| 15 |
namespace WPVR\Builder\DIVI; |
| 16 |
|
| 17 |
use WPVR\Builder\DIVI\Modules\WPVR_Modules; |
| 18 |
|
| 19 |
/** |
| 20 |
* Manages the singleton instance for DIVI modules integration and initialization. |
| 21 |
* |
| 22 |
* This class handles the setup and initialization of WPVR modules within the DIVI theme. |
| 23 |
* It ensures a single instance of this class is created (singleton pattern). |
| 24 |
* |
| 25 |
* @since 8.4.8 |
| 26 |
*/ |
| 27 |
class WPVR_Divi_modules { //phpcs:ignore |
| 28 |
|
| 29 |
/** |
| 30 |
* Holds the class instance. |
| 31 |
* |
| 32 |
* @var WPVR_Divi_modules|null The single instance of the class. |
| 33 |
*/ |
| 34 |
private static $_instance = null; //phpcs:ignore |
| 35 |
|
| 36 |
/** |
| 37 |
* Provides a single instance of this class. |
| 38 |
* |
| 39 |
* If the instance does not exist yet, it creates one and returns it. If it exists, it simply returns it. |
| 40 |
* This method ensures that WPVR_Divi_modules can only have one instance. |
| 41 |
* |
| 42 |
* @return WPVR_Divi_modules Returns the single instance of this class. |
| 43 |
*/ |
| 44 |
public static function instance() { |
| 45 |
if ( is_null( self::$_instance ) ) { |
| 46 |
self::$_instance = new self(); |
| 47 |
} |
| 48 |
return self::$_instance; |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* The class constructor. |
| 53 |
* |
| 54 |
* Private to prevent creating multiple instances directly. |
| 55 |
*/ |
| 56 |
private function __construct() { |
| 57 |
$this->init(); |
| 58 |
} |
| 59 |
|
| 60 |
/** |
| 61 |
* The class constructor. |
| 62 |
* |
| 63 |
* Private to prevent creating multiple instances directly. |
| 64 |
*/ |
| 65 |
private function init() { |
| 66 |
add_action( 'divi_extensions_init', array( $this, 'wpvr_initialize_extension' ) ); |
| 67 |
} |
| 68 |
|
| 69 |
/** |
| 70 |
* Initializes the DIVI module extension. |
| 71 |
* |
| 72 |
* Registers action hooks necessary for the extension setup, specifically |
| 73 |
* initializing the DIVI extension when appropriate. |
| 74 |
*/ |
| 75 |
public function wpvr_initialize_extension() { |
| 76 |
new WPVR_Modules(); |
| 77 |
} |
| 78 |
} |
| 79 |
|