PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 7.9.8
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v7.9.8
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-postratings / wp-postratings.php

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

171 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 - WP PostRatings integration
4 * Plugin URI: https://wordpress.org/plugins/gamipress-wp-postratings-integration/
5 * Description: Connect GamiPress with WP PostRatings.
6 * Version: 1.0.7
7 * Author: GamiPress
8 * Author URI: https://gamipress.com/
9 * Text Domain: gamipress-wp-postratings-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_PostRatings
16 * @author GamiPress
17 * @copyright Copyright (c) GamiPress
18 */
19
20 final class GamiPress_Integration_WP_PostRatings {
21
22 /**
23 * @var GamiPress_Integration_WP_PostRatings $instance The one true GamiPress_Integration_WP_PostRatings
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 object self::$instance The one true GamiPress_Integration_WP_PostRatings
34 */
35 public static function instance() {
36
37 if( !self::$instance ) {
38
39 self::$instance = new GamiPress_Integration_WP_PostRatings();
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_WP_POSTRATINGS_VER', '1.0.7' );
62
63 // Plugin path
64 define( 'GAMIPRESS_WP_POSTRATINGS_DIR', plugin_dir_path( __FILE__ ) );
65
66 // Plugin URL
67 define( 'GAMIPRESS_WP_POSTRATINGS_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_WP_POSTRATINGS_DIR . 'includes/admin.php';
83 require_once GAMIPRESS_WP_POSTRATINGS_DIR . 'includes/listeners.php';
84 require_once GAMIPRESS_WP_POSTRATINGS_DIR . 'includes/requirements.php';
85 require_once GAMIPRESS_WP_POSTRATINGS_DIR . 'includes/rules-engine.php';
86 require_once GAMIPRESS_WP_POSTRATINGS_DIR . 'includes/scripts.php';
87 require_once GAMIPRESS_WP_POSTRATINGS_DIR . 'includes/triggers.php';
88
89 }
90 }
91
92 /**
93 * Setup plugin hooks
94 *
95 * @access private
96 * @since 1.0.0
97 * @return void
98 */
99 private function hooks() {
100 // Setup our activation and deactivation hooks
101 register_activation_hook( __FILE__, array( $this, 'activate' ) );
102 register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) );
103
104
105 }
106
107 /**
108 * Activation hook for the plugin.
109 *
110 * @since 1.0.0
111 */
112 function activate() {
113
114 if( $this->meets_requirements() ) {
115
116 }
117
118 }
119
120 /**
121 * Deactivation hook for the plugin.
122 *
123 * @since 1.0.0
124 */
125 function deactivate() {
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( 'GamiPress' ) )
139 return false;
140
141
142 // Requirements on multisite install
143 if( is_multisite() && is_main_site() && function_exists('gamipress_is_network_wide_active') && gamipress_is_network_wide_active() ) {
144
145 // On main site, need to check if integrated plugin is installed on any sub site to load all configuration files
146 if( gamipress_is_plugin_active_on_network( 'wp-postratings/wp-postratings.php' ) ) {
147 return true;
148 }
149
150 }
151
152 if ( ! function_exists( 'postratings_init' ) )
153 return false;
154
155 return true;
156
157 }
158
159 }
160
161 /**
162 * The main function responsible for returning the one true GamiPress_Integration_WP_PostRatings instance to functions everywhere
163 *
164 * @since 1.0.0
165 * @return \GamiPress_Integration_WP_PostRatings The one true GamiPress_Integration_WP_PostRatings
166 */
167 function GamiPress_Integration_WP_PostRatings() {
168 return GamiPress_Integration_WP_PostRatings::instance();
169 }
170 add_action( 'gamipress_pre_init', 'GamiPress_Integration_WP_PostRatings' );
171