Completed
Push — trunk ( 16f377...0795f4 )
by Justin
25:11 queued 10:17
created

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 66 and the first side effect is on line 188.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * @category     WordPress_Plugin
4
 * @package      CMB2
5
 * @author       WebDevStudios
6
 * @license      GPL-2.0+
7
 * @link         http://webdevstudios.com
8
 *
9
 * Plugin Name:  CMB2
10
 * Plugin URI:   https://github.com/WebDevStudios/CMB2
11
 * Description:  CMB2 will create metaboxes and forms with custom fields that will blow your mind.
12
 * Author:       WebDevStudios
13
 * Author URI:   http://webdevstudios.com
14
 * Contributors: WebDevStudios (@webdevstudios / webdevstudios.com)
15
 *               Justin Sternberg (@jtsternberg / dsgnwrks.pro)
16
 *               Jared Atchison (@jaredatch / jaredatchison.com)
17
 *               Bill Erickson (@billerickson / billerickson.net)
18
 *               Andrew Norcross (@norcross / andrewnorcross.com)
19
 *
20
 * Version:      2.2.4
21
 *
22
 * Text Domain:  cmb2
23
 * Domain Path:  languages
24
 *
25
 *
26
 * Released under the GPL license
27
 * http://www.opensource.org/licenses/gpl-license.php
28
 *
29
 * This is an add-on for WordPress
30
 * http://wordpress.org/
31
 *
32
 * **********************************************************************
33
 * This program is free software; you can redistribute it and/or modify
34
 * it under the terms of the GNU General Public License as published by
35
 * the Free Software Foundation; either version 2 of the License, or
36
 * (at your option) any later version.
37
 *
38
 * This program is distributed in the hope that it will be useful,
39
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
40
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
41
 * GNU General Public License for more details.
42
 * **********************************************************************
43
 */
44
45
/**
46
 * *********************************************************************
47
 *               You should not edit the code below
48
 *               (or any code in the included files)
49
 *               or things might explode!
50
 * ***********************************************************************
51
 */
52
53
if ( ! class_exists( 'CMB2_Bootstrap_225_Trunk', false ) ) {
54
55
	/**
56
	 * Handles checking for and loading the newest version of CMB2
57
	 *
58
	 * @since  2.0.0
59
	 *
60
	 * @category  WordPress_Plugin
61
	 * @package   CMB2
62
	 * @author    WebDevStudios
63
	 * @license   GPL-2.0+
64
	 * @link      http://webdevstudios.com
65
	 */
66
	class CMB2_Bootstrap_225_Trunk {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

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