PluginProbe
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites / 2.7.1
BlockSpare – Gutenberg Blocks for News, Magazine, Blog & Business Websites v2.7.1
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 +93 -21 2.5.32.7.1 View file →
@@ -26,9 +26,13 @@
26 26 public function __construct()
27 27 {
28 28 add_action('init', array($this, 'blockspare_blocks_block_assets' ));
29 29 add_action('enqueue_block_editor_assets', array($this,'blockspare_create_block'));
30 - add_action('wp_enqueue_scripts', array($this,'blockspare_load_scripts'));
30 + if (version_compare(get_bloginfo('version') , '5.8', '<')) {
31 + add_action('wp_enqueue_scripts', array($this,'blockspare_load_scripts'));
32 + }else{
33 + add_action('enqueue_block_assets', array($this,'blockspare_load_scripts'));
34 + }
31 35 add_action('plugins_loaded', array($this,'blockspare_blocks_loader'));
32 36 add_action( 'rest_api_init', array($this,'blockspare_blocks_register_api_endpoints' ));
33 37
34 38
@@ -34,12 +38,13 @@
34 38
35 39 }
36 40
37 41 function blockspare_blocks_block_assets(){
38 - wp_enqueue_style(
39 - 'blockspare-blocks-fontawesome-front',
42 + wp_register_style(
43 + 'fontawesome',
40 44 plugins_url('assets/fontawesome/css/all.css', dirname(__FILE__)),
41 45 array()
46 +
42 47 );
43 48 // Load the compiled styles.
44 49 wp_enqueue_style(
45 50 'blockspare-frontend-block-style-css',
@@ -45,28 +50,66 @@
45 50 'blockspare-frontend-block-style-css',
46 51 plugins_url('dist/style-blocks.css', dirname(__FILE__)),
47 52 array()
48 53 );
49 -
50 -
51 - wp_enqueue_style('slick-css', BLOCKSPARE_PLUGIN_URL . 'assets/slick/css/slick.css', array(), '', 'all');
54 +
55 + wp_register_style('slick', BLOCKSPARE_PLUGIN_URL . 'assets/slick/css/slick.css', array(), '', 'all');
56 + if (is_admin()){
57 + wp_enqueue_style('slick');
58 + }
59 +
60 + include(BLOCKSPARE_PLUGIN_DIR . '/admin/notice-upgrade.php');
52 61 }
53 62
54 63 function blockspare_load_scripts(){
55 - $min = (SCRIPT_DEBUG == true) ? '' : '.min';
56 - wp_enqueue_script('slick-js', BLOCKSPARE_PLUGIN_URL . 'assets/slick/js/slick.js', array('jquery'), '', true);
57 - wp_register_script('countup', BLOCKSPARE_PLUGIN_URL . 'assets/js/countup/jquery.counterup' . $min . '.js', array('waypoint'), true);
58 - wp_enqueue_script('waypoint', BLOCKSPARE_PLUGIN_URL . 'assets/js/countup/waypoints.min.js', array('jquery'), '', true);
59 - wp_enqueue_script('jquery-masonry');
60 - wp_enqueue_script('blockspare-animation', BLOCKSPARE_PLUGIN_URL . 'dist/block_animation.js', array(), '', true);
61 - wp_enqueue_script('blockspare-script', BLOCKSPARE_PLUGIN_URL . 'dist/block_frontend.js', array('jquery', 'waypoint', 'countup'), '', true);
62 - wp_enqueue_script('blockspare-tabs', BLOCKSPARE_PLUGIN_URL . 'dist/block_tabs.js', array('jquery'), '', true);
63 - wp_enqueue_script('blockspare-pagination-js', BLOCKSPARE_PLUGIN_URL . 'dist/block_pagination.js', array(), '', true);
64 64
65 - wp_localize_script('blockspare-pagination-js', 'blocsparePagination',array(
66 - 'ajaxurl' => admin_url( 'admin-ajax.php' ),
67 - 'nonce'=>wp_create_nonce('blockspare-load-more-nonce')
68 - ));
65 + wp_register_style(
66 + 'fontawesome',
67 + plugins_url('assets/fontawesome/css/all.css', dirname(__FILE__)),
68 + array()
69 +
70 + );
71 + // Load the compiled styles.
72 + wp_enqueue_style(
73 + 'blockspare-frontend-block-style-css',
74 + plugins_url('dist/style-blocks.css', dirname(__FILE__)),
75 + array()
76 + );
77 +
78 + wp_register_style('slick', BLOCKSPARE_PLUGIN_URL . 'assets/slick/css/slick.css', array(), '', 'all');
79 + if (is_admin()){
80 + wp_enqueue_style('slick');
81 + }
82 + //if(has_blocks()){
83 +
84 + wp_enqueue_style('fontawesome');
85 + $min = (SCRIPT_DEBUG == true) ? '' : '.min';
86 + wp_register_script('slick', BLOCKSPARE_PLUGIN_URL . 'assets/slick/js/slick.js', array('jquery'), '', true);
87 + 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')){
88 + wp_enqueue_script('slick');
89 + wp_enqueue_style('slick');
90 +
91 + }
92 +
93 + wp_register_script('countup', BLOCKSPARE_PLUGIN_URL . 'assets/js/countup/jquery.counterup' . $min . '.js', array('waypoint'), true);
94 + wp_enqueue_script('waypoint', BLOCKSPARE_PLUGIN_URL . 'assets/js/countup/waypoints.min.js', array('jquery'), '', true);
95 +
96 + if(has_block('blockspare/blockspare-masonry')){
97 + wp_enqueue_script('jquery-masonry');
98 + }
99 + wp_enqueue_script('blockspare-animation', BLOCKSPARE_PLUGIN_URL . 'dist/block_animation.js', array(), '', true);
100 + wp_enqueue_script('blockspare-script', BLOCKSPARE_PLUGIN_URL . 'dist/block_frontend.js', array('jquery', 'waypoint', 'countup'), '', true);
101 + if(has_block('blockspare/blockspare-tabs')){
102 + wp_enqueue_script('blockspare-tabs', BLOCKSPARE_PLUGIN_URL . 'dist/block_tabs.js', array('jquery'), '', true);
103 + }
104 + wp_register_script('blockspare-pagination-js', BLOCKSPARE_PLUGIN_URL . 'dist/block_pagination.js', array(), '', true);
105 + wp_localize_script('blockspare-pagination-js', 'blocsparePagination',array(
106 + 'ajaxurl' => admin_url( 'admin-ajax.php' ),
107 + 'nonce'=>wp_create_nonce('blockspare-load-more-nonce')
108 + ));
109 + //}
110 +
111 +
69 112 }
70 113
71 114 function blockspare_create_block(){
72 115
@@ -98,19 +141,23 @@
98 141 // Enqueue the script in the footer.
99 142 );
100 143
101 144 if (is_admin()) :
145 + wp_enqueue_style('fontawesome');
102 146 wp_enqueue_style(
103 147 'blockspare-block-edit-style',
104 148 BLOCKSPARE_PLUGIN_URL . 'dist/blocks.css',
105 149 array('wp-edit-blocks')
106 150 );
151 + wp_enqueue_script('blockspare-design-btn', BLOCKSPARE_PLUGIN_URL.'dist/block_design_btn.js',array( 'blockspare-blocks-block-js'), $script_info['version'], true);
152 + wp_enqueue_script('blockspare-design', BLOCKSPARE_PLUGIN_URL.'dist/block_design.js',array( 'blockspare-blocks-block-js'), $script_info['version'], true);
153 + wp_enqueue_style('blockspare-design', BLOCKSPARE_PLUGIN_URL.'dist/block_design.css',array( 'blockspare-block-edit-style'));
107 154 endif;
108 155
109 156
110 157 $blockspare_priview_img_url = BLOCKSPARE_PLUGIN_URL . 'assets/blockspare-placeholder-img.jpg';
111 158 $blockspare_food_img_url = BLOCKSPARE_PLUGIN_URL . 'assets/blockspare-placeholder-img-square.jpg';
112 -
159 + $blockspare_dashboard_logo = BLOCKSPARE_PLUGIN_URL . 'assets/images/blockspare-logo.png';
113 160 $taxonomies = get_categories();
114 161 $txnm = array();
115 162
116 163 foreach( $taxonomies as $type ) {
@@ -121,9 +168,9 @@
121 168 'value' => $type->term_id,
122 169 );
123 170 }
124 171
125 -
172 + $date = wp_kses_post(date_i18n(get_option('date_format')));
126 173 wp_localize_script(
127 174 'blockspare-blocks-block-js',
128 175 'blockspare_globals',
129 176 array(
@@ -129,9 +176,12 @@
129 176 array(
130 177 'srcUrl' => untrailingslashit(plugins_url('/', BLOCKSPARE_BASE_DIR . '/dist/')),
131 178 'rest_url' => esc_url(rest_url()),
132 179 'img' => $blockspare_priview_img_url,
180 + 'homeUrl'=>home_url(),
181 + 'blogUrl'=>get_site_url(),
133 182 'menu_img_url' => $blockspare_food_img_url,
183 + 'logo'=>$blockspare_dashboard_logo,
134 184 'postTypes' => $this->aft_get_post_types(),
135 185 'taxonomies' => $this->aft_get_taxonomies(),
136 186 'postQueryEndpoint'=>'aft/v1/post-query',
137 187 'config' => '',
@@ -136,8 +186,10 @@
136 186 'postQueryEndpoint'=>'aft/v1/post-query',
137 187 'config' => '',
138 188 'configuration' => '',
139 189 'settings' => '',
190 + 'bs_date'=>$date,
191 + "imagePath"=> "https://templatespare.com/wp-content/uploads/blockspare/blocks/"
140 192 )
141 193 );
142 194 }
143 195
@@ -193,8 +245,26 @@
193 245 return apply_filters( 'aft_blocks_taxonomies', $output );
194 246 }
195 247
196 248 function blockspare_blocks_loader(){
249 +
250 + if ( PHP_VERSION_ID >= 50600 ) {
251 + require_once BLOCKSPARE_PLUGIN_DIR .'inc/layout/class-image-importer.php';
252 + require_once BLOCKSPARE_PLUGIN_DIR . 'inc/layout/functions.php';
253 + require_once BLOCKSPARE_PLUGIN_DIR . 'inc/layout/registry.php';
254 + require_once BLOCKSPARE_PLUGIN_DIR . 'inc/layout/components.php';
255 +
256 + /**
257 + * REST API Endpoints for Layouts.
258 + */
259 + require_once BLOCKSPARE_PLUGIN_DIR . 'inc/layout/endpoints.php';
260 +
261 + /**
262 + * Import Pattern
263 + */
264 +
265 + //require_once BLOCKSPARE_PLUGIN_DIR . 'inc/pattern/pattern.php';
266 + }
197 267
198 268 //Load Gutenberg Block php Files
199 269 include(BLOCKSPARE_PLUGIN_DIR . 'inc/other-block/date-time/index.php');
200 270 include(BLOCKSPARE_PLUGIN_DIR . '/inc/other-block/social-sharing/index.php');
@@ -201,8 +271,9 @@
201 271 include(BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-grid/index.php');
202 272 include(BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-list/index.php');
203 273
204 274 include(BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-express-grid/index.php');
275 + include(BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-express-grid/post-content.php');
205 276
206 277
207 278 include(BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-carousel-grid/index.php');
208 279 include(BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-slider/index.php');
@@ -208,8 +279,9 @@
208 279 include(BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-slider/index.php');
209 280
210 281 include(BLOCKSPARE_PLUGIN_DIR . '/inc/post-banner/banner-1/index.php');
211 282 include(BLOCKSPARE_PLUGIN_DIR . '/inc/post-banner/banner-2/index.php');
283 + include(BLOCKSPARE_PLUGIN_DIR . '/inc/post-banner/banner-9/index.php');
212 284 include(BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/ajax-pagination.php');
213 285 include(BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/class-post-rest-api.php');
214 286 include(BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/class-multiauthor-backend.php');
215 287 include(BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/class-multiauthor-frontend.php');