PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.21.1
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.21.1
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
formidable / formidable.php

formidable.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More 6.21.1, at formidable.php

161 lines 4.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: Formidable Forms
4 * Description: Quickly and easily create drag-and-drop forms
5 * Version: 6.21.1
6 * Plugin URI: https://formidableforms.com/
7 * Author URI: https://formidableforms.com/
8 * Author: Strategy11 Form Builder Team
9 * Text Domain: formidable
10 *
11 * @package Formidable
12 */
13
14 /*
15 Copyright 2010 Formidable Forms
16
17 This program is free software; you can redistribute it and/or modify
18 it under the terms of the GNU General Public License, version 2, as
19 published by the Free Software Foundation.
20
21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU General Public License for more details.
25 */
26
27 if ( ! defined( 'ABSPATH' ) ) {
28 die( 'You are not allowed to call this page directly.' );
29 }
30
31 add_action( 'plugins_loaded', 'load_formidable_forms', 0 );
32 /**
33 * @return void
34 */
35 function load_formidable_forms() {
36 global $frm_vars;
37 $frm_vars = array(
38 'load_css' => false,
39 'forms_loaded' => array(),
40 'created_entries' => array(),
41 'pro_is_authorized' => false,
42 );
43
44 // For reverse compatibility. Load Pro if it's still nested.
45 $frm_path = __DIR__;
46 if ( file_exists( $frm_path . '/pro/formidable-pro.php' ) ) {
47 include $frm_path . '/pro/formidable-pro.php';
48 }
49
50 FrmHooksController::trigger_load_hook();
51 }
52
53 // If __autoload is active, put it on the spl_autoload stack.
54 if ( is_array( spl_autoload_functions() ) && in_array( '__autoload', spl_autoload_functions(), true ) ) {
55 spl_autoload_register( '__autoload' );
56 }
57
58 // Add the autoloader.
59 spl_autoload_register( 'frm_forms_autoloader' );
60
61 /**
62 * @return void
63 */
64 function frm_forms_autoloader( $class_name ) {
65 // Only load Frm classes here.
66 if ( ! preg_match( '/^Frm.+$/', $class_name ) || preg_match( '/^FrmPro.+$/', $class_name ) ) {
67 return;
68 }
69
70 frm_class_autoloader( $class_name, __DIR__ );
71 }
72
73 /**
74 * Autoload the Formidable and Pro classes
75 *
76 * @since 3.0
77 *
78 * @return void
79 */
80 function frm_class_autoloader( $class_name, $filepath ) {
81 $deprecated = array( 'FrmEDD_SL_Plugin_Updater' );
82 $is_deprecated = in_array( $class_name, $deprecated, true ) || preg_match( '/^.+Deprecate/', $class_name );
83 $original_filepath = $filepath;
84
85 if ( $is_deprecated ) {
86 $filepath .= '/deprecated/';
87 } else {
88 $filepath .= '/classes/';
89 if ( preg_match( '/^.+Helper$/', $class_name ) ) {
90 $filepath .= 'helpers/';
91 } elseif ( preg_match( '/^.+Controller$/', $class_name ) ) {
92 $filepath .= 'controllers/';
93 } elseif ( preg_match( '/^.+Factory$/', $class_name ) ) {
94 $filepath .= 'factories/';
95 } elseif ( preg_match( '/^.+StyleComponent$/', $class_name ) ) {
96 $filepath .= 'views/styles/components/';
97 } else {
98 $filepath .= 'models/';
99 if ( strpos( $class_name, 'Field' ) && ! file_exists( $filepath . $class_name . '.php' ) ) {
100 $filepath .= 'fields/';
101 }
102 }
103 }
104
105 if ( file_exists( $filepath . $class_name . '.php' ) ) {
106 require $filepath . $class_name . '.php';
107 return;
108 }
109
110 if ( ! preg_match( '/^FrmStrpLite.+$/', $class_name ) && ! preg_match( '/^FrmTransLite.+$/', $class_name ) ) {
111 // Exit early if the class does not match the Stripe Lite prefix.
112 return;
113 }
114
115 // Autoload for /stripe/ folder.
116 $filepath = $original_filepath . '/stripe/';
117 if ( preg_match( '/^.+Helper$/', $class_name ) ) {
118 $filepath .= 'helpers/';
119 } elseif ( preg_match( '/^.+Controller$/', $class_name ) ) {
120 $filepath .= 'controllers/';
121 } else {
122 $filepath .= 'models/';
123 }
124
125 $filepath .= $class_name . '.php';
126
127 if ( file_exists( $filepath ) ) {
128 require $filepath;
129 }
130 }
131
132 add_action( 'activate_' . FrmAppHelper::plugin_folder() . '/formidable.php', 'frm_maybe_install' );
133
134 /**
135 * This function is triggered when Formidable is activated.
136 *
137 * @return void
138 */
139 function frm_maybe_install() {
140 if ( get_transient( FrmOnboardingWizardController::TRANSIENT_NAME ) !== 'no' ) {
141 set_transient(
142 FrmOnboardingWizardController::TRANSIENT_NAME,
143 FrmOnboardingWizardController::TRANSIENT_VALUE,
144 60
145 );
146 }
147
148 FrmAppController::handle_activation();
149 }
150
151 register_deactivation_hook(
152 __FILE__,
153 function () {
154 if ( ! class_exists( 'FrmCronController', false ) ) {
155 require_once __DIR__ . '/classes/controllers/FrmCronController.php';
156 }
157
158 FrmCronController::remove_crons();
159 }
160 );
161