PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 8.0.4
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v8.0.4
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
gamipress / integrations / woocommerce-shipstation / woocommerce-shipstation.php

woocommerce-shipstation.php in GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI 8.0.4, at integrations/woocommerce-shipstation/woocommerce-shipstation.php

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