| 1 |
<?php |
| 2 |
|
| 3 |
defined( 'ABSPATH' ) || exit; |
| 4 |
|
| 5 |
use FormGent\App\Providers\PostTypeServiceProvider; |
| 6 |
use FormGent\WpMVC\App; |
| 7 |
|
| 8 |
/** |
| 9 |
* Plugin Name: FormGent |
| 10 |
* Description: Next-Gen AI Form Builder for WordPress with Multi-Step, Quizzes, Payments & More. |
| 11 |
* Version: 1.8.1 |
| 12 |
* Requires at least: 6.6 |
| 13 |
* Requires PHP: 7.4 |
| 14 |
* Tested up to: 6.9 |
| 15 |
* Author: wpWax - Contact Form Plugin & WP Form Builder |
| 16 |
* Author URI: http://wpwax.com |
| 17 |
* License: GPL v3 or later |
| 18 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html |
| 19 |
* Text Domain: formgent |
| 20 |
* Domain Path: /languages |
| 21 |
*/ |
| 22 |
|
| 23 |
require_once __DIR__ . '/vendor/vendor-src/autoload.php'; |
| 24 |
require_once __DIR__ . '/app/Helpers/helper.php'; |
| 25 |
|
| 26 |
define( 'FORMGENT_DEPENDENCY_VERSION', '1.0.0' ); |
| 27 |
|
| 28 |
final class FormGent { |
| 29 |
private static ?FormGent $instance = null; |
| 30 |
|
| 31 |
public static function instance(): FormGent { |
| 32 |
if ( is_null( self::$instance ) ) { |
| 33 |
self::$instance = new self(); |
| 34 |
} |
| 35 |
return self::$instance; |
| 36 |
} |
| 37 |
|
| 38 |
public function load(): void { |
| 39 |
register_activation_hook( __FILE__, [$this, 'on_activation'] ); |
| 40 |
register_deactivation_hook( __FILE__, [$this, 'on_deactivation'] ); |
| 41 |
|
| 42 |
$application = App::instance(); |
| 43 |
|
| 44 |
$application->boot( __FILE__, __DIR__ ); |
| 45 |
|
| 46 |
/** |
| 47 |
* Fires once activated plugins have loaded. |
| 48 |
*/ |
| 49 |
add_action( |
| 50 |
'plugins_loaded', function () use ( $application ): void { |
| 51 |
|
| 52 |
do_action( 'formgent_before_load' ); |
| 53 |
|
| 54 |
$application->load(); |
| 55 |
|
| 56 |
do_action( 'formgent_after_load' ); |
| 57 |
} |
| 58 |
); |
| 59 |
} |
| 60 |
|
| 61 |
public function on_activation(): void { |
| 62 |
new FormGent\App\Setup\Activation(); |
| 63 |
PostTypeServiceProvider::register_post_type(); |
| 64 |
flush_rewrite_rules(); |
| 65 |
add_option( 'formgent_activation_redirect', true ); |
| 66 |
} |
| 67 |
|
| 68 |
public function on_deactivation(): void { |
| 69 |
flush_rewrite_rules(); |
| 70 |
wp_clear_scheduled_hook( 'formgent_cleanup_old_pdfs' ); |
| 71 |
} |
| 72 |
} |
| 73 |
|
| 74 |
FormGent::instance()->load(); |
| 75 |
|