| 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.6.0 |
| 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: 6.9 |
| 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.6.0' ); |
| 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 |
// Do version checks early |
| 53 |
quillforms_pre_init(); |
| 54 |
|
| 55 |
// Suppress the WordPress 6.7+ notice and load textdomain immediately |
| 56 |
add_filter( 'doing_it_wrong_trigger_error', 'quillforms_suppress_translation_notice', 10, 2 ); |
| 57 |
|
| 58 |
// Load textdomain immediately before QuillForms initializes |
| 59 |
quillforms_load_textdomain_early(); |
| 60 |
|
| 61 |
// Initialize QuillForms on plugins_loaded as normal |
| 62 |
add_action( 'plugins_loaded', 'quillforms_initialize_main' ); |
| 63 |
|
| 64 |
/** |
| 65 |
* Verify that we can initialize QuillForms , then load it. |
| 66 |
* |
| 67 |
* @since 1.0.0 |
| 68 |
*/ |
| 69 |
function quillforms_pre_init() { |
| 70 |
global $wp_version; |
| 71 |
|
| 72 |
// Get unmodified $wp_version. |
| 73 |
include ABSPATH . WPINC . '/version.php'; |
| 74 |
|
| 75 |
// Strip '-src' from the version string. Messes up version_compare(). |
| 76 |
$version = str_replace( '-src', '', $wp_version ); |
| 77 |
|
| 78 |
// Check for minimum WordPress version. |
| 79 |
if ( version_compare( $version, QUILLFORMS_MIN_WP_VERSION, '<' ) ) { |
| 80 |
add_action( 'admin_notices', 'quillforms_wordpress_version_notice' ); |
| 81 |
return; |
| 82 |
} |
| 83 |
|
| 84 |
// Check for minimum PHP version. |
| 85 |
if ( version_compare( phpversion(), QUILLFORMS_MIN_PHP_VERSION, '<' ) ) { |
| 86 |
add_action( 'admin_notices', 'quillforms_php_version_notice' ); |
| 87 |
return; |
| 88 |
} |
| 89 |
} |
| 90 |
|
| 91 |
/** |
| 92 |
* Suppress WordPress 6.7+ translation timing notice |
| 93 |
*/ |
| 94 |
function quillforms_suppress_translation_notice( $trigger, $function ) { |
| 95 |
if ( '_load_textdomain_just_in_time' === $function ) { |
| 96 |
return false; |
| 97 |
} |
| 98 |
return $trigger; |
| 99 |
} |
| 100 |
|
| 101 |
/** |
| 102 |
* Load textdomain early (before QuillForms initializes) |
| 103 |
* |
| 104 |
* Note: For plugins hosted on WordPress.org, translations are loaded automatically |
| 105 |
* since WordPress 4.6. This function is kept for backwards compatibility and |
| 106 |
* for self-hosted installations. |
| 107 |
*/ |
| 108 |
function quillforms_load_textdomain_early() { |
| 109 |
// phpcs:ignore PluginCheck.CodeAnalysis.DiscouragedFunctions.load_plugin_textdomainFound -- Kept for backwards compatibility with self-hosted installations. |
| 110 |
load_plugin_textdomain( |
| 111 |
'quillforms', |
| 112 |
false, |
| 113 |
dirname( plugin_basename( __FILE__ ) ) . '/languages' |
| 114 |
); |
| 115 |
} |
| 116 |
|
| 117 |
/** |
| 118 |
* Initialize QuillForms after textdomain is ready |
| 119 |
*/ |
| 120 |
function quillforms_initialize_main() { |
| 121 |
// QuillForms initialization |
| 122 |
require_once QUILLFORMS_PLUGIN_DIR . 'includes/autoload.php'; |
| 123 |
QuillForms\QuillForms::instance(); |
| 124 |
|
| 125 |
register_activation_hook( QUILLFORMS_PLUGIN_FILE, array( QuillForms\Install::class, 'install' ) ); |
| 126 |
|
| 127 |
do_action( 'quillforms_loaded' ); |
| 128 |
} |
| 129 |
|
| 130 |
/** |
| 131 |
* Display a WordPress version notice and deactivate QuillForms plugin. |
| 132 |
* |
| 133 |
* @since 1.0.0 |
| 134 |
*/ |
| 135 |
function quillforms_wordpress_version_notice() { |
| 136 |
echo '<div class="error"><p>'; |
| 137 |
/* translators: %s: minimum WordPress version required */ |
| 138 |
echo esc_html( sprintf( __( 'QuillForms requires WordPress %s or later to function properly. Please upgrade WordPress before activating QuillForms.', 'quillforms' ), QUILLFORMS_MIN_WP_VERSION ) ); |
| 139 |
echo '</p></div>'; |
| 140 |
|
| 141 |
deactivate_plugins( 'quillforms/quillforms.php' ); |
| 142 |
} |
| 143 |
|
| 144 |
/** |
| 145 |
* Display a PHP version notice and deactivate QuillForms plugin. |
| 146 |
* |
| 147 |
* @since 1.0.0 |
| 148 |
*/ |
| 149 |
function quillforms_php_version_notice() { |
| 150 |
echo '<div class="error"><p>'; |
| 151 |
/* translators: %s: minimum PHP version required */ |
| 152 |
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 ) ); |
| 153 |
echo '</p></div>'; |
| 154 |
|
| 155 |
deactivate_plugins( 'quillforms/quillforms.php' ); |
| 156 |
} |