PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.6
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.6
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.6, at formidable.php

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