/
quillforms.php
executable file
·119 lines (96 loc) · 3.21 KB
/
quillforms.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
/**
* Plugin Name: Quill Forms
* Plugin URI: https://www.quillforms.com/
* Description: Conversational Forms Builder for WordPress
* Version: 3.6.2
* Author: quillforms.com
* Author URI: http://www.quillforms.com
* Text Domain: quillforms
* Requires at least: 5.4
* Requires PHP: 7.1
*
* @package QuillForms
*/
defined( 'ABSPATH' ) || exit;
// Plugin file.
if ( ! defined( 'QUILLFORMS_PLUGIN_FILE' ) ) {
define( 'QUILLFORMS_PLUGIN_FILE', __FILE__ );
}
// Plugin version.
if ( ! defined( 'QUILLFORMS_VERSION' ) ) {
define( 'QUILLFORMS_VERSION', '3.6.2' );
}
// Plugin Folder Path.
if ( ! defined( 'QUILLFORMS_PLUGIN_DIR' ) ) {
define( 'QUILLFORMS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
}
// Plugin Folder URL.
if ( ! defined( 'QUILLFORMS_PLUGIN_URL' ) ) {
define( 'QUILLFORMS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
}
// Define minimum WP version.
define( 'QUILLFORMS_MIN_WP_VERSION', '5.4' );
// Define minimun php version.
define( 'QUILLFORMS_MIN_PHP_VERSION', '7.1' );
// Require dependencies.
require_once QUILLFORMS_PLUGIN_DIR . 'dependencies/libraries/load.php';
require_once QUILLFORMS_PLUGIN_DIR . 'dependencies/vendor/autoload.php';
// Require autoload.
require_once QUILLFORMS_PLUGIN_DIR . 'includes/autoload.php';
quillforms_pre_init();
/**
* Verify that we can initialize QuillForms , then load it.
*
* @since 1.0.0
*/
function quillforms_pre_init() {
global $wp_version;
// Get unmodified $wp_version.
include ABSPATH . WPINC . '/version.php';
// Strip '-src' from the version string. Messes up version_compare().
$version = str_replace( '-src', '', $wp_version );
// Check for minimum WordPress version.
if ( version_compare( $version, QUILLFORMS_MIN_WP_VERSION, '<' ) ) {
add_action( 'admin_notices', 'quillforms_wordpress_version_notice' );
return;
}
// Check for minimum PHP version.
if ( version_compare( phpversion(), QUILLFORMS_MIN_PHP_VERSION, '<' ) ) {
add_action( 'admin_notices', 'quillforms_php_version_notice' );
return;
}
QuillForms\QuillForms::instance();
register_activation_hook( __FILE__, array( QuillForms\Install::class, 'install' ) );
// do quillforms_loaded action.
add_action(
'plugins_loaded',
function () {
do_action( 'quillforms_loaded' );
}
);
}
/**
* Display a WordPress version notice and deactivate QuillForms plugin.
*
* @since 1.0.0
*/
function quillforms_wordpress_version_notice() {
echo '<div class="error"><p>';
/* translators: %s: Minimum required version */
printf( __( 'QuillForms requires WordPress %s or later to function properly. Please upgrade WordPress before activating QuillForms.', 'quillforms' ), QUILLFORMS_MIN_WP_VERSION );
echo '</p></div>';
deactivate_plugins( 'quillforms/quillforms.php' );
}
/**
* Display a PHP version notice and deactivate QuillForms plugin.
*
* @since 1.0.0
*/
function quillforms_php_version_notice() {
echo '<div class="error"><p>';
/* translators: %s: Minimum required version */
printf( __( 'QuillForms requires PHP %s or later to function properly. Please upgrade your PHP version before activating QuillForms.', 'quillforms' ), QUILLFORMS_MIN_PHP_VERSION );
echo '</p></div>';
deactivate_plugins( 'quillforms/quillforms.php' );
}