PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 8.0.5
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v8.0.5
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 7.8.8 All 47 releases
← All changes | integrations/wplms/wplms.php +175 -0 7.9.0 → 8.0.5 View file →
@@ -1,0 +1,175 @@
1 +<?php
2 +/**
3 + * Plugin Name: GamiPress - WPLMS integration
4 + * Plugin URI: https://wordpress.org/plugins/gamipress-wplms-integration/
5 + * Description: Connect GamiPress with WPLMS.
6 + * Version: 1.0.7
7 + * Author: GamiPress
8 + * Author URI: https://gamipress.com/
9 + * Text Domain: gamipress-wplms-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\WPLMS
16 + * @author GamiPress
17 + * @copyright Copyright (c) GamiPress
18 + */
19 +
20 +final class GamiPress_Integration_WPLMS {
21 +
22 + /**
23 + * @var GamiPress_Integration_WPLMS $instance The one true GamiPress_Integration_WPLMS
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_WPLMS
34 + */
35 + public static function instance() {
36 +
37 + if( !self::$instance ) {
38 +
39 + self::$instance = new GamiPress_Integration_WPLMS();
40 + self::$instance->constants();
41 + self::$instance->includes();
42 + self::$instance->hooks();
43 +
44 +
45 + }
46 +
47 + return self::$instance;
48 +
49 + }
50 +
51 + /**
52 + * Setup plugin constants
53 + *
54 + * @access private
55 + * @since 1.0.0
56 + * @return void
57 + */
58 + private function constants() {
59 +
60 + // Plugin version
61 + define( 'GAMIPRESS_WPLMS_VER', '1.0.7' );
62 +
63 + // Plugin path
64 + define( 'GAMIPRESS_WPLMS_DIR', plugin_dir_path( __FILE__ ) );
65 +
66 + // Plugin URL
67 + define( 'GAMIPRESS_WPLMS_URL', plugin_dir_url( __FILE__ ) );
68 +
69 + }
70 +
71 + /**
72 + * Include plugin files
73 + *
74 + * @access private
75 + * @since 1.0.0
76 + * @return void
77 + */
78 + private function includes() {
79 +
80 + if( $this->meets_requirements() ) {
81 +
82 + require_once GAMIPRESS_WPLMS_DIR . 'includes/admin.php';
83 + require_once GAMIPRESS_WPLMS_DIR . 'includes/listeners.php';
84 + require_once GAMIPRESS_WPLMS_DIR . 'includes/requirements.php';
85 + require_once GAMIPRESS_WPLMS_DIR . 'includes/rules-engine.php';
86 + require_once GAMIPRESS_WPLMS_DIR . 'includes/scripts.php';
87 + require_once GAMIPRESS_WPLMS_DIR . 'includes/triggers.php';
88 +
89 + }
90 +
91 + }
92 +
93 + /**
94 + * Setup plugin hooks
95 + *
96 + * @access private
97 + * @since 1.0.0
98 + * @return void
99 + */
100 + private function hooks() {
101 +
102 + // Setup our activation and deactivation hooks
103 + register_activation_hook( __FILE__, array( $this, 'activate' ) );
104 + register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );
105 +
106 +
107 +
108 + }
109 +
110 + /**
111 + * Activation hook for the plugin.
112 + *
113 + * @since 1.0.0
114 + */
115 + function activate() {
116 +
117 + if( $this->meets_requirements() ) {
118 +
119 + }
120 +
121 + }
122 +
123 + /**
124 + * Deactivation hook for the plugin.
125 + *
126 + * @since 1.0.0
127 + */
128 + function deactivate() {
129 +
130 + }
131 +
132 + /**
133 + * Check if there are all plugin requirements
134 + *
135 + * @since 1.0.0
136 + *
137 + * @return bool True if installation meets all requirements
138 + */
139 + private function meets_requirements() {
140 +
141 + if ( ! class_exists( 'GamiPress' ) ) {
142 + return false;
143 + }
144 +
145 + // Requirements on multisite install
146 + if( is_multisite() && is_main_site() && function_exists('gamipress_is_network_wide_active') && gamipress_is_network_wide_active() ) {
147 + // On main site, need to check if integrated plugin is installed on any sub site to load all configuration files
148 + if( gamipress_is_plugin_active_on_network( 'wplms/wplms.php' ) || gamipress_is_plugin_active_on_network( 'wplms_plugin/loader.php' ) ) {
149 + return true;
150 + }
151 +
152 + }
153 +
154 + if ( ! ( class_exists( 'WPLMS_Init' ) || class_exists( 'WPLMS_4_Init' ) ) ) {
155 + return false;
156 + }
157 +
158 + return true;
159 +
160 + }
161 +
162 +}
163 +
164 +/**
165 + * The main function responsible for returning the one true GamiPress_Integration_WPLMS instance to functions everywhere
166 + *
167 + * @since 1.0.0
168 + * @return \GamiPress_Integration_WPLMS The one true GamiPress_Integration_WPLMS
169 + */
170 +function GamiPress_Integration_WPLMS() {
171 +
172 + return GamiPress_Integration_WPLMS::instance();
173 +
174 +}
175 +add_action( 'gamipress_pre_init', 'GamiPress_Integration_WPLMS' );