PluginProbe
bBlocks – Essential Gutenberg Blocks & Patterns Collection / 2.1.8
bBlocks – Essential Gutenberg Blocks & Patterns Collection v2.1.8
2.1.8 2.1.7 2.1.6 2.1.5 2.1.4 2.1.3 2.1.2 2.1.1 2.1.0 2.0.43 2.0.42 2.0.41 2.0.40 2.0.39 2.0.38 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.5.1 1.5.2 1.5.3 All 108 releases
← All changes | plugin.php +59 -337 2.0.42 → 2.1.8 View file →
@@ -1,352 +1,74 @@
1 1 <?php
2 -
3 2 /**
4 3 * Plugin Name: bBlocks
5 4 * Description: Gutenberg Blocks Collection and Page Builder.
6 - * Version: 2.0.42
5 + * Version: 2.1.8
7 6 * Author: bPlugins
8 7 * Author URI: https://bplugins.com
9 - * License: GPLv3
10 - * License URI: https://www.gnu.org/licenses/gpl-3.0.txt
8 + * License: GPLv3 or later
9 + * License URI: https://www.gnu.org/licenses/gpl-3.0.html
11 10 * Text Domain: b-blocks
12 - */
11 + */
12 +
13 13 // ABS PATH
14 -if ( !defined( 'ABSPATH' ) ) {
15 - exit;
14 +if (!defined('ABSPATH')) {
15 + exit;
16 16 }
17 -if ( function_exists( 'b_blocks_fs' ) ) {
18 - register_activation_hook( __FILE__, function () {
19 - if ( is_plugin_active( 'b-blocks/plugin.php' ) ) {
20 - deactivate_plugins( 'b-blocks/plugin.php' );
21 - }
22 - if ( is_plugin_active( 'b-blocks-pro/plugin.php' ) ) {
23 - deactivate_plugins( 'b-blocks-pro/plugin.php' );
24 - }
25 - } );
17 +
18 +if (function_exists('b_blocks_fs')) {
19 + register_activation_hook(__FILE__, function () {
20 + if (is_plugin_active('b-blocks/plugin.php')) {
21 + deactivate_plugins('b-blocks/plugin.php');
22 + }
23 + if (is_plugin_active('b-blocks-pro/plugin.php')) {
24 + deactivate_plugins('b-blocks-pro/plugin.php');
25 + }
26 + });
26 27 } else {
27 - // Constant
28 - define( 'B_BLOCKS_VERSION', ( isset( $_SERVER['HTTP_HOST'] ) && ('localhost' === $_SERVER['HTTP_HOST'] || 'muradwahid.local' === $_SERVER['HTTP_HOST']) ? time() : '2.0.42' ) );
29 - define( 'B_BLOCKS_DIR_PATH', plugin_dir_path( __FILE__ ) );
30 - define( 'B_BLOCKS_DIR_URL', plugin_dir_url( __FILE__ ) );
31 - define( 'B_BLOCKS_HAS_PRO', 'b-blocks-pro/plugin.php' === plugin_basename( __FILE__ ) );
32 - define( 'B_BLOCKS_BUILD', B_BLOCKS_DIR_URL . 'build/' );
33 - define( 'B_BLOCKS_ASSETS', B_BLOCKS_DIR_URL . 'assets/' );
34 - if ( !function_exists( 'b_blocks_fs' ) ) {
35 - // Create a helper function for easy SDK access.
36 - function b_blocks_fs() {
37 - global $b_blocks_fs;
38 - if ( !isset( $b_blocks_fs ) ) {
39 - // Include Freemius SDK.
40 - require_once dirname( __FILE__ ) . '/freemius/start.php';
41 - $b_blocks_fs = fs_dynamic_init( array(
42 - 'id' => '12845',
43 - 'slug' => 'b-blocks',
44 - 'premium_slug' => 'b-blocks-pro',
45 - 'type' => 'plugin',
46 - 'public_key' => 'pk_d6426b344df4918bc066a7a0b4719',
47 - 'is_premium' => false,
48 - 'premium_suffix' => 'Pro',
49 - 'has_addons' => false,
50 - 'has_paid_plans' => true,
51 - 'trial' => array(
52 - 'days' => 7,
53 - 'is_require_payment' => true,
54 - ),
55 - 'menu' => array(
56 - 'slug' => 'b-blocks',
57 - 'first-path' => 'admin.php?page=b-blocks',
58 - 'contact' => false,
59 - 'support' => false,
60 - ),
61 - 'is_live' => true,
62 - 'is_org_compliant' => true,
63 - ) );
64 - }
65 - return $b_blocks_fs;
66 - }
67 28
68 - // Init Freemius.
69 - b_blocks_fs();
70 - // Signal that SDK was initiated.
71 - do_action( 'b_blocks_fs_loaded' );
72 - }
73 - // Generate Styles
74 - class BBlocksStyleGenerator {
75 - public static $styles = [];
29 + define( 'B_BLOCKS_FILE', __FILE__ );
76 30
77 - public static function addStyle( $selector, $styles ) {
78 - if ( array_key_exists( $selector, self::$styles ) ) {
79 - self::$styles[$selector] = wp_parse_args( self::$styles[$selector], $styles );
80 - } else {
81 - self::$styles[$selector] = $styles;
82 - }
83 - }
31 + require_once plugin_dir_path( __FILE__ ) . 'includes/Constants.php';
32 + require_once B_BLOCKS_DIR_PATH . 'includes/FInit.php';
33 + require_once B_BLOCKS_DIR_PATH . 'includes/StyleGenerator.php';
34 + require_once B_BLOCKS_DIR_PATH . 'includes/Sanitize.php';
84 35
85 - public static function renderStyle() {
86 - $output = '';
87 - foreach ( self::$styles as $selector => $style ) {
88 - $new = '';
89 - foreach ( $style as $property => $value ) {
90 - if ( $value == '' ) {
91 - $new .= "{$property} ;";
92 - } else {
93 - $new .= " {$property}: {$value};";
94 - }
95 - }
96 - $output .= "{$selector} { {$new} }";
97 - }
98 - return $output;
99 - }
36 + // Require files
37 + require_once B_BLOCKS_DIR_PATH . 'includes/Dashboard.php';
38 + require_once B_BLOCKS_DIR_PATH . 'includes/EnqueueScripts.php';
39 + require_once B_BLOCKS_DIR_PATH . 'includes/Utils.php';
40 + require_once B_BLOCKS_DIR_PATH . 'includes/GetCSS.php';
41 + require_once B_BLOCKS_DIR_PATH . 'includes/Ajax.php';
42 + require_once B_BLOCKS_DIR_PATH . 'includes/posts/Posts.php';
43 + require_once B_BLOCKS_DIR_PATH . 'includes/Templates/Templates.php';
44 + require_once B_BLOCKS_DIR_PATH . 'includes/blocks/LoginForm.php';
45 + require_once B_BLOCKS_DIR_PATH . 'includes/blocks/cursor.php';
46 + require_once B_BLOCKS_DIR_PATH . 'includes/Ai.php';
47 + require_once B_BLOCKS_DIR_PATH . 'includes/ApiKeys.php';
48 + require_once B_BLOCKS_DIR_PATH . 'includes/Instagram.php';
49 + require_once B_BLOCKS_DIR_PATH . 'includes/blocks/OptinRateLimit.php';
50 + require_once B_BLOCKS_DIR_PATH . 'includes/blocks/form/FormHandler.php';
51 + require_once B_BLOCKS_DIR_PATH . 'includes/blocks/newsletter/NewsletterHandler.php';
52 + // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/popup-optin/PopupOptinHandler.php';
53 + // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/post-filter-grid/PostFilterGrid.php';
54 + // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/post-masonry-grid/PostMasonryGrid.php';
55 + // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/woo-add-to-cart/WooAddToCart.php';
56 + // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/woo-best-sellers/WooBestSellers.php';
57 + // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/woo-featured-product/WooFeaturedProduct.php';
58 + // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/woo-mini-cart/WooMiniCart.php';
59 + // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/woo-product-carousel/WooProductCarousel.php';
60 + // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/woo-product-grid/WooProductGrid.php';
61 + // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/woo-product-reviews/WooProductReviews.php';
62 + // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/woo-single-product/WooSingleProduct.php';
100 63
101 - }
64 + // Blocks, settings and uploads
65 + require_once B_BLOCKS_DIR_PATH . 'includes/BlocksList.php';
66 + require_once B_BLOCKS_DIR_PATH . 'includes/RegisterBlocks.php';
67 + require_once B_BLOCKS_DIR_PATH . 'includes/RegisterSettings.php';
68 + require_once B_BLOCKS_DIR_PATH . 'includes/UploadFileTypes.php';
102 69
103 - // Require files
104 - require_once B_BLOCKS_DIR_PATH . 'includes/Dashboard.php';
105 - require_once B_BLOCKS_DIR_PATH . 'includes/EnqueueScripts.php';
106 - require_once B_BLOCKS_DIR_PATH . 'includes/Utils.php';
107 - require_once B_BLOCKS_DIR_PATH . 'includes/GetCSS.php';
108 - require_once B_BLOCKS_DIR_PATH . 'includes/Ajax.php';
109 - require_once B_BLOCKS_DIR_PATH . 'includes/posts/Posts.php';
110 - require_once B_BLOCKS_DIR_PATH . 'includes/Templates/Templates.php';
111 - require_once B_BLOCKS_DIR_PATH . 'includes/blocks/LoginForm.php';
112 - require_once B_BLOCKS_DIR_PATH . 'includes/blocks/cursor.php';
113 - require_once B_BLOCKS_DIR_PATH . 'includes/Ai.php';
114 - require_once B_BLOCKS_DIR_PATH . 'includes/ApiKeys.php';
115 - require_once B_BLOCKS_DIR_PATH . 'includes/blocks/form/FormHandler.php';
116 - // License Activation
117 - if ( file_exists( B_BLOCKS_DIR_PATH . 'includes/LicenseActivation.php' ) && B_BLOCKS_HAS_PRO ) {
118 - require_once B_BLOCKS_DIR_PATH . 'includes/LicenseActivation.php';
119 - }
120 - class BBlocks {
121 - protected static $_instance = null;
122 -
123 - function __construct() {
124 - add_action( 'init', [$this, 'onInit'] );
125 - add_action( 'wp_ajax_bBlocksPipeChecker', [$this, 'bBlocksPipeChecker'] );
126 - add_action( 'wp_ajax_nopriv_bBlocksPipeChecker', [$this, 'bBlocksPipeChecker'] );
127 - add_action( 'admin_init', [$this, 'registerSettings'] );
128 - add_action( 'rest_api_init', [$this, 'registerSettings'] );
129 - add_filter( 'block_categories_all', [$this, 'registerCategories'] );
130 - add_filter( 'upload_mimes', [$this, 'uploadMimes'] );
131 - add_filter(
132 - 'wp_check_filetype_and_ext',
133 - [$this, 'wpCheckFiletypeAndExt'],
134 - 10,
135 - 5
136 - );
137 - add_action( 'wp_ajax_b-blocks-enable-svg-mime-type', [$this, 'enableSvgMimeType'] );
138 - add_filter(
139 - 'plugin_row_meta',
140 - [$this, 'pluginRowMeta'],
141 - 10,
142 - 2
143 - );
144 - }
145 -
146 - function pluginRowMeta( $plugin_meta, $plugin_file ) {
147 - if ( strpos( $plugin_file, 'b-blocks' ) !== false && time() < strtotime( '2025-12-06' ) ) {
148 - $new_links = array(
149 - 'deal' => "<a href='https://bblockswp.com/pricing/?from=plugins.php' target='_blank' style='font-weight: 600; color: #ff7a00;'>🎉 Black Friday Sale - Get up to 40% OFF Now!</a>",
150 - );
151 - $plugin_meta = array_merge( $plugin_meta, $new_links );
152 - }
153 - return $plugin_meta;
154 - }
155 -
156 - public static function instance() {
157 - if ( self::$_instance === null ) {
158 - self::$_instance = new self();
159 - }
160 - return self::$_instance;
161 - }
162 -
163 - function bBlocksPipeChecker() {
164 - $nonce = sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ?? null ) );
165 - if ( !wp_verify_nonce( $nonce, 'wp_ajax' ) ) {
166 - wp_send_json_error( 'Invalid Request' );
167 - }
168 - wp_send_json_success( [
169 - 'isPipe' => BBlocks\Inc\Utils::isPro(),
170 - ] );
171 - }
172 -
173 - function onInit() {
174 - $disabledBlocks = get_option( 'bBlocksDisabledBlocks', [] );
175 - $disabledBlocks = ( is_array( $disabledBlocks ) ? $disabledBlocks : [] );
176 - $premiumBlocks = ( BBlocks\Inc\Utils::isPro() ? [] : [
177 - 'b-blocks/logo-slider',
178 - 'b-blocks/content-ticker',
179 - 'b-blocks/image-hotspot',
180 - 'b-blocks/stacked-cards'
181 - ] );
182 - // Add dependent blocks
183 - if ( in_array( 'b-blocks/row', $disabledBlocks ) && !in_array( 'b-blocks/column', $disabledBlocks ) ) {
184 - $disabledBlocks[] = 'b-blocks/column';
185 - }
186 - if ( in_array( 'b-blocks/services', $disabledBlocks ) && !in_array( 'b-blocks/service', $disabledBlocks ) ) {
187 - $disabledBlocks[] = 'b-blocks/service';
188 - }
189 - $blocks = [
190 - 'alert',
191 - 'advanced-image',
192 - 'animated-text',
193 - 'advanced-tabs',
194 - 'button',
195 - 'button-group',
196 - 'breadcrumb',
197 - 'cards',
198 - 'chart',
199 - 'column',
200 - 'container',
201 - 'content-ticker',
202 - 'countdown',
203 - 'counters',
204 - 'data-table',
205 - 'table-head',
206 - 'table-body',
207 - 'table-row',
208 - 'table-cell',
209 - 'table-footer',
210 - 'carousel',
211 - 'carousel-slide',
212 - 'dual-color-heading',
213 - 'emoji-stack-separator',
214 - 'facebook-embed',
215 - 'facebook-page',
216 - 'feature-boxes',
217 - 'flip-boxes',
218 - 'gif',
219 - 'form-builder',
220 - 'html',
221 - 'icon-box',
222 - 'image-comparison',
223 - 'image-gallery',
224 - 'image-hotspot',
225 - 'image-scroller',
226 - 'info-box',
227 - 'input-field',
228 - 'logo-slider',
229 - 'lottie-player',
230 - 'list',
231 - 'mailto',
232 - 'navigation',
233 - 'news-ticker',
234 - 'posts',
235 - 'price-lists',
236 - 'pricing-table',
237 - 'qr-code',
238 - 'row',
239 - 'section-heading',
240 - 'skill-bar',
241 - 'service',
242 - 'services',
243 - 'shape-divider',
244 - 'slider',
245 - 'scroll-to-top',
246 - 'social-share',
247 - 'whatsapp-chat',
248 - 'star-rating',
249 - 'stacked-cards',
250 - 'svg-draw',
251 - 'table-of-content',
252 - 'td-viewer',
253 - 'team-members',
254 - 'testimonials',
255 - 'toggle-content',
256 - 'accordion-block',
257 - 'video',
258 - 'text-path'
259 - ];
260 - foreach ( $blocks as $block ) {
261 - if ( !in_array( "b-blocks/{$block}", $disabledBlocks ) && !in_array( "b-blocks/{$block}", $premiumBlocks ) ) {
262 - register_block_type( __DIR__ . "/build/{$block}" );
263 - wp_deregister_script( "b-blocks-{$block}-editor-script" );
264 - }
265 - }
266 - }
267 -
268 - function registerSettings() {
269 - register_setting( 'bBlocksUtils', 'bBlocksUtils', [
270 - 'show_in_rest' => [
271 - 'name' => 'bBlocksUtils',
272 - 'schema' => [
273 - 'type' => 'string',
274 - ],
275 - ],
276 - 'type' => 'string',
277 - 'default' => wp_json_encode( [
278 - 'nonce' => wp_create_nonce( 'wp_ajax' ),
279 - ] ),
280 - 'sanitize_callback' => 'sanitize_text_field',
281 - ] );
282 - }
283 -
284 - function registerCategories( $categories ) {
285 - return array_merge( [[
286 - 'slug' => 'bBlocks',
287 - 'title' => __( 'bBlocks', 'b-blocks' ),
288 - ]], $categories );
289 - }
290 -
291 - // Register categories
292 - //Allow some additional file types for upload
293 - function uploadMimes( $mimes ) {
294 - $mimes['glb'] = 'model/gltf-binary';
295 - // 3D Viewer
296 - $mimes['gltf'] = 'model/gltf-binary';
297 - // 3D Viewer
298 - $mimes['json'] = 'application/json';
299 - // Lottie Player
300 - $mimes['lottie'] = 'application/json';
301 - // Lottie Player
302 - if ( get_transient( 'b-blocks-enable-svg-mime-type' ) === 'true' ) {
303 - $mimes['svg'] = 'image/svg+xml';
304 - }
305 - return $mimes;
306 - }
307 -
308 - function wpCheckFiletypeAndExt(
309 - $data,
310 - $file,
311 - $filename,
312 - $mimes,
313 - $real_mime = null
314 - ) {
315 - // If file extension is 2 or more
316 - $f_sp = explode( '.', $filename );
317 - $f_exp_count = count( $f_sp );
318 - if ( $f_exp_count <= 1 ) {
319 - return $data;
320 - } else {
321 - $f_name = $f_sp[0];
322 - $ext = $f_sp[$f_exp_count - 1];
323 - }
324 - if ( $ext == 'glb' || $ext == 'gltf' ) {
325 - // 3D Viewer
326 - $type = 'model/gltf-binary';
327 - $proper_filename = '';
328 - return compact( 'ext', 'type', 'proper_filename' );
329 - } else {
330 - if ( $ext == 'json' || $ext === 'lottie' ) {
331 - // Lottie Player
332 - $type = 'application/json';
333 - $proper_filename = '';
334 - return compact( 'ext', 'type', 'proper_filename' );
335 - } else {
336 - return $data;
337 - }
338 - }
339 - }
340 -
341 - public function enableSvgMimeType() {
342 - if ( !wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ?? null ) ), 'wp_ajax' ) ) {
343 - wp_send_json_error();
344 - }
345 - set_transient( 'b-blocks-enable-svg-mime-type', 'true', 80 );
346 - wp_send_json_success();
347 - }
348 -
349 - }
350 -
351 - BBlocks::instance();
352 -}
70 + // License Activation
71 + if (file_exists(B_BLOCKS_DIR_PATH . 'includes/LicenseActivation.php') && B_BLOCKS_HAS_PRO ) {
72 + require_once B_BLOCKS_DIR_PATH . 'includes/LicenseActivation.php';
73 + }
74 +}