PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 8.0.6
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v8.0.6
8.0.6 8.0.5 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 All 48 releases
gamipress / integrations / asgaros-forum / asgaros-forum.php

asgaros-forum.php in GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI 8.0.6, at integrations/asgaros-forum/asgaros-forum.php

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