PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-beta
Jetpack – WP Security, Backup, Speed, & Growth v16.3-beta
16.3-beta 16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 All 507 releases
jetpack / jetpack_vendor / automattic / jetpack-videopress / src / class-divi.php

class-divi.php in Jetpack – WP Security, Backup, Speed, & Growth 16.3-beta, at jetpack_vendor/automattic/jetpack-videopress/src/class-divi.php

96 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Divi integration for Videopress.
4 *
5 * @package automattic/jetpack-videopress
6 **/
7
8 namespace Automattic\Jetpack\VideoPress;
9
10 use Automattic\Jetpack\VideoPress\Divi5\Divi_5;
11
12 /**
13 * Class Divi
14 **/
15 class Divi {
16 /**
17 * The instance.
18 *
19 * @var Divi
20 **/
21 private static $instance = null;
22
23 /**
24 * Running or not.
25 *
26 * @var bool
27 **/
28 private $running = false;
29
30 /**
31 * VideoPress Divi Extension object.
32 *
33 * @var ?\VideoPress_Divi_Extension
34 **/
35 private $vidi_extension;
36
37 /**
38 * Initializes VideoPress/Divi integration.
39 *
40 * Called only once by the Initializer class
41 *
42 * @return self
43 */
44 public static function init() {
45 return self::get_instance()->run();
46 }
47
48 /**
49 * Get the instance.
50 *
51 * @return self
52 */
53 public static function get_instance() {
54 if ( null === self::$instance ) {
55 self::$instance = new self();
56 }
57 return self::$instance;
58 }
59
60 /**
61 * Run the extension.
62 *
63 * @return self
64 */
65 public function run() {
66 if ( $this->running ) {
67 return $this;
68 }
69
70 $this->running = true;
71 add_action( 'divi_extensions_init', array( $this, 'initialize_extension' ) );
72 add_action( 'et_fb_framework_loaded', array( $this, 'on_fb_framework_loaded' ) );
73
74 // Divi 5 integration. These hooks only fire under Divi 5; the legacy
75 // extension above continues to serve Divi 4.
76 Divi_5::init();
77
78 return $this;
79 }
80
81 /**
82 * Fires when the Frontend Builder is loaded.
83 */
84 public function on_fb_framework_loaded() {
85 Jwt_Token_Bridge::enqueue_jwt_token_bridge();
86 }
87
88 /**
89 * Creates the extension's main class instance.
90 */
91 public function initialize_extension() {
92 require_once plugin_dir_path( __FILE__ ) . 'videopress-divi/class-videopress-divi-extension.php';
93 $this->vidi_extension = new \VideoPress_Divi_Extension();
94 }
95 }
96