jetformbuilder
Last commit date
assets
4 years ago
framework
4 years ago
includes
4 years ago
templates
4 years ago
README.md
4 years ago
index.php
4 years ago
jet-form-builder.php
4 years ago
readme.txt
4 years ago
jet-form-builder.php
80 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: JetFormBuilder |
| 4 | * Plugin URI: https://jetformbuilder.com/ |
| 5 | * Description: Advanced form builder plugin for Gutenberg. Create forms from the ground up, customize the existing ones, and style them up – all in one editor |
| 6 | * Version: 1.2.6 |
| 7 | * Author: Crocoblock |
| 8 | * Author URI: https://crocoblock.com/ |
| 9 | * Text Domain: jet-form-builder |
| 10 | * License: GPL-3.0+ |
| 11 | * License URI: http://www.gnu.org/licenses/gpl-3.0.txt |
| 12 | * Domain Path: /languages |
| 13 | */ |
| 14 | |
| 15 | // If this file is called directly, abort. |
| 16 | if ( ! defined( 'WPINC' ) ) { |
| 17 | die(); |
| 18 | } |
| 19 | |
| 20 | |
| 21 | function jet_form_builder_init() { |
| 22 | |
| 23 | define( 'JET_FORM_BUILDER_VERSION', '1.2.6' ); |
| 24 | |
| 25 | define( 'JET_FORM_BUILDER__FILE__', __FILE__ ); |
| 26 | define( 'JET_FORM_BUILDER_PLUGIN_BASE', plugin_basename( JET_FORM_BUILDER__FILE__ ) ); |
| 27 | define( 'JET_FORM_BUILDER_PATH', plugin_dir_path( JET_FORM_BUILDER__FILE__ ) ); |
| 28 | define( 'JET_FORM_BUILDER_URL', plugins_url( '/', JET_FORM_BUILDER__FILE__ ) ); |
| 29 | |
| 30 | require JET_FORM_BUILDER_PATH . 'includes/plugin.php'; |
| 31 | |
| 32 | add_filter( 'plugin_action_links_' . JET_FORM_BUILDER_PLUGIN_BASE, function ( $links ) { |
| 33 | $url = 'https://jetformbuilder.com/pricing/'; |
| 34 | $url = add_query_arg( array( |
| 35 | 'utm_source' => 'wp-dashboard/jet-form-builder-plugins-page', |
| 36 | 'utm_medium' => 'crocoblock-license/theme-author', |
| 37 | 'utm_campaign' => 'go-pro-button' |
| 38 | ), $url ); |
| 39 | |
| 40 | wp_enqueue_style( |
| 41 | 'jet-fb-admin', |
| 42 | JET_FORM_BUILDER_URL . 'assets/css/admin/plugins.css', |
| 43 | array(), |
| 44 | JET_FORM_BUILDER_VERSION |
| 45 | ); |
| 46 | |
| 47 | $links['go_pro'] = "<a href=\"{$url}\" target=\"_blank\" class=\"jet-fb-go-pro-link\">Go Pro</a>"; |
| 48 | |
| 49 | return $links; |
| 50 | } ); |
| 51 | } |
| 52 | |
| 53 | if ( version_compare( PHP_VERSION, '7.0.0', '>=' ) ) { |
| 54 | add_action( 'plugins_loaded', 'jet_form_builder_init' ); |
| 55 | |
| 56 | function jet_form_builder() { |
| 57 | return Jet_Form_Builder\Plugin::instance(); |
| 58 | } |
| 59 | |
| 60 | if ( ! function_exists( 'jet_fb_render_form' ) ) { |
| 61 | function jet_fb_render_form( $settings ) { |
| 62 | return Jet_Form_Builder\Plugin::instance()->blocks->get_form_class()->render_callback_field( $settings ); |
| 63 | } |
| 64 | } |
| 65 | } else { |
| 66 | add_action( 'admin_notices', function () { |
| 67 | $class = 'notice notice-error'; |
| 68 | $message = __( |
| 69 | '<b>Error:</b> <b>JetFormBuilder</b> plugin requires a PHP version ">= 7.0"', |
| 70 | 'jet-form-builder' |
| 71 | ); |
| 72 | printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), wp_kses_post( $message ) ); |
| 73 | } ); |
| 74 | |
| 75 | add_action( 'admin_init', function () { |
| 76 | deactivate_plugins( plugin_basename( __FILE__ ) ); |
| 77 | } ); |
| 78 | } |
| 79 | |
| 80 |