PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 8.0.2
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v8.0.2
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 7.8.6 7.8.5 All 44 releases
gamipress / integrations / gravity-kit / gravity-kit.php

gravity-kit.php in GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI 8.0.2, at integrations/gravity-kit/gravity-kit.php

162 lines 4.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: GamiPress - Gravity Kit integration
4 * Plugin URI: https://wordpress.org/plugins/gamipress-gravity-kit-integration/
5 * Description: Connect GamiPress with Gravity Kit.
6 * Version: 1.0.0
7 * Author: GamiPress
8 * Author URI: https://gamipress.com/
9 * Text Domain: gamipress-gravity-kit-integration
10 * Domain Path: /languages/
11 * Requires at least: 4.4
12 * Tested up to: 6.2
13 * License: GNU AGPL v3.0 (http://www.gnu.org/licenses/agpl.txt)
14 *
15 * @package GamiPress\Gravity_Kit
16 * @author GamiPress
17 * @copyright Copyright (c) GamiPress
18 */
19
20 final class GamiPress_Integration_Gravity_Kit {
21
22 /**
23 * @var GamiPress_Integration_Gravity_Kit $instance The one true GamiPress_Integration_Gravity_Kit
24 * @since 1.0.0
25 */
26 private static $instance;
27
28 /**
29 * Get active instance
30 *
31 * @access public
32 * @since 1.0.0
33 * @return GamiPress_Integration_Gravity_Kit self::$instance The one true GamiPress_Integration_Gravity_Kit
34 */
35 public static function instance() {
36 if( !self::$instance ) {
37 self::$instance = new GamiPress_Integration_Gravity_Kit();
38 self::$instance->constants();
39 self::$instance->includes();
40 self::$instance->hooks();
41 }
42
43 return self::$instance;
44 }
45
46 /**
47 * Setup plugin constants
48 *
49 * @access private
50 * @since 1.0.0
51 * @return void
52 */
53 private function constants() {
54 // Plugin version
55 define( 'GAMIPRESS_GRAVITY_KIT_VER', '1.0.0' );
56
57 // Plugin path
58 define( 'GAMIPRESS_GRAVITY_KIT_DIR', plugin_dir_path( __FILE__ ) );
59
60 // Plugin URL
61 define( 'GAMIPRESS_GRAVITY_KIT_URL', plugin_dir_url( __FILE__ ) );
62 }
63
64 /**
65 * Include plugin files
66 *
67 * @access private
68 * @since 1.0.0
69 * @return void
70 */
71 private function includes() {
72
73 if( $this->meets_requirements() ) {
74
75 require_once GAMIPRESS_GRAVITY_KIT_DIR . 'includes/admin.php';
76 require_once GAMIPRESS_GRAVITY_KIT_DIR . 'includes/functions.php';
77 require_once GAMIPRESS_GRAVITY_KIT_DIR . 'includes/listeners.php';
78 require_once GAMIPRESS_GRAVITY_KIT_DIR . 'includes/triggers.php';
79
80 }
81 }
82
83 /**
84 * Setup plugin hooks
85 *
86 * @access private
87 * @since 1.0.0
88 * @return void
89 */
90 private function hooks() {
91 // Setup our activation and deactivation hooks
92 register_activation_hook( __FILE__, array( $this, 'activate' ) );
93 register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );
94
95 }
96
97 /**
98 * Activation hook for the plugin.
99 *
100 * @since 1.0.0
101 */
102 function activate() {
103
104 if( $this->meets_requirements() ) {
105
106 }
107
108 }
109
110 /**
111 * Deactivation hook for the plugin.
112 *
113 * @since 1.0.0
114 */
115 function deactivate() {
116
117 }
118
119 /**
120 * Check if there are all plugin requirements
121 *
122 * @since 1.0.0
123 *
124 * @return bool True if installation meets all requirements
125 */
126 private function meets_requirements() {
127
128 if ( ! class_exists( 'GamiPress' ) ) {
129 return false;
130 }
131
132 // Requirements on multisite install
133 if( is_multisite() && gamipress_is_network_wide_active() && is_main_site() ) {
134
135 // On main site, need to check if integrated plugin is installed on any sub site to load all configuration files
136 if( gamipress_is_plugin_active_on_network( 'gravityview/gravityview.php' ) ) {
137 return true;
138 }
139
140 }
141
142 if ( ! class_exists( 'GravityView_Plugin' ) ) {
143 return false;
144 }
145
146 return true;
147
148 }
149
150 }
151
152 /**
153 * The main function responsible for returning the one true GamiPress_Integration_Gravity_Kit instance to functions everywhere
154 *
155 * @since 1.0.0
156 * @return \GamiPress_Integration_Gravity_Kit The one true GamiPress_Integration_Gravity_Kit
157 */
158 function GamiPress_Integration_Gravity_Kit() {
159 return GamiPress_Integration_Gravity_Kit::instance();
160 }
161 add_action( 'gamipress_pre_init', 'GamiPress_Integration_Gravity_Kit' );
162