| 1 |
<?php |
| 2 |
/** |
| 3 |
* WPVR Bricks Widget |
| 4 |
* |
| 5 |
* @package WPVR |
| 6 |
* @since 8.5.19 |
| 7 |
*/ |
| 8 |
namespace WpvrElement; |
| 9 |
|
| 10 |
use WpvrElement\Elements\Wpvr\Wpvr_Widget; |
| 11 |
|
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) exit; |
| 14 |
/** |
| 15 |
* Class Manager |
| 16 |
* |
| 17 |
* @package WpvrElement\Elements\Wpvr\Wpvr_Widget |
| 18 |
* @since 8.5.19 |
| 19 |
*/ |
| 20 |
class Manager { |
| 21 |
|
| 22 |
|
| 23 |
/** |
| 24 |
* Instance of the class |
| 25 |
* |
| 26 |
* @access private |
| 27 |
* @static |
| 28 |
* |
| 29 |
* @var Manager The single instance of the class. |
| 30 |
* @since 8.5.19 |
| 31 |
*/ |
| 32 |
private static $instance = null; |
| 33 |
|
| 34 |
/** |
| 35 |
* Instance |
| 36 |
* |
| 37 |
* Ensures only one instance of the class is loaded or can be loaded. |
| 38 |
* |
| 39 |
* @return Manager An instance of the class. |
| 40 |
* @since 8.5.19 |
| 41 |
* |
| 42 |
* @access public |
| 43 |
* @static |
| 44 |
*/ |
| 45 |
public static function instance() { |
| 46 |
if (is_null(self::$instance)) { |
| 47 |
self::$instance = new self(); |
| 48 |
} |
| 49 |
return self::$instance; |
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* Constructor for the class |
| 54 |
* |
| 55 |
* @since 8.5.19 |
| 56 |
* |
| 57 |
* @access public |
| 58 |
*/ |
| 59 |
public function __construct() { |
| 60 |
add_action('init', array($this, 'init')); |
| 61 |
} |
| 62 |
|
| 63 |
|
| 64 |
/** |
| 65 |
* Register checkout elements for bricks |
| 66 |
* |
| 67 |
* @since 8.5.19 |
| 68 |
* |
| 69 |
* @access public |
| 70 |
*/ |
| 71 |
public function init() { |
| 72 |
$element_files = [ |
| 73 |
WPVR_PLUGIN_DIR_PATH. 'bricks/Wpvr-widget.php' |
| 74 |
]; |
| 75 |
foreach ( $element_files as $file ) { |
| 76 |
\Bricks\Elements::register_element( $file, '', 'WpvrElement\Bricks\Wpvr\WpvrWidget' ); |
| 77 |
} |
| 78 |
} |
| 79 |
|
| 80 |
} |
| 81 |
|
| 82 |
Manager::instance(); |