| @@ -1,126 +1,114 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /* |
| 3 | -Plugin Name: Formidable Forms | |
| 3 | +Plugin Name: Formidable | |
| 4 | 4 | Description: Quickly and easily create drag-and-drop forms |
| 5 | -Version: 6.3.2 | |
| 6 | -Plugin URI: https://formidableforms.com/ | |
| 7 | -Author URI: https://formidableforms.com/ | |
| 8 | -Author: Strategy11 Form Builder Team | |
| 5 | +Version: 1.07.11 | |
| 6 | +Plugin URI: http://formidablepro.com/ | |
| 7 | +Author URI: http://strategy11.com | |
| 8 | +Author: Strategy11 | |
| 9 | 9 | Text Domain: formidable |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -/* | |
| 13 | - Copyright 2010 Formidable Forms | |
| 12 | +/* Copyright 2010 Strategy11 (email : support@strategy11.com) | |
| 14 | 13 | |
| 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. | |
| 14 | + This program is free software; you can redistribute it and/or modify | |
| 15 | + it under the terms of the GNU General Public License, version 2, as | |
| 16 | + published by the Free Software Foundation. | |
| 18 | 17 | |
| 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. | |
| 18 | + This program is distributed in the hope that it will be useful, | |
| 19 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 20 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 21 | + GNU General Public License for more details. | |
| 23 | 22 | */ |
| 24 | 23 | |
| 25 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 26 | - die( 'You are not allowed to call this page directly.' ); | |
| 27 | -} | |
| 24 | +require_once(dirname( __FILE__ ) .'/classes/models/FrmSettings.php'); | |
| 28 | 25 | |
| 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 | - ); | |
| 26 | +global $frm_vars; | |
| 27 | +$frm_vars = array( | |
| 28 | + 'load_css' => false, 'forms_loaded' => array(), | |
| 29 | + 'created_entries' => array(), 'pro_is_installed' => false | |
| 30 | +); | |
| 41 | 31 | |
| 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 | - } | |
| 32 | +require_once(dirname( __FILE__ ) .'/classes/helpers/FrmAppHelper.php'); | |
| 33 | +$obj = new FrmAppHelper(); | |
| 47 | 34 | |
| 48 | - FrmHooksController::trigger_load_hook(); | |
| 35 | +/***** SETUP SETTINGS OBJECT *****/ | |
| 36 | +global $frm_settings; | |
| 37 | + | |
| 38 | +$frm_settings = get_transient('frm_options'); | |
| 39 | +if(!is_object($frm_settings)){ | |
| 40 | + if($frm_settings){ //workaround for W3 total cache conflict | |
| 41 | + $frm_settings = unserialize(serialize($frm_settings)); | |
| 42 | + }else{ | |
| 43 | + $frm_settings = get_option('frm_options'); | |
| 44 | + | |
| 45 | + // If unserializing didn't work | |
| 46 | + if(!is_object($frm_settings)){ | |
| 47 | + if($frm_settings) //workaround for W3 total cache conflict | |
| 48 | + $frm_settings = unserialize(serialize($frm_settings)); | |
| 49 | + else | |
| 50 | + $frm_settings = new FrmSettings(); | |
| 51 | + update_option('frm_options', $frm_settings); | |
| 52 | + set_transient('frm_options', $frm_settings); | |
| 53 | + } | |
| 54 | + } | |
| 49 | 55 | } |
| 56 | +$frm_settings->set_default_options(); // Sets defaults for unset options | |
| 50 | 57 | |
| 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 | - spl_autoload_register( '__autoload' ); | |
| 54 | -} | |
| 58 | +$frm_path = FrmAppHelper::plugin_path(); | |
| 55 | 59 | |
| 56 | -// Add the autoloader | |
| 57 | -spl_autoload_register( 'frm_forms_autoloader' ); | |
| 60 | +// Instansiate Models | |
| 61 | +require_once($frm_path .'/classes/models/FrmDb.php'); | |
| 62 | +require_once($frm_path .'/classes/models/FrmField.php'); | |
| 63 | +require_once($frm_path .'/classes/models/FrmForm.php'); | |
| 64 | +require_once($frm_path .'/classes/models/FrmEntry.php'); | |
| 65 | +require_once($frm_path .'/classes/models/FrmEntryMeta.php'); | |
| 66 | +require_once($frm_path .'/classes/models/FrmNotification.php'); | |
| 58 | 67 | |
| 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 | - } | |
| 68 | +global $frmdb; | |
| 69 | +global $frm_field; | |
| 70 | +global $frm_form; | |
| 71 | +global $frm_entry; | |
| 72 | +global $frm_entry_meta; | |
| 67 | 73 | |
| 68 | - frm_class_autoloader( $class_name, dirname( __FILE__ ) ); | |
| 69 | -} | |
| 74 | +$frmdb = new FrmDb(); | |
| 75 | +$frm_field = new FrmField(); | |
| 76 | +$frm_form = new FrmForm(); | |
| 77 | +$frm_entry = new FrmEntry(); | |
| 78 | +$frm_entry_meta = new FrmEntryMeta(); | |
| 79 | +$obj = new FrmNotification(); | |
| 70 | 80 | |
| 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( 'FrmEntryFormat', 'FrmPointers', 'FrmEDD_SL_Plugin_Updater' ); | |
| 80 | - $is_deprecated = in_array( $class_name, $deprecated ) || preg_match( '/^.+Deprecate/', $class_name ); | |
| 81 | 81 | |
| 82 | - if ( $is_deprecated ) { | |
| 83 | - $filepath .= '/deprecated/'; | |
| 84 | - } else { | |
| 85 | - $filepath .= '/classes/'; | |
| 86 | - if ( preg_match( '/^.+Helper$/', $class_name ) ) { | |
| 87 | - $filepath .= 'helpers/'; | |
| 88 | - } else if ( preg_match( '/^.+Controller$/', $class_name ) ) { | |
| 89 | - $filepath .= 'controllers/'; | |
| 90 | - } else if ( preg_match( '/^.+Factory$/', $class_name ) ) { | |
| 91 | - $filepath .= 'factories/'; | |
| 92 | - } else { | |
| 93 | - $filepath .= 'models/'; | |
| 94 | - if ( strpos( $class_name, 'Field' ) && ! file_exists( $filepath . $class_name . '.php' ) ) { | |
| 95 | - $filepath .= 'fields/'; | |
| 96 | - } | |
| 97 | - } | |
| 98 | - } | |
| 82 | +// Instansiate Controllers | |
| 83 | +require_once($frm_path .'/classes/controllers/FrmAppController.php'); | |
| 84 | +require_once($frm_path .'/classes/controllers/FrmFieldsController.php'); | |
| 85 | +require_once($frm_path .'/classes/controllers/FrmFormsController.php'); | |
| 86 | +require_once($frm_path .'/classes/controllers/FrmEntriesController.php'); | |
| 99 | 87 | |
| 100 | - $filepath .= $class_name . '.php'; | |
| 88 | +FrmAppController::load_hooks(); | |
| 89 | +FrmEntriesController::load_hooks(); | |
| 90 | +FrmFieldsController::load_hooks(); | |
| 91 | +FrmFormsController::load_hooks(); | |
| 101 | 92 | |
| 102 | - if ( file_exists( $filepath ) ) { | |
| 103 | - require( $filepath ); | |
| 104 | - } | |
| 93 | +if(is_admin()){ | |
| 94 | + require_once($frm_path .'/classes/controllers/FrmSettingsController.php'); | |
| 95 | + FrmSettingsController::load_hooks(); | |
| 96 | + | |
| 97 | + require_once($frm_path .'/classes/controllers/FrmStatisticsController.php'); | |
| 98 | + FrmStatisticsController::load_hooks(); | |
| 99 | + | |
| 100 | + require_once($frm_path .'/classes/controllers/FrmXMLController.php'); | |
| 101 | + FrmXMLController::load_hooks(); | |
| 105 | 102 | } |
| 106 | 103 | |
| 107 | -add_action( 'activate_' . FrmAppHelper::plugin_folder() . '/formidable.php', 'frm_maybe_install' ); | |
| 108 | -/** | |
| 109 | - * @return void | |
| 110 | - */ | |
| 111 | -function frm_maybe_install() { | |
| 112 | - if ( get_transient( FrmWelcomeController::$option_name ) !== 'no' ) { | |
| 113 | - set_transient( FrmWelcomeController::$option_name, FrmWelcomeController::$menu_slug, 60 ); | |
| 114 | - } | |
| 104 | +// Instansiate Helpers | |
| 105 | +require_once($frm_path .'/classes/helpers/FrmEntriesHelper.php'); | |
| 106 | +require_once($frm_path .'/classes/helpers/FrmFieldsHelper.php'); | |
| 107 | +require_once($frm_path .'/classes/helpers/FrmFormsHelper.php'); | |
| 108 | + | |
| 109 | +if ( file_exists($frm_path . '/pro/formidable-pro.php') ) { | |
| 110 | + require_once($frm_path .'/pro/formidable-pro.php'); | |
| 115 | 111 | } |
| 116 | 112 | |
| 117 | -register_deactivation_hook( | |
| 118 | - __FILE__, | |
| 119 | - function() { | |
| 120 | - if ( ! class_exists( 'FrmCronController', false ) ) { | |
| 121 | - require_once __DIR__ . '/classes/controllers/FrmCronController.php'; | |
| 122 | - } | |
| 123 | - | |
| 124 | - FrmCronController::remove_crons(); | |
| 125 | - } | |
| 126 | -); | |
| 113 | +include_once($frm_path .'/deprecated.php'); | |
| 114 | +unset($frm_path); | |