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/divi/divi.php +157 -0 7.9.2 → 8.0.5 View file →
@@ -1,0 +1,157 @@
1 +<?php
2 +/**
3 + * Plugin Name: GamiPress - Divi integration
4 + * Plugin URI: https://wordpress.org/plugins/gamipress-divi-integration/
5 + * Description: Connect GamiPress with Divi.
6 + * Version: 1.0.0
7 + * Author: GamiPress
8 + * Author URI: https://gamipress.com/
9 + * Text Domain: gamipress-divi-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\Divi
16 + * @author GamiPress
17 + * @copyright Copyright (c) GamiPress
18 + */
19 +
20 +final class GamiPress_Integration_Divi {
21 +
22 + /**
23 + * @var GamiPress_Integration_Divi $instance The one true GamiPress_Integration_Divi
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_Divi self::$instance The one true GamiPress_Integration_Divi
34 + */
35 + public static function instance() {
36 + if( !self::$instance ) {
37 + self::$instance = new GamiPress_Integration_Divi();
38 + self::$instance->constants();
39 + self::$instance->includes();
40 + self::$instance->hooks();
41 +
42 + }
43 +
44 + return self::$instance;
45 + }
46 +
47 + /**
48 + * Setup plugin constants
49 + *
50 + * @access private
51 + * @since 1.0.0
52 + * @return void
53 + */
54 + private function constants() {
55 + // Plugin version
56 + define( 'GAMIPRESS_DIVI_VER', '1.0.0' );
57 +
58 + // Plugin path
59 + define( 'GAMIPRESS_DIVI_DIR', plugin_dir_path( __FILE__ ) );
60 +
61 + // Plugin URL
62 + define( 'GAMIPRESS_DIVI_URL', plugin_dir_url( __FILE__ ) );
63 + }
64 +
65 + /**
66 + * Include plugin files
67 + *
68 + * @access private
69 + * @since 1.0.0
70 + * @return void
71 + */
72 + private function includes() {
73 +
74 + if( $this->meets_requirements() ) {
75 +
76 + require_once GAMIPRESS_DIVI_DIR . 'includes/admin.php';
77 + require_once GAMIPRESS_DIVI_DIR . 'includes/listeners.php';
78 + require_once GAMIPRESS_DIVI_DIR . 'includes/requirements.php';
79 + require_once GAMIPRESS_DIVI_DIR . 'includes/rules-engine.php';
80 + require_once GAMIPRESS_DIVI_DIR . 'includes/scripts.php';
81 + require_once GAMIPRESS_DIVI_DIR . 'includes/triggers.php';
82 +
83 + }
84 + }
85 +
86 + /**
87 + * Setup plugin hooks
88 + *
89 + * @access private
90 + * @since 1.0.0
91 + * @return void
92 + */
93 + private function hooks() {
94 + // Setup our activation and deactivation hooks
95 + register_activation_hook( __FILE__, array( $this, 'activate' ) );
96 + register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );
97 +
98 +
99 + }
100 +
101 + /**
102 + * Activation hook for the plugin.
103 + *
104 + * @since 1.0.0
105 + */
106 + function activate() {
107 +
108 + if( $this->meets_requirements() ) {
109 +
110 + }
111 +
112 + }
113 +
114 + /**
115 + * Deactivation hook for the plugin.
116 + *
117 + * @since 1.0.0
118 + */
119 + function deactivate() {
120 +
121 + }
122 +
123 + /**
124 + * Check if there are all plugin requirements
125 + *
126 + * @since 1.0.0
127 + *
128 + * @return bool True if installation meets all requirements
129 + */
130 + private function meets_requirements() {
131 +
132 + if ( ! class_exists( 'GamiPress' ) ) {
133 + return false;
134 + }
135 +
136 + $theme = wp_get_theme();
137 +
138 + if ( $theme->get_template() !== 'Divi' ) {
139 + return false;
140 + }
141 +
142 + return true;
143 +
144 + }
145 +
146 +}
147 +
148 +/**
149 + * The main function responsible for returning the one true GamiPress_Integration_Divi instance to functions everywhere
150 + *
151 + * @since 1.0.0
152 + * @return \GamiPress_Integration_Divi The one true GamiPress_Integration_Divi
153 + */
154 +function GamiPress_Integration_Divi() {
155 + return GamiPress_Integration_Divi::instance();
156 +}
157 +add_action( 'gamipress_pre_init', 'GamiPress_Integration_Divi' );