superb-blocks
Last commit date
blocks
4 years ago
build
4 years ago
inc
4 years ago
lib
4 years ago
init.php
4 years ago
plugin.php
4 years ago
readme.txt
4 years ago
init.php
57 lines
| 1 | <?php |
| 2 | |
| 3 | // Exit if accessed directly. |
| 4 | if (! defined('ABSPATH')) { |
| 5 | exit; |
| 6 | } |
| 7 | |
| 8 | if (! defined('SUPERBBLOCKS_VERSION')) { |
| 9 | exit; |
| 10 | } |
| 11 | |
| 12 | /** |
| 13 | * Registers the block using the metadata loaded from the `block.json` file. |
| 14 | * Behind the scenes, it registers also all assets so they can be enqueued |
| 15 | * through the block editor in the corresponding context. |
| 16 | * |
| 17 | * @see https://developer.wordpress.org/reference/functions/register_block_type/ |
| 18 | */ |
| 19 | function create_block_superb_blocks_block_init() |
| 20 | { |
| 21 | wp_register_style( |
| 22 | 'superb-blocks-fontawesome-css', // Handle. |
| 23 | plugins_url('superb-blocks/lib/fontawesome/css/all.min.css', plugin_dir_path(__FILE__)), // Block style CSS. |
| 24 | is_admin() ? array( 'wp-editor' ) : null, // Dependency to include the CSS after it. |
| 25 | SUPERBBLOCKS_VERSION // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: File modification time. |
| 26 | ); |
| 27 | wp_enqueue_style('superb-blocks-fontawesome-css'); |
| 28 | $blocks = array( |
| 29 | 'superb-author-block', |
| 30 | 'superb-rating-block', |
| 31 | 'superb-table-of-content-block' |
| 32 | ); |
| 33 | foreach ($blocks as $block) { |
| 34 | register_block_type(plugin_dir_path(__FILE__).'blocks/'.$block.'/'); |
| 35 | } |
| 36 | } |
| 37 | add_action('init', 'create_block_superb_blocks_block_init'); |
| 38 | |
| 39 | |
| 40 | add_action('admin_init', 'superb_blocks_spbThemesNotification', 9); |
| 41 | function superb_blocks_spbThemesNotification() |
| 42 | { |
| 43 | $notifications = include(plugin_dir_path(__FILE__).'inc/admin_notification/Autoload.php'); |
| 44 | $options = array("delay"=> "+3 days"); |
| 45 | $notifications->Add("superb_blocks_admin_notification", "Unlock All Features with Superb Blocks Premium", " |
| 46 | |
| 47 | Take advantage of the up to <span style='font-weight:bold;'>45% discount</span> and unlock all features for Superb Blocks Premium. |
| 48 | The discount is only available for a limited time. |
| 49 | |
| 50 | <div> |
| 51 | <a style='margin-bottom:15px;' class='button button-large button-secondary' target='_blank' href='https://superbthemes.com/plugins/superb-blocks/'>Read more</a> <a style='margin-bottom:15px;' class='button button-large button-primary' target='_blank' href='https://superbthemes.com/plugins/superb-blocks/'>Buy now</a> |
| 52 | </div> |
| 53 | |
| 54 | ", "info", $options); |
| 55 | $notifications->Boot(); |
| 56 | } |
| 57 |