PluginProbe
Virtue/Ascend/Pinnacle Toolkit / 4.9.12.2
Virtue/Ascend/Pinnacle Toolkit v4.9.12.2
4.9.12.2 trunk 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2.0 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.7 All 48 releases
virtue-toolkit / cmb / init.php

init.php in Virtue/Ascend/Pinnacle Toolkit 4.9.12.2, at cmb/init.php

183 lines 4.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The initation loader for CMB2, and the main plugin file.
4 *
5 * @category WordPress_Plugin
6 * @package CMB2
7 * @author CMB2 team
8 * @license GPL-2.0+
9 * @link https://cmb2.io
10 *
11 *
12 *
13 * Released under the GPL license
14 * http://www.opensource.org/licenses/gpl-license.php
15 *
16 * This is an add-on for WordPress
17 * https://wordpress.org/
18 *
19 * **********************************************************************
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 2 of the License, or
23 * (at your option) any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 * **********************************************************************
30 */
31
32 /**
33 * *********************************************************************
34 * You should not edit the code below
35 * (or any code in the included files)
36 * or things might explode!
37 * ***********************************************************************
38 */
39
40 if ( ! class_exists( 'CMB2_Bootstrap_290', false ) ) {
41
42 /**
43 * Handles checking for and loading the newest version of CMB2
44 *
45 * @since 2.0.0
46 *
47 * @category WordPress_Plugin
48 * @package CMB2
49 * @author CMB2 team
50 * @license GPL-2.0+
51 * @link https://cmb2.io
52 */
53 class CMB2_Bootstrap_290 {
54
55 /**
56 * Current version number
57 *
58 * @var string
59 * @since 1.0.0
60 */
61 const VERSION = '2.9.0';
62
63 /**
64 * Current version hook priority.
65 * Will decrement with each release
66 *
67 * @var int
68 * @since 2.0.0
69 */
70 const PRIORITY = 9959;
71
72 /**
73 * Single instance of the CMB2_Bootstrap_290 object
74 *
75 * @var CMB2_Bootstrap_290
76 */
77 public static $single_instance = null;
78
79 /**
80 * Creates/returns the single instance CMB2_Bootstrap_290 object
81 *
82 * @since 2.0.0
83 * @return CMB2_Bootstrap_290 Single instance object
84 */
85 public static function initiate() {
86 if ( null === self::$single_instance ) {
87 self::$single_instance = new self();
88 }
89 return self::$single_instance;
90 }
91
92 /**
93 * Starts the version checking process.
94 * Creates CMB2_LOADED definition for early detection by other scripts
95 *
96 * Hooks CMB2 inclusion to the init hook on a high priority which decrements
97 * (increasing the priority) with each version release.
98 *
99 * @since 2.0.0
100 */
101 private function __construct() {
102 /**
103 * A constant you can use to check if CMB2 is loaded
104 * for your plugins/themes with CMB2 dependency
105 */
106 if ( ! defined( 'CMB2_LOADED' ) ) {
107 define( 'CMB2_LOADED', self::PRIORITY );
108 }
109
110 if ( ! function_exists( 'add_action' ) ) {
111 // We are running outside of the context of WordPress.
112 return;
113 }
114
115 add_action( 'init', array( $this, 'include_cmb' ), self::PRIORITY );
116 }
117
118 /**
119 * A final check if CMB2 exists before kicking off our CMB2 loading.
120 * CMB2_VERSION and CMB2_DIR constants are set at this point.
121 *
122 * @since 2.0.0
123 */
124 public function include_cmb() {
125 if ( class_exists( 'CMB2', false ) ) {
126 return;
127 }
128
129 if ( ! defined( 'CMB2_VERSION' ) ) {
130 define( 'CMB2_VERSION', self::VERSION );
131 }
132
133 if ( ! defined( 'CMB2_DIR' ) ) {
134 define( 'CMB2_DIR', trailingslashit( dirname( __FILE__ ) ) );
135 }
136
137 $this->l10ni18n();
138
139 // Include helper functions.
140 require_once CMB2_DIR . 'includes/CMB2_Base.php';
141 require_once CMB2_DIR . 'includes/CMB2.php';
142 require_once CMB2_DIR . 'includes/helper-functions.php';
143
144 // Now kick off the class autoloader.
145 spl_autoload_register( 'cmb2_autoload_classes' );
146
147 // Kick the whole thing off.
148 require_once( cmb2_dir( 'bootstrap.php' ) );
149 cmb2_bootstrap();
150 }
151
152 /**
153 * Registers CMB2 text domain path
154 *
155 * @since 2.0.0
156 */
157 public function l10ni18n() {
158
159 $loaded = load_plugin_textdomain( 'cmb2', false, '/languages/' );
160
161 if ( ! $loaded ) {
162 $loaded = load_muplugin_textdomain( 'cmb2', '/languages/' );
163 }
164
165 if ( ! $loaded ) {
166 $loaded = load_theme_textdomain( 'cmb2', get_stylesheet_directory() . '/languages/' );
167 }
168
169 if ( ! $loaded ) {
170 $locale = apply_filters( 'plugin_locale', function_exists( 'determine_locale' ) ? determine_locale() : get_locale(), 'cmb2' );
171 $mofile = dirname( __FILE__ ) . '/languages/cmb2-' . $locale . '.mo';
172 load_textdomain( 'cmb2', $mofile );
173 }
174
175 }
176
177 }
178
179 // Make it so...
180 CMB2_Bootstrap_290::initiate();
181
182 }// End if().
183