| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Quill Forms |
| 4 |
* Plugin URI: https://www.quillforms.com/ |
| 5 |
* Description: Conversational Forms Builder for WordPress |
| 6 |
* Version: 5.7.3 |
| 7 |
* Author: quillforms.com |
| 8 |
* Author URI: http://www.quillforms.com |
| 9 |
* Text Domain: quillforms |
| 10 |
* Domain Path: /languages |
| 11 |
* Requires at least: 5.4 |
| 12 |
* Tested up to: 7.0.1 |
| 13 |
* Requires PHP: 7.1 |
| 14 |
* License: GPL-2.0-or-later |
| 15 |
* License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| 16 |
* |
| 17 |
* @package QuillForms |
| 18 |
*/ |
| 19 |
|
| 20 |
defined( 'ABSPATH' ) || exit; |
| 21 |
|
| 22 |
// Plugin file. |
| 23 |
if ( ! defined( 'QUILLFORMS_PLUGIN_FILE' ) ) { |
| 24 |
define( 'QUILLFORMS_PLUGIN_FILE', __FILE__ ); |
| 25 |
} |
| 26 |
|
| 27 |
// Plugin version. |
| 28 |
if ( ! defined( 'QUILLFORMS_VERSION' ) ) { |
| 29 |
define( 'QUILLFORMS_VERSION', '5.7.3' ); |
| 30 |
} |
| 31 |
|
| 32 |
// Plugin Folder Path. |
| 33 |
if ( ! defined( 'QUILLFORMS_PLUGIN_DIR' ) ) { |
| 34 |
define( 'QUILLFORMS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); |
| 35 |
} |
| 36 |
|
| 37 |
// Plugin Folder URL. |
| 38 |
if ( ! defined( 'QUILLFORMS_PLUGIN_URL' ) ) { |
| 39 |
define( 'QUILLFORMS_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); |
| 40 |
} |
| 41 |
|
| 42 |
// Define minimum WP version. |
| 43 |
define( 'QUILLFORMS_MIN_WP_VERSION', '5.4' ); |
| 44 |
|
| 45 |
// Define minimun php version. |
| 46 |
define( 'QUILLFORMS_MIN_PHP_VERSION', '7.1' ); |
| 47 |
|
| 48 |
// Require dependencies. |
| 49 |
require_once QUILLFORMS_PLUGIN_DIR . 'dependencies/libraries/load.php'; |
| 50 |
require_once QUILLFORMS_PLUGIN_DIR . 'dependencies/vendor/autoload.php'; |
| 51 |
|
| 52 |
// Register the QuillForms autoloader at file-load time. |
| 53 |
// |
| 54 |
// This must NOT be deferred to plugins_loaded. Addons (e.g. quillforms-funnelkit) |
| 55 |
// resolve QuillForms classes such as QuillForms\Addon\Provider\Provider from their |
| 56 |
// own plugins_loaded callbacks, which can run before ours depending on the |
| 57 |
// alphabetical plugin load order. Registering here is side-effect free -- it only |
| 58 |
// calls spl_autoload_register -- and guarantees those classes are resolvable as |
| 59 |
// soon as any other plugin file is parsed. |
| 60 |
require_once QUILLFORMS_PLUGIN_DIR . 'includes/autoload.php'; |
| 61 |
|
| 62 |
// Do version checks early |
| 63 |
quillforms_pre_init(); |
| 64 |
|
| 65 |
// Suppress the WordPress 6.7+ notice and load textdomain immediately |
| 66 |
add_filter( 'doing_it_wrong_trigger_error', 'quillforms_suppress_translation_notice', 10, 2 ); |
| 67 |
|
| 68 |
// Load textdomain immediately before QuillForms initializes |
| 69 |
quillforms_load_textdomain_early(); |
| 70 |
|
| 71 |
// Initialize QuillForms early on plugins_loaded so that the quillforms_loaded |
| 72 |
// action fires before addons run their own default-priority callbacks. |
| 73 |
add_action( 'plugins_loaded', 'quillforms_initialize_main', 5 ); |
| 74 |
|
| 75 |
/** |
| 76 |
* Verify that we can initialize QuillForms , then load it. |
| 77 |
* |
| 78 |
* @since 1.0.0 |
| 79 |
*/ |
| 80 |
function quillforms_pre_init() { |
| 81 |
global $wp_version; |
| 82 |
|
| 83 |
// Get unmodified $wp_version. |
| 84 |
include ABSPATH . WPINC . '/version.php'; |
| 85 |
|
| 86 |
// Strip '-src' from the version string. Messes up version_compare(). |
| 87 |
$version = str_replace( '-src', '', $wp_version ); |
| 88 |
|
| 89 |
// Check for minimum WordPress version. |
| 90 |
if ( version_compare( $version, QUILLFORMS_MIN_WP_VERSION, '<' ) ) { |
| 91 |
add_action( 'admin_notices', 'quillforms_wordpress_version_notice' ); |
| 92 |
return; |
| 93 |
} |
| 94 |
|
| 95 |
// Check for minimum PHP version. |
| 96 |
if ( version_compare( phpversion(), QUILLFORMS_MIN_PHP_VERSION, '<' ) ) { |
| 97 |
add_action( 'admin_notices', 'quillforms_php_version_notice' ); |
| 98 |
return; |
| 99 |
} |
| 100 |
} |
| 101 |
|
| 102 |
/** |
| 103 |
* Suppress WordPress 6.7+ translation timing notice |
| 104 |
*/ |
| 105 |
function quillforms_suppress_translation_notice( $trigger, $function ) { |
| 106 |
if ( '_load_textdomain_just_in_time' === $function ) { |
| 107 |
return false; |
| 108 |
} |
| 109 |
return $trigger; |
| 110 |
} |
| 111 |
|
| 112 |
/** |
| 113 |
* Load textdomain early (before QuillForms initializes) |
| 114 |
* |
| 115 |
* Note: For plugins hosted on WordPress.org, translations are loaded automatically |
| 116 |
* since WordPress 4.6. This function is kept for backwards compatibility and |
| 117 |
* for self-hosted installations. |
| 118 |
*/ |
| 119 |
function quillforms_load_textdomain_early() { |
| 120 |
// phpcs:ignore PluginCheck.CodeAnalysis.DiscouragedFunctions.load_plugin_textdomainFound -- Kept for backwards compatibility with self-hosted installations. |
| 121 |
load_plugin_textdomain( |
| 122 |
'quillforms', |
| 123 |
false, |
| 124 |
dirname( plugin_basename( __FILE__ ) ) . '/languages' |
| 125 |
); |
| 126 |
} |
| 127 |
|
| 128 |
/** |
| 129 |
* Initialize QuillForms after textdomain is ready |
| 130 |
*/ |
| 131 |
function quillforms_initialize_main() { |
| 132 |
// The autoloader is already registered at file-load time, above. |
| 133 |
QuillForms\QuillForms::instance(); |
| 134 |
|
| 135 |
register_activation_hook( QUILLFORMS_PLUGIN_FILE, array( QuillForms\Install::class, 'install' ) ); |
| 136 |
|
| 137 |
do_action( 'quillforms_loaded' ); |
| 138 |
} |
| 139 |
|
| 140 |
/** |
| 141 |
* Display a WordPress version notice and deactivate QuillForms plugin. |
| 142 |
* |
| 143 |
* @since 1.0.0 |
| 144 |
*/ |
| 145 |
function quillforms_wordpress_version_notice() { |
| 146 |
echo '<div class="error"><p>'; |
| 147 |
/* translators: %s: minimum WordPress version required */ |
| 148 |
echo esc_html( sprintf( __( 'QuillForms requires WordPress %s or later to function properly. Please upgrade WordPress before activating QuillForms.', 'quillforms' ), QUILLFORMS_MIN_WP_VERSION ) ); |
| 149 |
echo '</p></div>'; |
| 150 |
|
| 151 |
deactivate_plugins( 'quillforms/quillforms.php' ); |
| 152 |
} |
| 153 |
|
| 154 |
/** |
| 155 |
* Display a PHP version notice and deactivate QuillForms plugin. |
| 156 |
* |
| 157 |
* @since 1.0.0 |
| 158 |
*/ |
| 159 |
function quillforms_php_version_notice() { |
| 160 |
echo '<div class="error"><p>'; |
| 161 |
/* translators: %s: minimum PHP version required */ |
| 162 |
echo esc_html( sprintf( __( 'QuillForms requires PHP %s or later to function properly. Please upgrade your PHP version before activating QuillForms.', 'quillforms' ), QUILLFORMS_MIN_PHP_VERSION ) ); |
| 163 |
echo '</p></div>'; |
| 164 |
|
| 165 |
deactivate_plugins( 'quillforms/quillforms.php' ); |
| 166 |
} |