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 / formidable-forms / formidable-forms.php

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

175 lines 4.8 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 - Formidable Forms integration
4 * Plugin URI: https://wordpress.org/plugins/gamipress-formidable-forms-integration/
5 * Description: Connect GamiPress with Formidable Forms.
6 * Version: 1.0.7
7 * Author: GamiPress
8 * Author URI: https://gamipress.com/
9 * Text Domain: gamipress-formidable-forms-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\Formidable_Forms
16 * @author GamiPress
17 * @copyright Copyright (c) GamiPress
18 */
19
20 final class GamiPress_Integration_Formidable_Forms {
21
22 /**
23 * @var GamiPress_Integration_Formidable_Forms $instance The one true GamiPress_Integration_Formidable_Forms
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_Formidable_Forms self::$instance The one true GamiPress_Integration_Formidable_Forms
34 */
35 public static function instance() {
36
37 if( !self::$instance ) {
38
39 self::$instance = new GamiPress_Integration_Formidable_Forms();
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_FRM_VER', '1.0.6' );
62
63 // Plugin path
64 define( 'GAMIPRESS_FRM_DIR', plugin_dir_path( __FILE__ ) );
65
66 // Plugin URL
67 define( 'GAMIPRESS_FRM_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_FRM_DIR . 'includes/admin.php';
83 require_once GAMIPRESS_FRM_DIR . 'includes/functions.php';
84 require_once GAMIPRESS_FRM_DIR . 'includes/listeners.php';
85 require_once GAMIPRESS_FRM_DIR . 'includes/requirements.php';
86 require_once GAMIPRESS_FRM_DIR . 'includes/rules-engine.php';
87 require_once GAMIPRESS_FRM_DIR . 'includes/scripts.php';
88 require_once GAMIPRESS_FRM_DIR . 'includes/triggers.php';
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
148 // On main site, need to check if integrated plugin is installed on any sub site to load all configuration files
149 if( gamipress_is_plugin_active_on_network( 'formidable/formidable.php' ) ) {
150 return true;
151 }
152
153 }
154
155 if ( ! function_exists( 'load_formidable_forms' ) ) {
156 return false;
157 }
158
159 return true;
160
161 }
162
163 }
164
165 /**
166 * The main function responsible for returning the one true GamiPress_Integration_Formidable_Forms instance to functions everywhere
167 *
168 * @since 1.0.0
169 * @return \GamiPress_Integration_Formidable_Forms The one true GamiPress_Integration_Formidable_Forms
170 */
171 function GamiPress_FRM() {
172 return GamiPress_Integration_Formidable_Forms::instance();
173 }
174 add_action( 'gamipress_pre_init', 'GamiPress_FRM' );
175