PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 7.9.8
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v7.9.8
8.0.4 8.0.3 8.0.1 8.0.2 8.0.0 7.9.9.7 7.9.9.6 7.9.9.5 7.9.9.4 7.9.9.3 7.9.9.2 7.9.9.1 7.9.9 7.9.8 7.9.7 7.9.6 7.9.5 7.9.4 7.9.3 7.9.2 7.9.1 7.9.0 7.8.9 7.8.8 7.8.7 All 46 releases
gamipress / libraries / ct / init.php

init.php in GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI 7.9.8, at libraries/ct/init.php

145 lines 4.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Custom Tables Loader
4 *
5 * Handles checking for and smartly loading the newest version of this library.
6 *
7 * @category WordPressLibrary
8 * @package Custom_Tables\Loader
9 * @author GamiPress <[email protected]>, Ruben Garcia <[email protected]>
10 * @copyright GamiPress <[email protected]>, Ruben Garcia <[email protected]>
11 * @credits Justin Sternberg (https://jtsternberg.com), Jhon James Jacob (https://jjj.blog)
12 * @license GPL-2.0+
13 * @version 1.1.1
14 * @link https://gamipress.com
15 */
16
17 /*
18 * Copyright (c) GamiPress ([email protected]), Ruben Garcia ([email protected])
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, version 2 or, at
22 * your discretion, any later version, as published by the Free
23 * Software Foundation.
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 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
33 */
34
35 /**
36 * Loader versioning: http://jtsternberg.github.io/wp-lib-loader/
37 */
38 if ( ! class_exists( 'CT_Loader_111', false ) ) {
39
40 class CT_Loader_111 {
41
42 /**
43 * CT_Loader version number
44 * @var string
45 * @since 1.0.0
46 */
47 const VERSION = '1.1.1';
48
49 /**
50 * Setup constants
51 *
52 * @since 1.0.0
53 */
54 private function constants() {
55
56 // Version
57 define( 'CT_VER', self::VERSION );
58
59 // File
60 define( 'CT_FILE', __FILE__ );
61
62 // Path
63 define( 'CT_DIR', plugin_dir_path( __FILE__ ) );
64
65 // URL
66 define( 'CT_URL', plugin_dir_url( __FILE__ ) );
67
68 // Debug
69 define( 'CT_DEBUG', false );
70
71 }
72
73 /**
74 * Starts the version checking process.
75 * Creates CT_LOADED definition for early detection by other scripts.
76 *
77 * Hooks CT_Loader inclusion to the ct_loader_load hook
78 * on a high priority which decrements (increasing the priority) with
79 * each version release.
80 *
81 * @since 1.0.0
82 */
83 public function __construct() {
84
85 $priority = 99999 - absint( str_replace( '.', '', self::VERSION ) );
86
87 if ( ! defined( 'CT_LOADER_PRIORITY' ) ) {
88 // Calculate priority converting version into a number (eg: 1.0.0 to 100)
89 define( 'CT_LOADER_PRIORITY', $priority );
90 }
91
92
93 if ( ! defined( 'CT_LOADED' ) ) {
94 // A constant you can use to check if Custom Tables (CT) is loaded for your plugins/themes with CT dependency.
95 // Can also be used to determine the priority of the hook in use for the currently loaded version.
96 define( 'CT_LOADED', $priority );
97 }
98
99 // Use the hook system to ensure only the newest version is loaded.
100 add_action( 'ct_loader_load', array( $this, 'include_lib' ), $priority );
101
102 // Try to fire our hook as soon as possible,including right now (required for activation hooks).
103 self::fire_hook();
104
105 // Hook in to the first hook we have available and fire our `ct_loader_load' hook.
106 add_action( 'muplugins_loaded', array( __CLASS__, 'fire_hook' ), 9 );
107 add_action( 'plugins_loaded', array( __CLASS__, 'fire_hook' ), 9 );
108 add_action( 'after_setup_theme', array( __CLASS__, 'fire_hook' ), 9 );
109 }
110
111 /**
112 * Fires the ct_loader_load action hook.
113 *
114 * @since 1.0.0
115 */
116 public static function fire_hook() {
117 if ( ! did_action( 'ct_loader_load' ) ) {
118 // Then fire our hook.
119 do_action( 'ct_loader_load' );
120 }
121 }
122
123 /**
124 * A final check if CT_Loader exists before kicking off
125 * our CT_Loader loading.
126 *
127 * @since 1.0.0
128 */
129 public function include_lib() {
130 if ( class_exists( 'CT', false ) ) {
131 return;
132 }
133
134 $this->constants();
135
136 // Include and initiate Custom Tables (CT) class.
137 require_once CT_DIR . 'includes/class-ct.php';
138 }
139
140 }
141
142 // Kick it off.
143 new CT_Loader_111;
144 }
145