| @@ -3,9 +3,9 @@ | ||
| 3 | 3 | /** |
| 4 | 4 | * Plugin Name: Tableberg |
| 5 | 5 | * Plugin URI: https://tableberg.com/ |
| 6 | 6 | * Description: Table Block by Tableberg - Create Better Tables With Block Editor |
| 7 | - * Version: 1.0.3 | |
| 7 | + * Version: 1.1.5 | |
| 8 | 8 | * Requires at least: 6.1 |
| 9 | 9 | * Requires PHP: 7.0 |
| 10 | 10 | * Author: Tableberg |
| 11 | 11 | * Author URI: https://tableberg.com/ |
| @@ -19,9 +19,9 @@ | ||
| 19 | 19 | if (!defined('ABSPATH')) { |
| 20 | 20 | exit; |
| 21 | 21 | } |
| 22 | 22 | if (!defined('TABLEBERG_VERSION')) { |
| 23 | - define('TABLEBERG_VERSION', '0.6.11'); | |
| 23 | + define('TABLEBERG_VERSION', '1.1.5'); | |
| 24 | 24 | } |
| 25 | 25 | if (!defined('TABLEBERG_DIR_PATH')) { |
| 26 | 26 | define('TABLEBERG_DIR_PATH', plugin_dir_path(__FILE__)); |
| 27 | 27 | } |
| @@ -40,9 +40,9 @@ | ||
| 40 | 40 | function tab_fs() { |
| 41 | 41 | global $tab_fs; |
| 42 | 42 | |
| 43 | 43 | if (!isset($tab_fs)) { |
| 44 | - require_once __DIR__ . '/vendor/freemius/wordpress-sdk/start.php'; | |
| 44 | + require_once __DIR__ . '/vendor/freemius/start.php'; | |
| 45 | 45 | |
| 46 | 46 | $tab_fs = fs_dynamic_init( |
| 47 | 47 | [ |
| 48 | 48 | 'id' => '14649', |
| @@ -77,8 +77,13 @@ | ||
| 77 | 77 | class Tableberg { |
| 78 | 78 | public function __construct() { |
| 79 | 79 | new Tableberg\Admin\Tableberg_Admin(); |
| 80 | 80 | add_action('init', [$this, 'register_blocks']); |
| 81 | + add_action( | |
| 82 | + 'enqueue_block_editor_assets', | |
| 83 | + [$this, 'localize_block_editor_assets'] | |
| 84 | + ); | |
| 85 | + add_action('wp_enqueue_scripts', [$this, 'localize_frontend_assets']); | |
| 81 | 86 | |
| 82 | 87 | $restController = new Tableberg\DynamicData\RestController(); |
| 83 | 88 | add_action('rest_api_init', [$restController, 'register_routes']); |
| 84 | 89 | |
| @@ -89,13 +94,23 @@ | ||
| 89 | 94 | register_activation_hook(__FILE__, [$this, 'activate_plugin']); |
| 90 | 95 | register_deactivation_hook(__FILE__, [$this, 'deactivate_plugin']); |
| 91 | 96 | } |
| 92 | 97 | |
| 98 | + public function localize_block_editor_assets() { | |
| 99 | + $assets = new \Tableberg\Assets(); | |
| 100 | + $assets->register_blocks_assets(); | |
| 101 | + } | |
| 102 | + | |
| 103 | + public function localize_frontend_assets() { | |
| 104 | + $assets = new \Tableberg\Assets(); | |
| 105 | + $assets->register_frontend_assets(); | |
| 106 | + } | |
| 107 | + | |
| 93 | 108 | public function register_blocks() { |
| 94 | 109 | $renderer = new TableRenderer(); |
| 95 | 110 | |
| 96 | 111 | register_block_type_from_metadata( |
| 97 | - TABLEBERG_DIR_PATH . 'build/block.json', | |
| 112 | + TABLEBERG_DIR_PATH . 'build/blocks/table/block.json', | |
| 98 | 113 | [ |
| 99 | 114 | 'render_callback' => [$renderer, 'render'], |
| 100 | 115 | ] |
| 101 | 116 | ); |