-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathformit.php
More file actions
180 lines (156 loc) · 4.41 KB
/
Copy pathformit.php
File metadata and controls
180 lines (156 loc) · 4.41 KB
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?php
/**
* Plugin Name: Formit
* Description: A Formit drag and drop streamlines complex online forms, aiding web developers and businesses by structuring data collection into user-friendly steps.
* Plugin URI: https://themeies.com/item/formit
* Version: 2.1.4
* Requires at least: 6.0
* Requires PHP: 7.4
* Author: Xirosoft
* Author URI: https://xirosoft.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: formit
* Domain Path: /languages
*/
/**
* Main Formit Plugin Class
*
* The init class that runs the Hello World plugin.
* Intended To make sure that the plugin's minimum requirements are met.
*
* You should only modify the constants to match your plugin's needs.
*
* Any custom code should go inside Plugin Class in the plugin.php file.
* @since 1.2.0
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
require_once __DIR__ .'/vendor/autoload.php';
final class Formit_Plugin
{
/**
* Plugin Version
*
* @since 1.2.0
* @var string The plugin version.
*/
const Formit_Version = '2.1.4';
/**
* Minimum PHP Version
*
* @since 1.2.0
* @var string Minimum PHP version required to run the plugin.
*/
const FORMIT_MINIMUM_PHP_VERSION = '7.4';
/**
* Constructor
*
* @since 1.0.0
* @access public
*/
public function __construct(){
/**
* define constatns
*/
$this->define_constants();
register_activation_hook( FORMIT__FILE__ , [$this, 'activate'] );
// Load translation
add_action('init', array($this, 'i18n'));
// Init Plugin
add_action('plugins_loaded', array($this, 'init'));
}
/**
* Load Textdomain
*
* Load plugin localization files.
* Fired by `init` action hook.
*
* @since 1.2.0
* @access public
*/
public function i18n(){
load_plugin_textdomain('formit');
}
/**
* Initialize the plugin
*
* Validates that Elementor is already loaded.
* Checks for basic plugin requirements, if one check fail don't continue,
* if all check have passed include the plugin class.
*
* Fired by `plugins_loaded` action hook.
*
* @since 1.2.0
* @access public
*/
public function init(){
/**
* Global function Innitial
*/
new Formit\Formit_GlobalFunctions();
new Formit\Formit_API();
new Formit\Frontend\Formit_ShortCode();
/**
* checking admin or frontend
*/
if ( is_admin() ) {
// Enqueue all admin styles and scripts
new Formit\Formit_AdminPanel();
}else{
// Manege All fontend functionility
new Formit\Formit_FrotnendPanel();
}
}
/**
* Define the required plugin constants
*
* @return void
*/
public function define_constants(){
define('FORMIT_VERSION', self::Formit_Version);
define('FORMIT__FILE__', __FILE__);
define('FORMIT_PLUGIN_BASE', plugin_basename(FORMIT__FILE__));
define('FORMIT_PATH', plugin_dir_path(FORMIT__FILE__));
define('FORMIT_ASSETS_PATH', FORMIT_PATH . 'assets/');
define('FORMIT_MODULES_PATH', FORMIT_PATH . 'modules/');
define('FORMIT_URL', plugins_url('/', FORMIT__FILE__));
define('FORMIT_ASSETS_URL', FORMIT_URL . 'assets/');
define('FORMIT_MODULES_URL', FORMIT_URL . 'modules/');
}
/**
* Do stuff upon plugin activation
*
* @return void
*/
public function activate(){
$installer = new Formit\Formit_Installer();
$installer->run();
}
/**
* Admin notice
*
* Warning when the site doesn't have a minimum required PHP version.
*
* @since 1.0.0
* @access public
*/
public function admin_notice_minimum_php_version(){
wp_nonce_field( 'formit_nonce_action', 'formit_nonce_field' );
// Verify nonce before processing form data
if ( ! isset( $_POST['formit_nonce_field'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash ( $_POST['formit_nonce_field'] ) ) , 'formit_nonce_action' ) ){
if (isset($_GET['activate'])) { unset($_GET['activate']); }
} else {
echo esc_html__('Nonce verification failed. Please try again.', 'formit');
}
$message = sprintf(
/* translators: 1: Plugin name 2: PHP 3: Required PHP version */
esc_html__('"%1$s" requires "%2$s" version %3$s or greater.', 'formit'),
'<strong>' . esc_html__('formit Plugin', 'formit') . '</strong>',
'<strong>' . esc_html__('PHP', 'formit') . '</strong>',
self::FORMIT_MINIMUM_PHP_VERSION
);
printf('<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', esc_html($message));
}
}
// Instantiate Formit_Plugin.
new Formit_Plugin();