PluginProbe
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI / 6.0.2
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI v6.0.2
6.0.2 6.0.1 6.0.0 5.8.6 5.8.5 5.8.4 5.8.3 5.8.2 5.8.1 5.8.0 5.7.9.2 5.7.9.1 5.7.8 5.7.9 5.7.6 5.7.7 5.7.5 5.7.4 5.7.3 5.7.2 5.7.1 trunk 5.6.0 5.6.1 5.6.2 All 33 releases
automatorwp / libraries / cmb2 / init.php

init.php in AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI 6.0.2, at libraries/cmb2/init.php

201 lines 5.5 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 * Plugin Name: CMB2
12 * Plugin URI: https://github.com/CMB2/CMB2
13 * Description: CMB2 will create metaboxes and forms with custom fields that will blow your mind.
14 * Author: CMB2 team
15 * Author URI: https://cmb2.io
16 * Contributors: Justin Sternberg (@jtsternberg / dsgnwrks.pro)
17 * WebDevStudios (@webdevstudios / webdevstudios.com)
18 * Human Made (@humanmadeltd / hmn.md)
19 * Jared Atchison (@jaredatch / jaredatchison.com)
20 * Bill Erickson (@billerickson / billerickson.net)
21 * Andrew Norcross (@norcross / andrewnorcross.com)
22 *
23 * Version: 2.12.0
24 *
25 * Text Domain: cmb2
26 * Domain Path: languages
27 *
28 *
29 * Released under the GPL license
30 * http://www.opensource.org/licenses/gpl-license.php
31 *
32 * This is an add-on for WordPress
33 * https://wordpress.org/
34 *
35 * **********************************************************************
36 * This program is free software; you can redistribute it and/or modify
37 * it under the terms of the GNU General Public License as published by
38 * the Free Software Foundation; either version 2 of the License, or
39 * (at your option) any later version.
40 *
41 * This program is distributed in the hope that it will be useful,
42 * but WITHOUT ANY WARRANTY; without even the implied warranty of
43 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
44 * GNU General Public License for more details.
45 * **********************************************************************
46 */
47
48 /**
49 * *********************************************************************
50 * You should not edit the code below
51 * (or any code in the included files)
52 * or things might explode!
53 * ***********************************************************************
54 */
55
56 // Exit if accessed directly
57 if( !defined( 'ABSPATH' ) ) exit;
58
59 if ( ! class_exists( 'CMB2_Bootstrap_2120', false ) ) {
60
61 /**
62 * Handles checking for and loading the newest version of CMB2
63 *
64 * @since 2.0.0
65 *
66 * @category WordPress_Plugin
67 * @package CMB2
68 * @author CMB2 team
69 * @license GPL-2.0+
70 * @link https://cmb2.io
71 */
72 class CMB2_Bootstrap_2120 {
73
74 /**
75 * Current version number
76 *
77 * @var string
78 * @since 1.0.0
79 */
80 const VERSION = '2.12.0';
81
82 /**
83 * Current version hook priority.
84 * Will decrement with each release
85 *
86 * @var int
87 * @since 2.0.0
88 */
89 const PRIORITY = 9956;
90
91 /**
92 * Single instance of the CMB2_Bootstrap_2120 object
93 *
94 * @var CMB2_Bootstrap_2120
95 */
96 public static $single_instance = null;
97
98 /**
99 * Creates/returns the single instance CMB2_Bootstrap_2120 object
100 *
101 * @since 2.0.0
102 * @return CMB2_Bootstrap_2120 Single instance object
103 */
104 public static function initiate() {
105 if ( null === self::$single_instance ) {
106 self::$single_instance = new self();
107 }
108 return self::$single_instance;
109 }
110
111 /**
112 * Starts the version checking process.
113 * Creates CMB2_LOADED definition for early detection by other scripts
114 *
115 * Hooks CMB2 inclusion to the init hook on a high priority which decrements
116 * (increasing the priority) with each version release.
117 *
118 * @since 2.0.0
119 */
120 private function __construct() {
121 /**
122 * A constant you can use to check if CMB2 is loaded
123 * for your plugins/themes with CMB2 dependency
124 */
125 if ( ! defined( 'CMB2_LOADED' ) ) {
126 define( 'CMB2_LOADED', self::PRIORITY );
127 }
128
129 if ( ! function_exists( 'add_action' ) ) {
130 // We are running outside of the context of WordPress.
131 return;
132 }
133
134 add_action( 'init', array( $this, 'include_cmb' ), self::PRIORITY );
135 }
136
137 /**
138 * A final check if CMB2 exists before kicking off our CMB2 loading.
139 * CMB2_VERSION and CMB2_DIR constants are set at this point.
140 *
141 * @since 2.0.0
142 */
143 public function include_cmb() {
144 if ( class_exists( 'CMB2', false ) ) {
145 return;
146 }
147
148 if ( ! defined( 'CMB2_VERSION' ) ) {
149 define( 'CMB2_VERSION', self::VERSION );
150 }
151
152 if ( ! defined( 'CMB2_DIR' ) ) {
153 define( 'CMB2_DIR', trailingslashit( __DIR__ ) );
154 }
155
156 $this->l10ni18n();
157
158 // Include helper functions.
159 require_once CMB2_DIR . 'includes/CMB2_Base.php';
160 require_once CMB2_DIR . 'includes/CMB2.php';
161 require_once CMB2_DIR . 'includes/helper-functions.php';
162
163 // Now kick off the class autoloader.
164 spl_autoload_register( 'cmb2_autoload_classes' );
165
166 // Kick the whole thing off.
167 require_once cmb2_dir( 'bootstrap.php' );
168 cmb2_bootstrap();
169 }
170
171 /**
172 * Registers CMB2 text domain path
173 *
174 * @since 2.0.0
175 */
176 public function l10ni18n() {
177
178 $loaded = load_plugin_textdomain( 'cmb2', false, '/languages/' );
179
180 if ( ! $loaded ) {
181 $loaded = load_muplugin_textdomain( 'cmb2', '/languages/' );
182 }
183
184 if ( ! $loaded ) {
185 $loaded = load_theme_textdomain( 'cmb2', get_stylesheet_directory() . '/languages/' );
186 }
187
188 if ( ! $loaded ) {
189 $locale = apply_filters( 'plugin_locale', function_exists( 'determine_locale' ) ? determine_locale() : get_locale(), 'cmb2' );
190 $mofile = __DIR__ . '/languages/cmb2-' . $locale . '.mo';
191 load_textdomain( 'cmb2', $mofile );
192 }
193 }
194
195 }
196
197 // Make it so...
198 CMB2_Bootstrap_2120::initiate();
199
200 }// End if().
201