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 / learndash / learndash.php

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

164 lines 4.6 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 - LearnDash integration
4 * Plugin URI: https://wordpress.org/plugins/gamipress-learndash-integration/
5 * Description: Connect GamiPress with LearnDash.
6 * Version: 1.3.6
7 * Author: GamiPress
8 * Author URI: https://gamipress.com/
9 * Text Domain: gamipress-learndash-integration
10 * Domain Path: /languages/
11 * Requires at least: 4.4
12 * Tested up to: 6.4
13 * License: GNU AGPL v3.0 (http://www.gnu.org/licenses/agpl.txt)
14 *
15 * @package GamiPress\LearnDash
16 * @author GamiPress
17 * @copyright Copyright (c) GamiPress
18 */
19
20 final class GamiPress_Integration_LearnDash {
21
22 /**
23 * @var GamiPress_Integration_LearnDash $instance The one true GamiPress_Integration_LearnDash
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_LearnDash self::$instance The one true GamiPress_Integration_LearnDash
34 */
35 public static function instance() {
36
37 if( !self::$instance ) {
38 self::$instance = new GamiPress_Integration_LearnDash();
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_LD_VER', '1.3.6' );
58
59 // Plugin path
60 define( 'GAMIPRESS_LD_DIR', plugin_dir_path( __FILE__ ) );
61
62 // Plugin URL
63 define( 'GAMIPRESS_LD_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_LD_DIR . 'includes/admin.php';
78 require_once GAMIPRESS_LD_DIR . 'includes/functions.php';
79 require_once GAMIPRESS_LD_DIR . 'includes/listeners.php';
80 require_once GAMIPRESS_LD_DIR . 'includes/requirements.php';
81 require_once GAMIPRESS_LD_DIR . 'includes/rules-engine.php';
82 require_once GAMIPRESS_LD_DIR . 'includes/scripts.php';
83 require_once GAMIPRESS_LD_DIR . 'includes/triggers.php';
84
85 }
86 }
87
88 /**
89 * Setup plugin hooks
90 *
91 * @access private
92 * @since 1.0.0
93 * @return void
94 */
95 private function hooks() {
96 // Setup our activation and deactivation hooks
97 register_activation_hook( __FILE__, array( $this, 'activate' ) );
98 register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );
99
100
101 }
102
103 /**
104 * Activation hook for the plugin.
105 *
106 * @since 1.0.0
107 */
108 function activate() {
109
110 if( $this->meets_requirements() ) {
111
112 }
113
114 }
115
116 /**
117 * Deactivation hook for the plugin.
118 *
119 * @since 1.0.0
120 */
121 function deactivate() {
122
123 }
124
125 /**
126 * Check if there are all plugin requirements
127 *
128 * @since 1.0.0
129 *
130 * @return bool True if installation meets all requirements
131 */
132 private function meets_requirements() {
133
134 if ( ! class_exists( 'GamiPress' ) )
135 return false;
136
137 // Requirements on multisite install
138 if( is_multisite() && is_main_site() && function_exists('gamipress_is_network_wide_active') && gamipress_is_network_wide_active() ) {
139 // On main site, need to check if integrated plugin is installed on any sub site to load all configuration files
140 if( gamipress_is_plugin_active_on_network( 'sfwd-lms/sfwd_lms.php' ) ) {
141 return true;
142 }
143 }
144
145 if ( ! class_exists( 'SFWD_LMS' ) )
146 return false;
147
148 return true;
149
150 }
151
152 }
153
154 /**
155 * The main function responsible for returning the one true GamiPress_Integration_LearnDash instance to functions everywhere
156 *
157 * @since 1.0.0
158 * @return \GamiPress_Integration_LearnDash The one true GamiPress_Integration_LearnDash
159 */
160 function GamiPress_LD() {
161 return GamiPress_Integration_LearnDash::instance();
162 }
163 add_action( 'gamipress_pre_init', 'GamiPress_LD' );
164