| 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.9.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 |
if ( ! class_exists( 'CMB2_Bootstrap_290_Develop', false ) ) { |
| 57 |
|
| 58 |
/** |
| 59 |
* Handles checking for and loading the newest version of CMB2 |
| 60 |
* |
| 61 |
* @since 2.0.0 |
| 62 |
* |
| 63 |
* @category WordPress_Plugin |
| 64 |
* @package CMB2 |
| 65 |
* @author CMB2 team |
| 66 |
* @license GPL-2.0+ |
| 67 |
* @link https://cmb2.io |
| 68 |
*/ |
| 69 |
class CMB2_Bootstrap_290_Develop { |
| 70 |
|
| 71 |
/** |
| 72 |
* Current version number |
| 73 |
* |
| 74 |
* @var string |
| 75 |
* @since 1.0.0 |
| 76 |
*/ |
| 77 |
const VERSION = '2.9.0'; |
| 78 |
|
| 79 |
/** |
| 80 |
* Current version hook priority. |
| 81 |
* Will decrement with each release |
| 82 |
* |
| 83 |
* @var int |
| 84 |
* @since 2.0.0 |
| 85 |
*/ |
| 86 |
const PRIORITY = 10; |
| 87 |
|
| 88 |
/** |
| 89 |
* Single instance of the CMB2_Bootstrap_290_Develop object |
| 90 |
* |
| 91 |
* @var CMB2_Bootstrap_290_Develop |
| 92 |
*/ |
| 93 |
public static $single_instance = null; |
| 94 |
|
| 95 |
/** |
| 96 |
* Creates/returns the single instance CMB2_Bootstrap_290_Develop object |
| 97 |
* |
| 98 |
* @since 2.0.0 |
| 99 |
* @return CMB2_Bootstrap_290_Develop Single instance object |
| 100 |
*/ |
| 101 |
public static function initiate() { |
| 102 |
if ( null === self::$single_instance ) { |
| 103 |
self::$single_instance = new self(); |
| 104 |
} |
| 105 |
return self::$single_instance; |
| 106 |
} |
| 107 |
|
| 108 |
/** |
| 109 |
* Starts the version checking process. |
| 110 |
* Creates CMB2_LOADED definition for early detection by other scripts |
| 111 |
* |
| 112 |
* Hooks CMB2 inclusion to the init hook on a high priority which decrements |
| 113 |
* (increasing the priority) with each version release. |
| 114 |
* |
| 115 |
* @since 2.0.0 |
| 116 |
*/ |
| 117 |
private function __construct() { |
| 118 |
/** |
| 119 |
* A constant you can use to check if CMB2 is loaded |
| 120 |
* for your plugins/themes with CMB2 dependency |
| 121 |
*/ |
| 122 |
if ( ! defined( 'CMB2_LOADED' ) ) { |
| 123 |
define( 'CMB2_LOADED', self::PRIORITY ); |
| 124 |
} |
| 125 |
|
| 126 |
if ( ! function_exists( 'add_action' ) ) { |
| 127 |
// We are running outside of the context of WordPress. |
| 128 |
return; |
| 129 |
} |
| 130 |
|
| 131 |
add_action( 'init', array( $this, 'include_cmb' ), self::PRIORITY ); |
| 132 |
} |
| 133 |
|
| 134 |
/** |
| 135 |
* A final check if CMB2 exists before kicking off our CMB2 loading. |
| 136 |
* CMB2_VERSION and CMB2_DIR constants are set at this point. |
| 137 |
* |
| 138 |
* @since 2.0.0 |
| 139 |
*/ |
| 140 |
public function include_cmb() { |
| 141 |
if ( class_exists( 'CMB2', false ) ) { |
| 142 |
return; |
| 143 |
} |
| 144 |
|
| 145 |
if ( ! defined( 'CMB2_VERSION' ) ) { |
| 146 |
define( 'CMB2_VERSION', self::VERSION ); |
| 147 |
} |
| 148 |
|
| 149 |
if ( ! defined( 'CMB2_DIR' ) ) { |
| 150 |
define( 'CMB2_DIR', trailingslashit( dirname( __FILE__ ) ) ); |
| 151 |
} |
| 152 |
|
| 153 |
$this->l10ni18n(); |
| 154 |
|
| 155 |
// Include helper functions. |
| 156 |
require_once CMB2_DIR . 'includes/CMB2_Base.php'; |
| 157 |
require_once CMB2_DIR . 'includes/CMB2.php'; |
| 158 |
require_once CMB2_DIR . 'includes/helper-functions.php'; |
| 159 |
|
| 160 |
// Now kick off the class autoloader. |
| 161 |
spl_autoload_register( 'cmb2_autoload_classes' ); |
| 162 |
|
| 163 |
// Kick the whole thing off. |
| 164 |
require_once( cmb2_dir( 'bootstrap.php' ) ); |
| 165 |
cmb2_bootstrap(); |
| 166 |
} |
| 167 |
|
| 168 |
/** |
| 169 |
* Registers CMB2 text domain path |
| 170 |
* |
| 171 |
* @since 2.0.0 |
| 172 |
*/ |
| 173 |
public function l10ni18n() { |
| 174 |
|
| 175 |
$loaded = load_plugin_textdomain( 'cmb2', false, '/languages/' ); |
| 176 |
|
| 177 |
if ( ! $loaded ) { |
| 178 |
$loaded = load_muplugin_textdomain( 'cmb2', '/languages/' ); |
| 179 |
} |
| 180 |
|
| 181 |
if ( ! $loaded ) { |
| 182 |
$loaded = load_theme_textdomain( 'cmb2', get_stylesheet_directory() . '/languages/' ); |
| 183 |
} |
| 184 |
|
| 185 |
if ( ! $loaded ) { |
| 186 |
$locale = apply_filters( 'plugin_locale', function_exists( 'determine_locale' ) ? determine_locale() : get_locale(), 'cmb2' ); |
| 187 |
$mofile = dirname( __FILE__ ) . '/languages/cmb2-' . $locale . '.mo'; |
| 188 |
load_textdomain( 'cmb2', $mofile ); |
| 189 |
} |
| 190 |
|
| 191 |
} |
| 192 |
|
| 193 |
} |
| 194 |
|
| 195 |
// Make it so... |
| 196 |
CMB2_Bootstrap_290_Develop::initiate(); |
| 197 |
|
| 198 |
}// End if(). |
| 199 |
|