PluginProbe
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI / 6.0.1
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI v6.0.1
6.0.3 6.0.2 6.0.1 6.0.0 5.8.6 5.8.5 5.8.4 5.8.3 5.8.2 5.8.1 5.8.0 5.7.9.2 5.7.9.1 5.7.8 5.7.9 5.7.6 5.7.7 5.7.5 5.7.4 5.7.3 5.7.2 5.7.1 trunk 5.6.0 5.6.1 All 34 releases
automatorwp / integrations / gamipress / gamipress.php

gamipress.php in AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI 6.0.1, at integrations/gamipress/gamipress.php

179 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: AutomatorWP - GamiPress integration
4 * Plugin URI: https://automatorwp.com/add-ons/gamipress/
5 * Description: Connect AutomatorWP with GamiPress.
6 * Version: 1.0.8
7 * Author: AutomatorWP
8 * Author URI: https://automatorwp.com/
9 * Text Domain: automatorwp-gamipress-integration
10 * Domain Path: /languages/
11 * Requires at least: 4.4
12 * Tested up to: 5.7
13 * License: GNU AGPL v3.0 (http://www.gnu.org/licenses/agpl.txt)
14 *
15 * @package AutomatorWP\GamiPress
16 * @author AutomatorWP
17 * @copyright Copyright (c) AutomatorWP
18 */
19
20 final class AutomatorWP_Integration_GamiPress {
21
22 /**
23 * @var AutomatorWP_Integration_GamiPress $instance The one true AutomatorWP_Integration_GamiPress
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 AutomatorWP_Integration_GamiPress self::$instance The one true AutomatorWP_Integration_GamiPress
34 */
35 public static function instance() {
36
37 if( ! self::$instance ) {
38
39 self::$instance = new AutomatorWP_Integration_GamiPress();
40
41 if( ! self::$instance->pro_installed() ) {
42
43 self::$instance->constants();
44 self::$instance->includes();
45
46 }
47
48 self::$instance->hooks();
49 }
50
51 return self::$instance;
52 }
53
54 /**
55 * Setup plugin constants
56 *
57 * @access private
58 * @since 1.0.0
59 * @return void
60 */
61 private function constants() {
62 // Plugin version
63 define( 'AUTOMATORWP_GAMIPRESS_VER', '1.0.8' );
64
65 // Plugin file
66 define( 'AUTOMATORWP_GAMIPRESS_FILE', __FILE__ );
67
68 // Plugin path
69 define( 'AUTOMATORWP_GAMIPRESS_DIR', plugin_dir_path( __FILE__ ) );
70
71 // Plugin URL
72 define( 'AUTOMATORWP_GAMIPRESS_URL', plugin_dir_url( __FILE__ ) );
73 }
74
75 /**
76 * Include plugin files
77 *
78 * @access private
79 * @since 1.0.0
80 * @return void
81 */
82 private function includes() {
83
84 if( $this->meets_requirements() && ! $this->pro_installed() ) {
85
86 // Includes
87 require_once AUTOMATORWP_GAMIPRESS_DIR . 'includes/functions.php';
88
89 // Triggers
90 require_once AUTOMATORWP_GAMIPRESS_DIR . 'includes/triggers/earn-points.php';
91 require_once AUTOMATORWP_GAMIPRESS_DIR . 'includes/triggers/earn-achievement.php';
92 require_once AUTOMATORWP_GAMIPRESS_DIR . 'includes/triggers/reach-rank.php';
93
94 // Actions
95 require_once AUTOMATORWP_GAMIPRESS_DIR . 'includes/actions/user-points.php';
96 require_once AUTOMATORWP_GAMIPRESS_DIR . 'includes/actions/user-achievement.php';
97 require_once AUTOMATORWP_GAMIPRESS_DIR . 'includes/actions/user-rank.php';
98
99 }
100 }
101
102 /**
103 * Setup plugin hooks
104 *
105 * @access private
106 * @since 1.0.0
107 * @return void
108 */
109 private function hooks() {
110
111 add_action( 'automatorwp_init', array( $this, 'register_integration' ) );
112
113 }
114
115 /**
116 * Registers this integration
117 *
118 * @since 1.0.0
119 */
120 function register_integration() {
121
122 automatorwp_register_integration( 'gamipress', array(
123 'label' => 'GamiPress',
124 'icon' => plugin_dir_url( __FILE__ ) . 'assets/gamipress.svg',
125 ) );
126
127 }
128
129 /**
130 * Check if there are all plugin requirements
131 *
132 * @since 1.0.0
133 *
134 * @return bool True if installation meets all requirements
135 */
136 private function meets_requirements() {
137
138 if ( ! class_exists( 'AutomatorWP' ) ) {
139 return false;
140 }
141
142 if ( ! class_exists( 'GamiPress' ) ) {
143 return false;
144 }
145
146 return true;
147
148 }
149
150 /**
151 * Check if the pro version of this integration is installed
152 *
153 * @since 1.0.0
154 *
155 * @return bool True if pro version installed
156 */
157 private function pro_installed() {
158
159 if ( ! class_exists( 'AutomatorWP_GamiPress' ) ) {
160 return false;
161 }
162
163 return true;
164
165 }
166
167 }
168
169 /**
170 * The main function responsible for returning the one true AutomatorWP_Integration_GamiPress instance to functions everywhere
171 *
172 * @since 1.0.0
173 * @return \AutomatorWP_Integration_GamiPress The one true AutomatorWP_Integration_GamiPress
174 */
175 function AutomatorWP_Integration_GamiPress() {
176 return AutomatorWP_Integration_GamiPress::instance();
177 }
178 add_action( 'automatorwp_pre_init', 'AutomatorWP_Integration_GamiPress' );
179