actions
5 years ago
admin
5 years ago
blocks
5 years ago
classes
5 years ago
compatibility
5 years ago
dev-mode
5 years ago
exceptions
5 years ago
form-messages
5 years ago
form-patterns
5 years ago
form-response
5 years ago
gateways
5 years ago
generators
5 years ago
integrations
5 years ago
presets
5 years ago
request
5 years ago
shortcodes
5 years ago
widgets
5 years ago
autoloader.php
5 years ago
file-upload.php
5 years ago
form-handler.php
5 years ago
form-manager.php
5 years ago
form-messages-builder.php
5 years ago
form-messages-manager.php
5 years ago
form-preset.php
5 years ago
live-form.php
5 years ago
plugin.php
5 years ago
post-type.php
5 years ago
request-handler.php
5 years ago
plugin.php
97 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Jet_Form_Builder; |
| 4 | |
| 5 | // If this file is called directly, abort. |
| 6 | use Jet_Form_Builder\Classes\Instance_Trait; |
| 7 | use Jet_Form_Builder\Form_Patterns; |
| 8 | use Jet_Form_Builder\Integrations\Forms_Captcha; |
| 9 | use Jet_Form_Builder\Widgets\Elementor_Controller; |
| 10 | |
| 11 | if ( ! defined( 'WPINC' ) ) { |
| 12 | die; |
| 13 | } |
| 14 | |
| 15 | /** |
| 16 | * Main file |
| 17 | */ |
| 18 | class Plugin { |
| 19 | |
| 20 | use Instance_Trait; |
| 21 | |
| 22 | public $post_type; |
| 23 | public $blocks; |
| 24 | public $actions; |
| 25 | public $form; |
| 26 | public $form_handler; |
| 27 | public $editor; |
| 28 | public $captcha; |
| 29 | public $dev_manager; |
| 30 | |
| 31 | public $is_activated_jet_sm; |
| 32 | public $allow_gateways; |
| 33 | |
| 34 | /** |
| 35 | * Register autoloader. |
| 36 | */ |
| 37 | private function register_autoloader() { |
| 38 | require JET_FORM_BUILDER_PATH . 'includes' . DIRECTORY_SEPARATOR . 'autoloader.php'; |
| 39 | Autoloader::run(); |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Initialize plugin parts |
| 44 | * |
| 45 | * @return void |
| 46 | */ |
| 47 | public function init_components() { |
| 48 | $this->allow_gateways = apply_filters( 'jet-form-builder/allow-gateways', false ); |
| 49 | |
| 50 | $this->post_type = new Post_Type(); |
| 51 | $this->blocks = new Blocks\Manager(); |
| 52 | $this->actions = new Actions\Manager(); |
| 53 | $this->form = new Form_Manager(); |
| 54 | $this->form_handler = new Form_Handler(); |
| 55 | $this->captcha = new Forms_Captcha(); |
| 56 | |
| 57 | Dev_Mode\Manager::instance(); |
| 58 | File_Upload::instance(); |
| 59 | new Elementor_Controller(); |
| 60 | |
| 61 | if ( is_admin() ) { |
| 62 | $this->editor = new Admin\Editor(); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Returns url to file or dir inside plugin folder |
| 68 | * |
| 69 | * @param string $path Path inside plugin dir. |
| 70 | * |
| 71 | * @return string |
| 72 | */ |
| 73 | public function plugin_url( $path = null ) { |
| 74 | return JET_FORM_BUILDER_URL . $path; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Returns plugin version |
| 79 | */ |
| 80 | public function get_version() { |
| 81 | return JET_FORM_BUILDER_VERSION; |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * Plugin constructor. |
| 86 | */ |
| 87 | private function __construct() { |
| 88 | |
| 89 | $this->register_autoloader(); |
| 90 | |
| 91 | add_action( 'after_setup_theme', array( $this, 'init_components' ), 0 ); |
| 92 | } |
| 93 | |
| 94 | } |
| 95 | |
| 96 | Plugin::instance(); |
| 97 |