| @@ -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.31 | |
| 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: 6.1 | |
| 6 | +Plugin URI: https://formidableforms.com/ | |
| 7 | +Author URI: https://formidableforms.com/ | |
| 8 | +Author: Strategy11 Form Builder Team | |
| 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,37 +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__; | |
| 46 | - | |
| 40 | + $frm_path = dirname( __FILE__ ); | |
| 47 | 41 | if ( file_exists( $frm_path . '/pro/formidable-pro.php' ) ) { |
| 48 | - include $frm_path . '/pro/formidable-pro.php'; | |
| 42 | + include( $frm_path . '/pro/formidable-pro.php' ); | |
| 49 | 43 | } |
| 50 | 44 | |
| 51 | 45 | FrmHooksController::trigger_load_hook(); |
| 52 | 46 | } |
| 53 | 47 | |
| 54 | -// If __autoload is active, put it on the spl_autoload stack. | |
| 55 | -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() ) ) { | |
| 56 | 50 | spl_autoload_register( '__autoload' ); |
| 57 | 51 | } |
| 58 | 52 | |
| 59 | -// Add the autoloader. | |
| 53 | +// Add the autoloader | |
| 60 | 54 | spl_autoload_register( 'frm_forms_autoloader' ); |
| 61 | 55 | |
| 62 | -/** | |
| 63 | - * @param string $class_name Class name. | |
| 64 | - * | |
| 65 | - * @return void | |
| 66 | - */ | |
| 67 | 56 | function frm_forms_autoloader( $class_name ) { |
| 68 | - // Only load Frm classes here. | |
| 57 | + // Only load Frm classes here | |
| 69 | 58 | if ( ! preg_match( '/^Frm.+$/', $class_name ) || preg_match( '/^FrmPro.+$/', $class_name ) ) { |
| 70 | 59 | return; |
| 71 | 60 | } |
| 72 | 61 | |
| 73 | - frm_class_autoloader( $class_name, __DIR__ ); | |
| 62 | + frm_class_autoloader( $class_name, dirname( __FILE__ ) ); | |
| 74 | 63 | } |
| 75 | 64 | |
| 76 | 65 | /** |
| 77 | 66 | * Autoload the Formidable and Pro classes |
| @@ -76,92 +65,40 @@ | ||
| 76 | 65 | /** |
| 77 | 66 | * Autoload the Formidable and Pro classes |
| 78 | 67 | * |
| 79 | 68 | * @since 3.0 |
| 80 | - * | |
| 81 | - * @param string $class_name Class name. | |
| 82 | - * @param string $filepath File path. | |
| 83 | - * | |
| 84 | - * @return void | |
| 85 | 69 | */ |
| 86 | 70 | function frm_class_autoloader( $class_name, $filepath ) { |
| 87 | - $original_filepath = $filepath; | |
| 88 | - $filepath .= '/classes/'; | |
| 71 | + $deprecated = array( 'FrmEntryFormat', 'FrmPointers', 'FrmEDD_SL_Plugin_Updater' ); | |
| 72 | + $is_deprecated = in_array( $class_name, $deprecated ) || preg_match( '/^.+Deprecate/', $class_name ); | |
| 89 | 73 | |
| 90 | - if ( preg_match( '/^.+Helper$/', $class_name ) ) { | |
| 91 | - $filepath .= 'helpers/'; | |
| 92 | - } elseif ( preg_match( '/^.+Controller$/', $class_name ) ) { | |
| 93 | - $filepath .= 'controllers/'; | |
| 94 | - } elseif ( preg_match( '/^.+Factory$/', $class_name ) ) { | |
| 95 | - $filepath .= 'factories/'; | |
| 96 | - } elseif ( preg_match( '/^.+StyleComponent$/', $class_name ) ) { | |
| 97 | - $filepath .= 'views/styles/components/'; | |
| 74 | + if ( $is_deprecated ) { | |
| 75 | + $filepath .= '/deprecated/'; | |
| 98 | 76 | } else { |
| 99 | - $filepath .= 'models/'; | |
| 100 | - | |
| 101 | - if ( str_contains( $class_name, 'Field' ) && ! file_exists( $filepath . $class_name . '.php' ) ) { | |
| 102 | - $filepath .= 'fields/'; | |
| 77 | + $filepath .= '/classes/'; | |
| 78 | + if ( preg_match( '/^.+Helper$/', $class_name ) ) { | |
| 79 | + $filepath .= 'helpers/'; | |
| 80 | + } else if ( preg_match( '/^.+Controller$/', $class_name ) ) { | |
| 81 | + $filepath .= 'controllers/'; | |
| 82 | + } else if ( preg_match( '/^.+Factory$/', $class_name ) ) { | |
| 83 | + $filepath .= 'factories/'; | |
| 84 | + } else { | |
| 85 | + $filepath .= 'models/'; | |
| 86 | + if ( strpos( $class_name, 'Field' ) && ! file_exists( $filepath . $class_name . '.php' ) ) { | |
| 87 | + $filepath .= 'fields/'; | |
| 88 | + } | |
| 103 | 89 | } |
| 104 | 90 | } |
| 105 | 91 | |
| 106 | - if ( file_exists( $filepath . $class_name . '.php' ) ) { | |
| 107 | - require $filepath . $class_name . '.php'; | |
| 108 | - return; | |
| 109 | - } | |
| 110 | - | |
| 111 | - $filepath = $original_filepath; | |
| 112 | - | |
| 113 | - if ( preg_match( '/^FrmStrpLite.+$/', $class_name ) || preg_match( '/^FrmTransLite.+$/', $class_name ) ) { | |
| 114 | - // Autoload for /stripe/ folder. | |
| 115 | - $filepath .= '/stripe/'; | |
| 116 | - } elseif ( preg_match( '/^FrmSquareLite.+$/', $class_name ) ) { | |
| 117 | - $filepath .= '/square/'; | |
| 118 | - } elseif ( preg_match( '/^FrmPayPalLite.+$/', $class_name ) ) { | |
| 119 | - $filepath .= '/paypal/'; | |
| 120 | - } else { | |
| 121 | - return; | |
| 122 | - } | |
| 123 | - | |
| 124 | - if ( preg_match( '/^.+Helper$/', $class_name ) ) { | |
| 125 | - $filepath .= 'helpers/'; | |
| 126 | - } elseif ( preg_match( '/^.+Controller$/', $class_name ) ) { | |
| 127 | - $filepath .= 'controllers/'; | |
| 128 | - } else { | |
| 129 | - $filepath .= 'models/'; | |
| 130 | - } | |
| 131 | - | |
| 132 | 92 | $filepath .= $class_name . '.php'; |
| 133 | 93 | |
| 134 | 94 | if ( file_exists( $filepath ) ) { |
| 135 | - require $filepath; | |
| 95 | + require( $filepath ); | |
| 136 | 96 | } |
| 137 | 97 | } |
| 138 | 98 | |
| 139 | 99 | add_action( 'activate_' . FrmAppHelper::plugin_folder() . '/formidable.php', 'frm_maybe_install' ); |
| 140 | - | |
| 141 | -/** | |
| 142 | - * This function is triggered when Formidable is activated. | |
| 143 | - * | |
| 144 | - * @return void | |
| 145 | - */ | |
| 146 | 100 | function frm_maybe_install() { |
| 147 | - if ( get_transient( FrmOnboardingWizardController::TRANSIENT_NAME ) !== 'no' ) { | |
| 148 | - set_transient( | |
| 149 | - FrmOnboardingWizardController::TRANSIENT_NAME, | |
| 150 | - FrmOnboardingWizardController::TRANSIENT_VALUE, | |
| 151 | - 60 | |
| 152 | - ); | |
| 101 | + if ( get_transient( FrmWelcomeController::$option_name ) !== 'no' ) { | |
| 102 | + set_transient( FrmWelcomeController::$option_name, FrmWelcomeController::$menu_slug, 60 ); | |
| 153 | 103 | } |
| 154 | - | |
| 155 | - FrmAppController::handle_activation(); | |
| 156 | 104 | } |
| 157 | - | |
| 158 | -register_deactivation_hook( | |
| 159 | - __FILE__, | |
| 160 | - function () { | |
| 161 | - if ( ! class_exists( 'FrmCronController', false ) ) { | |
| 162 | - require_once __DIR__ . '/classes/controllers/FrmCronController.php'; | |
| 163 | - } | |
| 164 | - | |
| 165 | - FrmCronController::remove_crons(); | |
| 166 | - } | |
| 167 | -); | |