| @@ -1,16 +1,14 @@ | ||
| 1 | 1 | <?php |
| 2 | -/** | |
| 3 | - * Plugin Name: Formidable Forms | |
| 4 | - * Description: Quickly and easily create drag-and-drop forms | |
| 5 | - * Version: 6.25 | |
| 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 | - */ | |
| 2 | +/* | |
| 3 | +Plugin Name: Formidable Forms | |
| 4 | +Description: Quickly and easily create drag-and-drop forms | |
| 5 | +Version: 5.0.14 | |
| 6 | +Plugin URI: https://formidableforms.com/ | |
| 7 | +Author URI: https://formidableforms.com/ | |
| 8 | +Author: Strategy11 | |
| 9 | +Text Domain: formidable | |
| 10 | +*/ | |
| 13 | 11 | |
| 14 | 12 | /* |
| 15 | 13 | Copyright 2010 Formidable Forms |
| 16 | 14 | |
| @@ -28,11 +26,8 @@ | ||
| 28 | 26 | die( 'You are not allowed to call this page directly.' ); |
| 29 | 27 | } |
| 30 | 28 | |
| 31 | 29 | add_action( 'plugins_loaded', 'load_formidable_forms', 0 ); |
| 32 | -/** | |
| 33 | - * @return void | |
| 34 | - */ | |
| 35 | 30 | function load_formidable_forms() { |
| 36 | 31 | global $frm_vars; |
| 37 | 32 | $frm_vars = array( |
| 38 | 33 | 'load_css' => false, |
| @@ -41,34 +36,31 @@ | ||
| 41 | 36 | 'pro_is_authorized' => false, |
| 42 | 37 | ); |
| 43 | 38 | |
| 44 | 39 | // For reverse compatibility. Load Pro if it's still nested. |
| 45 | - $frm_path = __DIR__; | |
| 40 | + $frm_path = dirname( __FILE__ ); | |
| 46 | 41 | if ( file_exists( $frm_path . '/pro/formidable-pro.php' ) ) { |
| 47 | - include $frm_path . '/pro/formidable-pro.php'; | |
| 42 | + include( $frm_path . '/pro/formidable-pro.php' ); | |
| 48 | 43 | } |
| 49 | 44 | |
| 50 | 45 | FrmHooksController::trigger_load_hook(); |
| 51 | 46 | } |
| 52 | 47 | |
| 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 ) ) { | |
| 48 | +// if __autoload is active, put it on the spl_autoload stack | |
| 49 | +if ( is_array( spl_autoload_functions() ) && in_array( '__autoload', spl_autoload_functions() ) ) { | |
| 55 | 50 | spl_autoload_register( '__autoload' ); |
| 56 | 51 | } |
| 57 | 52 | |
| 58 | -// Add the autoloader. | |
| 53 | +// Add the autoloader | |
| 59 | 54 | spl_autoload_register( 'frm_forms_autoloader' ); |
| 60 | 55 | |
| 61 | -/** | |
| 62 | - * @return void | |
| 63 | - */ | |
| 64 | 56 | function frm_forms_autoloader( $class_name ) { |
| 65 | - // Only load Frm classes here. | |
| 57 | + // Only load Frm classes here | |
| 66 | 58 | if ( ! preg_match( '/^Frm.+$/', $class_name ) || preg_match( '/^FrmPro.+$/', $class_name ) ) { |
| 67 | 59 | return; |
| 68 | 60 | } |
| 69 | 61 | |
| 70 | - frm_class_autoloader( $class_name, __DIR__ ); | |
| 62 | + frm_class_autoloader( $class_name, dirname( __FILE__ ) ); | |
| 71 | 63 | } |
| 72 | 64 | |
| 73 | 65 | /** |
| 74 | 66 | * Autoload the Formidable and Pro classes |
| @@ -73,15 +65,12 @@ | ||
| 73 | 65 | /** |
| 74 | 66 | * Autoload the Formidable and Pro classes |
| 75 | 67 | * |
| 76 | 68 | * @since 3.0 |
| 77 | - * | |
| 78 | - * @return void | |
| 79 | 69 | */ |
| 80 | 70 | 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; | |
| 71 | + $deprecated = array( 'FrmEntryFormat', 'FrmPointers', 'FrmEDD_SL_Plugin_Updater' ); | |
| 72 | + $is_deprecated = in_array( $class_name, $deprecated ) || preg_match( '/^.+Deprecate/', $class_name ); | |
| 84 | 73 | |
| 85 | 74 | if ( $is_deprecated ) { |
| 86 | 75 | $filepath .= '/deprecated/'; |
| 87 | 76 | } else { |
| @@ -87,14 +76,12 @@ | ||
| 87 | 76 | } else { |
| 88 | 77 | $filepath .= '/classes/'; |
| 89 | 78 | if ( preg_match( '/^.+Helper$/', $class_name ) ) { |
| 90 | 79 | $filepath .= 'helpers/'; |
| 91 | - } elseif ( preg_match( '/^.+Controller$/', $class_name ) ) { | |
| 80 | + } else if ( preg_match( '/^.+Controller$/', $class_name ) ) { | |
| 92 | 81 | $filepath .= 'controllers/'; |
| 93 | - } elseif ( preg_match( '/^.+Factory$/', $class_name ) ) { | |
| 82 | + } else if ( preg_match( '/^.+Factory$/', $class_name ) ) { | |
| 94 | 83 | $filepath .= 'factories/'; |
| 95 | - } elseif ( preg_match( '/^.+StyleComponent$/', $class_name ) ) { | |
| 96 | - $filepath .= 'views/styles/components/'; | |
| 97 | 84 | } else { |
| 98 | 85 | $filepath .= 'models/'; |
| 99 | 86 | if ( strpos( $class_name, 'Field' ) && ! file_exists( $filepath . $class_name . '.php' ) ) { |
| 100 | 87 | $filepath .= 'fields/'; |
| @@ -101,76 +88,17 @@ | ||
| 101 | 88 | } |
| 102 | 89 | } |
| 103 | 90 | } |
| 104 | 91 | |
| 105 | - if ( file_exists( $filepath . $class_name . '.php' ) ) { | |
| 106 | - require $filepath . $class_name . '.php'; | |
| 107 | - return; | |
| 108 | - } | |
| 92 | + $filepath .= $class_name . '.php'; | |
| 109 | 93 | |
| 110 | - if ( preg_match( '/^FrmStrpLite.+$/', $class_name ) || preg_match( '/^FrmTransLite.+$/', $class_name ) ) { | |
| 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 | - return; | |
| 94 | + if ( file_exists( $filepath ) ) { | |
| 95 | + require( $filepath ); | |
| 128 | 96 | } |
| 129 | - | |
| 130 | - if ( preg_match( '/^FrmSquareLite.+$/', $class_name ) ) { | |
| 131 | - $filepath = $original_filepath . '/square/'; | |
| 132 | - if ( preg_match( '/^.+Helper$/', $class_name ) ) { | |
| 133 | - $filepath .= 'helpers/'; | |
| 134 | - } elseif ( preg_match( '/^.+Controller$/', $class_name ) ) { | |
| 135 | - $filepath .= 'controllers/'; | |
| 136 | - } else { | |
| 137 | - $filepath .= 'models/'; | |
| 138 | - } | |
| 139 | - | |
| 140 | - $filepath .= $class_name . '.php'; | |
| 141 | - | |
| 142 | - if ( file_exists( $filepath ) ) { | |
| 143 | - require $filepath; | |
| 144 | - } | |
| 145 | - } | |
| 146 | 97 | } |
| 147 | 98 | |
| 148 | 99 | add_action( 'activate_' . FrmAppHelper::plugin_folder() . '/formidable.php', 'frm_maybe_install' ); |
| 149 | - | |
| 150 | -/** | |
| 151 | - * This function is triggered when Formidable is activated. | |
| 152 | - * | |
| 153 | - * @return void | |
| 154 | - */ | |
| 155 | 100 | function frm_maybe_install() { |
| 156 | - if ( get_transient( FrmOnboardingWizardController::TRANSIENT_NAME ) !== 'no' ) { | |
| 157 | - set_transient( | |
| 158 | - FrmOnboardingWizardController::TRANSIENT_NAME, | |
| 159 | - FrmOnboardingWizardController::TRANSIENT_VALUE, | |
| 160 | - 60 | |
| 161 | - ); | |
| 101 | + if ( get_transient( FrmWelcomeController::$option_name ) !== 'no' ) { | |
| 102 | + set_transient( FrmWelcomeController::$option_name, FrmWelcomeController::$menu_slug, 60 ); | |
| 162 | 103 | } |
| 163 | - | |
| 164 | - FrmAppController::handle_activation(); | |
| 165 | 104 | } |
| 166 | - | |
| 167 | -register_deactivation_hook( | |
| 168 | - __FILE__, | |
| 169 | - function () { | |
| 170 | - if ( ! class_exists( 'FrmCronController', false ) ) { | |
| 171 | - require_once __DIR__ . '/classes/controllers/FrmCronController.php'; | |
| 172 | - } | |
| 173 | - | |
| 174 | - FrmCronController::remove_crons(); | |
| 175 | - } | |
| 176 | -); | |