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 +60 -205 1.4 → 2.1.8 View file →
@@ -1,219 +1,74 @@
1 1 <?php
2 2 /**
3 - * Plugin Name: B Blocks
3 + * Plugin Name: bBlocks
4 4 * Description: Gutenberg Blocks Collection and Page Builder.
5 - * Version: 1.4
6 - * Author: bPlugins LLC
7 - * Author URI: http://bplugins.com
8 - * License: GPLv3
9 - * License URI: https://www.gnu.org/licenses/gpl-2.0.txt
5 + * Version: 2.1.8
6 + * Author: bPlugins
7 + * Author URI: https://bplugins.com
8 + * License: GPLv3 or later
9 + * License URI: https://www.gnu.org/licenses/gpl-3.0.html
10 10 * Text Domain: b-blocks
11 - */
11 + */
12 12
13 13 // ABS PATH
14 -if ( !defined( 'ABSPATH' ) ) {
15 - exit;
14 +if (!defined('ABSPATH')) {
15 + exit;
16 16 }
17 17
18 -// Constant
19 -define( 'B_BLOCKS_PLUGIN_VERSION', '1.4' );
20 -define( "B_BLOCKS_ASSETS_DIR", plugin_dir_url( __FILE__ ) . 'assets/' );
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 + });
27 +} else {
21 28
22 -// Register Block Category
23 -function b_blocks_block_categories( $categories ) {
24 - return array_merge(
25 - array(
26 - array(
27 - 'slug' => 'bBlocks',
28 - 'title' => __( 'B Blocks', 'b-blocks' ),
29 - ),
30 - ),
31 - $categories
32 - );
33 -}
34 -add_filter( 'block_categories', 'b_blocks_block_categories' );
29 + define( 'B_BLOCKS_FILE', __FILE__ );
35 30
36 -// Register Blocks
37 -function b_blocks_wp_register_script( $block, $options = array() ) {
38 - register_block_type(
39 - 'b-blocks/' . $block,
40 - array_merge(
41 - array(
42 - 'editor_script' => 'b_blocks_editor_script',
43 - 'editor_style' => 'b_blocks_editor_style',
44 - 'script' => 'b_blocks_script',
45 - 'style' => 'b_blocks_style',
46 - ),
47 - $options
48 - )
49 - );
50 -}
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';
51 35
52 -// Enqueue assets
53 -function b_blocks_enqueue_block_assets() {
54 - wp_enqueue_style( 'bootstrap', B_BLOCKS_ASSETS_DIR . 'css/bootstrap.min.css', '', '4.6.0', 'all' );
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';
55 63
56 - wp_enqueue_script( 'bootstrap', B_BLOCKS_ASSETS_DIR . 'js/bootstrap.bundle.min.js', array( 'jquery' ), '4.6.0', true );
57 - wp_enqueue_script( 'mailtoui', B_BLOCKS_ASSETS_DIR . 'js/mailtoui-min.js', array(), B_BLOCKS_PLUGIN_VERSION, true );
58 -}
59 -add_action( 'enqueue_block_assets', 'b_blocks_enqueue_block_assets' );
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';
60 69
61 -function b_blocks_enqueue_assets() {
62 - wp_enqueue_style( 'fancybox', B_BLOCKS_ASSETS_DIR . 'css/fancybox.min.css', '', '3.5.6', 'all' );
63 -
64 - wp_enqueue_script( 'fancybox', B_BLOCKS_ASSETS_DIR . 'js/fancybox.min.js', array( 'jquery' ), '3.5.6', true );
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 + }
65 74 }
66 -add_action( 'wp_enqueue_scripts', 'b_blocks_enqueue_assets' );
67 -
68 -function b_blocks_register() {
69 - // Resister script in editor
70 - wp_register_script( 'b_blocks_editor_script', plugins_url( 'dist/editor.js', __FILE__ ), array( 'wp-blocks', 'wp-element', 'wp-data', 'wp-i18n', 'wp-editor', 'wp-components', 'wp-blob', 'wp-html-entities', 'wp-compose', 'wp-rich-text' ), null, false );
71 - // Register style in editor
72 - wp_register_style( 'b_blocks_editor_style', plugins_url( 'dist/editor.css', __FILE__ ), array( 'wp-edit-blocks', 'bootstrap' ), null );
73 -
74 - // Register script in frontend
75 - wp_register_script( 'b_blocks_script', plugins_url( 'dist/script.js', __FILE__ ), array( 'jquery', 'bootstrap', 'mailtoui' ), null, true );
76 - // Register style in frontend
77 - wp_register_style( 'b_blocks_style', plugins_url( 'dist/style.css', __FILE__ ), array( 'wp-editor', 'bootstrap' ), null );
78 -
79 - // Register Blocks
80 - b_blocks_wp_register_script( 'posts', array(
81 - 'render_callback' => 'render_b_blocks_posts',
82 - // 'attributes' => array(
83 - // 'postsPerPage' => array( 'type' => 'number', 'default' => 5 ),
84 - // ),
85 - ) );
86 - b_blocks_wp_register_script( 'slider' );
87 - b_blocks_wp_register_script( 'section' );
88 - b_blocks_wp_register_script( 'section-heading' );
89 - b_blocks_wp_register_script( 'image-gallery' );
90 - b_blocks_wp_register_script( 'image-comparison' );
91 - b_blocks_wp_register_script( 'flip-boxes' );
92 - b_blocks_wp_register_script( 'flip-box' );
93 - b_blocks_wp_register_script( 'team-members' );
94 - b_blocks_wp_register_script( 'team-member' );
95 - b_blocks_wp_register_script( 'price-lists' );
96 - b_blocks_wp_register_script( 'price-list' );
97 - b_blocks_wp_register_script( 'feature-boxes' );
98 - b_blocks_wp_register_script( 'feature-box' );
99 - b_blocks_wp_register_script( 'info-box' );
100 - b_blocks_wp_register_script( 'button-group' );
101 - b_blocks_wp_register_script( 'countdown' );
102 - b_blocks_wp_register_script( 'card' );
103 - b_blocks_wp_register_script( 'mailto' );
104 - b_blocks_wp_register_script( 'modal' );
105 - b_blocks_wp_register_script( 'tabs' );
106 - b_blocks_wp_register_script( 'accordion' );
107 - b_blocks_wp_register_script( 'note' );
108 - b_blocks_wp_register_script( 'gif' );
109 - b_blocks_wp_register_script( 'qr-code' );
110 - b_blocks_wp_register_script( 'highlight-text' );
111 - b_blocks_wp_register_script( 'progress-bar' );
112 - b_blocks_wp_register_script( 'spacer' );
113 - b_blocks_wp_register_script( 'selection' );
114 - b_blocks_wp_register_script( 'divider' );
115 - b_blocks_wp_register_script( 'to-top' );
116 -
117 - // WP Localized globals.
118 - wp_localize_script(
119 - 'b_blocks_editor_script',
120 - 'bBlocksAdmin', // Array containing dynamic data for a JS Global.
121 - array(
122 - 'pluginDirPath' => plugin_dir_path( __DIR__ ),
123 - 'pluginDirUrl' => plugin_dir_url( __DIR__ ),
124 - 'siteUrl' => get_site_url(),
125 - )
126 - );
127 -}
128 -add_action( 'init', 'b_blocks_register' );
129 -
130 -// After Setup Theme
131 -function b_blocks_after_setup_theme() {
132 - add_theme_support( 'align-wide' );
133 -
134 - add_image_size( 'b_blocks_large', 1200, 800, true );
135 - add_image_size( 'b_blocks_medium', 525, 350, true );
136 - add_image_size( 'b_blocks_square', 300, 300, true );
137 - add_image_size( 'b_blocks_thumbnail', 150, 100, true );
138 -}
139 -add_action( 'after_setup_theme', 'b_blocks_after_setup_theme' );
140 -
141 -// Posts Block.
142 -require_once plugin_dir_path( __FILE__ ) . 'inc/posts.php';
143 -
144 -// Post API update
145 -function b_blocks_custom_rest() {
146 - register_rest_field( 'post', 'wbImage', array(
147 - 'get_callback' => function ( $obj ) {
148 - $f_images = array();
149 - if ( !isset( $obj['featured_media'] ) ) {
150 - return $f_images;
151 - } else {
152 - $image = wp_get_attachment_image_src( $obj['featured_media'], 'full', false );
153 - if ( is_array( $image ) ) {
154 - $f_images['full'] = $image;
155 - $f_images['large'] = wp_get_attachment_image_src( $obj['featured_media'], 'b_blocks_large', false );
156 - $f_images['medium'] = wp_get_attachment_image_src( $obj['featured_media'], 'b_blocks_medium', false );
157 - $f_images['square'] = wp_get_attachment_image_src( $obj['featured_media'], 'b_blocks_square', false );
158 - $f_images['thumbnail'] = wp_get_attachment_image_src( $obj['featured_media'], 'b_blocks_thumbnail', false );
159 -
160 - return $f_images;
161 - }
162 - }
163 - },
164 - 'update_callback' => null,
165 - 'schema' => array(
166 - 'description' => __( 'Different sizes featured images', 'b-blocks' ),
167 - 'type' => 'array',
168 - ),
169 - ) );
170 -
171 - register_rest_field( 'post', 'wbAuthor', array(
172 - 'get_callback' => function ( $obj ) {
173 - $author['name'] = get_the_author_meta( 'display_name', isset( $obj['author'] ) ? $obj['author'] : '' );
174 - $author['link'] = get_author_posts_url( isset( $obj['author'] ) ? $obj['author'] : '' );
175 - return $author;
176 - },
177 - 'update_callback' => null,
178 - 'schema' => array(
179 - 'description' => __( 'Author name and link', 'b-blocks' ),
180 - 'type' => 'string',
181 - ),
182 - ) );
183 -
184 - register_rest_field( 'post', 'wbDate', array(
185 - 'get_callback' => function ( $obj ) {
186 - return get_the_date( 'M j, Y', $obj['id'] );
187 - },
188 - 'update_callback' => null,
189 - 'schema' => array(
190 - 'description' => __( 'Author name and link', 'b-blocks' ),
191 - 'type' => 'string',
192 - ),
193 - ) );
194 -
195 - register_rest_field( 'post', 'wbCategories', array(
196 - 'get_callback' => function ( $obj ) {
197 - $catsLink['space'] = get_the_category_list( esc_html__( ' ' ), '', $obj['id'] );
198 - $catsLink['coma'] = get_the_category_list( esc_html__( ', ' ), '', $obj['id'] );
199 - return $catsLink;
200 - },
201 - 'update_callback' => null,
202 - 'schema' => array(
203 - 'description' => __( 'Category link lists', 'b-blocks' ),
204 - 'type' => 'string',
205 - ),
206 - ) );
207 -
208 - register_rest_field( 'post', 'wbComment', array(
209 - 'get_callback' => function ( $obj ) {
210 - return wp_count_comments( $obj['id'] )->total_comments;
211 - },
212 - 'update_callback' => null,
213 - 'schema' => array(
214 - 'description' => __( 'Comment', 'b-blocks' ),
215 - 'type' => 'number',
216 - ),
217 - ) );
218 -}
219 -add_action( 'rest_api_init', 'b_blocks_custom_rest' );