| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Plugin Name: Tableberg |
| 5 |
* Plugin URI: https://tableberg.com/ |
| 6 |
* Description: Table Block by Tableberg - Create Better Tables With Block Editor |
| 7 |
* Version: 0.5.7 |
| 8 |
* Requires at least: 6.1 |
| 9 |
* Requires PHP: 7.0 |
| 10 |
* Author: Tableberg |
| 11 |
* Author URI: https://tableberg.com/ |
| 12 |
* License: GPL-2.0-or-later |
| 13 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 14 |
* Text Domain: tableberg |
| 15 |
* |
| 16 |
* @package Tableberg |
| 17 |
*/ |
| 18 |
|
| 19 |
if (!defined('ABSPATH')) { |
| 20 |
exit; // Exit if accessed directly. |
| 21 |
} |
| 22 |
if (!defined('TABLEBERG_VERSION')) { |
| 23 |
define('TABLEBERG_VERSION', '0.0.2'); |
| 24 |
} |
| 25 |
if (!defined('TABLEBERG_DIR_PATH')) { |
| 26 |
define('TABLEBERG_DIR_PATH', plugin_dir_path(__FILE__)); |
| 27 |
} |
| 28 |
|
| 29 |
if (!defined('TABLEBERG_URL')) { |
| 30 |
define('TABLEBERG_URL', plugin_dir_url(__FILE__)); |
| 31 |
} |
| 32 |
if (!defined('TABLEBERG_PLUGIN_FILE')) { |
| 33 |
define('TABLEBERG_PLUGIN_FILE', __FILE__); |
| 34 |
} |
| 35 |
|
| 36 |
require_once __DIR__ . '/vendor/autoload.php'; |
| 37 |
|
| 38 |
|
| 39 |
if (!function_exists('tab_fs')) { |
| 40 |
// Create a helper function for easy SDK access. |
| 41 |
function tab_fs() |
| 42 |
{ |
| 43 |
global $tab_fs; |
| 44 |
|
| 45 |
if (!isset($tab_fs)) { |
| 46 |
// Include Freemius SDK. |
| 47 |
require_once __DIR__ . '/includes/freemius/start.php'; |
| 48 |
|
| 49 |
$tab_fs = fs_dynamic_init( |
| 50 |
array( |
| 51 |
'id' => '14649', |
| 52 |
'slug' => 'tableberg', |
| 53 |
'type' => 'plugin', |
| 54 |
'public_key' => 'pk_8043aa788c004c4b385af8384c74b', |
| 55 |
'is_premium' => false, |
| 56 |
'has_addons' => true, |
| 57 |
'has_paid_plans' => false, |
| 58 |
'menu' => array( |
| 59 |
'slug' => 'tableberg-settings', |
| 60 |
'first-path' => 'admin.php?page=tableberg-settings&route=welcome', |
| 61 |
), |
| 62 |
) |
| 63 |
); |
| 64 |
} |
| 65 |
|
| 66 |
return $tab_fs; |
| 67 |
} |
| 68 |
|
| 69 |
// Init Freemius. |
| 70 |
tab_fs(); |
| 71 |
// Signal that SDK was initiated. |
| 72 |
do_action('tab_fs_loaded'); |
| 73 |
} |
| 74 |
|
| 75 |
|
| 76 |
if (!class_exists('Tableberg')) { |
| 77 |
/** |
| 78 |
* External Query Block main class. |
| 79 |
*/ |
| 80 |
$pro_activated = false; |
| 81 |
|
| 82 |
|
| 83 |
if (isset($tp_fs)) { |
| 84 |
$pro_activated = $tp_fs->is__premium_only() |
| 85 |
&& $tp_fs->can_use_premium_code(); |
| 86 |
} |
| 87 |
class Tableberg |
| 88 |
{ |
| 89 |
|
| 90 |
|
| 91 |
/** |
| 92 |
* Constructor. |
| 93 |
* |
| 94 |
* @return void |
| 95 |
*/ |
| 96 |
public function __construct() |
| 97 |
{ |
| 98 |
new Tableberg\Admin\Tableberg_Admin(); |
| 99 |
new Tableberg\Blocks\Button(); |
| 100 |
new Tableberg\Blocks\Image(); |
| 101 |
new Tableberg\Blocks\Table(); |
| 102 |
new Tableberg\Blocks\Cell(); |
| 103 |
|
| 104 |
global $pro_activated; |
| 105 |
|
| 106 |
if (!$pro_activated) { |
| 107 |
add_action('init', function () { |
| 108 |
register_block_type(TABLEBERG_DIR_PATH . 'build/upsells-blocks/styled-list-dummy/block.json'); |
| 109 |
register_block_type(TABLEBERG_DIR_PATH . 'build/upsells-blocks/html-dummy/block.json'); |
| 110 |
register_block_type(TABLEBERG_DIR_PATH . 'build/upsells-blocks/icon-dummy/block.json'); |
| 111 |
register_block_type(TABLEBERG_DIR_PATH . 'build/upsells-blocks/ribbon-dummy/block.json'); |
| 112 |
register_block_type(TABLEBERG_DIR_PATH . 'build/upsells-blocks/star-rating-dummy/block.json'); |
| 113 |
}); |
| 114 |
} |
| 115 |
|
| 116 |
register_activation_hook(__FILE__, array($this, 'activate_plugin')); |
| 117 |
register_deactivation_hook(__FILE__, array($this, 'deactivate_plugin')); |
| 118 |
} |
| 119 |
|
| 120 |
/** |
| 121 |
* The code that runs during plugin activation. |
| 122 |
* This action is documented in includes/Activator.php |
| 123 |
*/ |
| 124 |
public function activate_plugin() |
| 125 |
{ |
| 126 |
Tableberg\Activator::activate(); |
| 127 |
} |
| 128 |
|
| 129 |
/** |
| 130 |
* The code that runs during plugin deactivation. |
| 131 |
* This action is documented in includes/Deactivator.php |
| 132 |
*/ |
| 133 |
public function deactivate_plugin() |
| 134 |
{ |
| 135 |
Tableberg\Deactivator::deactivate(); |
| 136 |
} |
| 137 |
} |
| 138 |
|
| 139 |
new Tableberg(); |
| 140 |
|
| 141 |
function load_tableberg_textdomain() { |
| 142 |
load_plugin_textdomain('tableberg',false,dirname(plugin_basename(__FILE__)) . '/languages'); |
| 143 |
} |
| 144 |
|
| 145 |
add_action('init', function () { |
| 146 |
global $pro_activated; |
| 147 |
Tableberg\Patterns\RegisterPatterns::categories(); |
| 148 |
Tableberg\Patterns\RegisterPatterns::from_dir(__DIR__ . '/includes/Patterns/data'); |
| 149 |
if (!$pro_activated) { |
| 150 |
Tableberg\Patterns\RegisterPatterns::upsells(); |
| 151 |
} |
| 152 |
|
| 153 |
load_tableberg_textdomain(); |
| 154 |
|
| 155 |
// wp_set_script_translations("tableberg-script","tableberg", dirname(plugin_basename(__FILE__)) . '/languages'); |
| 156 |
}); |
| 157 |
} |
| 158 |
|