Completed
Branch FET-3467-waitlists (9ee75b)
by
unknown
91:40 queued 79:00
created
core/domain/DomainBase.php 2 patches
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -18,132 +18,132 @@
 block discarded – undo
18 18
 abstract class DomainBase
19 19
 {
20 20
 
21
-    /**
22
-     * Equivalent to `__FILE__` for main plugin file.
23
-     *
24
-     * @var string
25
-     */
26
-    private static $plugin_file = '';
27
-
28
-    /**
29
-     * String indicating version for plugin
30
-     *
31
-     * @var string
32
-     */
33
-    private static $version = '';
34
-
35
-    /**
36
-     * @var string $plugin_basename
37
-     */
38
-    private static $plugin_basename = '';
39
-
40
-    /**
41
-     * @var string $plugin_path
42
-     */
43
-    private static $plugin_path = '';
44
-
45
-    /**
46
-     * @var string $plugin_url
47
-     */
48
-    private static $plugin_url = '';
49
-
50
-
51
-
52
-    /**
53
-     * Initializes internal static properties.
54
-     *
55
-     * @param string $plugin_file
56
-     * @param string $version
57
-     */
58
-    public static function init($plugin_file, $version)
59
-    {
60
-        self::$plugin_file = $plugin_file;
61
-        self::$version = $version;
62
-        self::$plugin_basename = plugin_basename($plugin_file);
63
-        self::$plugin_path = plugin_dir_path($plugin_file);
64
-        self::$plugin_url = plugin_dir_url($plugin_file);
65
-    }
66
-
67
-
68
-
69
-    /**
70
-     * @return string
71
-     * @throws DomainException
72
-     */
73
-    public static function pluginFile()
74
-    {
75
-        self::verifyInitialized(__METHOD__);
76
-        return self::$plugin_file;
77
-    }
78
-
79
-
80
-
81
-    /**
82
-     * @return string
83
-     * @throws DomainException
84
-     */
85
-    public static function pluginBasename()
86
-    {
87
-        self::verifyInitialized(__METHOD__);
88
-        return self::$plugin_basename;
89
-    }
90
-
91
-
92
-
93
-    /**
94
-     * @return string
95
-     * @throws DomainException
96
-     */
97
-    public static function pluginPath()
98
-    {
99
-        self::verifyInitialized(__METHOD__);
100
-        return self::$plugin_path;
101
-    }
102
-
103
-
104
-
105
-    /**
106
-     * @return string
107
-     * @throws DomainException
108
-     */
109
-    public static function pluginUrl()
110
-    {
111
-        self::verifyInitialized(__METHOD__);
112
-        return self::$plugin_url;
113
-    }
114
-
115
-
116
-
117
-    /**
118
-     * @return string
119
-     * @throws DomainException
120
-     */
121
-    public static function version()
122
-    {
123
-        self::verifyInitialized(__METHOD__);
124
-        return self::$version;
125
-    }
126
-
127
-
128
-
129
-    /**
130
-     * @param string $method
131
-     * @throws DomainException
132
-     */
133
-    private static function verifyInitialized($method)
134
-    {
135
-        if (self::$plugin_file === '') {
136
-            throw new DomainException(
137
-                sprintf(
138
-                    esc_html__(
139
-                        '%1$s needs to be called before %2$s can return a value.',
140
-                        'event_espresso'
141
-                    ),
142
-                    get_called_class() . '::init()',
143
-                    "{$method}()"
144
-                )
145
-            );
146
-        }
147
-    }
21
+	/**
22
+	 * Equivalent to `__FILE__` for main plugin file.
23
+	 *
24
+	 * @var string
25
+	 */
26
+	private static $plugin_file = '';
27
+
28
+	/**
29
+	 * String indicating version for plugin
30
+	 *
31
+	 * @var string
32
+	 */
33
+	private static $version = '';
34
+
35
+	/**
36
+	 * @var string $plugin_basename
37
+	 */
38
+	private static $plugin_basename = '';
39
+
40
+	/**
41
+	 * @var string $plugin_path
42
+	 */
43
+	private static $plugin_path = '';
44
+
45
+	/**
46
+	 * @var string $plugin_url
47
+	 */
48
+	private static $plugin_url = '';
49
+
50
+
51
+
52
+	/**
53
+	 * Initializes internal static properties.
54
+	 *
55
+	 * @param string $plugin_file
56
+	 * @param string $version
57
+	 */
58
+	public static function init($plugin_file, $version)
59
+	{
60
+		self::$plugin_file = $plugin_file;
61
+		self::$version = $version;
62
+		self::$plugin_basename = plugin_basename($plugin_file);
63
+		self::$plugin_path = plugin_dir_path($plugin_file);
64
+		self::$plugin_url = plugin_dir_url($plugin_file);
65
+	}
66
+
67
+
68
+
69
+	/**
70
+	 * @return string
71
+	 * @throws DomainException
72
+	 */
73
+	public static function pluginFile()
74
+	{
75
+		self::verifyInitialized(__METHOD__);
76
+		return self::$plugin_file;
77
+	}
78
+
79
+
80
+
81
+	/**
82
+	 * @return string
83
+	 * @throws DomainException
84
+	 */
85
+	public static function pluginBasename()
86
+	{
87
+		self::verifyInitialized(__METHOD__);
88
+		return self::$plugin_basename;
89
+	}
90
+
91
+
92
+
93
+	/**
94
+	 * @return string
95
+	 * @throws DomainException
96
+	 */
97
+	public static function pluginPath()
98
+	{
99
+		self::verifyInitialized(__METHOD__);
100
+		return self::$plugin_path;
101
+	}
102
+
103
+
104
+
105
+	/**
106
+	 * @return string
107
+	 * @throws DomainException
108
+	 */
109
+	public static function pluginUrl()
110
+	{
111
+		self::verifyInitialized(__METHOD__);
112
+		return self::$plugin_url;
113
+	}
114
+
115
+
116
+
117
+	/**
118
+	 * @return string
119
+	 * @throws DomainException
120
+	 */
121
+	public static function version()
122
+	{
123
+		self::verifyInitialized(__METHOD__);
124
+		return self::$version;
125
+	}
126
+
127
+
128
+
129
+	/**
130
+	 * @param string $method
131
+	 * @throws DomainException
132
+	 */
133
+	private static function verifyInitialized($method)
134
+	{
135
+		if (self::$plugin_file === '') {
136
+			throw new DomainException(
137
+				sprintf(
138
+					esc_html__(
139
+						'%1$s needs to be called before %2$s can return a value.',
140
+						'event_espresso'
141
+					),
142
+					get_called_class() . '::init()',
143
+					"{$method}()"
144
+				)
145
+			);
146
+		}
147
+	}
148 148
 
149 149
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@
 block discarded – undo
139 139
                         '%1$s needs to be called before %2$s can return a value.',
140 140
                         'event_espresso'
141 141
                     ),
142
-                    get_called_class() . '::init()',
142
+                    get_called_class().'::init()',
143 143
                     "{$method}()"
144 144
                 )
145 145
             );
Please login to merge, or discard this patch.
espresso.php 1 patch
Indentation   +219 added lines, -219 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php if ( ! defined('ABSPATH')) {
2
-    exit('No direct script access allowed');
2
+	exit('No direct script access allowed');
3 3
 }
4 4
 /*
5 5
   Plugin Name:		Event Espresso
@@ -40,243 +40,243 @@  discard block
 block discarded – undo
40 40
  * @since            4.0
41 41
  */
42 42
 if (function_exists('espresso_version')) {
43
-    /**
44
-     *    espresso_duplicate_plugin_error
45
-     *    displays if more than one version of EE is activated at the same time
46
-     */
47
-    function espresso_duplicate_plugin_error()
48
-    {
49
-        ?>
43
+	/**
44
+	 *    espresso_duplicate_plugin_error
45
+	 *    displays if more than one version of EE is activated at the same time
46
+	 */
47
+	function espresso_duplicate_plugin_error()
48
+	{
49
+		?>
50 50
         <div class="error">
51 51
             <p>
52 52
                 <?php echo esc_html__(
53
-                        'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
-                        'event_espresso'
55
-                ); ?>
53
+						'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.',
54
+						'event_espresso'
55
+				); ?>
56 56
             </p>
57 57
         </div>
58 58
         <?php
59
-        espresso_deactivate_plugin(plugin_basename(__FILE__));
60
-    }
59
+		espresso_deactivate_plugin(plugin_basename(__FILE__));
60
+	}
61 61
 
62
-    add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
62
+	add_action('admin_notices', 'espresso_duplicate_plugin_error', 1);
63 63
 } else {
64
-    define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
65
-    if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
-        /**
67
-         * espresso_minimum_php_version_error
68
-         *
69
-         * @return void
70
-         */
71
-        function espresso_minimum_php_version_error()
72
-        {
73
-            ?>
64
+	define('EE_MIN_PHP_VER_REQUIRED', '5.3.9');
65
+	if ( ! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) {
66
+		/**
67
+		 * espresso_minimum_php_version_error
68
+		 *
69
+		 * @return void
70
+		 */
71
+		function espresso_minimum_php_version_error()
72
+		{
73
+			?>
74 74
             <div class="error">
75 75
                 <p>
76 76
                     <?php
77
-                    printf(
78
-                            esc_html__(
79
-                                    'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
-                                    'event_espresso'
81
-                            ),
82
-                            EE_MIN_PHP_VER_REQUIRED,
83
-                            PHP_VERSION,
84
-                            '<br/>',
85
-                            '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
-                    );
87
-                    ?>
77
+					printf(
78
+							esc_html__(
79
+									'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.',
80
+									'event_espresso'
81
+							),
82
+							EE_MIN_PHP_VER_REQUIRED,
83
+							PHP_VERSION,
84
+							'<br/>',
85
+							'<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>'
86
+					);
87
+					?>
88 88
                 </p>
89 89
             </div>
90 90
             <?php
91
-            espresso_deactivate_plugin(plugin_basename(__FILE__));
92
-        }
91
+			espresso_deactivate_plugin(plugin_basename(__FILE__));
92
+		}
93 93
 
94
-        add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
-    } else {
96
-        /**
97
-         * espresso_version
98
-         * Returns the plugin version
99
-         *
100
-         * @return string
101
-         */
102
-        function espresso_version()
103
-        {
104
-            return apply_filters('FHEE__espresso__espresso_version', '4.9.44.rc.006');
105
-        }
94
+		add_action('admin_notices', 'espresso_minimum_php_version_error', 1);
95
+	} else {
96
+		/**
97
+		 * espresso_version
98
+		 * Returns the plugin version
99
+		 *
100
+		 * @return string
101
+		 */
102
+		function espresso_version()
103
+		{
104
+			return apply_filters('FHEE__espresso__espresso_version', '4.9.44.rc.006');
105
+		}
106 106
 
107
-        // define versions
108
-        define('EVENT_ESPRESSO_VERSION', espresso_version());
109
-        define('EE_MIN_WP_VER_REQUIRED', '4.1');
110
-        define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
111
-        define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
112
-        define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
113
-        //used to be DIRECTORY_SEPARATOR, but that caused issues on windows
114
-        if ( ! defined('DS')) {
115
-            define('DS', '/');
116
-        }
117
-        if ( ! defined('PS')) {
118
-            define('PS', PATH_SEPARATOR);
119
-        }
120
-        if ( ! defined('SP')) {
121
-            define('SP', ' ');
122
-        }
123
-        if ( ! defined('EENL')) {
124
-            define('EENL', "\n");
125
-        }
126
-        define('EE_SUPPORT_EMAIL', '[email protected]');
127
-        // define the plugin directory and URL
128
-        define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
129
-        define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
130
-        define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
131
-        // main root folder paths
132
-        define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS);
133
-        define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS);
134
-        define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS);
135
-        define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS);
136
-        define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS);
137
-        define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS);
138
-        define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS);
139
-        define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS);
140
-        // core system paths
141
-        define('EE_ADMIN', EE_CORE . 'admin' . DS);
142
-        define('EE_CPTS', EE_CORE . 'CPTs' . DS);
143
-        define('EE_CLASSES', EE_CORE . 'db_classes' . DS);
144
-        define('EE_INTERFACES', EE_CORE . 'interfaces' . DS);
145
-        define('EE_BUSINESS', EE_CORE . 'business' . DS);
146
-        define('EE_MODELS', EE_CORE . 'db_models' . DS);
147
-        define('EE_HELPERS', EE_CORE . 'helpers' . DS);
148
-        define('EE_LIBRARIES', EE_CORE . 'libraries' . DS);
149
-        define('EE_TEMPLATES', EE_CORE . 'templates' . DS);
150
-        define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS);
151
-        define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS);
152
-        define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS);
153
-        // gateways
154
-        define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS);
155
-        define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS);
156
-        // asset URL paths
157
-        define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS);
158
-        define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS);
159
-        define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS);
160
-        define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS);
161
-        define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/');
162
-        define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/');
163
-        // define upload paths
164
-        $uploads = wp_upload_dir();
165
-        // define the uploads directory and URL
166
-        define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS);
167
-        define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS);
168
-        // define the templates directory and URL
169
-        define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS);
170
-        define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS);
171
-        // define the gateway directory and URL
172
-        define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS);
173
-        define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS);
174
-        // languages folder/path
175
-        define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS);
176
-        define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS);
177
-        //check for dompdf fonts in uploads
178
-        if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) {
179
-            define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS);
180
-        }
181
-        //ajax constants
182
-        define(
183
-                'EE_FRONT_AJAX',
184
-                isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false
185
-        );
186
-        define(
187
-                'EE_ADMIN_AJAX',
188
-                isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false
189
-        );
190
-        //just a handy constant occasionally needed for finding values representing infinity in the DB
191
-        //you're better to use this than its straight value (currently -1) in case you ever
192
-        //want to change its default value! or find when -1 means infinity
193
-        define('EE_INF_IN_DB', -1);
194
-        define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX);
195
-        define('EE_DEBUG', false);
196
-        // for older WP versions
197
-        if ( ! defined('MONTH_IN_SECONDS')) {
198
-            define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
199
-        }
200
-        /**
201
-         *    espresso_plugin_activation
202
-         *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
203
-         */
204
-        function espresso_plugin_activation()
205
-        {
206
-            update_option('ee_espresso_activation', true);
207
-        }
107
+		// define versions
108
+		define('EVENT_ESPRESSO_VERSION', espresso_version());
109
+		define('EE_MIN_WP_VER_REQUIRED', '4.1');
110
+		define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2');
111
+		define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44');
112
+		define('EVENT_ESPRESSO_MAIN_FILE', __FILE__);
113
+		//used to be DIRECTORY_SEPARATOR, but that caused issues on windows
114
+		if ( ! defined('DS')) {
115
+			define('DS', '/');
116
+		}
117
+		if ( ! defined('PS')) {
118
+			define('PS', PATH_SEPARATOR);
119
+		}
120
+		if ( ! defined('SP')) {
121
+			define('SP', ' ');
122
+		}
123
+		if ( ! defined('EENL')) {
124
+			define('EENL', "\n");
125
+		}
126
+		define('EE_SUPPORT_EMAIL', '[email protected]');
127
+		// define the plugin directory and URL
128
+		define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE));
129
+		define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE));
130
+		define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE));
131
+		// main root folder paths
132
+		define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS);
133
+		define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS);
134
+		define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS);
135
+		define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS);
136
+		define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS);
137
+		define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS);
138
+		define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS);
139
+		define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS);
140
+		// core system paths
141
+		define('EE_ADMIN', EE_CORE . 'admin' . DS);
142
+		define('EE_CPTS', EE_CORE . 'CPTs' . DS);
143
+		define('EE_CLASSES', EE_CORE . 'db_classes' . DS);
144
+		define('EE_INTERFACES', EE_CORE . 'interfaces' . DS);
145
+		define('EE_BUSINESS', EE_CORE . 'business' . DS);
146
+		define('EE_MODELS', EE_CORE . 'db_models' . DS);
147
+		define('EE_HELPERS', EE_CORE . 'helpers' . DS);
148
+		define('EE_LIBRARIES', EE_CORE . 'libraries' . DS);
149
+		define('EE_TEMPLATES', EE_CORE . 'templates' . DS);
150
+		define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS);
151
+		define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS);
152
+		define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS);
153
+		// gateways
154
+		define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS);
155
+		define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS);
156
+		// asset URL paths
157
+		define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS);
158
+		define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS);
159
+		define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS);
160
+		define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS);
161
+		define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/');
162
+		define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/');
163
+		// define upload paths
164
+		$uploads = wp_upload_dir();
165
+		// define the uploads directory and URL
166
+		define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS);
167
+		define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS);
168
+		// define the templates directory and URL
169
+		define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS);
170
+		define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS);
171
+		// define the gateway directory and URL
172
+		define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS);
173
+		define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS);
174
+		// languages folder/path
175
+		define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS);
176
+		define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS);
177
+		//check for dompdf fonts in uploads
178
+		if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) {
179
+			define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS);
180
+		}
181
+		//ajax constants
182
+		define(
183
+				'EE_FRONT_AJAX',
184
+				isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false
185
+		);
186
+		define(
187
+				'EE_ADMIN_AJAX',
188
+				isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false
189
+		);
190
+		//just a handy constant occasionally needed for finding values representing infinity in the DB
191
+		//you're better to use this than its straight value (currently -1) in case you ever
192
+		//want to change its default value! or find when -1 means infinity
193
+		define('EE_INF_IN_DB', -1);
194
+		define('EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX);
195
+		define('EE_DEBUG', false);
196
+		// for older WP versions
197
+		if ( ! defined('MONTH_IN_SECONDS')) {
198
+			define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30);
199
+		}
200
+		/**
201
+		 *    espresso_plugin_activation
202
+		 *    adds a wp-option to indicate that EE has been activated via the WP admin plugins page
203
+		 */
204
+		function espresso_plugin_activation()
205
+		{
206
+			update_option('ee_espresso_activation', true);
207
+		}
208 208
 
209
-        register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
210
-        /**
211
-         *    espresso_load_error_handling
212
-         *    this function loads EE's class for handling exceptions and errors
213
-         */
214
-        function espresso_load_error_handling()
215
-        {
216
-            // load debugging tools
217
-            if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
218
-                require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php');
219
-                EEH_Debug_Tools::instance();
220
-            }
221
-            // load error handling
222
-            if (is_readable(EE_CORE . 'EE_Error.core.php')) {
223
-                require_once(EE_CORE . 'EE_Error.core.php');
224
-            } else {
225
-                wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
226
-            }
227
-        }
209
+		register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation');
210
+		/**
211
+		 *    espresso_load_error_handling
212
+		 *    this function loads EE's class for handling exceptions and errors
213
+		 */
214
+		function espresso_load_error_handling()
215
+		{
216
+			// load debugging tools
217
+			if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) {
218
+				require_once(EE_HELPERS . 'EEH_Debug_Tools.helper.php');
219
+				EEH_Debug_Tools::instance();
220
+			}
221
+			// load error handling
222
+			if (is_readable(EE_CORE . 'EE_Error.core.php')) {
223
+				require_once(EE_CORE . 'EE_Error.core.php');
224
+			} else {
225
+				wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso'));
226
+			}
227
+		}
228 228
 
229
-        /**
230
-         *    espresso_load_required
231
-         *    given a class name and path, this function will load that file or throw an exception
232
-         *
233
-         * @param    string $classname
234
-         * @param    string $full_path_to_file
235
-         * @throws    EE_Error
236
-         */
237
-        function espresso_load_required($classname, $full_path_to_file)
238
-        {
239
-            static $error_handling_loaded = false;
240
-            if ( ! $error_handling_loaded) {
241
-                espresso_load_error_handling();
242
-                $error_handling_loaded = true;
243
-            }
244
-            if (is_readable($full_path_to_file)) {
245
-                require_once($full_path_to_file);
246
-            } else {
247
-                throw new EE_Error (
248
-                        sprintf(
249
-                                esc_html__(
250
-                                        'The %s class file could not be located or is not readable due to file permissions.',
251
-                                        'event_espresso'
252
-                                ),
253
-                                $classname
254
-                        )
255
-                );
256
-            }
257
-        }
229
+		/**
230
+		 *    espresso_load_required
231
+		 *    given a class name and path, this function will load that file or throw an exception
232
+		 *
233
+		 * @param    string $classname
234
+		 * @param    string $full_path_to_file
235
+		 * @throws    EE_Error
236
+		 */
237
+		function espresso_load_required($classname, $full_path_to_file)
238
+		{
239
+			static $error_handling_loaded = false;
240
+			if ( ! $error_handling_loaded) {
241
+				espresso_load_error_handling();
242
+				$error_handling_loaded = true;
243
+			}
244
+			if (is_readable($full_path_to_file)) {
245
+				require_once($full_path_to_file);
246
+			} else {
247
+				throw new EE_Error (
248
+						sprintf(
249
+								esc_html__(
250
+										'The %s class file could not be located or is not readable due to file permissions.',
251
+										'event_espresso'
252
+								),
253
+								$classname
254
+						)
255
+				);
256
+			}
257
+		}
258 258
 
259
-        espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php');
260
-        espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php');
261
-        espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php');
262
-        new EE_Bootstrap();
263
-    }
259
+		espresso_load_required('EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php');
260
+		espresso_load_required('EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php');
261
+		espresso_load_required('EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php');
262
+		new EE_Bootstrap();
263
+	}
264 264
 }
265 265
 if ( ! function_exists('espresso_deactivate_plugin')) {
266
-    /**
267
-     *    deactivate_plugin
268
-     * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
269
-     *
270
-     * @access public
271
-     * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
272
-     * @return    void
273
-     */
274
-    function espresso_deactivate_plugin($plugin_basename = '')
275
-    {
276
-        if ( ! function_exists('deactivate_plugins')) {
277
-            require_once(ABSPATH . 'wp-admin/includes/plugin.php');
278
-        }
279
-        unset($_GET['activate'], $_REQUEST['activate']);
280
-        deactivate_plugins($plugin_basename);
281
-    }
266
+	/**
267
+	 *    deactivate_plugin
268
+	 * usage:  espresso_deactivate_plugin( plugin_basename( __FILE__ ));
269
+	 *
270
+	 * @access public
271
+	 * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file
272
+	 * @return    void
273
+	 */
274
+	function espresso_deactivate_plugin($plugin_basename = '')
275
+	{
276
+		if ( ! function_exists('deactivate_plugins')) {
277
+			require_once(ABSPATH . 'wp-admin/includes/plugin.php');
278
+		}
279
+		unset($_GET['activate'], $_REQUEST['activate']);
280
+		deactivate_plugins($plugin_basename);
281
+	}
282 282
 }
283 283
\ No newline at end of file
Please login to merge, or discard this patch.
core/libraries/form_sections/form_handlers/FormHandler.php 2 patches
Indentation   +637 added lines, -637 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 use EventEspresso\core\exceptions\InvalidFormSubmissionException;
16 16
 
17 17
 if (! defined('EVENT_ESPRESSO_VERSION')) {
18
-    exit('No direct script access allowed');
18
+	exit('No direct script access allowed');
19 19
 }
20 20
 
21 21
 
@@ -34,642 +34,642 @@  discard block
 block discarded – undo
34 34
 abstract class FormHandler implements FormHandlerInterface
35 35
 {
36 36
 
37
-    /**
38
-     * will add opening and closing HTML form tags as well as a submit button
39
-     */
40
-    const ADD_FORM_TAGS_AND_SUBMIT = 'add_form_tags_and_submit';
41
-
42
-    /**
43
-     * will add opening and closing HTML form tags but NOT a submit button
44
-     */
45
-    const ADD_FORM_TAGS_ONLY = 'add_form_tags_only';
46
-
47
-    /**
48
-     * will NOT add opening and closing HTML form tags but will add a submit button
49
-     */
50
-    const ADD_FORM_SUBMIT_ONLY = 'add_form_submit_only';
51
-
52
-    /**
53
-     * will NOT add opening and closing HTML form tags NOR a submit button
54
-     */
55
-    const DO_NOT_SETUP_FORM = 'do_not_setup_form';
56
-
57
-    /**
58
-     * if set to false, then this form has no displayable content,
59
-     * and will only be used for processing data sent passed via GET or POST
60
-     * defaults to true ( ie: form has displayable content )
61
-     *
62
-     * @var boolean $displayable
63
-     */
64
-    private $displayable = true;
65
-
66
-    /**
67
-     * @var string $form_name
68
-     */
69
-    private $form_name;
70
-
71
-    /**
72
-     * @var string $admin_name
73
-     */
74
-    private $admin_name;
75
-
76
-    /**
77
-     * @var string $slug
78
-     */
79
-    private $slug;
80
-
81
-    /**
82
-     * @var string $submit_btn_text
83
-     */
84
-    private $submit_btn_text;
85
-
86
-    /**
87
-     * @var string $form_action
88
-     */
89
-    private $form_action;
90
-
91
-    /**
92
-     * form params in key value pairs
93
-     * can be added to form action URL or as hidden inputs
94
-     *
95
-     * @var array $form_args
96
-     */
97
-    private $form_args = array();
98
-
99
-    /**
100
-     * value of one of the string constant above
101
-     *
102
-     * @var string $form_config
103
-     */
104
-    private $form_config;
105
-
106
-    /**
107
-     * whether or not the form was determined to be invalid
108
-     *
109
-     * @var boolean $form_has_errors
110
-     */
111
-    private $form_has_errors;
112
-
113
-    /**
114
-     * the absolute top level form section being used on the page
115
-     *
116
-     * @var EE_Form_Section_Proper $form
117
-     */
118
-    private $form;
119
-
120
-    /**
121
-     * @var EE_Registry $registry
122
-     */
123
-    protected $registry;
124
-
125
-
126
-
127
-    /**
128
-     * Form constructor.
129
-     *
130
-     * @param string      $form_name
131
-     * @param string      $admin_name
132
-     * @param string      $slug
133
-     * @param string      $form_action
134
-     * @param string      $form_config
135
-     * @param EE_Registry $registry
136
-     * @throws InvalidDataTypeException
137
-     * @throws DomainException
138
-     * @throws InvalidArgumentException
139
-     */
140
-    public function __construct(
141
-        $form_name,
142
-        $admin_name,
143
-        $slug,
144
-        $form_action = '',
145
-        $form_config = FormHandler::ADD_FORM_TAGS_AND_SUBMIT,
146
-        EE_Registry $registry
147
-    ) {
148
-        $this->setFormName($form_name);
149
-        $this->setAdminName($admin_name);
150
-        $this->setSlug($slug);
151
-        $this->setFormAction($form_action);
152
-        $this->setFormConfig($form_config);
153
-        $this->setSubmitBtnText(esc_html__('Submit', 'event_espresso'));
154
-        $this->registry = $registry;
155
-    }
156
-
157
-
158
-
159
-    /**
160
-     * @return array
161
-     */
162
-    public static function getFormConfigConstants()
163
-    {
164
-        return array(
165
-            FormHandler::ADD_FORM_TAGS_AND_SUBMIT,
166
-            FormHandler::ADD_FORM_TAGS_ONLY,
167
-            FormHandler::ADD_FORM_SUBMIT_ONLY,
168
-            FormHandler::DO_NOT_SETUP_FORM,
169
-        );
170
-    }
171
-
172
-
173
-
174
-    /**
175
-     * @param bool $for_display
176
-     * @return EE_Form_Section_Proper
177
-     * @throws EE_Error
178
-     * @throws LogicException
179
-     */
180
-    public function form($for_display = false)
181
-    {
182
-        if (! $this->formIsValid()) {
183
-            return null;
184
-        }
185
-        if ($for_display) {
186
-            $form_config = $this->formConfig();
187
-            if (
188
-                $form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT
189
-                || $form_config === FormHandler::ADD_FORM_SUBMIT_ONLY
190
-            ) {
191
-                $this->appendSubmitButton();
192
-                $this->clearFormButtonFloats();
193
-            }
194
-        }
195
-        return $this->form;
196
-    }
197
-
198
-
199
-
200
-    /**
201
-     * @return boolean
202
-     * @throws LogicException
203
-     */
204
-    public function formIsValid()
205
-    {
206
-        if (! $this->form instanceof EE_Form_Section_Proper) {
207
-            static $generated = false;
208
-            if (! $generated) {
209
-                $generated = true;
210
-                $form = apply_filters(
211
-                    'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__formIsValid__generated_form_object',
212
-                    $this->generate(),
213
-                    $this
214
-                );
215
-                if ($form instanceof EE_Form_Section_Proper) {
216
-                    $this->setForm($form);
217
-                }
218
-            }
219
-            return $this->verifyForm();
220
-        }
221
-        return true;
222
-    }
223
-
224
-
225
-
226
-    /**
227
-     * @return boolean
228
-     * @throws LogicException
229
-     */
230
-    public function verifyForm()
231
-    {
232
-        if ($this->form instanceof EE_Form_Section_Proper) {
233
-            return true;
234
-        }
235
-        throw new LogicException(
236
-            sprintf(
237
-                esc_html__('The "%1$s" form is invalid or missing', 'event_espresso'),
238
-                $this->form_name
239
-            )
240
-        );
241
-    }
242
-
243
-
244
-
245
-    /**
246
-     * @param EE_Form_Section_Proper $form
247
-     */
248
-    public function setForm(EE_Form_Section_Proper $form)
249
-    {
250
-        $this->form = $form;
251
-    }
252
-
253
-
254
-
255
-    /**
256
-     * @return boolean
257
-     */
258
-    public function displayable()
259
-    {
260
-        return $this->displayable;
261
-    }
262
-
263
-
264
-
265
-    /**
266
-     * @param boolean $displayable
267
-     */
268
-    public function setDisplayable($displayable = false)
269
-    {
270
-        $this->displayable = filter_var($displayable, FILTER_VALIDATE_BOOLEAN);
271
-    }
272
-
273
-
274
-
275
-    /**
276
-     * a public name for the form that can be displayed on the frontend of a site
277
-     *
278
-     * @return string
279
-     */
280
-    public function formName()
281
-    {
282
-        return $this->form_name;
283
-    }
284
-
285
-
286
-
287
-    /**
288
-     * @param string $form_name
289
-     * @throws InvalidDataTypeException
290
-     */
291
-    public function setFormName($form_name)
292
-    {
293
-        if (! is_string($form_name)) {
294
-            throw new InvalidDataTypeException('$form_name', $form_name, 'string');
295
-        }
296
-        $this->form_name = $form_name;
297
-    }
298
-
299
-
300
-
301
-    /**
302
-     * a public name for the form that can be displayed, but only in the admin
303
-     *
304
-     * @return string
305
-     */
306
-    public function adminName()
307
-    {
308
-        return $this->admin_name;
309
-    }
310
-
311
-
312
-
313
-    /**
314
-     * @param string $admin_name
315
-     * @throws InvalidDataTypeException
316
-     */
317
-    public function setAdminName($admin_name)
318
-    {
319
-        if (! is_string($admin_name)) {
320
-            throw new InvalidDataTypeException('$admin_name', $admin_name, 'string');
321
-        }
322
-        $this->admin_name = $admin_name;
323
-    }
324
-
325
-
326
-
327
-    /**
328
-     * a URL friendly string that can be used for identifying the form
329
-     *
330
-     * @return string
331
-     */
332
-    public function slug()
333
-    {
334
-        return $this->slug;
335
-    }
336
-
337
-
338
-
339
-    /**
340
-     * @param string $slug
341
-     * @throws InvalidDataTypeException
342
-     */
343
-    public function setSlug($slug)
344
-    {
345
-        if (! is_string($slug)) {
346
-            throw new InvalidDataTypeException('$slug', $slug, 'string');
347
-        }
348
-        $this->slug = $slug;
349
-    }
350
-
351
-
352
-
353
-    /**
354
-     * @return string
355
-     */
356
-    public function submitBtnText()
357
-    {
358
-        return $this->submit_btn_text;
359
-    }
360
-
361
-
362
-
363
-    /**
364
-     * @param string $submit_btn_text
365
-     * @throws InvalidDataTypeException
366
-     * @throws InvalidArgumentException
367
-     */
368
-    public function setSubmitBtnText($submit_btn_text)
369
-    {
370
-        if (! is_string($submit_btn_text)) {
371
-            throw new InvalidDataTypeException('$submit_btn_text', $submit_btn_text, 'string');
372
-        }
373
-        if (empty($submit_btn_text)) {
374
-            throw new InvalidArgumentException(
375
-                esc_html__('Can not set Submit button text because an empty string was provided.', 'event_espresso')
376
-            );
377
-        }
378
-        $this->submit_btn_text = $submit_btn_text;
379
-    }
380
-
381
-
382
-
383
-    /**
384
-     * @return string
385
-     */
386
-    public function formAction()
387
-    {
388
-        return ! empty($this->form_args)
389
-            ? add_query_arg($this->form_args, $this->form_action)
390
-            : $this->form_action;
391
-    }
392
-
393
-
394
-
395
-    /**
396
-     * @param string $form_action
397
-     * @throws InvalidDataTypeException
398
-     */
399
-    public function setFormAction($form_action)
400
-    {
401
-        if (! is_string($form_action)) {
402
-            throw new InvalidDataTypeException('$form_action', $form_action, 'string');
403
-        }
404
-        $this->form_action = $form_action;
405
-    }
406
-
407
-
408
-
409
-    /**
410
-     * @param array $form_args
411
-     * @throws InvalidDataTypeException
412
-     * @throws InvalidArgumentException
413
-     */
414
-    public function addFormActionArgs($form_args = array())
415
-    {
416
-        if (is_object($form_args)) {
417
-            throw new InvalidDataTypeException(
418
-                '$form_args',
419
-                $form_args,
420
-                'anything other than an object was expected.'
421
-            );
422
-        }
423
-        if (empty($form_args)) {
424
-            throw new InvalidArgumentException(
425
-                esc_html__('The redirect arguments can not be an empty array.', 'event_espresso')
426
-            );
427
-        }
428
-        $this->form_args = array_merge($this->form_args, $form_args);
429
-    }
430
-
431
-
432
-
433
-    /**
434
-     * @return string
435
-     */
436
-    public function formConfig()
437
-    {
438
-        return $this->form_config;
439
-    }
440
-
441
-
442
-
443
-    /**
444
-     * @param string $form_config
445
-     * @throws DomainException
446
-     */
447
-    public function setFormConfig($form_config)
448
-    {
449
-        if (
450
-        ! in_array(
451
-            $form_config,
452
-            array(
453
-                FormHandler::ADD_FORM_TAGS_AND_SUBMIT,
454
-                FormHandler::ADD_FORM_TAGS_ONLY,
455
-                FormHandler::ADD_FORM_SUBMIT_ONLY,
456
-                FormHandler::DO_NOT_SETUP_FORM,
457
-            ),
458
-            true
459
-        )
460
-        ) {
461
-            throw new DomainException(
462
-                sprintf(
463
-                    esc_html__('"%1$s" is not a valid value for the form config. Please use one of the class constants on \EventEspresso\core\libraries\form_sections\form_handlers\Form',
464
-                        'event_espresso'),
465
-                    $form_config
466
-                )
467
-            );
468
-        }
469
-        $this->form_config = $form_config;
470
-    }
471
-
472
-
473
-
474
-    /**
475
-     * called after the form is instantiated
476
-     * and used for performing any logic that needs to occur early
477
-     * before any of the other methods are called.
478
-     * returns true if everything is ok to proceed,
479
-     * and false if no further form logic should be implemented
480
-     *
481
-     * @return boolean
482
-     */
483
-    public function initialize()
484
-    {
485
-        $this->form_has_errors = EE_Error::has_error(true);
486
-        return true;
487
-    }
488
-
489
-
490
-
491
-    /**
492
-     * used for setting up css and js
493
-     *
494
-     * @return void
495
-     * @throws LogicException
496
-     * @throws EE_Error
497
-     */
498
-    public function enqueueStylesAndScripts()
499
-    {
500
-        $this->form(false)->enqueue_js();
501
-    }
502
-
503
-
504
-
505
-    /**
506
-     * creates and returns the actual form
507
-     *
508
-     * @return EE_Form_Section_Proper
509
-     */
510
-    abstract public function generate();
511
-
512
-
513
-
514
-    /**
515
-     * creates and returns an EE_Submit_Input labeled "Submit"
516
-     *
517
-     * @param string $text
518
-     * @return EE_Submit_Input
519
-     */
520
-    public function generateSubmitButton($text = '')
521
-    {
522
-        $text = ! empty($text) ? $text : $this->submitBtnText();
523
-        return new EE_Submit_Input(
524
-            array(
525
-                'html_name'             => 'ee-form-submit-' . $this->slug(),
526
-                'html_id'               => 'ee-form-submit-' . $this->slug(),
527
-                'html_class'            => 'ee-form-submit',
528
-                'html_label'            => '&nbsp;',
529
-                'other_html_attributes' => ' rel="' . $this->slug() . '"',
530
-                'default'               => $text,
531
-            )
532
-        );
533
-    }
534
-
535
-
536
-
537
-    /**
538
-     * calls generateSubmitButton() and appends it onto the form along with a float clearing div
539
-     *
540
-     * @param string $text
541
-     * @return void
542
-     * @throws LogicException
543
-     * @throws EE_Error
544
-     */
545
-    public function appendSubmitButton($text = '')
546
-    {
547
-        if ($this->form->subsection_exists($this->slug() . '-submit-btn')) {
548
-            return;
549
-        }
550
-        $this->form->add_subsections(
551
-            array($this->slug() . '-submit-btn' => $this->generateSubmitButton($text)),
552
-            null,
553
-            false
554
-        );
555
-    }
556
-
557
-
558
-
559
-    /**
560
-     * creates and returns an EE_Submit_Input labeled "Cancel"
561
-     *
562
-     * @param string $text
563
-     * @return EE_Submit_Input
564
-     */
565
-    public function generateCancelButton($text = '')
566
-    {
567
-        $cancel_button = new EE_Submit_Input(
568
-            array(
569
-                'html_name'             => 'ee-form-submit-' . $this->slug(), // YES! Same name as submit !!!
570
-                'html_id'               => 'ee-cancel-form-' . $this->slug(),
571
-                'html_class'            => 'ee-cancel-form',
572
-                'html_label'            => '&nbsp;',
573
-                'other_html_attributes' => ' rel="' . $this->slug() . '"',
574
-                'default'               => ! empty($text) ? $text : esc_html__('Cancel', 'event_espresso'),
575
-            )
576
-        );
577
-        $cancel_button->set_button_css_attributes(false);
578
-        return $cancel_button;
579
-    }
580
-
581
-
582
-
583
-    /**
584
-     * appends a float clearing div onto end of form
585
-     *
586
-     * @return void
587
-     * @throws EE_Error
588
-     */
589
-    public function clearFormButtonFloats()
590
-    {
591
-        $this->form->add_subsections(
592
-            array(
593
-                'clear-submit-btn-float' => new EE_Form_Section_HTML(
594
-                    EEH_HTML::div('', '', 'clear-float') . EEH_HTML::divx()
595
-                ),
596
-            ),
597
-            null,
598
-            false
599
-        );
600
-    }
601
-
602
-
603
-
604
-    /**
605
-     * takes the generated form and displays it along with ony other non-form HTML that may be required
606
-     * returns a string of HTML that can be directly echoed in a template
607
-     *
608
-     * @return string
609
-     * @throws LogicException
610
-     * @throws EE_Error
611
-     */
612
-    public function display()
613
-    {
614
-        $form_html = apply_filters(
615
-            'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__before_form',
616
-            ''
617
-        );
618
-        $form_config = $this->formConfig();
619
-        if (
620
-            $form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT
621
-            || $form_config === FormHandler::ADD_FORM_TAGS_ONLY
622
-        ) {
623
-            $form_html .= $this->form()->form_open($this->formAction());
624
-        }
625
-        $form_html .= $this->form(true)->get_html($this->form_has_errors);
626
-        if (
627
-            $form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT
628
-            || $form_config === FormHandler::ADD_FORM_TAGS_ONLY
629
-        ) {
630
-            $form_html .= $this->form()->form_close();
631
-        }
632
-        $form_html .= apply_filters(
633
-            'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__after_form',
634
-            ''
635
-        );
636
-        return $form_html;
637
-    }
638
-
639
-
640
-
641
-    /**
642
-     * handles processing the form submission
643
-     * returns true or false depending on whether the form was processed successfully or not
644
-     *
645
-     * @param array $submitted_form_data
646
-     * @return array
647
-     * @throws EE_Error
648
-     * @throws LogicException
649
-     * @throws InvalidFormSubmissionException
650
-     */
651
-    public function process($submitted_form_data = array())
652
-    {
653
-        if (! $this->form()->was_submitted($submitted_form_data)) {
654
-            throw new InvalidFormSubmissionException($this->form_name);
655
-        }
656
-        $this->form(true)->receive_form_submission($submitted_form_data);
657
-        if (! $this->form()->is_valid()) {
658
-            throw new InvalidFormSubmissionException(
659
-                $this->form_name,
660
-                sprintf(
661
-                    esc_html__(
662
-                        'The "%1$s" form is invalid. Please correct the following errors and resubmit: %2$s %3$s',
663
-                        'event_espresso'
664
-                    ),
665
-                    $this->form_name,
666
-                    '<br />',
667
-                    $this->form()->submission_error_message()
668
-                )
669
-            );
670
-        }
671
-        return $this->form()->valid_data();
672
-    }
37
+	/**
38
+	 * will add opening and closing HTML form tags as well as a submit button
39
+	 */
40
+	const ADD_FORM_TAGS_AND_SUBMIT = 'add_form_tags_and_submit';
41
+
42
+	/**
43
+	 * will add opening and closing HTML form tags but NOT a submit button
44
+	 */
45
+	const ADD_FORM_TAGS_ONLY = 'add_form_tags_only';
46
+
47
+	/**
48
+	 * will NOT add opening and closing HTML form tags but will add a submit button
49
+	 */
50
+	const ADD_FORM_SUBMIT_ONLY = 'add_form_submit_only';
51
+
52
+	/**
53
+	 * will NOT add opening and closing HTML form tags NOR a submit button
54
+	 */
55
+	const DO_NOT_SETUP_FORM = 'do_not_setup_form';
56
+
57
+	/**
58
+	 * if set to false, then this form has no displayable content,
59
+	 * and will only be used for processing data sent passed via GET or POST
60
+	 * defaults to true ( ie: form has displayable content )
61
+	 *
62
+	 * @var boolean $displayable
63
+	 */
64
+	private $displayable = true;
65
+
66
+	/**
67
+	 * @var string $form_name
68
+	 */
69
+	private $form_name;
70
+
71
+	/**
72
+	 * @var string $admin_name
73
+	 */
74
+	private $admin_name;
75
+
76
+	/**
77
+	 * @var string $slug
78
+	 */
79
+	private $slug;
80
+
81
+	/**
82
+	 * @var string $submit_btn_text
83
+	 */
84
+	private $submit_btn_text;
85
+
86
+	/**
87
+	 * @var string $form_action
88
+	 */
89
+	private $form_action;
90
+
91
+	/**
92
+	 * form params in key value pairs
93
+	 * can be added to form action URL or as hidden inputs
94
+	 *
95
+	 * @var array $form_args
96
+	 */
97
+	private $form_args = array();
98
+
99
+	/**
100
+	 * value of one of the string constant above
101
+	 *
102
+	 * @var string $form_config
103
+	 */
104
+	private $form_config;
105
+
106
+	/**
107
+	 * whether or not the form was determined to be invalid
108
+	 *
109
+	 * @var boolean $form_has_errors
110
+	 */
111
+	private $form_has_errors;
112
+
113
+	/**
114
+	 * the absolute top level form section being used on the page
115
+	 *
116
+	 * @var EE_Form_Section_Proper $form
117
+	 */
118
+	private $form;
119
+
120
+	/**
121
+	 * @var EE_Registry $registry
122
+	 */
123
+	protected $registry;
124
+
125
+
126
+
127
+	/**
128
+	 * Form constructor.
129
+	 *
130
+	 * @param string      $form_name
131
+	 * @param string      $admin_name
132
+	 * @param string      $slug
133
+	 * @param string      $form_action
134
+	 * @param string      $form_config
135
+	 * @param EE_Registry $registry
136
+	 * @throws InvalidDataTypeException
137
+	 * @throws DomainException
138
+	 * @throws InvalidArgumentException
139
+	 */
140
+	public function __construct(
141
+		$form_name,
142
+		$admin_name,
143
+		$slug,
144
+		$form_action = '',
145
+		$form_config = FormHandler::ADD_FORM_TAGS_AND_SUBMIT,
146
+		EE_Registry $registry
147
+	) {
148
+		$this->setFormName($form_name);
149
+		$this->setAdminName($admin_name);
150
+		$this->setSlug($slug);
151
+		$this->setFormAction($form_action);
152
+		$this->setFormConfig($form_config);
153
+		$this->setSubmitBtnText(esc_html__('Submit', 'event_espresso'));
154
+		$this->registry = $registry;
155
+	}
156
+
157
+
158
+
159
+	/**
160
+	 * @return array
161
+	 */
162
+	public static function getFormConfigConstants()
163
+	{
164
+		return array(
165
+			FormHandler::ADD_FORM_TAGS_AND_SUBMIT,
166
+			FormHandler::ADD_FORM_TAGS_ONLY,
167
+			FormHandler::ADD_FORM_SUBMIT_ONLY,
168
+			FormHandler::DO_NOT_SETUP_FORM,
169
+		);
170
+	}
171
+
172
+
173
+
174
+	/**
175
+	 * @param bool $for_display
176
+	 * @return EE_Form_Section_Proper
177
+	 * @throws EE_Error
178
+	 * @throws LogicException
179
+	 */
180
+	public function form($for_display = false)
181
+	{
182
+		if (! $this->formIsValid()) {
183
+			return null;
184
+		}
185
+		if ($for_display) {
186
+			$form_config = $this->formConfig();
187
+			if (
188
+				$form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT
189
+				|| $form_config === FormHandler::ADD_FORM_SUBMIT_ONLY
190
+			) {
191
+				$this->appendSubmitButton();
192
+				$this->clearFormButtonFloats();
193
+			}
194
+		}
195
+		return $this->form;
196
+	}
197
+
198
+
199
+
200
+	/**
201
+	 * @return boolean
202
+	 * @throws LogicException
203
+	 */
204
+	public function formIsValid()
205
+	{
206
+		if (! $this->form instanceof EE_Form_Section_Proper) {
207
+			static $generated = false;
208
+			if (! $generated) {
209
+				$generated = true;
210
+				$form = apply_filters(
211
+					'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__formIsValid__generated_form_object',
212
+					$this->generate(),
213
+					$this
214
+				);
215
+				if ($form instanceof EE_Form_Section_Proper) {
216
+					$this->setForm($form);
217
+				}
218
+			}
219
+			return $this->verifyForm();
220
+		}
221
+		return true;
222
+	}
223
+
224
+
225
+
226
+	/**
227
+	 * @return boolean
228
+	 * @throws LogicException
229
+	 */
230
+	public function verifyForm()
231
+	{
232
+		if ($this->form instanceof EE_Form_Section_Proper) {
233
+			return true;
234
+		}
235
+		throw new LogicException(
236
+			sprintf(
237
+				esc_html__('The "%1$s" form is invalid or missing', 'event_espresso'),
238
+				$this->form_name
239
+			)
240
+		);
241
+	}
242
+
243
+
244
+
245
+	/**
246
+	 * @param EE_Form_Section_Proper $form
247
+	 */
248
+	public function setForm(EE_Form_Section_Proper $form)
249
+	{
250
+		$this->form = $form;
251
+	}
252
+
253
+
254
+
255
+	/**
256
+	 * @return boolean
257
+	 */
258
+	public function displayable()
259
+	{
260
+		return $this->displayable;
261
+	}
262
+
263
+
264
+
265
+	/**
266
+	 * @param boolean $displayable
267
+	 */
268
+	public function setDisplayable($displayable = false)
269
+	{
270
+		$this->displayable = filter_var($displayable, FILTER_VALIDATE_BOOLEAN);
271
+	}
272
+
273
+
274
+
275
+	/**
276
+	 * a public name for the form that can be displayed on the frontend of a site
277
+	 *
278
+	 * @return string
279
+	 */
280
+	public function formName()
281
+	{
282
+		return $this->form_name;
283
+	}
284
+
285
+
286
+
287
+	/**
288
+	 * @param string $form_name
289
+	 * @throws InvalidDataTypeException
290
+	 */
291
+	public function setFormName($form_name)
292
+	{
293
+		if (! is_string($form_name)) {
294
+			throw new InvalidDataTypeException('$form_name', $form_name, 'string');
295
+		}
296
+		$this->form_name = $form_name;
297
+	}
298
+
299
+
300
+
301
+	/**
302
+	 * a public name for the form that can be displayed, but only in the admin
303
+	 *
304
+	 * @return string
305
+	 */
306
+	public function adminName()
307
+	{
308
+		return $this->admin_name;
309
+	}
310
+
311
+
312
+
313
+	/**
314
+	 * @param string $admin_name
315
+	 * @throws InvalidDataTypeException
316
+	 */
317
+	public function setAdminName($admin_name)
318
+	{
319
+		if (! is_string($admin_name)) {
320
+			throw new InvalidDataTypeException('$admin_name', $admin_name, 'string');
321
+		}
322
+		$this->admin_name = $admin_name;
323
+	}
324
+
325
+
326
+
327
+	/**
328
+	 * a URL friendly string that can be used for identifying the form
329
+	 *
330
+	 * @return string
331
+	 */
332
+	public function slug()
333
+	{
334
+		return $this->slug;
335
+	}
336
+
337
+
338
+
339
+	/**
340
+	 * @param string $slug
341
+	 * @throws InvalidDataTypeException
342
+	 */
343
+	public function setSlug($slug)
344
+	{
345
+		if (! is_string($slug)) {
346
+			throw new InvalidDataTypeException('$slug', $slug, 'string');
347
+		}
348
+		$this->slug = $slug;
349
+	}
350
+
351
+
352
+
353
+	/**
354
+	 * @return string
355
+	 */
356
+	public function submitBtnText()
357
+	{
358
+		return $this->submit_btn_text;
359
+	}
360
+
361
+
362
+
363
+	/**
364
+	 * @param string $submit_btn_text
365
+	 * @throws InvalidDataTypeException
366
+	 * @throws InvalidArgumentException
367
+	 */
368
+	public function setSubmitBtnText($submit_btn_text)
369
+	{
370
+		if (! is_string($submit_btn_text)) {
371
+			throw new InvalidDataTypeException('$submit_btn_text', $submit_btn_text, 'string');
372
+		}
373
+		if (empty($submit_btn_text)) {
374
+			throw new InvalidArgumentException(
375
+				esc_html__('Can not set Submit button text because an empty string was provided.', 'event_espresso')
376
+			);
377
+		}
378
+		$this->submit_btn_text = $submit_btn_text;
379
+	}
380
+
381
+
382
+
383
+	/**
384
+	 * @return string
385
+	 */
386
+	public function formAction()
387
+	{
388
+		return ! empty($this->form_args)
389
+			? add_query_arg($this->form_args, $this->form_action)
390
+			: $this->form_action;
391
+	}
392
+
393
+
394
+
395
+	/**
396
+	 * @param string $form_action
397
+	 * @throws InvalidDataTypeException
398
+	 */
399
+	public function setFormAction($form_action)
400
+	{
401
+		if (! is_string($form_action)) {
402
+			throw new InvalidDataTypeException('$form_action', $form_action, 'string');
403
+		}
404
+		$this->form_action = $form_action;
405
+	}
406
+
407
+
408
+
409
+	/**
410
+	 * @param array $form_args
411
+	 * @throws InvalidDataTypeException
412
+	 * @throws InvalidArgumentException
413
+	 */
414
+	public function addFormActionArgs($form_args = array())
415
+	{
416
+		if (is_object($form_args)) {
417
+			throw new InvalidDataTypeException(
418
+				'$form_args',
419
+				$form_args,
420
+				'anything other than an object was expected.'
421
+			);
422
+		}
423
+		if (empty($form_args)) {
424
+			throw new InvalidArgumentException(
425
+				esc_html__('The redirect arguments can not be an empty array.', 'event_espresso')
426
+			);
427
+		}
428
+		$this->form_args = array_merge($this->form_args, $form_args);
429
+	}
430
+
431
+
432
+
433
+	/**
434
+	 * @return string
435
+	 */
436
+	public function formConfig()
437
+	{
438
+		return $this->form_config;
439
+	}
440
+
441
+
442
+
443
+	/**
444
+	 * @param string $form_config
445
+	 * @throws DomainException
446
+	 */
447
+	public function setFormConfig($form_config)
448
+	{
449
+		if (
450
+		! in_array(
451
+			$form_config,
452
+			array(
453
+				FormHandler::ADD_FORM_TAGS_AND_SUBMIT,
454
+				FormHandler::ADD_FORM_TAGS_ONLY,
455
+				FormHandler::ADD_FORM_SUBMIT_ONLY,
456
+				FormHandler::DO_NOT_SETUP_FORM,
457
+			),
458
+			true
459
+		)
460
+		) {
461
+			throw new DomainException(
462
+				sprintf(
463
+					esc_html__('"%1$s" is not a valid value for the form config. Please use one of the class constants on \EventEspresso\core\libraries\form_sections\form_handlers\Form',
464
+						'event_espresso'),
465
+					$form_config
466
+				)
467
+			);
468
+		}
469
+		$this->form_config = $form_config;
470
+	}
471
+
472
+
473
+
474
+	/**
475
+	 * called after the form is instantiated
476
+	 * and used for performing any logic that needs to occur early
477
+	 * before any of the other methods are called.
478
+	 * returns true if everything is ok to proceed,
479
+	 * and false if no further form logic should be implemented
480
+	 *
481
+	 * @return boolean
482
+	 */
483
+	public function initialize()
484
+	{
485
+		$this->form_has_errors = EE_Error::has_error(true);
486
+		return true;
487
+	}
488
+
489
+
490
+
491
+	/**
492
+	 * used for setting up css and js
493
+	 *
494
+	 * @return void
495
+	 * @throws LogicException
496
+	 * @throws EE_Error
497
+	 */
498
+	public function enqueueStylesAndScripts()
499
+	{
500
+		$this->form(false)->enqueue_js();
501
+	}
502
+
503
+
504
+
505
+	/**
506
+	 * creates and returns the actual form
507
+	 *
508
+	 * @return EE_Form_Section_Proper
509
+	 */
510
+	abstract public function generate();
511
+
512
+
513
+
514
+	/**
515
+	 * creates and returns an EE_Submit_Input labeled "Submit"
516
+	 *
517
+	 * @param string $text
518
+	 * @return EE_Submit_Input
519
+	 */
520
+	public function generateSubmitButton($text = '')
521
+	{
522
+		$text = ! empty($text) ? $text : $this->submitBtnText();
523
+		return new EE_Submit_Input(
524
+			array(
525
+				'html_name'             => 'ee-form-submit-' . $this->slug(),
526
+				'html_id'               => 'ee-form-submit-' . $this->slug(),
527
+				'html_class'            => 'ee-form-submit',
528
+				'html_label'            => '&nbsp;',
529
+				'other_html_attributes' => ' rel="' . $this->slug() . '"',
530
+				'default'               => $text,
531
+			)
532
+		);
533
+	}
534
+
535
+
536
+
537
+	/**
538
+	 * calls generateSubmitButton() and appends it onto the form along with a float clearing div
539
+	 *
540
+	 * @param string $text
541
+	 * @return void
542
+	 * @throws LogicException
543
+	 * @throws EE_Error
544
+	 */
545
+	public function appendSubmitButton($text = '')
546
+	{
547
+		if ($this->form->subsection_exists($this->slug() . '-submit-btn')) {
548
+			return;
549
+		}
550
+		$this->form->add_subsections(
551
+			array($this->slug() . '-submit-btn' => $this->generateSubmitButton($text)),
552
+			null,
553
+			false
554
+		);
555
+	}
556
+
557
+
558
+
559
+	/**
560
+	 * creates and returns an EE_Submit_Input labeled "Cancel"
561
+	 *
562
+	 * @param string $text
563
+	 * @return EE_Submit_Input
564
+	 */
565
+	public function generateCancelButton($text = '')
566
+	{
567
+		$cancel_button = new EE_Submit_Input(
568
+			array(
569
+				'html_name'             => 'ee-form-submit-' . $this->slug(), // YES! Same name as submit !!!
570
+				'html_id'               => 'ee-cancel-form-' . $this->slug(),
571
+				'html_class'            => 'ee-cancel-form',
572
+				'html_label'            => '&nbsp;',
573
+				'other_html_attributes' => ' rel="' . $this->slug() . '"',
574
+				'default'               => ! empty($text) ? $text : esc_html__('Cancel', 'event_espresso'),
575
+			)
576
+		);
577
+		$cancel_button->set_button_css_attributes(false);
578
+		return $cancel_button;
579
+	}
580
+
581
+
582
+
583
+	/**
584
+	 * appends a float clearing div onto end of form
585
+	 *
586
+	 * @return void
587
+	 * @throws EE_Error
588
+	 */
589
+	public function clearFormButtonFloats()
590
+	{
591
+		$this->form->add_subsections(
592
+			array(
593
+				'clear-submit-btn-float' => new EE_Form_Section_HTML(
594
+					EEH_HTML::div('', '', 'clear-float') . EEH_HTML::divx()
595
+				),
596
+			),
597
+			null,
598
+			false
599
+		);
600
+	}
601
+
602
+
603
+
604
+	/**
605
+	 * takes the generated form and displays it along with ony other non-form HTML that may be required
606
+	 * returns a string of HTML that can be directly echoed in a template
607
+	 *
608
+	 * @return string
609
+	 * @throws LogicException
610
+	 * @throws EE_Error
611
+	 */
612
+	public function display()
613
+	{
614
+		$form_html = apply_filters(
615
+			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__before_form',
616
+			''
617
+		);
618
+		$form_config = $this->formConfig();
619
+		if (
620
+			$form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT
621
+			|| $form_config === FormHandler::ADD_FORM_TAGS_ONLY
622
+		) {
623
+			$form_html .= $this->form()->form_open($this->formAction());
624
+		}
625
+		$form_html .= $this->form(true)->get_html($this->form_has_errors);
626
+		if (
627
+			$form_config === FormHandler::ADD_FORM_TAGS_AND_SUBMIT
628
+			|| $form_config === FormHandler::ADD_FORM_TAGS_ONLY
629
+		) {
630
+			$form_html .= $this->form()->form_close();
631
+		}
632
+		$form_html .= apply_filters(
633
+			'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__display__after_form',
634
+			''
635
+		);
636
+		return $form_html;
637
+	}
638
+
639
+
640
+
641
+	/**
642
+	 * handles processing the form submission
643
+	 * returns true or false depending on whether the form was processed successfully or not
644
+	 *
645
+	 * @param array $submitted_form_data
646
+	 * @return array
647
+	 * @throws EE_Error
648
+	 * @throws LogicException
649
+	 * @throws InvalidFormSubmissionException
650
+	 */
651
+	public function process($submitted_form_data = array())
652
+	{
653
+		if (! $this->form()->was_submitted($submitted_form_data)) {
654
+			throw new InvalidFormSubmissionException($this->form_name);
655
+		}
656
+		$this->form(true)->receive_form_submission($submitted_form_data);
657
+		if (! $this->form()->is_valid()) {
658
+			throw new InvalidFormSubmissionException(
659
+				$this->form_name,
660
+				sprintf(
661
+					esc_html__(
662
+						'The "%1$s" form is invalid. Please correct the following errors and resubmit: %2$s %3$s',
663
+						'event_espresso'
664
+					),
665
+					$this->form_name,
666
+					'<br />',
667
+					$this->form()->submission_error_message()
668
+				)
669
+			);
670
+		}
671
+		return $this->form()->valid_data();
672
+	}
673 673
 
674 674
 
675 675
 
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 use EventEspresso\core\exceptions\InvalidDataTypeException;
15 15
 use EventEspresso\core\exceptions\InvalidFormSubmissionException;
16 16
 
17
-if (! defined('EVENT_ESPRESSO_VERSION')) {
17
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
18 18
     exit('No direct script access allowed');
19 19
 }
20 20
 
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
      */
180 180
     public function form($for_display = false)
181 181
     {
182
-        if (! $this->formIsValid()) {
182
+        if ( ! $this->formIsValid()) {
183 183
             return null;
184 184
         }
185 185
         if ($for_display) {
@@ -203,9 +203,9 @@  discard block
 block discarded – undo
203 203
      */
204 204
     public function formIsValid()
205 205
     {
206
-        if (! $this->form instanceof EE_Form_Section_Proper) {
206
+        if ( ! $this->form instanceof EE_Form_Section_Proper) {
207 207
             static $generated = false;
208
-            if (! $generated) {
208
+            if ( ! $generated) {
209 209
                 $generated = true;
210 210
                 $form = apply_filters(
211 211
                     'FHEE__EventEspresso_core_libraries_form_sections_form_handlers_FormHandler__formIsValid__generated_form_object',
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
      */
291 291
     public function setFormName($form_name)
292 292
     {
293
-        if (! is_string($form_name)) {
293
+        if ( ! is_string($form_name)) {
294 294
             throw new InvalidDataTypeException('$form_name', $form_name, 'string');
295 295
         }
296 296
         $this->form_name = $form_name;
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
      */
317 317
     public function setAdminName($admin_name)
318 318
     {
319
-        if (! is_string($admin_name)) {
319
+        if ( ! is_string($admin_name)) {
320 320
             throw new InvalidDataTypeException('$admin_name', $admin_name, 'string');
321 321
         }
322 322
         $this->admin_name = $admin_name;
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
      */
343 343
     public function setSlug($slug)
344 344
     {
345
-        if (! is_string($slug)) {
345
+        if ( ! is_string($slug)) {
346 346
             throw new InvalidDataTypeException('$slug', $slug, 'string');
347 347
         }
348 348
         $this->slug = $slug;
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
      */
368 368
     public function setSubmitBtnText($submit_btn_text)
369 369
     {
370
-        if (! is_string($submit_btn_text)) {
370
+        if ( ! is_string($submit_btn_text)) {
371 371
             throw new InvalidDataTypeException('$submit_btn_text', $submit_btn_text, 'string');
372 372
         }
373 373
         if (empty($submit_btn_text)) {
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
      */
399 399
     public function setFormAction($form_action)
400 400
     {
401
-        if (! is_string($form_action)) {
401
+        if ( ! is_string($form_action)) {
402 402
             throw new InvalidDataTypeException('$form_action', $form_action, 'string');
403 403
         }
404 404
         $this->form_action = $form_action;
@@ -522,11 +522,11 @@  discard block
 block discarded – undo
522 522
         $text = ! empty($text) ? $text : $this->submitBtnText();
523 523
         return new EE_Submit_Input(
524 524
             array(
525
-                'html_name'             => 'ee-form-submit-' . $this->slug(),
526
-                'html_id'               => 'ee-form-submit-' . $this->slug(),
525
+                'html_name'             => 'ee-form-submit-'.$this->slug(),
526
+                'html_id'               => 'ee-form-submit-'.$this->slug(),
527 527
                 'html_class'            => 'ee-form-submit',
528 528
                 'html_label'            => '&nbsp;',
529
-                'other_html_attributes' => ' rel="' . $this->slug() . '"',
529
+                'other_html_attributes' => ' rel="'.$this->slug().'"',
530 530
                 'default'               => $text,
531 531
             )
532 532
         );
@@ -544,11 +544,11 @@  discard block
 block discarded – undo
544 544
      */
545 545
     public function appendSubmitButton($text = '')
546 546
     {
547
-        if ($this->form->subsection_exists($this->slug() . '-submit-btn')) {
547
+        if ($this->form->subsection_exists($this->slug().'-submit-btn')) {
548 548
             return;
549 549
         }
550 550
         $this->form->add_subsections(
551
-            array($this->slug() . '-submit-btn' => $this->generateSubmitButton($text)),
551
+            array($this->slug().'-submit-btn' => $this->generateSubmitButton($text)),
552 552
             null,
553 553
             false
554 554
         );
@@ -566,11 +566,11 @@  discard block
 block discarded – undo
566 566
     {
567 567
         $cancel_button = new EE_Submit_Input(
568 568
             array(
569
-                'html_name'             => 'ee-form-submit-' . $this->slug(), // YES! Same name as submit !!!
570
-                'html_id'               => 'ee-cancel-form-' . $this->slug(),
569
+                'html_name'             => 'ee-form-submit-'.$this->slug(), // YES! Same name as submit !!!
570
+                'html_id'               => 'ee-cancel-form-'.$this->slug(),
571 571
                 'html_class'            => 'ee-cancel-form',
572 572
                 'html_label'            => '&nbsp;',
573
-                'other_html_attributes' => ' rel="' . $this->slug() . '"',
573
+                'other_html_attributes' => ' rel="'.$this->slug().'"',
574 574
                 'default'               => ! empty($text) ? $text : esc_html__('Cancel', 'event_espresso'),
575 575
             )
576 576
         );
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
         $this->form->add_subsections(
592 592
             array(
593 593
                 'clear-submit-btn-float' => new EE_Form_Section_HTML(
594
-                    EEH_HTML::div('', '', 'clear-float') . EEH_HTML::divx()
594
+                    EEH_HTML::div('', '', 'clear-float').EEH_HTML::divx()
595 595
                 ),
596 596
             ),
597 597
             null,
@@ -650,11 +650,11 @@  discard block
 block discarded – undo
650 650
      */
651 651
     public function process($submitted_form_data = array())
652 652
     {
653
-        if (! $this->form()->was_submitted($submitted_form_data)) {
653
+        if ( ! $this->form()->was_submitted($submitted_form_data)) {
654 654
             throw new InvalidFormSubmissionException($this->form_name);
655 655
         }
656 656
         $this->form(true)->receive_form_submission($submitted_form_data);
657
-        if (! $this->form()->is_valid()) {
657
+        if ( ! $this->form()->is_valid()) {
658 658
             throw new InvalidFormSubmissionException(
659 659
                 $this->form_name,
660 660
                 sprintf(
Please login to merge, or discard this patch.