| @@ -1,14 +1,16 @@ | ||
| 1 | 1 | <?php |
| 2 | -/* | |
| 3 | -Plugin Name: Formidable Forms | |
| 4 | -Description: Quickly and easily create drag-and-drop forms | |
| 5 | -Version: 6.4 | |
| 6 | -Plugin URI: https://formidableforms.com/ | |
| 7 | -Author URI: https://formidableforms.com/ | |
| 8 | -Author: Strategy11 Form Builder Team | |
| 9 | -Text Domain: formidable | |
| 10 | -*/ | |
| 2 | +/** | |
| 3 | + * Plugin Name: Formidable Forms | |
| 4 | + * Description: Quickly and easily create drag-and-drop forms | |
| 5 | + * Version: 6.8 | |
| 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 | + */ | |
| 11 | 13 | |
| 12 | 14 | /* |
| 13 | 15 | Copyright 2010 Formidable Forms |
| 14 | 16 | |
| @@ -47,14 +49,14 @@ | ||
| 47 | 49 | |
| 48 | 50 | FrmHooksController::trigger_load_hook(); |
| 49 | 51 | } |
| 50 | 52 | |
| 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() ) ) { | |
| 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 ) ) { | |
| 53 | 55 | spl_autoload_register( '__autoload' ); |
| 54 | 56 | } |
| 55 | 57 | |
| 56 | -// Add the autoloader | |
| 58 | +// Add the autoloader. | |
| 57 | 59 | spl_autoload_register( 'frm_forms_autoloader' ); |
| 58 | 60 | |
| 59 | 61 | /** |
| 60 | 62 | * @return void |
| @@ -59,9 +61,9 @@ | ||
| 59 | 61 | /** |
| 60 | 62 | * @return void |
| 61 | 63 | */ |
| 62 | 64 | function frm_forms_autoloader( $class_name ) { |
| 63 | - // Only load Frm classes here | |
| 65 | + // Only load Frm classes here. | |
| 64 | 66 | if ( ! preg_match( '/^Frm.+$/', $class_name ) || preg_match( '/^FrmPro.+$/', $class_name ) ) { |
| 65 | 67 | return; |
| 66 | 68 | } |
| 67 | 69 | |
| @@ -75,10 +77,11 @@ | ||
| 75 | 77 | * |
| 76 | 78 | * @return void |
| 77 | 79 | */ |
| 78 | 80 | function frm_class_autoloader( $class_name, $filepath ) { |
| 79 | - $deprecated = array( 'FrmEntryFormat', 'FrmPointers', 'FrmEDD_SL_Plugin_Updater' ); | |
| 80 | - $is_deprecated = in_array( $class_name, $deprecated ) || preg_match( '/^.+Deprecate/', $class_name ); | |
| 81 | + $deprecated = array( 'FrmPointers', 'FrmEDD_SL_Plugin_Updater', 'FrmWelcomeController' ); | |
| 82 | + $is_deprecated = in_array( $class_name, $deprecated, true ) || preg_match( '/^.+Deprecate/', $class_name ); | |
| 83 | + $original_filepath = $filepath; | |
| 81 | 84 | |
| 82 | 85 | if ( $is_deprecated ) { |
| 83 | 86 | $filepath .= '/deprecated/'; |
| 84 | 87 | } else { |
| @@ -84,11 +87,11 @@ | ||
| 84 | 87 | } else { |
| 85 | 88 | $filepath .= '/classes/'; |
| 86 | 89 | if ( preg_match( '/^.+Helper$/', $class_name ) ) { |
| 87 | 90 | $filepath .= 'helpers/'; |
| 88 | - } else if ( preg_match( '/^.+Controller$/', $class_name ) ) { | |
| 91 | + } elseif ( preg_match( '/^.+Controller$/', $class_name ) ) { | |
| 89 | 92 | $filepath .= 'controllers/'; |
| 90 | - } else if ( preg_match( '/^.+Factory$/', $class_name ) ) { | |
| 93 | + } elseif ( preg_match( '/^.+Factory$/', $class_name ) ) { | |
| 91 | 94 | $filepath .= 'factories/'; |
| 92 | 95 | } else { |
| 93 | 96 | $filepath .= 'models/'; |
| 94 | 97 | if ( strpos( $class_name, 'Field' ) && ! file_exists( $filepath . $class_name . '.php' ) ) { |
| @@ -96,23 +99,48 @@ | ||
| 96 | 99 | } |
| 97 | 100 | } |
| 98 | 101 | } |
| 99 | 102 | |
| 103 | + if ( file_exists( $filepath . $class_name . '.php' ) ) { | |
| 104 | + require $filepath . $class_name . '.php'; | |
| 105 | + return; | |
| 106 | + } | |
| 107 | + | |
| 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. | |
| 110 | + return; | |
| 111 | + } | |
| 112 | + | |
| 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 | + } | |
| 122 | + | |
| 100 | 123 | $filepath .= $class_name . '.php'; |
| 101 | 124 | |
| 102 | 125 | if ( file_exists( $filepath ) ) { |
| 103 | - require( $filepath ); | |
| 126 | + require $filepath; | |
| 104 | 127 | } |
| 105 | 128 | } |
| 106 | 129 | |
| 107 | 130 | add_action( 'activate_' . FrmAppHelper::plugin_folder() . '/formidable.php', 'frm_maybe_install' ); |
| 131 | + | |
| 108 | 132 | /** |
| 133 | + * This function is triggered when Formidable is activated. | |
| 134 | + * | |
| 109 | 135 | * @return void |
| 110 | 136 | */ |
| 111 | 137 | function frm_maybe_install() { |
| 112 | - if ( get_transient( FrmWelcomeController::$option_name ) !== 'no' ) { | |
| 113 | - set_transient( FrmWelcomeController::$option_name, FrmWelcomeController::$menu_slug, 60 ); | |
| 138 | + if ( get_transient( FrmDashboardController::REDIRECT_META_NAME ) !== 'no' ) { | |
| 139 | + set_transient( FrmDashboardController::REDIRECT_META_NAME, FrmDashboardController::PAGE_SLUG, 60 ); | |
| 114 | 140 | } |
| 141 | + | |
| 142 | + FrmAppController::handle_activation(); | |
| 115 | 143 | } |
| 116 | 144 | |
| 117 | 145 | register_deactivation_hook( |
| 118 | 146 | __FILE__, |