PluginProbe
bBlocks – Essential Gutenberg Blocks & Patterns Collection / 2.1.3
bBlocks – Essential Gutenberg Blocks & Patterns Collection v2.1.3
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 1.5.4 1.5.5 All 106 releases
b-blocks / plugin.php

plugin.php in bBlocks – Essential Gutenberg Blocks & Patterns Collection 2.1.3, at plugin.php

606 lines 25.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Plugin Name: bBlocks
5 * Description: Gutenberg Blocks Collection and Page Builder.
6 * Version: 2.1.3
7 * Author: bPlugins
8 * Author URI: https://bplugins.com
9 * License: GPLv3 or later
10 * License URI: https://www.gnu.org/licenses/gpl-3.0.html
11 * Text Domain: b-blocks
12 */
13 // ABS PATH
14 if ( !defined( 'ABSPATH' ) ) {
15 exit;
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 } );
26 } else {
27 // Constant. On a local dev host, use a changing version so the browser
28 // always loads freshly-built assets (no stale-bundle caching). Production
29 // keeps the real, stable version.
30 $bb_host = ( isset( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '' );
31 $bb_isLocal = $bb_host && (0 === strpos( $bb_host, 'localhost' ) || 0 === strpos( $bb_host, '127.0.0.1' ) || preg_match( '/\\.(local|test|ddev\\.site)(:\\d+)?$/', $bb_host ));
32 define( 'B_BLOCKS_VERSION', ( $bb_isLocal ? time() : '2.1.3' ) );
33 define( 'B_BLOCKS_DIR_PATH', plugin_dir_path( __FILE__ ) );
34 define( 'B_BLOCKS_DIR_URL', plugin_dir_url( __FILE__ ) );
35 define( 'B_BLOCKS_HAS_PRO', 'b-blocks-pro/plugin.php' === plugin_basename( __FILE__ ) );
36 define( 'B_BLOCKS_BUILD', B_BLOCKS_DIR_URL . 'build/' );
37 define( 'B_BLOCKS_ASSETS', B_BLOCKS_DIR_URL . 'assets/' );
38 if ( !function_exists( 'b_blocks_fs' ) ) {
39 // Create a helper function for easy SDK access.
40 function b_blocks_fs() {
41 global $b_blocks_fs;
42 if ( !isset( $b_blocks_fs ) ) {
43 // Include Freemius SDK.
44 require_once dirname( __FILE__ ) . '/freemius/start.php';
45 $b_blocks_fs = fs_dynamic_init( array(
46 'id' => '12845',
47 'slug' => 'b-blocks',
48 'premium_slug' => 'b-blocks-pro',
49 'type' => 'plugin',
50 'public_key' => 'pk_d6426b344df4918bc066a7a0b4719',
51 'is_premium' => false,
52 'premium_suffix' => 'Pro',
53 'has_addons' => false,
54 'has_paid_plans' => true,
55 'trial' => array(
56 'days' => 7,
57 'is_require_payment' => true,
58 ),
59 'menu' => array(
60 'slug' => 'b-blocks',
61 'first-path' => 'admin.php?page=b-blocks',
62 'contact' => false,
63 'support' => false,
64 ),
65 'is_live' => true,
66 'is_org_compliant' => true,
67 ) );
68 }
69 return $b_blocks_fs;
70 }
71
72 // Init Freemius.
73 b_blocks_fs();
74 // Signal that SDK was initiated.
75 do_action( 'b_blocks_fs_loaded' );
76 }
77 // Generate Styles
78 class BBlocksStyleGenerator {
79 public static $styles = [];
80
81 public static function addStyle( $selector, $styles ) {
82 if ( array_key_exists( $selector, self::$styles ) ) {
83 self::$styles[$selector] = wp_parse_args( self::$styles[$selector], $styles );
84 } else {
85 self::$styles[$selector] = $styles;
86 }
87 }
88
89 public static function renderStyle() {
90 $output = '';
91 foreach ( self::$styles as $selector => $style ) {
92 $new = '';
93 foreach ( $style as $property => $value ) {
94 if ( '' === $value ) {
95 $new .= "{$property} ;";
96 } else {
97 $new .= " {$property}: {$value};";
98 }
99 }
100 $output .= "{$selector} { {$new} }";
101 }
102 return $output;
103 }
104
105 }
106
107 // Require files
108 require_once B_BLOCKS_DIR_PATH . 'includes/Dashboard.php';
109 require_once B_BLOCKS_DIR_PATH . 'includes/EnqueueScripts.php';
110 require_once B_BLOCKS_DIR_PATH . 'includes/Utils.php';
111 require_once B_BLOCKS_DIR_PATH . 'includes/GetCSS.php';
112 require_once B_BLOCKS_DIR_PATH . 'includes/Ajax.php';
113 require_once B_BLOCKS_DIR_PATH . 'includes/posts/Posts.php';
114 require_once B_BLOCKS_DIR_PATH . 'includes/Templates/Templates.php';
115 require_once B_BLOCKS_DIR_PATH . 'includes/blocks/LoginForm.php';
116 require_once B_BLOCKS_DIR_PATH . 'includes/blocks/cursor.php';
117 require_once B_BLOCKS_DIR_PATH . 'includes/Ai.php';
118 require_once B_BLOCKS_DIR_PATH . 'includes/ApiKeys.php';
119 require_once B_BLOCKS_DIR_PATH . 'includes/blocks/OptinRateLimit.php';
120 require_once B_BLOCKS_DIR_PATH . 'includes/blocks/form/FormHandler.php';
121 require_once B_BLOCKS_DIR_PATH . 'includes/blocks/newsletter/NewsletterHandler.php';
122 // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/popup-optin/PopupOptinHandler.php';
123 // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/post-filter-grid/PostFilterGrid.php';
124 // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/post-masonry-grid/PostMasonryGrid.php';
125 // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/woo-add-to-cart/WooAddToCart.php';
126 // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/woo-best-sellers/WooBestSellers.php';
127 // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/woo-featured-product/WooFeaturedProduct.php';
128 // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/woo-mini-cart/WooMiniCart.php';
129 // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/woo-product-carousel/WooProductCarousel.php';
130 // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/woo-product-grid/WooProductGrid.php';
131 // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/woo-product-reviews/WooProductReviews.php';
132 // require_once B_BLOCKS_DIR_PATH . 'includes/blocks/woo-single-product/WooSingleProduct.php';
133 // License Activation
134 if ( file_exists( B_BLOCKS_DIR_PATH . 'includes/LicenseActivation.php' ) && B_BLOCKS_HAS_PRO ) {
135 require_once B_BLOCKS_DIR_PATH . 'includes/LicenseActivation.php';
136 }
137 class BBlocks {
138 protected static $_instance = null;
139
140 function __construct() {
141 add_action( 'init', [$this, 'onInit'] );
142 add_action( 'wp_ajax_bBlocksPipeChecker', [$this, 'bBlocksPipeChecker'] );
143 add_action( 'wp_ajax_nopriv_bBlocksPipeChecker', [$this, 'bBlocksPipeChecker'] );
144 add_action( 'admin_init', [$this, 'registerSettings'] );
145 add_action( 'rest_api_init', [$this, 'registerSettings'] );
146 add_filter( 'block_categories_all', [$this, 'registerCategories'] );
147 add_filter( 'upload_mimes', [$this, 'uploadMimes'] );
148 add_filter(
149 'wp_check_filetype_and_ext',
150 [$this, 'wpCheckFiletypeAndExt'],
151 10,
152 5
153 );
154 add_action( 'wp_ajax_b-blocks-enable-svg-mime-type', [$this, 'enableSvgMimeType'] );
155 add_filter(
156 'plugin_row_meta',
157 [$this, 'pluginRowMeta'],
158 10,
159 2
160 );
161 }
162
163 function pluginRowMeta( $plugin_meta, $plugin_file ) {
164 return $plugin_meta;
165 }
166
167 public static function instance() {
168 if ( self::$_instance === null ) {
169 self::$_instance = new self();
170 }
171 return self::$_instance;
172 }
173
174 function bBlocksPipeChecker() {
175 $nonce = sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ?? null ) );
176 if ( !wp_verify_nonce( $nonce, 'wp_ajax' ) ) {
177 wp_send_json_error( 'Invalid Request' );
178 }
179 wp_send_json_success( [
180 'isPipe' => BBlocks\Inc\Utils::isPro(),
181 ] );
182 }
183
184 function onInit() {
185 $disabledBlocks = get_option( 'bBlocksDisabledBlocks', [] );
186 $disabledBlocks = ( is_array( $disabledBlocks ) ? $disabledBlocks : [] );
187 $premiumBlocks = ( BBlocks\Inc\Utils::isPro() ? [] : [
188 'b-blocks/logo-slider',
189 'b-blocks/content-ticker',
190 'b-blocks/image-hotspot',
191 'b-blocks/stacked-cards',
192 'b-blocks/key-takeaways',
193 'b-blocks/stat-cards',
194 'b-blocks/article-card',
195 'b-blocks/event-card',
196 'b-blocks/file-download-card'
197 ] );
198 // Add dependent blocks
199 if ( in_array( 'b-blocks/row', $disabledBlocks ) && !in_array( 'b-blocks/column', $disabledBlocks ) ) {
200 $disabledBlocks[] = 'b-blocks/column';
201 }
202 if ( in_array( 'b-blocks/services', $disabledBlocks ) && !in_array( 'b-blocks/service', $disabledBlocks ) ) {
203 $disabledBlocks[] = 'b-blocks/service';
204 }
205 $blocks = [
206 'alert',
207 // 'anchor-nav',
208 'advanced-image',
209 'animated-text',
210 'advanced-tabs',
211 'article-card',
212 'audio-player',
213 // 'author-box',
214 'blockquote',
215 'button',
216 'button-group',
217 'breadcrumb',
218 // 'business-hours',
219 // 'call-to-action',
220 // 'callout',
221 'cards',
222 'chart',
223 'column',
224 'container',
225 'content-ticker',
226 'countdown',
227 'counters',
228 'data-table',
229 'table-head',
230 'table-body',
231 'table-row',
232 'table-cell',
233 'table-footer',
234 'carousel',
235 'carousel-slide',
236 // 'click-to-share',
237 // 'code-highlight',
238 'comparison-table',
239 // 'contact-card',
240 // 'content-filter',
241 // 'content-filter-item',
242 // 'cookie-consent-bar',
243 // 'coupon-code',
244 'divider',
245 'dual-color-heading',
246 'emoji-stack-separator',
247 'event-card',
248 'expand-content',
249 'facebook-embed',
250 'facebook-page',
251 // 'faq-block',
252 'feature-boxes',
253 // 'feature-tabs',
254 'file-download-card',
255 'flip-boxes',
256 // 'floating-cta',
257 'gif',
258 'form-builder',
259 'google-map',
260 'hero-section',
261 // 'howto-schema',
262 'html',
263 // 'icon',
264 'icon-box',
265 // 'icon-list',
266 // 'image-accordion',
267 // 'image-box',
268 'image-comparison',
269 'image-gallery',
270 'image-hotspot',
271 // 'image-mask',
272 'image-scroller',
273 // 'image-slider',
274 'info-box',
275 'input-field',
276 'interactive-checklist',
277 'key-takeaways',
278 // 'logo-grid',
279 'logo-slider',
280 'lottie-player',
281 'list',
282 'mailto',
283 // 'marquee',
284 'media-text-section',
285 // 'milestone-timeline',
286 // 'modal-popup',
287 'navigation',
288 'news-ticker',
289 // 'newsletter-optin',
290 // 'notification-bar',
291 'off-canvas',
292 // 'parallax-section',
293 // 'pdf-embed',
294 // 'popup-optin',
295 // 'portfolio-gallery',
296 // 'post-carousel',
297 // 'post-filter-grid',
298 // 'post-masonry-grid',
299 // 'post-navigation',
300 // 'post-timeline',
301 'posts',
302 'price-lists',
303 'pricing-table',
304 // 'pricing-toggle',
305 'process-steps',
306 // 'progress-bar',
307 // 'progress-circle',
308 // 'promo-strip',
309 'qr-code',
310 // 'reading-progress',
311 // 'review-box',
312 'row',
313 'section-heading',
314 'skill-bar',
315 'service',
316 'services',
317 'shape-divider',
318 'slider',
319 // 'scroll-reveal',
320 'scroll-to-top',
321 // 'search-bar',
322 'social-share',
323 // 'social-share-bar',
324 'whatsapp-chat',
325 // 'woo-add-to-cart',
326 // 'woo-best-sellers',
327 // 'woo-category-grid',
328 // 'woo-featured-product',
329 // 'woo-mini-cart',
330 // 'woo-product-carousel',
331 // 'woo-product-filter',
332 // 'woo-product-grid',
333 // 'woo-product-reviews',
334 // 'woo-sale-badge',
335 // 'woo-single-product',
336 'star-rating',
337 'stacked-cards',
338 'stat-cards',
339 // 'sticky-sidebar',
340 'svg-draw',
341 'table-of-content',
342 // 'taxonomy-grid',
343 'td-viewer',
344 'team-members',
345 // 'testimonial-card',
346 // 'testimonial-slider',
347 'testimonials',
348 // 'testimonials-grid',
349 'timeline',
350 'timeline-item',
351 'toggle-content',
352 'accordion-block',
353 'video',
354 // 'video-popup',
355 'text-path',
356 ];
357 foreach ( $blocks as $block ) {
358 if ( !in_array( "b-blocks/{$block}", $disabledBlocks ) && !in_array( "b-blocks/{$block}", $premiumBlocks ) ) {
359 $registered = register_block_type( __DIR__ . "/build/{$block}" );
360 // Every block shares one editor bundle, so the per-block
361 // handle is dropped to keep it from being loaded again.
362 // The handle WordPress generates comes from the block's
363 // NAME, which is not always its directory — data-table is
364 // registered as b-blocks/table — so deriving it from the
365 // directory silently misses those and the bundle runs
366 // twice, re-registering every inline format.
367 $name = ( $registered instanceof WP_Block_Type ? $registered->name : "b-blocks/{$block}" );
368 wp_deregister_script( generate_block_asset_handle( $name, 'editorScript' ) );
369 }
370 }
371 // The newsletter-optin view.js uses @wordpress/i18n – register translations
372 // for the auto-generated view-script handle so frontend error/success strings
373 // are translatable. The handle is derived from the block name by WordPress core.
374 // if ( ! in_array( 'b-blocks/newsletter-optin', $disabledBlocks ) ) {
375 // wp_set_script_translations(
376 // 'b-blocks-newsletter-optin-view-script',
377 // 'b-blocks',
378 // B_BLOCKS_DIR_PATH . 'languages'
379 // );
380 // }
381 // The popup-optin view.js imports @wordpress/i18n for frontend
382 // validation / status strings, so its view-script handle needs
383 // translations registered.
384 // if ( ! in_array( 'b-blocks/popup-optin', $disabledBlocks ) ) {
385 // wp_set_script_translations(
386 // 'b-blocks-popup-optin-view-script',
387 // 'b-blocks',
388 // B_BLOCKS_DIR_PATH . 'languages'
389 // );
390 // }
391 // The floating-cta view.js imports @wordpress/i18n (__('Button') and __('Dismiss'))
392 // so its view-script handle also needs translations registered.
393 // if ( ! in_array( 'b-blocks/floating-cta', $disabledBlocks ) ) {
394 // wp_set_script_translations(
395 // 'b-blocks-floating-cta-view-script',
396 // 'b-blocks',
397 // B_BLOCKS_DIR_PATH . 'languages'
398 // );
399 // }
400 // The image-slider view.js imports @wordpress/i18n for lightbox aria-labels
401 // so its view-script handle needs translations registered.
402 // if ( ! in_array( 'b-blocks/image-slider', $disabledBlocks ) ) {
403 // wp_set_script_translations(
404 // 'b-blocks-image-slider-view-script',
405 // 'b-blocks',
406 // B_BLOCKS_DIR_PATH . 'languages'
407 // );
408 // }
409 // The testimonial-slider view.js imports @wordpress/i18n for the
410 // play/pause toggle aria-labels, so its view-script handle needs
411 // translations registered.
412 // if ( ! in_array( 'b-blocks/testimonial-slider', $disabledBlocks ) ) {
413 // wp_set_script_translations(
414 // 'b-blocks-testimonial-slider-view-script',
415 // 'b-blocks',
416 // B_BLOCKS_DIR_PATH . 'languages'
417 // );
418 // }
419 // The post-filter-grid view.js imports @wordpress/i18n for the
420 // aria-live status announcements, so its view-script handle needs
421 // translations registered.
422 // if ( ! in_array( 'b-blocks/post-filter-grid', $disabledBlocks ) ) {
423 // wp_set_script_translations(
424 // 'b-blocks-post-filter-grid-view-script',
425 // 'b-blocks',
426 // B_BLOCKS_DIR_PATH . 'languages'
427 // );
428 // }
429 // The post-masonry-grid view.js imports @wordpress/i18n for the
430 // aria-live status announcements, so its view-script handle needs
431 // translations registered.
432 // if ( ! in_array( 'b-blocks/post-masonry-grid', $disabledBlocks ) ) {
433 // wp_set_script_translations(
434 // 'b-blocks-post-masonry-grid-view-script',
435 // 'b-blocks',
436 // B_BLOCKS_DIR_PATH . 'languages'
437 // );
438 // }
439 // The woo-add-to-cart view.js uses @wordpress/i18n for the aria-live
440 // add-to-cart status announcements, so its view-script handle needs
441 // translations registered.
442 // if ( ! in_array( 'b-blocks/woo-add-to-cart', $disabledBlocks ) ) {
443 // wp_set_script_translations(
444 // 'b-blocks-woo-add-to-cart-view-script',
445 // 'b-blocks',
446 // B_BLOCKS_DIR_PATH . 'languages'
447 // );
448 // }
449 // The woo-mini-cart view.js uses @wordpress/i18n for the cart
450 // aria-label and aria-live announcements, so its view-script
451 // handle needs translations registered.
452 // if ( ! in_array( 'b-blocks/woo-mini-cart', $disabledBlocks ) ) {
453 // wp_set_script_translations(
454 // 'b-blocks-woo-mini-cart-view-script',
455 // 'b-blocks',
456 // B_BLOCKS_DIR_PATH . 'languages'
457 // );
458 // }
459 // The woo-best-sellers view.js imports @wordpress/i18n for the
460 // aria-live add-to-cart status announcements ("added to cart",
461 // error messages), so its view-script handle needs translations
462 // registered.
463 // if ( ! in_array( 'b-blocks/woo-best-sellers', $disabledBlocks ) ) {
464 // wp_set_script_translations(
465 // 'b-blocks-woo-best-sellers-view-script',
466 // 'b-blocks',
467 // B_BLOCKS_DIR_PATH . 'languages'
468 // );
469 // }
470 // The woo-featured-product view.js uses @wordpress/i18n for the
471 // aria-live add-to-cart status announcements, so its view-script
472 // handle needs translations registered.
473 // if ( ! in_array( 'b-blocks/woo-featured-product', $disabledBlocks ) ) {
474 // wp_set_script_translations(
475 // 'b-blocks-woo-featured-product-view-script',
476 // 'b-blocks',
477 // B_BLOCKS_DIR_PATH . 'languages'
478 // );
479 // }
480 // The woo-product-grid view.js uses @wordpress/i18n for the aria-live
481 // add-to-cart status announcements, so its view-script handle needs
482 // translations registered.
483 // if ( ! in_array( 'b-blocks/woo-product-grid', $disabledBlocks ) ) {
484 // wp_set_script_translations(
485 // 'b-blocks-woo-product-grid-view-script',
486 // 'b-blocks',
487 // B_BLOCKS_DIR_PATH . 'languages'
488 // );
489 // }
490 // The woo-product-carousel view.js uses @wordpress/i18n for slide
491 // aria-live announcements and the add-to-cart status region, so its
492 // view-script handle needs translations registered.
493 // if ( ! in_array( 'b-blocks/woo-product-carousel', $disabledBlocks ) ) {
494 // wp_set_script_translations(
495 // 'b-blocks-woo-product-carousel-view-script',
496 // 'b-blocks',
497 // B_BLOCKS_DIR_PATH . 'languages'
498 // );
499 // }
500 // The sticky-sidebar view.js uses @wordpress/i18n for the scrollable
501 // sidebar aria-label, so its view-script handle needs translations registered.
502 // if ( ! in_array( 'b-blocks/sticky-sidebar', $disabledBlocks ) ) {
503 // wp_set_script_translations(
504 // 'b-blocks-sticky-sidebar-view-script',
505 // 'b-blocks',
506 // B_BLOCKS_DIR_PATH . 'languages'
507 // );
508 // }
509 // The search-bar view.js imports @wordpress/i18n for the live-search
510 // no-results / aria-live result-count strings, so its view-script
511 // handle needs translations registered.
512 // if ( ! in_array( 'b-blocks/search-bar', $disabledBlocks ) ) {
513 // wp_set_script_translations(
514 // 'b-blocks-search-bar-view-script',
515 // 'b-blocks',
516 // B_BLOCKS_DIR_PATH . 'languages'
517 // );
518 // }
519 }
520
521 function registerSettings() {
522 register_setting( 'bBlocksUtils', 'bBlocksUtils', [
523 'show_in_rest' => [
524 'name' => 'bBlocksUtils',
525 'schema' => [
526 'type' => 'string',
527 ],
528 ],
529 'type' => 'string',
530 'default' => wp_json_encode( [
531 'nonce' => wp_create_nonce( 'wp_ajax' ),
532 ] ),
533 'sanitize_callback' => 'sanitize_text_field',
534 ] );
535 }
536
537 function registerCategories( $categories ) {
538 return array_merge( [[
539 'slug' => 'bBlocks',
540 'title' => __( 'bBlocks', 'b-blocks' ),
541 ]], $categories );
542 }
543
544 // Register categories
545 //Allow some additional file types for upload
546 function uploadMimes( $mimes ) {
547 $mimes['glb'] = 'model/gltf-binary';
548 // 3D Viewer
549 $mimes['gltf'] = 'model/gltf-binary';
550 // 3D Viewer
551 $mimes['json'] = 'application/json';
552 // Lottie Player
553 $mimes['lottie'] = 'application/json';
554 // Lottie Player
555 if ( get_transient( 'b-blocks-enable-svg-mime-type' ) === 'true' ) {
556 $mimes['svg'] = 'image/svg+xml';
557 }
558 return $mimes;
559 }
560
561 function wpCheckFiletypeAndExt(
562 $data,
563 $file,
564 $filename,
565 $mimes,
566 $real_mime = null
567 ) {
568 // If file extension is 2 or more
569 $f_sp = explode( '.', $filename );
570 $f_exp_count = count( $f_sp );
571 if ( $f_exp_count <= 1 ) {
572 return $data;
573 } else {
574 $f_name = $f_sp[0];
575 $ext = $f_sp[$f_exp_count - 1];
576 }
577 if ( 'glb' === $ext || 'gltf' === $ext ) {
578 // 3D Viewer
579 $type = 'model/gltf-binary';
580 $proper_filename = '';
581 return compact( 'ext', 'type', 'proper_filename' );
582 } elseif ( 'json' === $ext || 'lottie' === $ext ) {
583 // Lottie Player
584 $type = 'application/json';
585 $proper_filename = '';
586 return compact( 'ext', 'type', 'proper_filename' );
587 } else {
588 return $data;
589 }
590 }
591
592 public function enableSvgMimeType() {
593 if ( !wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wpnonce'] ?? null ) ), 'wp_ajax' ) ) {
594 wp_send_json_error();
595 }
596 if ( !current_user_can( 'manage_options' ) ) {
597 wp_send_json_error();
598 }
599 set_transient( 'b-blocks-enable-svg-mime-type', 'true', 80 );
600 wp_send_json_success();
601 }
602
603 }
604
605 BBlocks::instance();
606 }