C:\xampp\htdocs\landing\wp-content\plugins\wpforms-lite\src\WPForms.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
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
<?php

namespace WPForms {

    
/**
     * Main WPForms class.
     *
     * @since 1.0.0
     */
    
final class WPForms {

        
/**
         * One is the loneliest number that you'll ever do.
         *
         * @since 1.0.0
         *
         * @var \WPForms\WPForms
         */
        
private static $instance;

        
/**
         * Plugin version for enqueueing, etc.
         * The value is got from WPFORMS_VERSION constant.
         *
         * @since 1.0.0
         *
         * @var string
         */
        
public $version '';

        
/**
         * The form data handler instance.
         *
         * @since 1.0.0
         *
         * @var \WPForms_Form_Handler
         */
        
public $form;

        
/**
         * The entry data handler instance (Pro).
         *
         * @since 1.0.0
         *
         * @var \WPForms_Entry_Handler
         */
        
public $entry;

        
/**
         * The entry fields data handler instance (Pro).
         *
         * @since 1.4.3
         *
         * @var \WPForms_Entry_Fields_Handler
         */
        
public $entry_fields;

        
/**
         * The entry meta data handler instance (Pro).
         *
         * @since 1.1.6
         *
         * @var \WPForms_Entry_Meta_Handler
         */
        
public $entry_meta;

        
/**
         * The front-end instance.
         *
         * @since 1.0.0
         *
         * @var \WPForms_Frontend
         */
        
public $frontend;

        
/**
         * The process instance.
         *
         * @since 1.0.0
         *
         * @var \WPForms_Process
         */
        
public $process;

        
/**
         * The smart tags instance.
         *
         * @since 1.0.0
         *
         * @var \WPForms_Smart_Tags
         */
        
public $smart_tags;

        
/**
         * The License class instance (Pro).
         *
         * @since 1.0.0
         *
         * @var \WPForms_License
         */
        
public $license;

        
/**
         * Classes registry.
         *
         * @since 1.5.7
         *
         * @var array
         */
        
private $registry = array();

        
/**
         * Paid returns true, free (Lite) returns false.
         *
         * @since 1.3.9
         *
         * @var bool
         */
        
public $pro false;

        
/**
         * Backward compatibility method for accessing the class registry in an old way
         * e.g. 'wpforms()->form' or 'wpforms()->entry'
         *
         * @since 1.5.7
         *
         * @param string $name Name of the object to get.
         *
         * @return mixed|null
         */
        
public function __get$name ) {

            return 
$this->get$name );
        }

        
/**
         * Main WPForms Instance.
         *
         * Only one instance of WPForms exists in memory at any one time.
         * Also prevent the need to define globals all over the place.
         *
         * @since 1.0.0
         *
         * @return WPForms
         */
        
public static function instance() {

            if (
                
null === self::$instance ||
                ! 
self::$instance instanceof self
            
) {

                
self::$instance = new self();
                
self::$instance->constants();
                
self::$instance->includes();

                
// Load Pro or Lite specific files.
                
if ( self::$instance->pro ) {
                    
self::$instance->registry['pro'] = require_once WPFORMS_PLUGIN_DIR 'pro/wpforms-pro.php';
                } else {
                    require_once 
WPFORMS_PLUGIN_DIR 'lite/wpforms-lite.php';
                }

                
add_action'init', array( self::$instance'load_textdomain' ), 10 );
                
add_action'plugins_loaded', array( self::$instance'objects' ), 10 );
            }

            return 
self::$instance;
        }

        
/**
         * Setup plugin constants.
         * All the path/URL related constants are defined in main plugin file.
         *
         * @since 1.0.0
         */
        
private function constants() {

            
$this->version WPFORMS_VERSION;

            
// Plugin Slug - Determine plugin type and set slug accordingly.
            
if ( apply_filters'wpforms_allow_pro_version'file_existsWPFORMS_PLUGIN_DIR 'pro/wpforms-pro.php' ) ) ) {
                
$this->pro true;
                
define'WPFORMS_PLUGIN_SLUG''wpforms' );
            } else {
                
define'WPFORMS_PLUGIN_SLUG''wpforms-lite' );
            }
        }

        
/**
         * Load the plugin language files.
         *
         * @since 1.0.0
         * @since 1.5.0 Load only the lite translation.
         */
        
public function load_textdomain() {

            
// If the user is logged in, unset the current text-domains before loading our text domain.
            // This feels hacky, but this way a user's set language in their profile will be used,
            // rather than the site-specific language.
            
if ( is_user_logged_in() ) {
                
unload_textdomain'wpforms-lite' );
            }

            
load_plugin_textdomain'wpforms-lite'falsedirnameplugin_basenameWPFORMS_PLUGIN_FILE ) ) . '/assets/languages/' );
        }

        
/**
         * Include files.
         *
         * @since 1.0.0
         */
        
private function includes() {

            require_once 
WPFORMS_PLUGIN_DIR 'includes/class-db.php';

            
$this->includes_magic();

            
// Global includes.
            
require_once WPFORMS_PLUGIN_DIR 'includes/functions.php';
            require_once 
WPFORMS_PLUGIN_DIR 'includes/functions-list.php';
            require_once 
WPFORMS_PLUGIN_DIR 'includes/class-install.php';
            require_once 
WPFORMS_PLUGIN_DIR 'includes/class-form.php';
            require_once 
WPFORMS_PLUGIN_DIR 'includes/class-fields.php';
            require_once 
WPFORMS_PLUGIN_DIR 'includes/class-frontend.php';
            
// TODO: class-templates.php should be loaded in admin area only.
            
require_once WPFORMS_PLUGIN_DIR 'includes/class-templates.php';
            
// TODO: class-providers.php should be loaded in admin area only.
            
require_once WPFORMS_PLUGIN_DIR 'includes/class-providers.php';
            require_once 
WPFORMS_PLUGIN_DIR 'includes/class-process.php';
            require_once 
WPFORMS_PLUGIN_DIR 'includes/class-smart-tags.php';
            require_once 
WPFORMS_PLUGIN_DIR 'includes/class-widget.php';
            require_once 
WPFORMS_PLUGIN_DIR 'includes/class-conditional-logic-core.php';
            require_once 
WPFORMS_PLUGIN_DIR 'includes/emails/class-emails.php';
            require_once 
WPFORMS_PLUGIN_DIR 'includes/integrations.php';
            require_once 
WPFORMS_PLUGIN_DIR 'includes/deprecated.php';

            
// Admin/Dashboard only includes, also in ajax.
            
if ( is_admin() ) {
                require_once 
WPFORMS_PLUGIN_DIR 'includes/admin/admin.php';
                require_once 
WPFORMS_PLUGIN_DIR 'includes/admin/class-notices.php';
                require_once 
WPFORMS_PLUGIN_DIR 'includes/admin/class-menu.php';
                require_once 
WPFORMS_PLUGIN_DIR 'includes/admin/overview/class-overview.php';
                require_once 
WPFORMS_PLUGIN_DIR 'includes/admin/builder/class-builder.php';
                require_once 
WPFORMS_PLUGIN_DIR 'includes/admin/builder/functions.php';
                require_once 
WPFORMS_PLUGIN_DIR 'includes/admin/class-settings.php';
                require_once 
WPFORMS_PLUGIN_DIR 'includes/admin/class-welcome.php';
                require_once 
WPFORMS_PLUGIN_DIR 'includes/admin/class-tools.php';
                require_once 
WPFORMS_PLUGIN_DIR 'includes/admin/class-editor.php';
                require_once 
WPFORMS_PLUGIN_DIR 'includes/admin/class-review.php';
                require_once 
WPFORMS_PLUGIN_DIR 'includes/admin/class-importers.php';
                require_once 
WPFORMS_PLUGIN_DIR 'includes/admin/class-about.php';
                require_once 
WPFORMS_PLUGIN_DIR 'includes/admin/ajax-actions.php';
            }
        }

        
/**
         * Including the new files with PHP 5.3 style.
         *
         * @since 1.4.7
         */
        
private function includes_magic() {

            
// Action Scheduler requires a special loading procedure.
            
require_once WPFORMS_PLUGIN_DIR 'vendor/woocommerce/action-scheduler/action-scheduler.php';

            
// Autoload Composer packages.
            
require_once WPFORMS_PLUGIN_DIR 'vendor/autoload.php';

            
// Load the class loader.
            
$this->register(
                [
                    
'name' => 'Loader',
                    
'hook' => false,
                ]
            );

            if ( 
version_comparephpversion(), '5.5''>=' ) ) {
                
/*
                 * Load PHP 5.5 email subsystem.
                 */
                
add_action'wpforms_loaded', array( '\WPForms\Emails\Summaries''get_instance' ) );
            }

            
/*
             * Load admin components. Exclude from frontend.
             */
            
if ( is_admin() ) {
                
add_action'wpforms_loaded', array( '\WPForms\Admin\Loader''get_instance' ) );
            }

            
/*
             * Load form components.
             */
            
add_action'wpforms_loaded', array( '\WPForms\Forms\Loader''get_instance' ) );

            
/*
             * Properly init the providers loader, that will handle all the related logic and further loading.
             */
            
add_action'wpforms_loaded', array( '\WPForms\Providers\Loader''get_instance' ) );

            
/*
             * Properly init the integrations loader, that will handle all the related logic and further loading.
             */
            
add_action'wpforms_loaded', array( '\WPForms\Integrations\Loader''get_instance' ) );
        }

        
/**
         * Setup objects.
         *
         * @since 1.0.0
         */
        
public function objects() {

            
// Global objects.
            
$this->form       = new \WPForms_Form_Handler();
            
$this->frontend   = new \WPForms_Frontend();
            
$this->process    = new \WPForms_Process();
            
$this->smart_tags = new \WPForms_Smart_Tags();

            
// Hook now that all of the WPForms stuff is loaded.
            
do_action'wpforms_loaded' );
        }

        
/**
         * Register a class.
         *
         * @since 1.5.7
         *
         * @param array $class Class registration info.
         */
        
public function register$class ) {

            if ( empty( 
$class['name'] ) || ! is_string$class['name'] ) ) {
                return;
            }

            if ( isset( 
$class['condition'] ) && empty( $class['condition'] ) ) {
                return;
            }

            
$full_name $this->pro '\WPForms\Pro\\' $class['name'] : '\WPForms\Lite\\' $class['name'];
            
$full_name class_exists$full_name ) ? $full_name '\WPForms\\' $class['name'];

            if ( ! 
class_exists$full_name ) ) {
                return;
            }

            
$pattern  '/[^a-zA-Z0-9_\\\-]/';
            
$id       = isset( $class['id'] ) ? $class['id'] : '';
            
$id       $id preg_replace$pattern'', (string) $id ) : $id;
            
$hook     = isset( $class['hook'] ) ? $class['hook'] : 'wpforms_loaded';
            
$hook     $hook preg_replace$pattern'', (string) $hook ) : $hook;
            
$run      = isset( $class['run'] ) ? $class['run'] : 'init';
            
$priority = isset( $class['priority'] ) && is_int$class['priority'] ) ? $class['priority'] : 10;

            
$callback = function () use ( $full_name$id$run ) {

                
$instance = new $full_name();
                if ( 
$id && ! array_key_exists$id$this->registry ) ) {
                    
$this->registry$id ] = $instance;
                }
                if ( 
$run && method_exists$instance$run ) ) {
                    
$instance->{$run}();
                }
            };

            if ( 
$hook ) {
                
add_action$hook$callback$priority );
            } else {
                
$callback();
            }
        }

        
/**
         * Register classes in bulk.
         *
         * @since 1.5.7
         *
         * @param array $classes Classes to register.
         */
        
public function register_bulk$classes ) {

            if ( ! 
is_array$classes ) ) {
                return;
            }

            foreach ( 
$classes as $class ) {
                
$this->register$class );
            }
        }

        
/**
         * Get a class instance from a registry.
         *
         * @since 1.5.7
         *
         * @param string $name Class name or an alias.
         *
         * @return mixed|\stdClass
         */
        
public function get$name ) {

            if ( ! empty( 
$this->registry$name ] ) ) {
                return 
$this->registry$name ];
            }

            return new \
stdClass();
        }

        
/**
         * Get the list of all custom tables starting with `wpforms_*`.
         *
         * @since 1.6.3
         *
         * @return array List of table names.
         */
        
public function get_existing_custom_tables() {

            global 
$wpdb;

            
$tables $wpdb->get_results"SHOW TABLES LIKE '" $wpdb->prefix "wpforms_%'"'ARRAY_N' ); // phpcs:ignore

            
return ! empty( $tables ) ? wp_list_pluck$tables) : array();
        }
    }
}

namespace {

    
/**
     * The function which returns the one WPForms instance.
     *
     * @since 1.0.0
     *
     * @return WPForms\WPForms
     */
    
function wpforms() {
        return 
WPForms\WPForms::instance();
    }

    
/**
     * Adding an alias for backward-compatibility with plugins
     * that still use class_exists('WPForms')
     * instead of function_exists('wpforms'), which is preferred.
     *
     * In 1.5.0 we removed support for PHP 5.2
     * and moved former WPForms class to a namespace: WPForms\WPForms.
     *
     * @since 1.5.1
     */
    
class_alias'WPForms\WPForms''WPForms' );
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586