| @@ -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 | |
| @@ -51,15 +55,33 @@ | ||
| 51 | 55 | wp_register_style('slick', BLOCKSPARE_PLUGIN_URL . 'assets/slick/css/slick.css', array(), '', 'all'); |
| 52 | 56 | if (is_admin()){ |
| 53 | 57 | wp_enqueue_style('slick'); |
| 54 | 58 | } |
| 55 | - | |
| 59 | + include(BLOCKSPARE_PLUGIN_DIR . '/admin/notice-setup.php'); | |
| 56 | 60 | include(BLOCKSPARE_PLUGIN_DIR . '/admin/notice-upgrade.php'); |
| 57 | 61 | } |
| 58 | 62 | |
| 59 | 63 | function blockspare_load_scripts(){ |
| 60 | - if(has_blocks()){ | |
| 64 | + | |
| 65 | + wp_register_style( | |
| 66 | + 'fontawesome', | |
| 67 | + plugins_url('assets/fontawesome/css/all.css', dirname(__FILE__)), | |
| 68 | + array() | |
| 61 | 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 | + | |
| 62 | 84 | wp_enqueue_style('fontawesome'); |
| 63 | 85 | $min = (SCRIPT_DEBUG == true) ? '' : '.min'; |
| 64 | 86 | wp_register_script('slick', BLOCKSPARE_PLUGIN_URL . 'assets/slick/js/slick.js', array('jquery'), '', true); |
| 65 | 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')){ |
| @@ -83,9 +105,9 @@ | ||
| 83 | 105 | wp_localize_script('blockspare-pagination-js', 'blocsparePagination',array( |
| 84 | 106 | 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
| 85 | 107 | 'nonce'=>wp_create_nonce('blockspare-load-more-nonce') |
| 86 | 108 | )); |
| 87 | - } | |
| 109 | + //} | |
| 88 | 110 | |
| 89 | 111 | |
| 90 | 112 | } |
| 91 | 113 | |
| @@ -125,14 +147,17 @@ | ||
| 125 | 147 | 'blockspare-block-edit-style', |
| 126 | 148 | BLOCKSPARE_PLUGIN_URL . 'dist/blocks.css', |
| 127 | 149 | array('wp-edit-blocks') |
| 128 | 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')); | |
| 129 | 154 | endif; |
| 130 | 155 | |
| 131 | 156 | |
| 132 | 157 | $blockspare_priview_img_url = BLOCKSPARE_PLUGIN_URL . 'assets/blockspare-placeholder-img.jpg'; |
| 133 | 158 | $blockspare_food_img_url = BLOCKSPARE_PLUGIN_URL . 'assets/blockspare-placeholder-img-square.jpg'; |
| 134 | - | |
| 159 | + $blockspare_dashboard_logo = BLOCKSPARE_PLUGIN_URL . 'assets/images/blockspare-logo.png'; | |
| 135 | 160 | $taxonomies = get_categories(); |
| 136 | 161 | $txnm = array(); |
| 137 | 162 | |
| 138 | 163 | foreach( $taxonomies as $type ) { |
| @@ -144,8 +169,33 @@ | ||
| 144 | 169 | ); |
| 145 | 170 | } |
| 146 | 171 | |
| 147 | 172 | $date = wp_kses_post(date_i18n(get_option('date_format'))); |
| 173 | + $open_design = false; | |
| 174 | + if(isset($_GET['blockspare_show_intro'])){ | |
| 175 | + if($_GET['blockspare_show_intro'] =='true'){ | |
| 176 | + $open_design = true; | |
| 177 | + } | |
| 178 | + } | |
| 179 | + $date_format = date_i18n(get_option('date_format'), current_time('timestamp')); | |
| 180 | + | |
| 181 | + $blockData =''; | |
| 182 | + if(isset($_GET['blockspare_create_block'])){ | |
| 183 | + $blockName = $_GET['blockspare_create_block']; | |
| 184 | + $blocks_lists = array(); | |
| 185 | + | |
| 186 | + $filterdata = apply_filters( 'blockspare_template_library', $blocks_lists ); | |
| 187 | + | |
| 188 | + | |
| 189 | + foreach ($filterdata as $block) { | |
| 190 | + if (isset($block['key']) && $block['key'] === $blockName) { | |
| 191 | + // Found the block with the desired key, retrieve the content | |
| 192 | + $blockData = $block['content']; | |
| 193 | + break; // Stop looping once the desired block is found | |
| 194 | + } | |
| 195 | + } | |
| 196 | + } | |
| 197 | + | |
| 148 | 198 | wp_localize_script( |
| 149 | 199 | 'blockspare-blocks-block-js', |
| 150 | 200 | 'blockspare_globals', |
| 151 | 201 | array( |
| @@ -151,9 +201,12 @@ | ||
| 151 | 201 | array( |
| 152 | 202 | 'srcUrl' => untrailingslashit(plugins_url('/', BLOCKSPARE_BASE_DIR . '/dist/')), |
| 153 | 203 | 'rest_url' => esc_url(rest_url()), |
| 154 | 204 | 'img' => $blockspare_priview_img_url, |
| 205 | + 'homeUrl'=>home_url(), | |
| 206 | + 'blogUrl'=>get_site_url(), | |
| 155 | 207 | 'menu_img_url' => $blockspare_food_img_url, |
| 208 | + 'logo'=>$blockspare_dashboard_logo, | |
| 156 | 209 | 'postTypes' => $this->aft_get_post_types(), |
| 157 | 210 | 'taxonomies' => $this->aft_get_taxonomies(), |
| 158 | 211 | 'postQueryEndpoint'=>'aft/v1/post-query', |
| 159 | 212 | 'config' => '', |
| @@ -159,9 +212,14 @@ | ||
| 159 | 212 | 'config' => '', |
| 160 | 213 | 'configuration' => '', |
| 161 | 214 | 'settings' => '', |
| 162 | 215 | 'bs_date'=>$date, |
| 163 | - "imagePath"=> "https://templatespare.com/wp-content/uploads/blockspare/blocks/" | |
| 216 | + "imagePath"=> "https://templatespare.com/wp-content/uploads/blockspare-demo-data/blocks/", | |
| 217 | + "open_design"=> $open_design, | |
| 218 | + 'date_format '=>$date_format, | |
| 219 | + 'blockData'=>$blockData, | |
| 220 | + 'template_link'=>admin_url('edit.php?post_type=bs_templates'), | |
| 221 | + 'newTemlateUrl'=>admin_url('post-new.php?post_type=bs_templates&blockspare_create_block&blockspare_show_intro=true'), | |
| 164 | 222 | ) |
| 165 | 223 | ); |
| 166 | 224 | } |
| 167 | 225 | |
| @@ -219,8 +277,9 @@ | ||
| 219 | 277 | |
| 220 | 278 | function blockspare_blocks_loader(){ |
| 221 | 279 | |
| 222 | 280 | if ( PHP_VERSION_ID >= 50600 ) { |
| 281 | + require_once BLOCKSPARE_PLUGIN_DIR .'inc/layout/class-image-importer.php'; | |
| 223 | 282 | require_once BLOCKSPARE_PLUGIN_DIR . 'inc/layout/functions.php'; |
| 224 | 283 | require_once BLOCKSPARE_PLUGIN_DIR . 'inc/layout/registry.php'; |
| 225 | 284 | require_once BLOCKSPARE_PLUGIN_DIR . 'inc/layout/components.php'; |
| 226 | 285 | |
| @@ -227,8 +286,9 @@ | ||
| 227 | 286 | /** |
| 228 | 287 | * REST API Endpoints for Layouts. |
| 229 | 288 | */ |
| 230 | 289 | require_once BLOCKSPARE_PLUGIN_DIR . 'inc/layout/endpoints.php'; |
| 290 | + require_once BLOCKSPARE_PLUGIN_DIR . 'inc/layout/save-templates.php'; | |
| 231 | 291 | |
| 232 | 292 | /** |
| 233 | 293 | * Import Pattern |
| 234 | 294 | */ |
| @@ -242,8 +302,9 @@ | ||
| 242 | 302 | include(BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-grid/index.php'); |
| 243 | 303 | include(BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-list/index.php'); |
| 244 | 304 | |
| 245 | 305 | include(BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-express-grid/index.php'); |
| 306 | + include(BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-express-grid/post-content.php'); | |
| 246 | 307 | |
| 247 | 308 | |
| 248 | 309 | include(BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-carousel-grid/index.php'); |
| 249 | 310 | include(BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-slider/index.php'); |
| @@ -249,8 +310,9 @@ | ||
| 249 | 310 | include(BLOCKSPARE_PLUGIN_DIR . '/inc/latest-post-block/posts-slider/index.php'); |
| 250 | 311 | |
| 251 | 312 | include(BLOCKSPARE_PLUGIN_DIR . '/inc/post-banner/banner-1/index.php'); |
| 252 | 313 | include(BLOCKSPARE_PLUGIN_DIR . '/inc/post-banner/banner-2/index.php'); |
| 314 | + include(BLOCKSPARE_PLUGIN_DIR . '/inc/post-banner/banner-9/index.php'); | |
| 253 | 315 | include(BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/ajax-pagination.php'); |
| 254 | 316 | include(BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/class-post-rest-api.php'); |
| 255 | 317 | include(BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/class-multiauthor-backend.php'); |
| 256 | 318 | include(BLOCKSPARE_PLUGIN_DIR . 'inc/block-posts-config/class-multiauthor-frontend.php'); |
| @@ -261,8 +323,9 @@ | ||
| 261 | 323 | include(BLOCKSPARE_PLUGIN_DIR . 'inc/other-block/search/index.php'); |
| 262 | 324 | include(BLOCKSPARE_PLUGIN_DIR . 'inc/latest-post-block/posts-flash/index.php'); |
| 263 | 325 | include(BLOCKSPARE_PLUGIN_DIR . 'inc/other-block/popular-tags/index.php'); |
| 264 | 326 | include(BLOCKSPARE_PLUGIN_DIR . 'inc/page-templates/module.php'); |
| 327 | + include(BLOCKSPARE_PLUGIN_DIR . 'inc/block-banner/frontend-render/post-category-style.php'); | |
| 265 | 328 | } |
| 266 | 329 | |
| 267 | 330 | function blockspare_blocks_register_api_endpoints(){ |
| 268 | 331 | |