PluginProbe ʕ •ᴥ•ʔ
WPForms – Easy Form Builder for WordPress – Contact Forms, Payment Forms, Surveys, & More / 1.2.5.1
WPForms – Easy Form Builder for WordPress – Contact Forms, Payment Forms, Surveys, & More v1.2.5.1
1.10.1 1.10.0.5 trunk 1.1.4 1.1.4.2 1.1.5 1.1.5.1 1.1.6 1.1.6.1 1.1.7 1.1.7.1 1.1.7.2 1.1.8 1.1.8.1 1.1.8.2 1.1.8.3 1.1.8.4 1.10.0.1 1.10.0.2 1.10.0.3 1.10.0.4 1.2.0 1.2.0.1 1.2.1 1.2.2 1.2.2.1 1.2.2.2 1.2.3 1.2.3.1 1.2.3.2 1.2.4 1.2.4.1 1.2.5 1.2.5.1 1.2.6 1.2.7 1.2.8 1.2.8.1 1.2.9 1.3.0 1.3.1 1.3.1.1 1.3.1.2 1.3.2 1.3.3 1.3.5 1.3.6 1.3.6.1 1.3.6.2 1.3.7.2 1.3.7.3 1.3.7.4 1.3.8 1.3.9.1 1.4.0.1 1.4.1.1 1.4.2 1.4.2.1 1.4.2.2 1.4.3 1.4.4 1.4.4.1 1.4.5 1.4.5.1 1.4.5.2 1.4.5.3 1.4.6 1.4.7.1 1.4.7.2 1.4.8.1 1.4.9 1.5.0.1 1.5.0.3 1.5.0.4 1.5.1 1.5.1.1 1.5.1.3 1.5.2.1 1.5.2.2 1.5.2.3 1.5.3 1.5.3.1 1.5.4.1 1.5.4.2 1.5.5 1.5.5.1 1.5.6 1.5.6.2 1.5.7 1.5.8.2 1.5.9.1 1.5.9.4 1.5.9.5 1.6.0.1 1.6.0.2 1.6.1 1.6.2.2 1.6.2.3 1.6.3.1 1.6.4 1.6.4.1 1.6.5 1.6.6 1.6.7 1.6.7.1 1.6.7.2 1.6.7.3 1.6.8 1.6.8.1 1.6.9 1.7.0 1.7.1.1 1.7.1.2 1.7.2 1.7.2.1 1.7.3 1.7.4 1.7.4.1 1.7.4.2 1.7.5.1 1.7.5.2 1.7.5.3 1.7.5.5 1.7.6 1.7.7 1.7.7.1 1.7.7.2 1.7.8 1.7.9 1.7.9.1 1.8.0.1 1.8.0.2 1.8.1.1 1.8.1.2 1.8.1.3 1.8.2.1 1.8.2.2 1.8.2.3 1.8.3 1.8.3.1 1.8.4 1.8.4.1 1.8.5.2 1.8.5.3 1.8.5.4 1.8.6.2 1.8.6.3 1.8.6.4 1.8.7.2 1.8.8.2 1.8.8.3 1.8.9.1 1.8.9.2 1.8.9.4 1.8.9.5 1.8.9.6 1.9.0.1 1.9.0.2 1.9.0.3 1.9.0.4 1.9.1.1 1.9.1.2 1.9.1.3 1.9.1.4 1.9.1.5 1.9.1.6 1.9.2.1 1.9.2.2 1.9.2.3 1.9.3.1 1.9.3.2 1.9.4.1 1.9.4.2 1.9.5 1.9.5.1 1.9.5.2 1.9.6 1.9.6.1 1.9.6.2 1.9.7.1 1.9.7.2 1.9.7.3 1.9.8.1 1.9.8.2 1.9.8.4 1.9.8.7 1.9.9.2 1.9.9.3 1.9.9.4
wpforms-lite / wpforms.php
wpforms-lite Last commit date
assets 9 years ago includes 9 years ago languages 9 years ago lite 9 years ago readme.txt 9 years ago wpforms.php 9 years ago
wpforms.php
296 lines
1 <?php
2 /**
3 * Plugin Name: WPForms Lite
4 * Plugin URI: https://wpforms.com
5 * Description: Beginner friendly WordPress contact form plugin. Use our Drag & Drop form builder to create your WordPress forms.
6 * Author: WPForms
7 * Author URI: https://wpforms.com
8 * Version: 1.2.5.1
9 * Text Domain: wpforms
10 * Domain Path: languages
11 *
12 * WPForms is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation, either version 2 of the License, or
15 * any later version.
16 *
17 * WPForms is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with WPForms. If not, see <http://www.gnu.org/licenses/>.
24 *
25 * @package WPForms
26 * @author WPForms
27 * @since 1.0.0
28 * @license GPL-2.0+
29 * @copyright Copyright (c) 2016, WPForms LLC
30 */
31
32 // Exit if accessed directly
33 if ( ! defined( 'ABSPATH' ) ) exit;
34
35 // Don't allow multiple versions to be active
36 if ( class_exists( 'WPForms' ) ) :
37
38 /**
39 * Deactivate if WPForms already activated.
40 *
41 * @since 1.0.0
42 */
43 function wpforms_deactivate() {
44 deactivate_plugins( plugin_basename( __FILE__ ) );
45 }
46 add_action( 'admin_init', 'wpforms_deactivate' );
47
48 /**
49 * Display notice after deactivation.
50 *
51 * @since 1.0.0
52 */
53 function wpforms_lite_notice() {
54 echo '<div class="notice notice-warning"><p>' . __( 'Please deactivate WPForms Lite before activating WPForms', 'wpforms' ) . '</p></div>';
55 if ( isset( $_GET['activate'] ) )
56 unset( $_GET['activate'] );
57 }
58 add_action( 'admin_notices', 'wpforms_lite_notice' );
59
60 else :
61
62 /**
63 * Main WPForms class.
64 *
65 * @since 1.0.0
66 * @package WPForms
67 */
68 final class WPForms {
69
70 /**
71 * One is the loneliest number that you'll ever do.
72 *
73 * @since 1.0.0
74 * @var object
75 */
76 private static $instance;
77
78 /**
79 * Plugin version for enqueueing, etc.
80 *
81 * @since 1.0.0
82 * @var sting
83 */
84 public $version = '1.2.5.1';
85
86 /**
87 * The form data handler instance.
88 *
89 * @var object WPForms_Form_Handler
90 * @since 1.0.0
91 */
92 public $form;
93
94 /**
95 * The entry data handler instance (Pro).
96 *
97 * @var object WPForms_Entry_Handler
98 * @since 1.0.0
99 */
100 public $entry;
101
102 /**
103 * The entry meta data handler instance (Pro).
104 *
105 * @var object WPForms_Entry_Meta_Handler
106 * @since 1.1.6
107 */
108 public $entry_meta;
109
110 /**
111 * The front-end instance.
112 *
113 * @var object WPForms_Frontend
114 * @since 1.0.0
115 */
116 public $frontend;
117
118 /**
119 * The process instance.
120 *
121 * @var object WPForms_Process
122 * @since 1.0.0
123 */
124 public $process;
125
126 /**
127 * The smart tags instance.
128 *
129 * @var object WPForms_Smart_Tags
130 * @since 1.0.0
131 */
132 public $smart_tags;
133
134 /**
135 * The Logging instance.
136 *
137 * @var object WPForms_Logging
138 * @since 1.0.0
139 */
140 public $logs;
141
142 /**
143 * The Preview instance.
144 *
145 * @var object WPForms_Preview
146 * @since 1.1.9
147 */
148 public $preview;
149
150 /**
151 * The License class instance (Pro).
152 *
153 * @var object WPForms_License
154 * @since 1.0.0
155 */
156 public $license;
157
158 /**
159 * Main WPForms Instance.
160 *
161 * Insures that only one instance of WPForms exists in memory at any one
162 * time. Also prevents needing to define globals all over the place.
163 *
164 * @since 1.0.0
165 * @return WPForms
166 */
167 public static function instance() {
168
169 if ( ! isset( self::$instance ) && ! ( self::$instance instanceof WPForms ) ) {
170
171 self::$instance = new WPForms;
172 self::$instance->constants();
173 self::$instance->load_textdomain();
174 self::$instance->includes();
175
176 // Load Pro or Lite specific files
177 if ( file_exists( WPFORMS_PLUGIN_DIR . 'pro/wpforms-pro.php' ) ) {
178 require_once WPFORMS_PLUGIN_DIR . 'pro/wpforms-pro.php';
179 } else {
180 require_once WPFORMS_PLUGIN_DIR . 'lite/wpforms-lite.php';
181 }
182
183 add_action( 'plugins_loaded', array( self::$instance, 'objects' ), 10 );
184 }
185 return self::$instance;
186 }
187
188 /**
189 * Include files.
190 *
191 * @since 1.0.0
192 */
193 private function includes() {
194
195 // Global includes
196 require_once WPFORMS_PLUGIN_DIR . 'includes/functions.php';
197 require_once WPFORMS_PLUGIN_DIR . 'includes/class-install.php';
198 require_once WPFORMS_PLUGIN_DIR . 'includes/class-form.php';
199 require_once WPFORMS_PLUGIN_DIR . 'includes/class-fields.php';
200 require_once WPFORMS_PLUGIN_DIR . 'includes/class-frontend.php';
201 require_once WPFORMS_PLUGIN_DIR . 'includes/class-templates.php';
202 require_once WPFORMS_PLUGIN_DIR . 'includes/class-process.php';
203 require_once WPFORMS_PLUGIN_DIR . 'includes/class-smart-tags.php';
204 require_once WPFORMS_PLUGIN_DIR . 'includes/class-logging.php';
205 require_once WPFORMS_PLUGIN_DIR . 'includes/class-widget.php';
206 require_once WPFORMS_PLUGIN_DIR . 'includes/class-preview.php';
207 require_once WPFORMS_PLUGIN_DIR . 'includes/emails/class-emails.php';
208
209 // Admin/Dashboard only includes
210 if ( is_admin() ) {
211 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-menu.php';
212 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/overview/class-overview.php';
213 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/builder/class-builder.php';
214 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/builder/functions.php';
215 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-welcome.php';
216 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/class-editor.php';
217 require_once WPFORMS_PLUGIN_DIR . 'includes/admin/ajax-actions.php';
218 }
219 }
220
221 /**
222 * Setup objects.
223 *
224 * @since 1.0.0
225 */
226 public function objects() {
227
228 // Global objects
229 $this->form = new WPForms_Form_Handler;
230 $this->frontend = new WPForms_Frontend;
231 $this->process = new WPForms_Process;
232 $this->smart_tags = new WPForms_Smart_Tags;
233 $this->logs = new WPForms_Logging;
234 $this->preview = new WPForms_Preview;
235
236 // Hook now that all of the WPForms stuff is loaded.
237 do_action( 'wpforms_loaded' );
238 }
239
240 /**
241 * Setup plugin constants.
242 *
243 * @since 1.0.0
244 */
245 private function constants() {
246
247 // Plugin version
248 if ( ! defined( 'WPFORMS_VERSION' ) ) {
249 define( 'WPFORMS_VERSION', $this->version );
250 }
251
252 // Plugin Folder Path
253 if ( ! defined( 'WPFORMS_PLUGIN_DIR' ) ) {
254 define( 'WPFORMS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
255 }
256
257 // Plugin Folder URL
258 if ( ! defined( 'WPFORMS_PLUGIN_URL' ) ) {
259 define( 'WPFORMS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
260 }
261
262 // Plugin Root File
263 if ( ! defined( 'WPFORMS_PLUGIN_FILE' ) ) {
264 define( 'WPFORMS_PLUGIN_FILE', __FILE__ );
265 }
266 }
267
268 /**
269 * Loads the plugin language files.
270 *
271 * @since 1.0.0
272 */
273 public function load_textdomain() {
274
275 load_plugin_textdomain( 'wpforms', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
276 }
277 }
278
279 /**
280 * The function which returns the one WPForms instance.
281 *
282 * Use this function like you would a global variable, except without needing
283 * to declare the global.
284 *
285 * Example: <?php $wpforms = wpforms(); ?>
286 *
287 * @since 1.0.0
288 * @return object
289 */
290 function wpforms() {
291
292 return WPForms::instance();
293 }
294 wpforms();
295
296 endif;