PluginProbe
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites / 3.3.3
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites v3.3.3
4.1.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.1.2 2.5.0 2.5.3 2.6.1 All 38 releases
← All changes | inc/init.php +363 -252 2.6.13.3.3 View file →
@@ -1,280 +1,391 @@
1 1 <?php
2 -
3 - //Exit if directly acess
4 - defined('ABSPATH') or die('No script kiddies please!');
2 +//Exit if directly acess
3 +defined('ABSPATH') or die('No script kiddies please!');
5 4
6 - if(!class_exists('BlockspareInit')){
7 - class BlockspareInit{
8 - /**
9 - * Member Variable
10 - *
11 - * @var instance
12 - */
13 - private static $instance;
5 +if (!class_exists('BlockspareInit')) {
6 + class BlockspareInit
7 + {
8 + /**
9 + * Member Variable
10 + *
11 + * @var instance
12 + */
13 + private static $instance;
14 14
15 - /**
16 - * Initiator
17 - */
18 - public static function get_instance()
19 - {
20 - if (!isset(self::$instance))
21 - {
22 - self::$instance = new self();
23 - }
24 - return self::$instance;
15 + /**
16 + * Initiator
17 + */
18 + public static function get_instance()
19 + {
20 + if (!isset(self::$instance)) {
21 + self::$instance = new self();
22 + }
23 + return self::$instance;
24 + }
25 + public function __construct()
26 + {
27 + add_action('init', array($this, 'blockspare_blocks_block_assets'));
28 + add_action('enqueue_block_editor_assets', array($this, 'blockspare_create_block'));
29 + if (version_compare(get_bloginfo('version'), '5.8', '<')) {
30 + add_action('wp_enqueue_scripts', array($this, 'blockspare_load_scripts'));
31 + } else {
32 + add_action('enqueue_block_assets', array($this, 'blockspare_load_scripts'), 1);
33 + }
34 + add_action('plugins_loaded', array($this, 'blockspare_blocks_loader'));
35 + add_action('rest_api_init', array($this, 'blockspare_blocks_register_api_endpoints'));
36 + }
37 +
38 + public function blockspare_blocks_block_assets()
39 + {
40 + // wp_register_style(
41 + // 'fontawesome',
42 + // plugins_url('assets/fontawesome/css/all.css', dirname(__FILE__)),
43 + // array()
44 +
45 + // );
46 + // // Load the compiled styles.
47 + // wp_enqueue_style(
48 + // 'blockspare-frontend-block-style-css',
49 + // plugins_url('dist/style-blocks.css', dirname(__FILE__)),
50 + // array()
51 + // );
52 +
53 +
54 + // wp_register_style('slick', BLOCKSPARE_PLUGIN_URL . 'assets/slick/css/slick.css', array(), '', 'all');
55 + // if (is_admin()) {
56 + // wp_enqueue_style('slick');
57 + // }
58 +
59 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/accordion');
60 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/button');
61 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/call-to-action');
62 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/content-box');
63 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/container');
64 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/counter');
65 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/icon-set');
66 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/image-carousel');
67 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/linear-progressbar');
68 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/list');
69 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/logos');
70 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/image-masonry');
71 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/notice-bar');
72 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/price-list');
73 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/pricing-table');
74 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/social-links');
75 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/section-header');
76 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/services');
77 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/image-slider');
78 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/star-ratings');
79 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/testimonial');
80 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/user-profile');
81 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/shape-divider');
82 + register_block_type(BLOCKSPARE_PLUGIN_DIR . 'dist/blocks/empty-section');
83 +
84 + include BLOCKSPARE_PLUGIN_DIR . '/admin/notice-setup.php';
85 + include BLOCKSPARE_PLUGIN_DIR . '/admin/notice-upgrade.php';
86 + }
87 +
88 + public function blockspare_load_scripts()
89 + {
90 +
91 + wp_register_style(
92 + 'fontawesome',
93 + plugins_url('assets/fontawesome/css/all.css', dirname(__FILE__)),
94 + array()
95 +
96 + );
97 + // Load the compiled styles.
98 + wp_enqueue_style(
99 + 'blockspare-frontend-block-style-css',
100 + plugins_url('dist/style-blocks.css', dirname(__FILE__)),
101 + array()
102 + );
103 +
104 + wp_enqueue_style(
105 + 'blockspare-frontend-banner-style-css',
106 + plugins_url('dist/style-banner_group.css', dirname(__FILE__)),
107 + array()
108 + );
109 +
110 +
111 + wp_register_style('slick', BLOCKSPARE_PLUGIN_URL . 'assets/slick/css/slick.css', array(), '', 'all');
112 + if (is_admin()) {
113 + wp_enqueue_style('slick');
114 + }
115 +
116 + wp_enqueue_style('fontawesome');
117 + $min = (SCRIPT_DEBUG == true) ? '' : '.min';
118 + wp_register_script('slick', BLOCKSPARE_PLUGIN_URL . 'assets/slick/js/slick.js', array('jquery'), '', true);
119 + if (has_blocks() || has_block('blockspare/blockspare-carousel') || has_block('blockspare/blockspare-slider') || has_block('blockspare/latest-posts-block-carousel-grid') || has_block('blockspare/blockspare-posts-block-slider')) {
120 + wp_enqueue_script('slick');
121 + wp_enqueue_style('slick');
122 + }
123 +
124 + wp_register_script('countup', BLOCKSPARE_PLUGIN_URL . 'assets/js/countup/jquery.counterup.min.js', array('waypoint'), true);
125 + wp_enqueue_script('waypoint', BLOCKSPARE_PLUGIN_URL . 'assets/js/countup/waypoints.min.js', array('jquery'), '', true);
126 +
127 + if (has_blocks() || has_block('blockspare/blockspare-masonry')) {
128 + wp_enqueue_script('jquery-masonry');
129 + }
130 + wp_enqueue_script('blockspare-animation', BLOCKSPARE_PLUGIN_URL . 'dist/block_animation.js', array(), '', true);
131 + wp_enqueue_script('blockspare-script', BLOCKSPARE_PLUGIN_URL . 'dist/block_frontend.js', array('jquery', 'waypoint', 'countup'), '', true);
132 + if (has_blocks() || has_block('blockspare/blockspare-tabs')) {
133 +
134 + wp_enqueue_script('blockspare-tabs', BLOCKSPARE_PLUGIN_URL . 'dist/block_tabs.js', array('jquery'), '', true);
135 + }
136 + wp_register_script('blockspare-pagination-js', BLOCKSPARE_PLUGIN_URL . 'dist/block_pagination.js', array(), '', true);
137 + wp_localize_script('blockspare-pagination-js', 'blocsparePagination', array(
138 + 'ajaxurl' => admin_url('admin-ajax.php'),
139 + 'nonce' => wp_create_nonce('blockspare-load-more-nonce'),
140 + ));
141 + }
142 +
143 + public function blockspare_create_block()
144 + {
145 +
146 + $script_dep_path = BLOCKSPARE_BASE_DIR . 'dist/blocks.asset.php';
147 + $script_info = file_exists($script_dep_path) ? include $script_dep_path : array(
148 + 'dependencies' => array(),
149 + 'version' => BLOCKSPARE_VERSION,
150 + );
151 + if (version_compare(get_bloginfo('version'), '5.8', '<')) {
152 + $script_dep = array_merge($script_info['dependencies'], array(
153 + 'wp-blocks',
154 + 'wp-i18n',
155 + 'wp-element',
156 + 'wp-components',
157 + 'wp-editor',
158 + 'wp-api-fetch',
159 + ));
160 + } else {
161 + $script_dep = $script_info['dependencies'];
162 + }
163 +
164 + wp_enqueue_script(
165 + 'blockspare-blocks-block-js', // Handle.
166 + BLOCKSPARE_PLUGIN_URL . 'dist/blocks.js',
167 + $script_dep, // Dependencies, defined above.
168 + $script_info['version'], // AFT_PRICING_TABLE_VERSION.
169 + true
170 + // Enqueue the script in the footer.
171 + );
172 +
173 + wp_enqueue_script(
174 + 'blockspare-banner-group-js', // Handle.
175 + BLOCKSPARE_PLUGIN_URL . 'dist/banner_group.js',
176 + $script_dep, // Dependencies, defined above.
177 + $script_info['version'], // AFT_PRICING_TABLE_VERSION.
178 + true
179 + // Enqueue the script in the footer.
180 + );
181 +
182 +
183 +
184 + if (is_admin()):
185 + wp_enqueue_style('fontawesome');
186 + wp_enqueue_style(
187 + 'blockspare-block-edit-style',
188 + BLOCKSPARE_PLUGIN_URL . 'dist/blocks.css',
189 + array('wp-edit-blocks')
190 + );
191 + wp_enqueue_style(
192 + 'blockspare-banner-edit-style',
193 + BLOCKSPARE_PLUGIN_URL . 'dist/banner_group.css',
194 + array('wp-edit-blocks')
195 + );
196 +
197 + wp_enqueue_script('blockspare-design-btn', BLOCKSPARE_PLUGIN_URL . 'dist/block_design_btn.js', array('blockspare-blocks-block-js'), $script_info['version'], true);
198 + wp_enqueue_script('blockspare-design', BLOCKSPARE_PLUGIN_URL . 'dist/block_design.js', array('blockspare-blocks-block-js'), $script_info['version'], true);
199 + wp_enqueue_style('blockspare-design', BLOCKSPARE_PLUGIN_URL . 'dist/block_design.css', array('blockspare-block-edit-style'));
200 + endif;
201 +
202 + $blockspare_priview_img_url = BLOCKSPARE_PLUGIN_URL . 'assets/blockspare-placeholder-img.jpg';
203 + $blockspare_food_img_url = BLOCKSPARE_PLUGIN_URL . 'assets/blockspare-placeholder-img-square.jpg';
204 + $blockspare_dashboard_logo = BLOCKSPARE_PLUGIN_URL . 'assets/images/blockspare-logo.png';
205 + $taxonomies = get_categories();
206 + $txnm = array();
207 +
208 + foreach ($taxonomies as $type) {
209 +
210 + $txnm[] = array(
211 + 'label' => $type->name,
212 + 'value' => $type->term_id,
213 + );
214 + }
215 +
216 + $date = wp_kses_post(date_i18n(get_option('date_format')));
217 + $open_design = false;
218 + if (isset($_GET['blockspare_show_intro'])) {
219 + if ($_GET['blockspare_show_intro'] == 'true') {
220 + $open_design = true;
25 221 }
26 - public function __construct()
27 - {
28 - add_action('init', array($this, 'blockspare_blocks_block_assets' ));
29 - add_action('enqueue_block_editor_assets', array($this,'blockspare_create_block'));
30 - add_action('wp_enqueue_scripts', array($this,'blockspare_load_scripts'));
31 - add_action('plugins_loaded', array($this,'blockspare_blocks_loader'));
32 - add_action( 'rest_api_init', array($this,'blockspare_blocks_register_api_endpoints' ));
33 -
34 -
35 - }
222 + }
223 + $date_format = date_i18n(get_option('date_format'), current_time('timestamp'));
36 224
37 - function blockspare_blocks_block_assets(){
38 - wp_register_style(
39 - 'fontawesome',
40 - plugins_url('assets/fontawesome/css/all.css', dirname(__FILE__)),
41 - array()
42 -
43 - );
44 - // Load the compiled styles.
45 - wp_enqueue_style(
46 - 'blockspare-frontend-block-style-css',
47 - plugins_url('dist/style-blocks.css', dirname(__FILE__)),
48 - array()
49 - );
225 + $blockData = '';
226 + if (isset($_GET['blockspare_create_block'])) {
227 + $blockName = $_GET['blockspare_create_block'];
228 + $blocks_lists = array();
50 229
51 - wp_register_style('slick', BLOCKSPARE_PLUGIN_URL . 'assets/slick/css/slick.css', array(), '', 'all');
52 - if (is_admin()){
53 - wp_enqueue_style('slick');
54 - }
55 -
56 - include(BLOCKSPARE_PLUGIN_DIR . '/admin/notice-upgrade.php');
230 + $filterdata = apply_filters('blockspare_template_library', $blocks_lists);
231 +
232 + foreach ($filterdata as $block) {
233 + if (isset($block['key']) && $block['key'] === $blockName) {
234 + // Found the block with the desired key, retrieve the content
235 + $blockData = $block['content'];
236 + break; // Stop looping once the desired block is found
237 + }
57 238 }
239 + }
58 240
59 - function blockspare_load_scripts(){
60 - if(has_blocks()){
61 -
62 - wp_enqueue_style('fontawesome');
63 - $min = (SCRIPT_DEBUG == true) ? '' : '.min';
64 - wp_register_script('slick', BLOCKSPARE_PLUGIN_URL . 'assets/slick/js/slick.js', array('jquery'), '', true);
65 - if(has_block('blockspare/blockspare-carousel' )|| has_block('blockspare/blockspare-slider' ) || has_block('blockspare/latest-posts-block-carousel-grid') || has_block('blockspare/blockspare-posts-block-slider')){
66 - wp_enqueue_script('slick');
67 - wp_enqueue_style('slick');
68 -
69 - }
70 -
71 - wp_register_script('countup', BLOCKSPARE_PLUGIN_URL . 'assets/js/countup/jquery.counterup' . $min . '.js', array('waypoint'), true);
72 - wp_enqueue_script('waypoint', BLOCKSPARE_PLUGIN_URL . 'assets/js/countup/waypoints.min.js', array('jquery'), '', true);
73 -
74 - if(has_block('blockspare/blockspare-masonry')){
75 - wp_enqueue_script('jquery-masonry');
76 - }
77 - wp_enqueue_script('blockspare-animation', BLOCKSPARE_PLUGIN_URL . 'dist/block_animation.js', array(), '', true);
78 - wp_enqueue_script('blockspare-script', BLOCKSPARE_PLUGIN_URL . 'dist/block_frontend.js', array('jquery', 'waypoint', 'countup'), '', true);
79 - if(has_block('blockspare/blockspare-tabs')){
80 - wp_enqueue_script('blockspare-tabs', BLOCKSPARE_PLUGIN_URL . 'dist/block_tabs.js', array('jquery'), '', true);
81 - }
82 - wp_register_script('blockspare-pagination-js', BLOCKSPARE_PLUGIN_URL . 'dist/block_pagination.js', array(), '', true);
83 - wp_localize_script('blockspare-pagination-js', 'blocsparePagination',array(
84 - 'ajaxurl' => admin_url( 'admin-ajax.php' ),
85 - 'nonce'=>wp_create_nonce('blockspare-load-more-nonce')
86 - ));
87 - }
241 + global $pagenow;
242 + $loadscripton = true;
243 + if ($pagenow !== 'widgets.php' && !is_customize_preview()) {
244 + $loadscripton = false;
245 + }
246 + //$blockspare_current_wp_version = '6.5';
247 + $blockspare_current_wp_version = get_bloginfo('version');
88 248
89 -
90 - }
249 + wp_localize_script(
250 + 'blockspare-blocks-block-js',
251 + 'blockspare_globals',
252 + array(
253 + 'srcUrl' => untrailingslashit(plugins_url('/', BLOCKSPARE_BASE_DIR . '/dist/')),
254 + 'rest_url' => esc_url(rest_url()),
255 + 'img' => $blockspare_priview_img_url,
256 + 'homeUrl' => home_url(),
257 + 'blogUrl' => get_site_url(),
258 + 'menu_img_url' => $blockspare_food_img_url,
259 + 'logo' => $blockspare_dashboard_logo,
260 + 'postTypes' => $this->aft_get_post_types(),
261 + 'taxonomies' => $this->aft_get_taxonomies(),
262 + 'postQueryEndpoint' => 'aft/v1/post-query',
263 + 'config' => '',
264 + 'configuration' => '',
265 + 'settings' => '',
266 + 'bs_date' => $date,
267 + "imagePath" => "https://raw.githubusercontent.com/afthemes/blockspare-demo-data/master/blocks/",
268 + "open_design" => $open_design,
269 + 'date_format ' => $date_format,
270 + 'blockData' => $blockData,
271 + 'template_link' => admin_url('edit.php?post_type=bs_templates'),
272 + 'newTemlateUrl' => admin_url('post-new.php?post_type=bs_templates&blockspare_create_block&blockspare_show_intro=true'),
273 + 'loadscripton' => $loadscripton,
274 + 'wpversion' => (version_compare($blockspare_current_wp_version, '6.6') >= 0) ? 'true' : 'false',
275 + )
276 + );
277 + }
91 278
92 - function blockspare_create_block(){
279 + public function aft_get_post_types()
280 + {
281 + $args = array(
282 + 'public' => true,
283 + 'show_in_rest' => true,
284 + );
285 + $post_types = get_post_types($args, 'objects');
286 + $output = array();
287 + foreach ($post_types as $post_type) {
93 288
94 - $script_dep_path = BLOCKSPARE_BASE_DIR . 'dist/blocks.asset.php';
95 - $script_info = file_exists($script_dep_path) ? include $script_dep_path : array(
96 - 'dependencies' => array() ,
97 - 'version' => BLOCKSPARE_VERSION,
98 - );
99 - if (version_compare(get_bloginfo('version') , '5.8', '<'))
100 - {
101 - $script_dep = array_merge($script_info['dependencies'],array(
102 - 'wp-blocks',
103 - 'wp-i18n',
104 - 'wp-element',
105 - 'wp-components',
106 - 'wp-editor',
107 - 'wp-api-fetch'
108 - ));
109 - }
110 - else
111 - {
112 - $script_dep = $script_info['dependencies'];
113 - }
289 + if ('attachment' == $post_type->name) {
290 + continue;
291 + }
292 + $output[] = array(
293 + 'value' => $post_type->name,
294 + 'label' => $post_type->label,
295 + );
296 + }
114 297
115 - wp_enqueue_script('blockspare-blocks-block-js', // Handle.
116 - BLOCKSPARE_PLUGIN_URL . 'dist/blocks.js', $script_dep, // Dependencies, defined above.
117 - $script_info['version'], // AFT_PRICING_TABLE_VERSION.
118 - true
119 - // Enqueue the script in the footer.
120 - );
298 + return apply_filters('aft_blocks_post_types', $output);
299 + }
121 300
122 - if (is_admin()) :
123 - wp_enqueue_style('fontawesome');
124 - wp_enqueue_style(
125 - 'blockspare-block-edit-style',
126 - BLOCKSPARE_PLUGIN_URL . 'dist/blocks.css',
127 - array('wp-edit-blocks')
128 - );
129 - endif;
130 -
131 -
132 - $blockspare_priview_img_url = BLOCKSPARE_PLUGIN_URL . 'assets/blockspare-placeholder-img.jpg';
133 - $blockspare_food_img_url = BLOCKSPARE_PLUGIN_URL . 'assets/blockspare-placeholder-img-square.jpg';
134 -
135 - $taxonomies = get_categories();
136 - $txnm = array();
137 -
138 - foreach( $taxonomies as $type ) {
139 -
140 -
141 - $txnm[] = array(
142 - 'label' => $type->name,
143 - 'value' => $type->term_id,
144 - );
301 + public function aft_get_taxonomies()
302 + {
303 + $post_types = $this->aft_get_post_types();
304 + $output = array();
305 + foreach ($post_types as $key => $post_type) {
306 + $taxonomies = get_object_taxonomies($post_type['value'], 'objects');
307 + $taxs = array();
308 + foreach ($taxonomies as $term_slug => $term) {
309 + if (!$term->public || !$term->show_ui) {
310 + continue;
311 + }
312 + $taxs[$term_slug] = $term;
313 + $terms = get_terms($term_slug);
314 + $term_items = array();
315 + if (!empty($terms)) {
316 + foreach ($terms as $term_key => $term_item) {
317 + $term_items[] = array(
318 + 'value' => $term_item->term_id,
319 + 'label' => $term_item->name,
320 + );
145 321 }
146 -
147 - $date = wp_kses_post(date_i18n(get_option('date_format')));
148 - wp_localize_script(
149 - 'blockspare-blocks-block-js',
150 - 'blockspare_globals',
151 - array(
152 - 'srcUrl' => untrailingslashit(plugins_url('/', BLOCKSPARE_BASE_DIR . '/dist/')),
153 - 'rest_url' => esc_url(rest_url()),
154 - 'img' => $blockspare_priview_img_url,
155 - 'menu_img_url' => $blockspare_food_img_url,
156 - 'postTypes' => $this->aft_get_post_types(),
157 - 'taxonomies' => $this->aft_get_taxonomies(),
158 - 'postQueryEndpoint'=>'aft/v1/post-query',
159 - 'config' => '',
160 - 'configuration' => '',
161 - 'settings' => '',
162 - 'bs_date'=>$date,
163 - "imagePath"=> "https://templatespare.com/wp-content/uploads/blockspare/blocks/"
164 - )
165 - );
322 + $output[$post_type['value']]['terms'][$term_slug] = $term_items;
323 + }
166 324 }
325 + $output[$post_type['value']]['taxonomy'] = $taxs;
326 + }
167 327
168 - function aft_get_post_types(){
169 - $args = array(
170 - 'public' => true,
171 - 'show_in_rest' => true,
172 - );
173 - $post_types = get_post_types( $args, 'objects' );
174 - $output = array();
175 - foreach ( $post_types as $post_type ) {
176 -
177 - if ( 'attachment' == $post_type->name ) {
178 - continue;
179 - }
180 - $output[] = array(
181 - 'value' => $post_type->name,
182 - 'label' => $post_type->label,
183 - );
184 - }
328 + return apply_filters('aft_blocks_taxonomies', $output);
329 + }
185 330
186 - return apply_filters( 'aft_blocks_post_types', $output );
187 - }
331 + public function blockspare_blocks_loader()
332 + {
188 333
189 -
334 + if (PHP_VERSION_ID >= 50600) {
335 + require_once BLOCKSPARE_PLUGIN_DIR . 'inc/layout/class-image-importer.php';
336 + require_once BLOCKSPARE_PLUGIN_DIR . 'inc/layout/functions.php';
337 + require_once BLOCKSPARE_PLUGIN_DIR . 'inc/layout/registry.php';
338 + require_once BLOCKSPARE_PLUGIN_DIR . 'inc/layout/components.php';
190 339
191 - function aft_get_taxonomies() {
192 - $post_types = $this->aft_get_post_types();
193 - $output = array();
194 - foreach ( $post_types as $key => $post_type ) {
195 - $taxonomies = get_object_taxonomies( $post_type['value'], 'objects' );
196 - $taxs = array();
197 - foreach ( $taxonomies as $term_slug => $term ) {
198 - if ( ! $term->public || ! $term->show_ui ) {
199 - continue;
200 - }
201 - $taxs[ $term_slug ] = $term;
202 - $terms = get_terms( $term_slug );
203 - $term_items = array();
204 - if ( ! empty( $terms ) ) {
205 - foreach ( $terms as $term_key => $term_item ) {
206 - $term_items[] = array(
207 - 'value' => $term_item->term_id,
208 - 'label' => $term_item->name,
209 - );
210 - }
211 - $output[ $post_type['value'] ]['terms'][ $term_slug ] = $term_items;
212 - }
213 - }
214 - $output[ $post_type['value'] ]['taxonomy'] = $taxs;
215 - }
216 -
217 - return apply_filters( 'aft_blocks_taxonomies', $output );
218 - }
340 + /**
341 + * REST API Endpoints for Layouts.
342 + */
343 + require_once BLOCKSPARE_PLUGIN_DIR . 'inc/layout/endpoints.php';
344 + require_once BLOCKSPARE_PLUGIN_DIR . 'inc/layout/save-templates.php';
219 345
220 - function blockspare_blocks_loader(){
346 + /**
347 + * Import Pattern
348 + */
221 349
222 - if ( PHP_VERSION_ID >= 50600 ) {
223 - require_once BLOCKSPARE_PLUGIN_DIR . 'inc/layout/functions.php';
224 - require_once BLOCKSPARE_PLUGIN_DIR . 'inc/layout/registry.php';
225 - require_once BLOCKSPARE_PLUGIN_DIR . 'inc/layout/components.php';
226 -
227 - /**
228 - * REST API Endpoints for Layouts.
229 - */
230 - require_once BLOCKSPARE_PLUGIN_DIR . 'inc/layout/endpoints.php';
350 + // require_once BLOCKSPARE_PLUGIN_DIR . 'inc/pattern/pattern.php';
351 + }
231 352
232 - /**
233 - * Import Pattern
234 - */
353 + //Load Gutenberg Block php Files
354 + include BLOCKSPARE_PLUGIN_DIR . 'inc/other-block/date-time/index.php';
355 + include BLOCKSPARE_PLUGIN_DIR . '/inc/other-block/social-sharing/index.php';
356 + include BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-grid/index.php';
357 + include BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-list/index.php';
235 358
236 - //require_once BLOCKSPARE_PLUGIN_DIR . 'inc/pattern/pattern.php';
237 - }
238 -
239 - //Load Gutenberg Block php Files
240 - include(BLOCKSPARE_PLUGIN_DIR . 'inc/other-block/date-time/index.php');
241 - include(BLOCKSPARE_PLUGIN_DIR . '/inc/other-block/social-sharing/index.php');
242 - include(BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-grid/index.php');
243 - include(BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-list/index.php');
244 -
245 - include(BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-express-grid/index.php');
246 -
247 -
248 - include(BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-carousel-grid/index.php');
249 - include(BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-slider/index.php');
250 -
251 - include(BLOCKSPARE_PLUGIN_DIR . '/inc/post-banner/banner-1/index.php');
252 - include(BLOCKSPARE_PLUGIN_DIR . '/inc/post-banner/banner-2/index.php');
253 - include(BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/ajax-pagination.php');
254 - include(BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/class-post-rest-api.php');
255 - include(BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/class-multiauthor-backend.php');
256 - include(BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/class-multiauthor-frontend.php');
257 - include(BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/tax-category.php');
258 - include(BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/class-bs-post.php');
259 - include(BLOCKSPARE_PLUGIN_DIR . 'inc/block-banner/frontend-render/post-banner-config.php');
260 - include(BLOCKSPARE_PLUGIN_DIR . 'inc/block-banner/frontend-render/post-banner-style.php');
261 - include(BLOCKSPARE_PLUGIN_DIR . 'inc/other-block/search/index.php');
262 - include(BLOCKSPARE_PLUGIN_DIR . 'inc/latest-post-block/posts-flash/index.php');
263 - include(BLOCKSPARE_PLUGIN_DIR . 'inc/other-block/popular-tags/index.php');
264 - include(BLOCKSPARE_PLUGIN_DIR . 'inc/page-templates/module.php');
265 - }
359 + include BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-express-grid/index.php';
360 + include BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-express-grid/post-content.php';
266 361
267 - function blockspare_blocks_register_api_endpoints(){
268 -
269 - $posts_controller = new Aft_Post_Rest_Controller();
270 - $posts_controller->register_routes();
271 -
362 + include BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-carousel-grid/index.php';
363 + include BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-slider/index.php';
272 364
273 - }
365 + include BLOCKSPARE_PLUGIN_DIR . '/inc/post-banner/banner-1/index.php';
366 + include BLOCKSPARE_PLUGIN_DIR . '/inc/post-banner/banner-2/index.php';
367 + include BLOCKSPARE_PLUGIN_DIR . '/inc/post-banner/banner-9/index.php';
368 + include BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/ajax-pagination.php';
369 + include BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/class-post-rest-api.php';
370 + include BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/class-multiauthor-backend.php';
371 + include BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/class-multiauthor-frontend.php';
372 + include BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/tax-category.php';
373 + include BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/class-bs-post.php';
374 + include BLOCKSPARE_PLUGIN_DIR . 'inc/block-banner/frontend-render/post-banner-config.php';
375 + include BLOCKSPARE_PLUGIN_DIR . 'inc/block-banner/frontend-render/post-banner-style.php';
376 + include BLOCKSPARE_PLUGIN_DIR . 'inc/other-block/search/index.php';
377 + include BLOCKSPARE_PLUGIN_DIR . 'inc/latest-post-block/posts-flash/index.php';
378 + include BLOCKSPARE_PLUGIN_DIR . 'inc/other-block/popular-tags/index.php';
379 + include BLOCKSPARE_PLUGIN_DIR . 'inc/page-templates/module.php';
380 + include BLOCKSPARE_PLUGIN_DIR . 'inc/block-banner/frontend-render/post-category-style.php';
381 + }
274 382
383 + public function blockspare_blocks_register_api_endpoints()
384 + {
385 +
386 + $posts_controller = new Aft_Post_Rest_Controller();
387 + $posts_controller->register_routes();
275 388 }
276 - BlockspareInit::get_instance();
389 + }
390 + BlockspareInit::get_instance();
277 391 }
278 -
279 -
280 -