PluginProbe
Cool Flipbox – Shortcode & Gutenberg Block / 1.4
Cool Flipbox – Shortcode & Gutenberg Block v1.4
trunk 1.4 1.5 1.6 1.6.2 1.7.1 1.8.3 1.9.0 1.9.1 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1
flip-boxes / CMB2 / init.php

init.php in Cool Flipbox – Shortcode & Gutenberg Block 1.4, at CMB2/init.php

140 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! class_exists( 'CMB2_Bootstrap_242_Trunk', false ) ) {
3
4 /**
5 * Handles checking for and loading the newest version of CMB2
6 *
7 * @since 2.0.0
8 *
9 * @category WordPress_Plugin
10 * @package CMB2
11 * @author CMB2 team
12 * @license GPL-2.0+
13 * @link https://cmb2.io
14 */
15 class CMB2_Bootstrap_242_Trunk {
16
17 /**
18 * Current version number
19 *
20 * @var string
21 * @since 1.0.0
22 */
23 const VERSION = '2.4.2';
24
25 /**
26 * Current version hook priority.
27 * Will decrement with each release
28 *
29 * @var int
30 * @since 2.0.0
31 */
32 const PRIORITY = 9966;
33
34 /**
35 * Single instance of the CMB2_Bootstrap_242_Trunk object
36 *
37 * @var CMB2_Bootstrap_242_Trunk
38 */
39 public static $single_instance = null;
40
41 /**
42 * Creates/returns the single instance CMB2_Bootstrap_242_Trunk object
43 *
44 * @since 2.0.0
45 * @return CMB2_Bootstrap_242_Trunk Single instance object
46 */
47 public static function initiate() {
48 if ( null === self::$single_instance ) {
49 self::$single_instance = new self();
50 }
51 return self::$single_instance;
52 }
53
54 /**
55 * Starts the version checking process.
56 * Creates CMB2_LOADED definition for early detection by other scripts
57 *
58 * Hooks CMB2 inclusion to the init hook on a high priority which decrements
59 * (increasing the priority) with each version release.
60 *
61 * @since 2.0.0
62 */
63 private function __construct() {
64 /**
65 * A constant you can use to check if CMB2 is loaded
66 * for your plugins/themes with CMB2 dependency
67 */
68 if ( ! defined( 'CMB2_LOADED' ) ) {
69 define( 'CMB2_LOADED', self::PRIORITY );
70 }
71
72 add_action( 'init', array( $this, 'include_cmb' ), self::PRIORITY );
73 }
74
75 /**
76 * A final check if CMB2 exists before kicking off our CMB2 loading.
77 * CMB2_VERSION and CMB2_DIR constants are set at this point.
78 *
79 * @since 2.0.0
80 */
81 public function include_cmb() {
82 if ( class_exists( 'CMB2', false ) ) {
83 return;
84 }
85
86 if ( ! defined( 'CMB2_VERSION' ) ) {
87 define( 'CMB2_VERSION', self::VERSION );
88 }
89
90 if ( ! defined( 'CMB2_DIR' ) ) {
91 define( 'CMB2_DIR', trailingslashit( dirname( __FILE__ ) ) );
92 }
93
94 $this->l10ni18n();
95
96 // Include helper functions.
97 require_once CMB2_DIR . 'includes/CMB2_Base.php';
98 require_once CMB2_DIR . 'includes/CMB2.php';
99 require_once CMB2_DIR . 'includes/helper-functions.php';
100
101 // Now kick off the class autoloader.
102 spl_autoload_register( 'cmb2_autoload_classes' );
103
104 // Kick the whole thing off.
105 require_once( cmb2_dir( 'bootstrap.php' ) );
106 cmb2_bootstrap();
107 }
108
109 /**
110 * Registers CMB2 text domain path
111 *
112 * @since 2.0.0
113 */
114 public function l10ni18n() {
115
116 $loaded = load_plugin_textdomain( 'cmb2', false, '/languages/' );
117
118 if ( ! $loaded ) {
119 $loaded = load_muplugin_textdomain( 'cmb2', '/languages/' );
120 }
121
122 if ( ! $loaded ) {
123 $loaded = load_theme_textdomain( 'cmb2', get_stylesheet_directory() . '/languages/' );
124 }
125
126 if ( ! $loaded ) {
127 $locale = apply_filters( 'plugin_locale', get_locale(), 'cmb2' );
128 $mofile = dirname( __FILE__ ) . '/languages/cmb2-' . $locale . '.mo';
129 load_textdomain( 'cmb2', $mofile );
130 }
131
132 }
133
134 }
135
136 // Make it so...
137 CMB2_Bootstrap_242_Trunk::initiate();
138
139 }// End if().
140