| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Tablentor |
| 4 |
* Description: Create tables effortlessly in Elementor using our Table Widget. You can either build tables manually by adding rows and columns or render them dynamically from a CSV file |
| 5 |
|
| 6 |
* Author: Jakaria Istauk |
| 7 |
* Version: 3.0.2 |
| 8 |
* Author URI: https://profiles.wordpress.org/jakariaistauk/ |
| 9 |
* Requires at least: 5.0 |
| 10 |
* Requires PHP: 7.4 |
| 11 |
* Requires Plugins: elementor |
| 12 |
* Text Domain: tablentor |
| 13 |
* Domain Path: /languages |
| 14 |
* License: GPLv2 or later |
| 15 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 16 |
* |
| 17 |
* Comparison Table is free software: you can redistribute it and/or modify |
| 18 |
* it under the terms of the GNU General Public License as published by |
| 19 |
* the Free Software Foundation, either version 3 of the License, or |
| 20 |
* any later version. |
| 21 |
* |
| 22 |
* Comparison Table is distributed in the hope that it will be useful, |
| 23 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 24 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 25 |
* GNU General Public License for more details. |
| 26 |
*/ |
| 27 |
|
| 28 |
namespace Jakaria\Tablentor; |
| 29 |
|
| 30 |
/** |
| 31 |
* if accessed directly, exit. |
| 32 |
*/ |
| 33 |
if ( ! defined( 'ABSPATH' ) ) { |
| 34 |
exit; |
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* Main class for the plugin |
| 39 |
* @package Plugin |
| 40 |
* @author Jakaria <jakariamd35@gmail.com> |
| 41 |
*/ |
| 42 |
final class Plugin { |
| 43 |
|
| 44 |
public static $_instance; |
| 45 |
|
| 46 |
public function __construct() { |
| 47 |
$this->include(); |
| 48 |
$this->define(); |
| 49 |
$this->hook(); |
| 50 |
} |
| 51 |
|
| 52 |
/** |
| 53 |
* Includes files |
| 54 |
*/ |
| 55 |
public function include() { |
| 56 |
require_once( dirname( __FILE__ ) . '/vendor/autoload.php' ); |
| 57 |
} |
| 58 |
|
| 59 |
/** |
| 60 |
* Define variables and constants |
| 61 |
*/ |
| 62 |
public function define() { |
| 63 |
// constants |
| 64 |
define( 'CMPRTBL', __FILE__ ); |
| 65 |
define( 'CMPRTBL_DIR', dirname( CMPRTBL ) ); |
| 66 |
define( 'CMPRTBL_ASSETS', plugins_url( 'assets/', CMPRTBL ) ); |
| 67 |
|
| 68 |
define( 'CMPRTBL_PREFIX', 'CMPRTBL' ); |
| 69 |
define( 'CMPRTBL_FILE', __FILE__ ); |
| 70 |
define( 'CMPRTBL_BASENAME', plugin_basename( __FILE__ ) ); |
| 71 |
define( 'CMPRTBL_PATH', trailingslashit( plugin_dir_path( __FILE__ ) ) ); |
| 72 |
define( 'CMPRTBL_URL', trailingslashit( plugins_url( '/', __FILE__ ) ) ); |
| 73 |
define( 'CMPRTBL_ASSET_DIR', trailingslashit( plugin_dir_url( __FILE__ ) . 'assets/' ) ); |
| 74 |
define( 'CMPRTBL_VERSION', '3.0.2' ); |
| 75 |
define( 'CMPRTBL_DEV_MODE', file_exists( CMPRTBL_PATH . '/.git' ) ); |
| 76 |
} |
| 77 |
|
| 78 |
/** |
| 79 |
* Hooks |
| 80 |
*/ |
| 81 |
public function hook() { |
| 82 |
|
| 83 |
$admin = new Admin; |
| 84 |
add_action( 'plugins_loaded', [ $admin, 'i18n'] ); |
| 85 |
add_action( 'elementor/editor/after_enqueue_styles', [ $admin, 'editor_enqueue_scripts'] ); |
| 86 |
add_action( 'elementor/editor/after_enqueue_scripts', [ $admin, 'editor_enqueue_js'] ); |
| 87 |
|
| 88 |
$front = new Front; |
| 89 |
add_action( 'wp_head', [ $front, 'head' ] ); |
| 90 |
|
| 91 |
$widgets = new Widgets; |
| 92 |
// add_action( 'elementor/elements/categories_registered', [ $widgets, 'register_category' ] ); |
| 93 |
add_action( 'elementor/controls/register', [ $widgets, 'register_controls' ] ); |
| 94 |
add_action( 'elementor/widgets/widgets_registered', [ $widgets, 'register_widgets' ] ); |
| 95 |
add_action( 'elementor/frontend/after_enqueue_styles', [ $widgets, 'enqueue_styles' ] ); |
| 96 |
add_action( 'elementor/frontend/after_enqueue_scripts', [ $widgets, 'enqueue_scripts' ] ); |
| 97 |
} |
| 98 |
|
| 99 |
/** |
| 100 |
* Cloning is forbidden. |
| 101 |
*/ |
| 102 |
public function __clone() { } |
| 103 |
|
| 104 |
/** |
| 105 |
* Unserializing instances of this class is forbidden. |
| 106 |
*/ |
| 107 |
public function __wakeup() { } |
| 108 |
|
| 109 |
/** |
| 110 |
* Instantiate the plugin |
| 111 |
*/ |
| 112 |
public static function instance() { |
| 113 |
if ( is_null( self::$_instance ) ) { |
| 114 |
self::$_instance = new self(); |
| 115 |
} |
| 116 |
return self::$_instance; |
| 117 |
} |
| 118 |
} |
| 119 |
|
| 120 |
Plugin::instance(); |