PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 8.0.3
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v8.0.3
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 7.8.7 All 46 releases
gamipress / integrations / wp-simple-pay / wp-simple-pay.php

wp-simple-pay.php in GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI 8.0.3, at integrations/wp-simple-pay/wp-simple-pay.php

138 lines 4.1 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 - WP Simple Pay integration
4 * Plugin URI: https://wordpress.org/plugins/gamipress-wp-simple-pay-integration/
5 * Description: Connect GamiPress with WP Simple Pay.
6 * Version: 1.0.1
7 * Author: GamiPress
8 * Author URI: https://gamipress.com/
9 * Text Domain: gamipress-wp-simple-pay-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\WP_Simple_Pay
16 * @author GamiPress
17 * @copyright Copyright (c) GamiPress
18 */
19
20 final class GamiPress_Integration_WP_Simple_Pay {
21
22 /**
23 * @var GamiPress_Integration_WP_Simple_Pay $instance The one true GamiPress_Integration_WP_Simple_Pay
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_WP_Simple_Pay self::$instance The one true GamiPress_Integration_WP_Simple_Pay
34 */
35 public static function instance() {
36
37 if( !self::$instance ) {
38 self::$instance = new GamiPress_Integration_WP_Simple_Pay();
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_WP_SIMPLE_PAY_VER', '1.0.1' );
58
59 // Plugin path
60 define( 'GAMIPRESS_WP_SIMPLE_PAY_DIR', plugin_dir_path( __FILE__ ) );
61
62 // Plugin URL
63 define( 'GAMIPRESS_WP_SIMPLE_PAY_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_WP_SIMPLE_PAY_DIR . 'includes/admin.php';
78 require_once GAMIPRESS_WP_SIMPLE_PAY_DIR . 'includes/listeners.php';
79 require_once GAMIPRESS_WP_SIMPLE_PAY_DIR . 'includes/triggers.php';
80
81 }
82 }
83
84 /**
85 * Setup plugin hooks
86 *
87 * @access private
88 * @since 1.0.0
89 * @return void
90 */
91 private function hooks() {
92
93 }
94
95 /**
96 * Check if there are all plugin requirements
97 *
98 * @since 1.0.0
99 *
100 * @return bool True if installation meets all requirements
101 */
102 private function meets_requirements() {
103
104 if ( ! class_exists( 'GamiPress' ) ) {
105 return false;
106 }
107
108 // Requirements on multisite install
109 if( is_multisite() && is_main_site() && function_exists('gamipress_is_network_wide_active') && gamipress_is_network_wide_active() ) {
110
111 // On main site, need to check if integrated plugin is installed on any sub site to load all configuration files
112 if( gamipress_is_plugin_active_on_network( 'stripe/stripe-checkout.php' ) || gamipress_is_plugin_active_on_network( 'wp-simple-pay-pro-3/simple-pay.php' ) ) {
113 return true;
114 }
115
116 }
117
118 if ( ! defined( 'SIMPLE_PAY_PLUGIN_NAME' ) ) {
119 return false;
120 }
121
122 return true;
123
124 }
125
126 }
127
128 /**
129 * The main function responsible for returning the one true GamiPress_Integration_WP_Simple_Pay instance to functions everywhere
130 *
131 * @since 1.0.0
132 * @return \GamiPress_Integration_WP_Simple_Pay The one true GamiPress_Integration_WP_Simple_Pay
133 */
134 function GamiPress_Integration_WP_Simple_Pay() {
135 return GamiPress_Integration_WP_Simple_Pay::instance();
136 }
137 add_action( 'gamipress_pre_init', 'GamiPress_Integration_WP_Simple_Pay' );
138