| @@ -1,9 +1,9 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | 3 | * Plugin Name: Formidable Forms |
| 4 | 4 | * Description: Quickly and easily create drag-and-drop forms |
| 5 | - * Version: 6.26.1 | |
| 5 | + * Version: 6.7.2 | |
| 6 | 6 | * Plugin URI: https://formidableforms.com/ |
| 7 | 7 | * Author URI: https://formidableforms.com/ |
| 8 | 8 | * Author: Strategy11 Form Builder Team |
| 9 | 9 | * Text Domain: formidable |
| @@ -41,12 +41,11 @@ | ||
| 41 | 41 | 'pro_is_authorized' => false, |
| 42 | 42 | ); |
| 43 | 43 | |
| 44 | 44 | // For reverse compatibility. Load Pro if it's still nested. |
| 45 | - $frm_path = __DIR__; | |
| 46 | - | |
| 45 | + $frm_path = dirname( __FILE__ ); | |
| 47 | 46 | if ( file_exists( $frm_path . '/pro/formidable-pro.php' ) ) { |
| 48 | - include $frm_path . '/pro/formidable-pro.php'; | |
| 47 | + include( $frm_path . '/pro/formidable-pro.php' ); | |
| 49 | 48 | } |
| 50 | 49 | |
| 51 | 50 | FrmHooksController::trigger_load_hook(); |
| 52 | 51 | } |
| @@ -59,10 +58,8 @@ | ||
| 59 | 58 | // Add the autoloader. |
| 60 | 59 | spl_autoload_register( 'frm_forms_autoloader' ); |
| 61 | 60 | |
| 62 | 61 | /** |
| 63 | - * @param string $class_name Class name. | |
| 64 | - * | |
| 65 | 62 | * @return void |
| 66 | 63 | */ |
| 67 | 64 | function frm_forms_autoloader( $class_name ) { |
| 68 | 65 | // Only load Frm classes here. |
| @@ -69,9 +66,9 @@ | ||
| 69 | 66 | if ( ! preg_match( '/^Frm.+$/', $class_name ) || preg_match( '/^FrmPro.+$/', $class_name ) ) { |
| 70 | 67 | return; |
| 71 | 68 | } |
| 72 | 69 | |
| 73 | - frm_class_autoloader( $class_name, __DIR__ ); | |
| 70 | + frm_class_autoloader( $class_name, dirname( __FILE__ ) ); | |
| 74 | 71 | } |
| 75 | 72 | |
| 76 | 73 | /** |
| 77 | 74 | * Autoload the Formidable and Pro classes |
| @@ -77,75 +74,57 @@ | ||
| 77 | 74 | * Autoload the Formidable and Pro classes |
| 78 | 75 | * |
| 79 | 76 | * @since 3.0 |
| 80 | 77 | * |
| 81 | - * @param string $class_name Class name. | |
| 82 | - * @param string $filepath File path. | |
| 83 | - * | |
| 84 | 78 | * @return void |
| 85 | 79 | */ |
| 86 | 80 | function frm_class_autoloader( $class_name, $filepath ) { |
| 81 | + $deprecated = array( 'FrmPointers', 'FrmEDD_SL_Plugin_Updater' ); | |
| 82 | + $is_deprecated = in_array( $class_name, $deprecated, true ) || preg_match( '/^.+Deprecate/', $class_name ); | |
| 87 | 83 | $original_filepath = $filepath; |
| 88 | - $filepath .= '/classes/'; | |
| 89 | 84 | |
| 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/'; | |
| 85 | + if ( $is_deprecated ) { | |
| 86 | + $filepath .= '/deprecated/'; | |
| 98 | 87 | } else { |
| 99 | - $filepath .= 'models/'; | |
| 100 | - | |
| 101 | - if ( strpos( $class_name, 'Field' ) && ! file_exists( $filepath . $class_name . '.php' ) ) { | |
| 102 | - $filepath .= 'fields/'; | |
| 103 | - } | |
| 104 | - } | |
| 105 | - | |
| 106 | - if ( file_exists( $filepath . $class_name . '.php' ) ) { | |
| 107 | - require $filepath . $class_name . '.php'; | |
| 108 | - return; | |
| 109 | - } | |
| 110 | - | |
| 111 | - if ( preg_match( '/^FrmStrpLite.+$/', $class_name ) || preg_match( '/^FrmTransLite.+$/', $class_name ) ) { | |
| 112 | - // Autoload for /stripe/ folder. | |
| 113 | - $filepath = $original_filepath . '/stripe/'; | |
| 114 | - | |
| 88 | + $filepath .= '/classes/'; | |
| 115 | 89 | if ( preg_match( '/^.+Helper$/', $class_name ) ) { |
| 116 | 90 | $filepath .= 'helpers/'; |
| 117 | 91 | } elseif ( preg_match( '/^.+Controller$/', $class_name ) ) { |
| 118 | 92 | $filepath .= 'controllers/'; |
| 93 | + } elseif ( preg_match( '/^.+Factory$/', $class_name ) ) { | |
| 94 | + $filepath .= 'factories/'; | |
| 119 | 95 | } else { |
| 120 | 96 | $filepath .= 'models/'; |
| 97 | + if ( strpos( $class_name, 'Field' ) && ! file_exists( $filepath . $class_name . '.php' ) ) { | |
| 98 | + $filepath .= 'fields/'; | |
| 99 | + } | |
| 121 | 100 | } |
| 101 | + } | |
| 122 | 102 | |
| 123 | - $filepath .= $class_name . '.php'; | |
| 103 | + if ( file_exists( $filepath . $class_name . '.php' ) ) { | |
| 104 | + require $filepath . $class_name . '.php'; | |
| 105 | + return; | |
| 106 | + } | |
| 124 | 107 | |
| 125 | - if ( file_exists( $filepath ) ) { | |
| 126 | - require $filepath; | |
| 127 | - } | |
| 128 | - | |
| 108 | + if ( ! preg_match( '/^FrmStrpLite.+$/', $class_name ) && ! preg_match( '/^FrmTransLite.+$/', $class_name ) ) { | |
| 109 | + // Exit early if the class does not match the Stripe Lite prefix. | |
| 129 | 110 | return; |
| 130 | 111 | } |
| 131 | 112 | |
| 132 | - if ( preg_match( '/^FrmSquareLite.+$/', $class_name ) ) { | |
| 133 | - $filepath = $original_filepath . '/square/'; | |
| 113 | + // Autoload for /stripe/ folder. | |
| 114 | + $filepath = $original_filepath . '/stripe/'; | |
| 115 | + if ( preg_match( '/^.+Helper$/', $class_name ) ) { | |
| 116 | + $filepath .= 'helpers/'; | |
| 117 | + } elseif ( preg_match( '/^.+Controller$/', $class_name ) ) { | |
| 118 | + $filepath .= 'controllers/'; | |
| 119 | + } else { | |
| 120 | + $filepath .= 'models/'; | |
| 121 | + } | |
| 134 | 122 | |
| 135 | - if ( preg_match( '/^.+Helper$/', $class_name ) ) { | |
| 136 | - $filepath .= 'helpers/'; | |
| 137 | - } elseif ( preg_match( '/^.+Controller$/', $class_name ) ) { | |
| 138 | - $filepath .= 'controllers/'; | |
| 139 | - } else { | |
| 140 | - $filepath .= 'models/'; | |
| 141 | - } | |
| 123 | + $filepath .= $class_name . '.php'; | |
| 142 | 124 | |
| 143 | - $filepath .= $class_name . '.php'; | |
| 144 | - | |
| 145 | - if ( file_exists( $filepath ) ) { | |
| 146 | - require $filepath; | |
| 147 | - } | |
| 125 | + if ( file_exists( $filepath ) ) { | |
| 126 | + require $filepath; | |
| 148 | 127 | } |
| 149 | 128 | } |
| 150 | 129 | |
| 151 | 130 | add_action( 'activate_' . FrmAppHelper::plugin_folder() . '/formidable.php', 'frm_maybe_install' ); |
| @@ -155,14 +134,10 @@ | ||
| 155 | 134 | * |
| 156 | 135 | * @return void |
| 157 | 136 | */ |
| 158 | 137 | function frm_maybe_install() { |
| 159 | - if ( get_transient( FrmOnboardingWizardController::TRANSIENT_NAME ) !== 'no' ) { | |
| 160 | - set_transient( | |
| 161 | - FrmOnboardingWizardController::TRANSIENT_NAME, | |
| 162 | - FrmOnboardingWizardController::TRANSIENT_VALUE, | |
| 163 | - 60 | |
| 164 | - ); | |
| 138 | + if ( get_transient( FrmWelcomeController::$option_name ) !== 'no' ) { | |
| 139 | + set_transient( FrmWelcomeController::$option_name, FrmWelcomeController::$menu_slug, 60 ); | |
| 165 | 140 | } |
| 166 | 141 | |
| 167 | 142 | FrmAppController::handle_activation(); |
| 168 | 143 | } |
| @@ -168,9 +143,9 @@ | ||
| 168 | 143 | } |
| 169 | 144 | |
| 170 | 145 | register_deactivation_hook( |
| 171 | 146 | __FILE__, |
| 172 | - function () { | |
| 147 | + function() { | |
| 173 | 148 | if ( ! class_exists( 'FrmCronController', false ) ) { |
| 174 | 149 | require_once __DIR__ . '/classes/controllers/FrmCronController.php'; |
| 175 | 150 | } |
| 176 | 151 | |