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

279 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.2
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.2';
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 add_action( 'after_setup_theme', [ $this, 'load_csf_files' ], 20 );
80
81 // Added Documentation links to plugin row meta
82 add_filter( 'plugin_row_meta', [ $this, 'bbpc_row_meta' ], 10, 2 );
83
84 /**
85 * Removes admin notices on the BBP Core Forum builder page.
86 *
87 * @return void
88 */
89 add_action( 'admin_head', function () {
90 // Get the current screen
91 $screen = get_current_screen();
92
93 // Check if the current screen is for your plugin page
94 if ( isset( $_GET['page'] ) && in_array( $_GET['page'], [ 'bbp-core' ] ) ) {
95 // Remove admin notices
96 remove_all_actions( 'admin_notices' );
97 remove_all_actions( 'all_admin_notices' );
98
99 // Re-add a specific notice
100 if ( ! bbpc_is_premium() && bbpc_is_plugin_installed_for_days( 12 ) ) {
101 add_action( 'admin_notices', 'bbpc_offer_notice' );
102 }
103 }
104 } );
105 }
106
107 /**
108 * Define Plugin Constants.
109 *
110 * @return void
111 */
112 public function define_constants() {
113 define( 'BBPC_VERSION', self::VERSION );
114 define( 'BBPC_FILE', __FILE__ );
115 define( 'BBPC_DIR', __DIR__ . '/' );
116 define( 'BBPC_URL', plugins_url( '/', __FILE__ ) );
117 define( 'BBPC_ASSETS', BBPC_URL . 'assets/' );
118 define( 'BBPC_FRONT_ASS', BBPC_URL . 'assets/frontend/' );
119 define( 'BBPC_ADMIN_ASS', BBPC_ASSETS . 'admin/' );
120 define( 'BBPC_IMG', BBPC_ASSETS . 'img/' );
121 define( 'BBPC_VEND', BBPC_ASSETS . 'vendors/' );
122 }
123
124 /**
125 * File includes.
126 */
127 public function core_includes() {
128 require_once __DIR__ . '/includes/functions.php';
129 require_once __DIR__ . '/includes/admin/menu/Approve_Topic.php';
130 require_once __DIR__ . '/includes/admin/menu/Create_Forum.php';
131 require_once __DIR__ . '/includes/admin/menu/Create_Topic.php';
132 require_once __DIR__ . '/includes/admin/menu/Delete_Forum.php';
133 require_once __DIR__ . '/includes/admin/menu/Delete_Topic.php';
134 require_once __DIR__ . '/includes/Elementor/BBP_Widgets.php';
135 require_once __DIR__ . '/includes/ajax_actions.php';
136 include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
137 require_once __DIR__ . '/includes/Frontend/Assets.php';
138
139 require_once __DIR__ . '/widgets/widgets.php';
140 require_once __DIR__ . '/includes/Elementor/inc/forum-ajax.php';
141
142 // Core installer notice
143 require_once __DIR__ . '/includes/admin/notices/_notices.php';
144
145 //Register Pro Widgets
146 $theme = wp_get_theme();
147
148 if ( $theme->get( 'Name' ) != 'Ama' || ! bbpc_is_premium() ) {
149 require_once __DIR__ . '/includes/admin/Pro_Widget_Map.php';
150 require_once __DIR__ . '/includes/admin/Pro_Widget_Service.php';
151 }
152
153 // Hooks
154 require BBPC_DIR . 'includes/hooks/actions.php';
155 require BBPC_DIR . 'includes/hooks/image_sizes.php';
156 }
157
158 /**
159 * Initializing Bbp_core class.
160 *
161 * @return \Bbp_core
162 */
163 static function init() {
164 static $instance = false;
165
166 if ( ! $instance ) {
167 $instance = new self();
168 }
169 }
170
171 /**
172 * Actions on plugin activation.
173 *
174 * @return void
175 */
176 public function activate() {
177 $installed = get_option( 'bbpc_installed' );
178 if ( ! $installed ) {
179 update_option( 'bbpc_installed', time() );
180 }
181
182 update_option( 'bbpc_version', BBPC_VERSION );
183 }
184
185 /**
186 * Initialize the plugin functionality.
187 *
188 * @return void
189 */
190 public function init_plugin() {
191
192 $this->load_features();
193
194 if ( is_admin() ) {
195 new Admin();
196 new admin\Assets();
197 } elseif ( ! is_admin() ) {
198 new Frontend\Assets();
199 }
200
201 // If bbPress is not active, don't load assets and widgets.
202 if ( ! class_exists( 'bbPress' ) ) {
203 return;
204 }
205
206 new admin\Elementor\BBP_Widgets();
207 }
208
209 /**
210 * Include CSF files include
211 */
212 public function load_csf_files(){
213 require BBPC_DIR . 'vendor/csf/classes/setup.class.php';
214 require BBPC_DIR . 'includes/admin/options/settings.php';
215 }
216
217 /**
218 * Load different features.
219 *
220 * @return void
221 */
222 public function load_features() {
223 define( 'BBPC_FEAT_PATH', plugin_dir_path( __FILE__ ) . 'includes/features/' );
224
225 if ( bbpc_get_opt( 'is_solved_topics', true ) ) {
226 require BBPC_FEAT_PATH . 'bbp_solved_topic.php';
227 }
228
229 if ( bbpc_get_opt( 'is_private_replies', true ) ) {
230 require BBPC_FEAT_PATH . 'bbp-private-replies.php';
231 }
232
233 if ( bbpc_is_premium() || class_exists( 'BBPC_GEO_ROLES' ) ) {
234 if ( bbpc_get_opt( 'agree_disagree_voting' ) ) {
235 require BBPC_FEAT_PATH . 'bbp_voting/agree-disagree/init.php';
236 require BBPC_FEAT_PATH . 'bbp_voting/agree-disagree/actions.php';
237 }
238 }
239
240 if ( bbpc_get_opt( 'is_votes', true ) ) {
241 new features\bbp_voting();
242 }
243
244 if ( bbpc_get_opt( 'is_attachment', true ) ) {
245 new features\bbp_attachments();
246 }
247 }
248
249 /**
250 * Documentation links to plugin row meta
251 */
252 public function bbpc_row_meta( $links, $file ) {
253 // Check if this is your plugin
254 if ( plugin_basename( __FILE__ ) === $file ) {
255 // Add your custom links
256 $plugin_links = array(
257 '<a href="https://helpdesk.spider-themes.net/docs/bbp-core-wordpress-plugin/" target="_blank">' . esc_html__('Documentation', 'bbp-core') . '</a>'
258 );
259 // Merge the custom links with the existing links
260 $links = array_merge( $links, $plugin_links );
261 }
262
263 return $links;
264 }
265 // end
266
267 }
268
269 /**
270 * Initialize the bbp core plugin.
271 *
272 * @return \Bbp_core
273 */
274 function bbp_core() {
275 return Bbp_core::init();
276 }
277
278 bbp_core();
279