PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 1.2.8
Forumax – AI Powered Advanced Community Forum Plugin v1.2.8
2.4.4 2.4.3 2.4.2 2.4.1 2.4.0 trunk 1.0.8 1.1.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 2.0.0 2.1.0 All 29 releases
bbp-core / bbp-core.php

bbp-core.php in Forumax – AI Powered Advanced Community Forum Plugin 1.2.8, at bbp-core.php

267 lines 6.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: BBP Core
4 Plugin URI: https://spider-themes.net/bbp-core
5 Description: Expand bbPress powered forums with useful features like - private reply, solved topics ...
6 Author: spider-themes
7 Author URI: https://spider-themes.net/bbp-core
8 Text Domain: bbp-core
9 Version: 1.2.8
10 Requires at least: 5.0
11 Tested up to: 6.6.1
12 Requires PHP: 7.4
13 License: GPLv3 or later
14 License URI: https://www.gnu.org/licenses/gpl-3.0.html
15 */
16
17 defined( 'ABSPATH' ) || exit;
18
19 if ( ! function_exists( 'bc_fs' ) ) {
20 // Create a helper function for easy SDK access.
21 function bc_fs() {
22 global $bc_fs;
23
24 if ( ! isset( $bc_fs ) ) {
25 // Include Freemius SDK.
26 require_once dirname( __FILE__ ) . '/includes/fs/start.php';
27
28 $bc_fs = fs_dynamic_init( [
29 'id' => '10864',
30 'slug' => 'bbp-core',
31 'type' => 'plugin',
32 'public_key' => 'pk_41277ad11125f6e2a1b4e66f40164',
33 'is_premium' => false,
34 'is_premium_only' => false,
35 'has_addons' => false,
36 'has_paid_plans' => true,
37 'trial' => [
38 'days' => 14,
39 'is_require_payment' => true,
40 ],
41 'menu' => [
42 'slug' => 'bbp-core',
43 'contact' => false,
44 'support' => false,
45 'first-path' => 'admin.php?page=bbp-core',
46 ],
47 ] );
48 }
49
50 return $bc_fs;
51 }
52
53 // Init Freemius.
54 bc_fs()->add_filter( 'deactivate_on_activation', '__return_false' );
55
56 // Signal that SDK was initiated.
57 do_action( 'bc_fs_loaded' );
58 }
59
60 require_once __DIR__ . '/autoloader.php';
61
62
63 /**
64 * Plugin's heart
65 */
66 final class BBP_Core {
67 const VERSION = '1.2.8';
68
69 /**
70 * Class constructor.
71 */
72 public function __construct() {
73
74 $this->define_constants();
75 $this->core_includes();
76
77 register_activation_hook( __FILE__, [ $this, 'activate' ] );
78 add_action( 'plugins_loaded', [ $this, 'init_plugin' ] );
79
80 // Added Documentation links to plugin row meta
81 add_filter('plugin_row_meta',[ $this, 'bbpc_row_meta' ], 10, 2);
82
83 /**
84 * Removes admin notices on the BBP Core Forum builder page.
85 *
86 * @return void
87 */
88 add_action( 'admin_head', function () {
89 // Get the current screen
90 $screen = get_current_screen();
91
92 // Check if the current screen is for your plugin page
93 if ( isset( $_GET['page'] ) && in_array( $_GET['page'], [ 'bbp-core' ] ) ) {
94 // Remove admin notices
95 remove_all_actions( 'admin_notices' );
96 remove_all_actions( 'all_admin_notices' );
97 }
98 });
99 }
100
101 /**
102 * Define Plugin Constants.
103 *
104 * @return void
105 */
106 public function define_constants() {
107 define( 'BBPC_VERSION', self::VERSION );
108 define( 'BBPC_FILE', __FILE__ );
109 define( 'BBPC_DIR', __DIR__ . '/' );
110 define( 'BBPC_URL', plugins_url( '/', __FILE__ ) );
111 define( 'BBPC_ASSETS', BBPC_URL . 'assets/' );
112 define( 'BBPC_IMG', BBPC_ASSETS . 'img/' );
113 }
114
115 /**
116 * File includes.
117 */
118 public function core_includes() {
119 require_once __DIR__ . '/includes/functions.php';
120 require_once __DIR__ . '/includes/admin/menu/Approve_Topic.php';
121 require_once __DIR__ . '/includes/admin/menu/Create_Forum.php';
122 require_once __DIR__ . '/includes/admin/menu/Create_Topic.php';
123 require_once __DIR__ . '/includes/admin/menu/Delete_Forum.php';
124 require_once __DIR__ . '/includes/admin/menu/Delete_Topic.php';
125 require_once __DIR__ . '/includes/Elementor/BBP_Widgets.php';
126 require_once __DIR__ . '/includes/ajax_actions.php';
127 include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
128 require_once __DIR__ . '/includes/Frontend/Assets.php';
129
130 require_once __DIR__ . '/includes/admin/widgets/forum-info/widgets.php';
131 require_once __DIR__ . '/includes/Elementor/inc/forum-ajax.php';
132
133 // Core installer notice
134 require_once __DIR__ . '/includes/admin/notices/notices.php';
135 require_once __DIR__ . '/includes/admin/notices/asking-for-review.php';
136
137 //Register Pro Widgets
138 $theme = wp_get_theme();
139
140 if ( $theme->get( 'Name' ) != 'Ama' || ! bbpc_is_premium() ) {
141 require_once __DIR__ . '/includes/admin/Pro_Widget_Map.php';
142 require_once __DIR__ . '/includes/admin/Pro_Widget_Service.php';
143 }
144
145 // Hooks
146 require BBPC_DIR . 'includes/hooks/actions.php';
147 require BBPC_DIR . 'includes/hooks/image_sizes.php';
148
149 // Load CSF
150 require BBPC_DIR . 'includes/admin/settings/csf/classes/setup.class.php';
151 require BBPC_DIR . 'includes/admin/settings/options/settings.php';
152 }
153
154 /**
155 * Initializing Bbp_core class.
156 *
157 * @return \Bbp_core
158 */
159 static function init() {
160 static $instance = false;
161
162 if ( ! $instance ) {
163 $instance = new self();
164 }
165 }
166
167 /**
168 * Actions on plugin activation.
169 *
170 * @return void
171 */
172 public function activate() {
173 $installed = get_option( 'bbpc_installed' );
174 if ( ! $installed ) {
175 update_option( 'bbpc_installed', time() );
176 }
177
178 update_option( 'bbpc_version', BBPC_VERSION );
179 }
180
181 /**
182 * Initialize the plugin functionality.
183 *
184 * @return void
185 */
186 public function init_plugin() {
187
188 $this->load_features();
189
190 if ( is_admin() ) {
191 new Admin();
192 new admin\Assets();
193 }elseif ( ! is_admin() ) {
194 new Frontend\Assets();
195 }
196
197 // If bbPress is not active, don't load assets and widgets.
198 if ( ! class_exists( 'bbPress' ) ) {
199 return;
200 }
201 new admin\Elementor\BBP_Widgets();
202 }
203
204
205 /**
206 * Load different features.
207 *
208 * @return void
209 */
210 public function load_features() {
211 $opt = get_option( 'bbp_core_settings' );
212 define( 'BBPC_FEAT_PATH', plugin_dir_path( __FILE__ ) . 'includes/features/' );
213
214 if ( $opt['is_solved_topics'] ?? true ) {
215 require BBPC_FEAT_PATH . 'bbp_solved_topic.php';
216 }
217
218 if ( $opt['is_private_replies'] ?? true ) {
219 require BBPC_FEAT_PATH . 'bbp-private-replies.php';
220 }
221
222 if ( bbpc_is_premium() || class_exists('BBPC_GEO_ROLES') ) {
223 $reactions = $opt['agree_disagree_voting'] ?? '';
224 if ( ! empty ( $reactions ) ) {
225 require BBPC_FEAT_PATH . 'bbp_voting/agree-disagree/init.php';
226 require BBPC_FEAT_PATH . 'bbp_voting/agree-disagree/actions.php';
227 }
228 }
229
230 if ( $opt['is_votes'] ?? true ) {
231 new features\bbp_voting();
232 }
233
234 if ( $opt['is_attachment'] ?? true ) {
235 new features\bbp_attachments();
236 }
237 }
238
239 /**
240 * Documentation links to plugin row meta
241 */
242 public function bbpc_row_meta($links, $file) {
243 // Check if this is your plugin
244 if (plugin_basename(__FILE__) === $file) {
245 // Add your custom links
246 $plugin_links = array(
247 '<a href="https://helpdesk.spider-themes.net/docs/bbp-core-wordpress-plugin/" target="_blank">Documentation</a>'
248 );
249 // Merge the custom links with the existing links
250 $links = array_merge($links, $plugin_links);
251 }
252 return $links;
253 }
254 // end
255
256 }
257
258 /**
259 * Initialize the bbp core plugin.
260 *
261 * @return \Bbp_core
262 */
263 function bbp_core() {
264 return Bbp_core::init();
265 }
266
267 bbp_core();