PluginProbe
Forumax – AI Powered Advanced Community Forum Plugin / 1.3.0
Forumax – AI Powered Advanced Community Forum Plugin v1.3.0
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.3.0, at bbp-core.php

272 lines 7.0 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.3.0
10 Requires at least: 5.0
11 Tested up to: 6.8
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__ ) . '/vendor/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
61 require_once __DIR__ . '/autoloader.php';
62
63 /**
64 * Plugin's heart
65 */
66 final class BBP_Core {
67 const VERSION = '1.3.0';
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 // Re-add a specific notice
99 if ( ! bbpc_is_premium() && bbpc_is_plugin_installed_for_days( 12 ) ) {
100 add_action( 'admin_notices', 'bbpc_offer_notice' );
101 }
102 }
103 } );
104 }
105
106 /**
107 * Define Plugin Constants.
108 *
109 * @return void
110 */
111 public function define_constants() {
112 define( 'BBPC_VERSION', self::VERSION );
113 define( 'BBPC_FILE', __FILE__ );
114 define( 'BBPC_DIR', __DIR__ . '/' );
115 define( 'BBPC_URL', plugins_url( '/', __FILE__ ) );
116 define( 'BBPC_ASSETS', BBPC_URL . 'assets/' );
117 define( 'BBPC_IMG', BBPC_ASSETS . 'img/' );
118 }
119
120 /**
121 * File includes.
122 */
123 public function core_includes() {
124 require_once __DIR__ . '/includes/functions.php';
125 require_once __DIR__ . '/includes/admin/menu/Approve_Topic.php';
126 require_once __DIR__ . '/includes/admin/menu/Create_Forum.php';
127 require_once __DIR__ . '/includes/admin/menu/Create_Topic.php';
128 require_once __DIR__ . '/includes/admin/menu/Delete_Forum.php';
129 require_once __DIR__ . '/includes/admin/menu/Delete_Topic.php';
130 require_once __DIR__ . '/includes/Elementor/BBP_Widgets.php';
131 require_once __DIR__ . '/includes/ajax_actions.php';
132 include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
133 require_once __DIR__ . '/includes/Frontend/Assets.php';
134
135 require_once __DIR__ . '/widgets/widgets.php';
136 require_once __DIR__ . '/includes/Elementor/inc/forum-ajax.php';
137
138 // Core installer notice
139 require_once __DIR__ . '/includes/admin/notices/_notices.php';
140
141 //Register Pro Widgets
142 $theme = wp_get_theme();
143
144 if ( $theme->get( 'Name' ) != 'Ama' || ! bbpc_is_premium() ) {
145 require_once __DIR__ . '/includes/admin/Pro_Widget_Map.php';
146 require_once __DIR__ . '/includes/admin/Pro_Widget_Service.php';
147 }
148
149 // Hooks
150 require BBPC_DIR . 'includes/hooks/actions.php';
151 require BBPC_DIR . 'includes/hooks/image_sizes.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
202 new admin\Elementor\BBP_Widgets();
203
204 // Load CSF
205 require BBPC_DIR . 'vendor/csf/classes/setup.class.php';
206 require BBPC_DIR . 'includes/admin/options/settings.php';
207 }
208
209 /**
210 * Load different features.
211 *
212 * @return void
213 */
214 public function load_features() {
215 $opt = get_option( 'bbp_core_settings' );
216 define( 'BBPC_FEAT_PATH', plugin_dir_path( __FILE__ ) . 'includes/features/' );
217
218 if ( $opt['is_solved_topics'] ?? true ) {
219 require BBPC_FEAT_PATH . 'bbp_solved_topic.php';
220 }
221
222 if ( $opt['is_private_replies'] ?? true ) {
223 require BBPC_FEAT_PATH . 'bbp-private-replies.php';
224 }
225
226 if ( bbpc_is_premium() || class_exists( 'BBPC_GEO_ROLES' ) ) {
227 $reactions = $opt['agree_disagree_voting'] ?? '';
228 if ( ! empty ( $reactions ) ) {
229 require BBPC_FEAT_PATH . 'bbp_voting/agree-disagree/init.php';
230 require BBPC_FEAT_PATH . 'bbp_voting/agree-disagree/actions.php';
231 }
232 }
233
234 if ( $opt['is_votes'] ?? true ) {
235 new features\bbp_voting();
236 }
237
238 if ( $opt['is_attachment'] ?? true ) {
239 new features\bbp_attachments();
240 }
241 }
242
243 /**
244 * Documentation links to plugin row meta
245 */
246 public function bbpc_row_meta( $links, $file ) {
247 // Check if this is your plugin
248 if ( plugin_basename( __FILE__ ) === $file ) {
249 // Add your custom links
250 $plugin_links = array(
251 '<a href="https://helpdesk.spider-themes.net/docs/bbp-core-wordpress-plugin/" target="_blank">Documentation</a>'
252 );
253 // Merge the custom links with the existing links
254 $links = array_merge( $links, $plugin_links );
255 }
256
257 return $links;
258 }
259 // end
260
261 }
262
263 /**
264 * Initialize the bbp core plugin.
265 *
266 * @return \Bbp_core
267 */
268 function bbp_core() {
269 return Bbp_core::init();
270 }
271
272 bbp_core();