| @@ -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.1 | |
| 7 | + * Version: 1.2.0 | |
| 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.2.0'); | |
| 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', |
| @@ -67,9 +67,8 @@ | ||
| 67 | 67 | tab_fs(); |
| 68 | 68 | do_action('tab_fs_loaded'); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | -use Tableberg\Constants; | |
| 72 | 71 | use Tableberg\Renderer\Migrations\BlockContentMigrator; |
| 73 | 72 | use Tableberg\Renderer\Table\TableRenderer; |
| 74 | 73 | use Tableberg\Renderer\ToggleBlockRenderer; |
| 75 | 74 | |
| @@ -77,8 +76,13 @@ | ||
| 77 | 76 | class Tableberg { |
| 78 | 77 | public function __construct() { |
| 79 | 78 | new Tableberg\Admin\Tableberg_Admin(); |
| 80 | 79 | add_action('init', [$this, 'register_blocks']); |
| 80 | + add_action( | |
| 81 | + 'enqueue_block_editor_assets', | |
| 82 | + [$this, 'localize_block_editor_assets'] | |
| 83 | + ); | |
| 84 | + add_action('wp_enqueue_scripts', [$this, 'localize_frontend_assets']); | |
| 81 | 85 | |
| 82 | 86 | $restController = new Tableberg\DynamicData\RestController(); |
| 83 | 87 | add_action('rest_api_init', [$restController, 'register_routes']); |
| 84 | 88 | |
| @@ -89,13 +93,23 @@ | ||
| 89 | 93 | register_activation_hook(__FILE__, [$this, 'activate_plugin']); |
| 90 | 94 | register_deactivation_hook(__FILE__, [$this, 'deactivate_plugin']); |
| 91 | 95 | } |
| 92 | 96 | |
| 97 | + public function localize_block_editor_assets() { | |
| 98 | + $assets = new \Tableberg\Assets(); | |
| 99 | + $assets->register_blocks_assets(); | |
| 100 | + } | |
| 101 | + | |
| 102 | + public function localize_frontend_assets() { | |
| 103 | + $assets = new \Tableberg\Assets(); | |
| 104 | + $assets->register_frontend_assets(); | |
| 105 | + } | |
| 106 | + | |
| 93 | 107 | public function register_blocks() { |
| 94 | 108 | $renderer = new TableRenderer(); |
| 95 | 109 | |
| 96 | 110 | register_block_type_from_metadata( |
| 97 | - TABLEBERG_DIR_PATH . 'build/block.json', | |
| 111 | + TABLEBERG_DIR_PATH . 'build/blocks/table/block.json', | |
| 98 | 112 | [ |
| 99 | 113 | 'render_callback' => [$renderer, 'render'], |
| 100 | 114 | ] |
| 101 | 115 | ); |