@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'ABSPATH' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('ABSPATH')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /* |
5 | 5 | Plugin Name: Event Espresso |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | */ |
43 | 43 | |
44 | -if ( function_exists( 'espresso_version' ) ) { |
|
44 | +if (function_exists('espresso_version')) { |
|
45 | 45 | |
46 | 46 | /** |
47 | 47 | * espresso_duplicate_plugin_error |
@@ -50,12 +50,12 @@ discard block |
||
50 | 50 | function espresso_duplicate_plugin_error() { |
51 | 51 | ?> |
52 | 52 | <div class="error"> |
53 | - <p><?php _e( '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.', 'event_espresso' ); ?></p> |
|
53 | + <p><?php _e('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.', 'event_espresso'); ?></p> |
|
54 | 54 | </div> |
55 | 55 | <?php |
56 | - espresso_deactivate_plugin( plugin_basename( __FILE__ ) ); |
|
56 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
57 | 57 | } |
58 | - add_action( 'admin_notices', 'espresso_duplicate_plugin_error', 1 ); |
|
58 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | 59 | |
60 | 60 | } else { |
61 | 61 | |
@@ -70,98 +70,98 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | // define versions |
73 | - define( 'EVENT_ESPRESSO_VERSION', espresso_version() ); |
|
74 | - define( 'EE_MIN_WP_VER_REQUIRED', '4.1' ); |
|
75 | - define( 'EE_MIN_WP_VER_RECOMMENDED', '4.4.2' ); |
|
76 | - define( 'EE_MIN_PHP_VER_REQUIRED', '5.3.0' ); |
|
77 | - define( 'EE_MIN_PHP_VER_RECOMMENDED', '5.4.44' ); |
|
78 | - define( 'EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - ' . EVENT_ESPRESSO_VERSION ); |
|
79 | - define( 'EVENT_ESPRESSO_MAIN_FILE', __FILE__ ); |
|
73 | + define('EVENT_ESPRESSO_VERSION', espresso_version()); |
|
74 | + define('EE_MIN_WP_VER_REQUIRED', '4.1'); |
|
75 | + define('EE_MIN_WP_VER_RECOMMENDED', '4.4.2'); |
|
76 | + define('EE_MIN_PHP_VER_REQUIRED', '5.3.0'); |
|
77 | + define('EE_MIN_PHP_VER_RECOMMENDED', '5.4.44'); |
|
78 | + define('EVENT_ESPRESSO_POWERED_BY', 'Event Espresso - '.EVENT_ESPRESSO_VERSION); |
|
79 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
80 | 80 | //used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
81 | - if ( ! defined( 'DS' ) ) { |
|
82 | - define( 'DS', '/' ); |
|
81 | + if ( ! defined('DS')) { |
|
82 | + define('DS', '/'); |
|
83 | 83 | } |
84 | - if ( ! defined( 'PS' ) ) { |
|
85 | - define( 'PS', PATH_SEPARATOR ); |
|
84 | + if ( ! defined('PS')) { |
|
85 | + define('PS', PATH_SEPARATOR); |
|
86 | 86 | } |
87 | - if ( ! defined( 'SP' ) ) { |
|
88 | - define( 'SP', ' ' ); |
|
87 | + if ( ! defined('SP')) { |
|
88 | + define('SP', ' '); |
|
89 | 89 | } |
90 | - if ( ! defined( 'EENL' ) ) { |
|
91 | - define( 'EENL', "\n" ); |
|
90 | + if ( ! defined('EENL')) { |
|
91 | + define('EENL', "\n"); |
|
92 | 92 | } |
93 | - define( 'EE_SUPPORT_EMAIL', '[email protected]' ); |
|
93 | + define('EE_SUPPORT_EMAIL', '[email protected]'); |
|
94 | 94 | // define the plugin directory and URL |
95 | - define( 'EE_PLUGIN_BASENAME', plugin_basename( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
96 | - define( 'EE_PLUGIN_DIR_PATH', plugin_dir_path( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
97 | - define( 'EE_PLUGIN_DIR_URL', plugin_dir_url( EVENT_ESPRESSO_MAIN_FILE ) ); |
|
95 | + define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
|
96 | + define('EE_PLUGIN_DIR_PATH', plugin_dir_path(EVENT_ESPRESSO_MAIN_FILE)); |
|
97 | + define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
|
98 | 98 | // main root folder paths |
99 | - define( 'EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS ); |
|
100 | - define( 'EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS ); |
|
101 | - define( 'EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS ); |
|
102 | - define( 'EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS ); |
|
103 | - define( 'EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS ); |
|
104 | - define( 'EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS ); |
|
105 | - define( 'EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS ); |
|
106 | - define( 'EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS ); |
|
99 | + define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
100 | + define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
101 | + define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
102 | + define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
103 | + define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
104 | + define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
105 | + define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
106 | + define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
107 | 107 | // core system paths |
108 | - define( 'EE_ADMIN', EE_CORE . 'admin' . DS ); |
|
109 | - define( 'EE_CPTS', EE_CORE . 'CPTs' . DS ); |
|
110 | - define( 'EE_CLASSES', EE_CORE . 'db_classes' . DS ); |
|
111 | - define( 'EE_INTERFACES', EE_CORE . 'interfaces' . DS ); |
|
112 | - define( 'EE_BUSINESS', EE_CORE . 'business' . DS ); |
|
113 | - define( 'EE_MODELS', EE_CORE . 'db_models' . DS ); |
|
114 | - define( 'EE_HELPERS', EE_CORE . 'helpers' . DS ); |
|
115 | - define( 'EE_LIBRARIES', EE_CORE . 'libraries' . DS ); |
|
116 | - define( 'EE_TEMPLATES', EE_CORE . 'templates' . DS ); |
|
117 | - define( 'EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS ); |
|
118 | - define( 'EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS ); |
|
119 | - define( 'EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS ); |
|
108 | + define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
109 | + define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
110 | + define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
111 | + define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
112 | + define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
113 | + define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
114 | + define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
115 | + define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
116 | + define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
117 | + define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
118 | + define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
119 | + define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
120 | 120 | // gateways |
121 | - define( 'EE_GATEWAYS', EE_MODULES . 'gateways' . DS ); |
|
122 | - define( 'EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS ); |
|
121 | + define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
122 | + define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
123 | 123 | // asset URL paths |
124 | - define( 'EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS ); |
|
125 | - define( 'EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS ); |
|
126 | - define( 'EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS ); |
|
127 | - define( 'EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS ); |
|
128 | - define( 'EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/' ); |
|
129 | - define( 'EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/' ); |
|
124 | + define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
125 | + define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
126 | + define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
127 | + define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
128 | + define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
129 | + define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
130 | 130 | // define upload paths |
131 | 131 | $uploads = wp_upload_dir(); |
132 | 132 | // define the uploads directory and URL |
133 | - define( 'EVENT_ESPRESSO_UPLOAD_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS ); |
|
134 | - define( 'EVENT_ESPRESSO_UPLOAD_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS ); |
|
133 | + define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
134 | + define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
135 | 135 | // define the templates directory and URL |
136 | - define( 'EVENT_ESPRESSO_TEMPLATE_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
137 | - define( 'EVENT_ESPRESSO_TEMPLATE_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'templates' . DS ); |
|
136 | + define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
137 | + define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
138 | 138 | // define the gateway directory and URL |
139 | - define( 'EVENT_ESPRESSO_GATEWAY_DIR', $uploads[ 'basedir' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
140 | - define( 'EVENT_ESPRESSO_GATEWAY_URL', $uploads[ 'baseurl' ] . DS . 'espresso' . DS . 'gateways' . DS ); |
|
139 | + define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
140 | + define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
141 | 141 | // languages folder/path |
142 | - define( 'EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS ); |
|
143 | - define( 'EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS ); |
|
142 | + define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
143 | + define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
144 | 144 | //check for dompdf fonts in uploads |
145 | - if ( file_exists( EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ) ) { |
|
146 | - define( 'DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS ); |
|
145 | + if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
146 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
147 | 147 | } |
148 | 148 | //ajax constants |
149 | - define( 'EE_FRONT_AJAX', isset( $_REQUEST[ 'ee_front_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_front_ajax' ] ) ? true : false ); |
|
150 | - define( 'EE_ADMIN_AJAX', isset( $_REQUEST[ 'ee_admin_ajax' ] ) || isset( $_REQUEST[ 'data' ][ 'ee_admin_ajax' ] ) ? true : false ); |
|
149 | + define('EE_FRONT_AJAX', isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) ? true : false); |
|
150 | + define('EE_ADMIN_AJAX', isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) ? true : false); |
|
151 | 151 | //just a handy constant occasionally needed for finding values representing infinity in the DB |
152 | 152 | //you're better to use this than its straight value (currently -1) in case you ever |
153 | 153 | //want to change its default value! or find when -1 means infinity |
154 | - define( 'EE_INF_IN_DB', -1 ); |
|
155 | - define( 'EE_INF', INF > (float)PHP_INT_MAX ? INF : PHP_INT_MAX ); |
|
154 | + define('EE_INF_IN_DB', -1); |
|
155 | + define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
|
156 | 156 | |
157 | 157 | /** |
158 | 158 | * espresso_plugin_activation |
159 | 159 | * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
160 | 160 | */ |
161 | 161 | function espresso_plugin_activation() { |
162 | - update_option( 'ee_espresso_activation', true ); |
|
162 | + update_option('ee_espresso_activation', true); |
|
163 | 163 | } |
164 | - register_activation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation' ); |
|
164 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
165 | 165 | |
166 | 166 | |
167 | 167 | |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | // } |
176 | 176 | // |
177 | 177 | } |
178 | - register_deactivation_hook( EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation' ); |
|
178 | + register_deactivation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_deactivation'); |
|
179 | 179 | |
180 | 180 | |
181 | 181 | |
@@ -185,15 +185,15 @@ discard block |
||
185 | 185 | */ |
186 | 186 | function espresso_load_error_handling() { |
187 | 187 | // load debugging tools |
188 | - if ( WP_DEBUG === true && is_readable( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ) ) { |
|
189 | - require_once( EE_HELPERS . 'EEH_Debug_Tools.helper.php' ); |
|
188 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
189 | + require_once(EE_HELPERS.'EEH_Debug_Tools.helper.php'); |
|
190 | 190 | EEH_Debug_Tools::instance(); |
191 | 191 | } |
192 | 192 | // load error handling |
193 | - if ( is_readable( EE_CORE . 'EE_Error.core.php' ) ) { |
|
194 | - require_once( EE_CORE . 'EE_Error.core.php' ); |
|
193 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
194 | + require_once(EE_CORE.'EE_Error.core.php'); |
|
195 | 195 | } else { |
196 | - wp_die( __( 'The EE_Error core class could not be loaded.', 'event_espresso' ) ); |
|
196 | + wp_die(__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
197 | 197 | } |
198 | 198 | } |
199 | 199 | |
@@ -207,25 +207,25 @@ discard block |
||
207 | 207 | * @param string $full_path_to_file |
208 | 208 | * @throws EE_Error |
209 | 209 | */ |
210 | - function espresso_load_required( $classname, $full_path_to_file ) { |
|
210 | + function espresso_load_required($classname, $full_path_to_file) { |
|
211 | 211 | static $error_handling_loaded = false; |
212 | - if ( ! $error_handling_loaded ) { |
|
212 | + if ( ! $error_handling_loaded) { |
|
213 | 213 | espresso_load_error_handling(); |
214 | 214 | $error_handling_loaded = true; |
215 | 215 | } |
216 | - if ( is_readable( $full_path_to_file ) ) { |
|
217 | - require_once( $full_path_to_file ); |
|
216 | + if (is_readable($full_path_to_file)) { |
|
217 | + require_once($full_path_to_file); |
|
218 | 218 | } else { |
219 | - throw new EE_Error ( sprintf( |
|
220 | - __( 'The %s class file could not be located or is not readable due to file permissions.', 'event_espresso' ), |
|
219 | + throw new EE_Error(sprintf( |
|
220 | + __('The %s class file could not be located or is not readable due to file permissions.', 'event_espresso'), |
|
221 | 221 | $classname |
222 | - ) ); |
|
222 | + )); |
|
223 | 223 | } |
224 | 224 | } |
225 | 225 | |
226 | - espresso_load_required( 'EEH_Base', EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' ); |
|
227 | - espresso_load_required( 'EEH_File', EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' ); |
|
228 | - espresso_load_required( 'EE_Bootstrap', EE_CORE . 'EE_Bootstrap.core.php' ); |
|
226 | + espresso_load_required('EEH_Base', EE_CORE.'helpers'.DS.'EEH_Base.helper.php'); |
|
227 | + espresso_load_required('EEH_File', EE_CORE.'helpers'.DS.'EEH_File.helper.php'); |
|
228 | + espresso_load_required('EE_Bootstrap', EE_CORE.'EE_Bootstrap.core.php'); |
|
229 | 229 | new EE_Bootstrap(); |
230 | 230 | |
231 | 231 | |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | |
235 | 235 | |
236 | 236 | |
237 | -if ( ! function_exists( 'espresso_deactivate_plugin' ) ) { |
|
237 | +if ( ! function_exists('espresso_deactivate_plugin')) { |
|
238 | 238 | /** |
239 | 239 | * deactivate_plugin |
240 | 240 | * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
@@ -243,12 +243,12 @@ discard block |
||
243 | 243 | * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
244 | 244 | * @return void |
245 | 245 | */ |
246 | - function espresso_deactivate_plugin( $plugin_basename = '' ) { |
|
247 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
248 | - require_once( ABSPATH . 'wp-admin/includes/plugin.php' ); |
|
246 | + function espresso_deactivate_plugin($plugin_basename = '') { |
|
247 | + if ( ! function_exists('deactivate_plugins')) { |
|
248 | + require_once(ABSPATH.'wp-admin/includes/plugin.php'); |
|
249 | 249 | } |
250 | - unset( $_GET[ 'activate' ] ); |
|
251 | - unset( $_REQUEST[ 'activate' ] ); |
|
252 | - deactivate_plugins( $plugin_basename ); |
|
250 | + unset($_GET['activate']); |
|
251 | + unset($_REQUEST['activate']); |
|
252 | + deactivate_plugins($plugin_basename); |
|
253 | 253 | } |
254 | 254 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return EED_Recaptcha |
44 | 44 | */ |
45 | 45 | public static function instance() { |
46 | - return parent::get_instance( __CLASS__ ); |
|
46 | + return parent::get_instance(__CLASS__); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -59,32 +59,32 @@ discard block |
||
59 | 59 | if ( |
60 | 60 | EE_Registry::instance()->CFG->registration->use_captcha |
61 | 61 | && ! ( |
62 | - EE_Registry::instance()->REQ->get( 'step', '' ) === 'payment_options' |
|
63 | - && (boolean) EE_Registry::instance()->REQ->get( 'revisit', false ) === true |
|
62 | + EE_Registry::instance()->REQ->get('step', '') === 'payment_options' |
|
63 | + && (boolean) EE_Registry::instance()->REQ->get('revisit', false) === true |
|
64 | 64 | ) |
65 | 65 | ) { |
66 | 66 | EED_Recaptcha::set_definitions(); |
67 | 67 | EED_Recaptcha::enqueue_styles_and_scripts(); |
68 | - add_action( 'wp', array( 'EED_Recaptcha', 'set_late_hooks' ), 1, 0 ); |
|
68 | + add_action('wp', array('EED_Recaptcha', 'set_late_hooks'), 1, 0); |
|
69 | 69 | add_action( |
70 | 70 | 'AHEE__before_spco_whats_next_buttons', |
71 | - array( 'EED_Recaptcha', 'display_recaptcha' ), 10, 0 |
|
71 | + array('EED_Recaptcha', 'display_recaptcha'), 10, 0 |
|
72 | 72 | ); |
73 | 73 | add_filter( |
74 | 74 | 'FHEE__EED_Single_Page_Checkout__init___continue_reg', |
75 | - array( 'EED_Recaptcha', 'not_a_robot' ), 10 |
|
75 | + array('EED_Recaptcha', 'not_a_robot'), 10 |
|
76 | 76 | ); |
77 | 77 | add_filter( |
78 | 78 | 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', |
79 | - array( 'EED_Recaptcha', 'not_a_robot' ), 10 |
|
79 | + array('EED_Recaptcha', 'not_a_robot'), 10 |
|
80 | 80 | ); |
81 | 81 | add_filter( |
82 | 82 | 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', |
83 | - array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 |
|
83 | + array('EED_Recaptcha', 'recaptcha_response'), 10, 1 |
|
84 | 84 | ); |
85 | 85 | add_filter( |
86 | 86 | 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', |
87 | - array( 'EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method' ), 10, 1 |
|
87 | + array('EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method'), 10, 1 |
|
88 | 88 | ); |
89 | 89 | } |
90 | 90 | } |
@@ -103,18 +103,18 @@ discard block |
||
103 | 103 | if ( |
104 | 104 | EE_Registry::instance()->CFG->registration->use_captcha |
105 | 105 | && ! ( |
106 | - EE_Registry::instance()->REQ->get( 'step', '' ) === 'payment_options' |
|
107 | - && (boolean) EE_Registry::instance()->REQ->get( 'revisit', false ) === true |
|
106 | + EE_Registry::instance()->REQ->get('step', '') === 'payment_options' |
|
107 | + && (boolean) EE_Registry::instance()->REQ->get('revisit', false) === true |
|
108 | 108 | ) |
109 | 109 | ) { |
110 | 110 | EED_Recaptcha::enqueue_styles_and_scripts(); |
111 | - add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
112 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
113 | - add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 ); |
|
111 | + add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
112 | + add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
113 | + add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1); |
|
114 | 114 | } |
115 | 115 | // admin settings |
116 | - add_action( 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array( 'EED_Recaptcha', 'admin_settings' ), 10, 1 ); |
|
117 | - add_filter( 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array( 'EED_Recaptcha', 'update_admin_settings' ), 10, 1 ); |
|
116 | + add_action('AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array('EED_Recaptcha', 'admin_settings'), 10, 1); |
|
117 | + add_filter('FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array('EED_Recaptcha', 'update_admin_settings'), 10, 1); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | |
@@ -126,11 +126,11 @@ discard block |
||
126 | 126 | * @return void |
127 | 127 | */ |
128 | 128 | public static function set_definitions() { |
129 | - if ( is_user_logged_in() ) { |
|
129 | + if (is_user_logged_in()) { |
|
130 | 130 | EED_Recaptcha::$_not_a_robot = true; |
131 | 131 | } |
132 | - define( 'RECAPTCHA_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
133 | - define( 'RECAPTCHA_BASE_URL', plugin_dir_url( __FILE__ )); |
|
132 | + define('RECAPTCHA_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
133 | + define('RECAPTCHA_BASE_URL', plugin_dir_url(__FILE__)); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | public static function set_late_hooks() { |
145 | 145 | add_filter( |
146 | 146 | 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', |
147 | - array( 'EED_Recaptcha', 'not_a_robot' ) |
|
147 | + array('EED_Recaptcha', 'not_a_robot') |
|
148 | 148 | ); |
149 | 149 | } |
150 | 150 | |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | * @return void |
158 | 158 | */ |
159 | 159 | public static function enqueue_styles_and_scripts() { |
160 | - wp_register_script( 'espresso_recaptcha', RECAPTCHA_BASE_URL . 'scripts' . DS . 'espresso_recaptcha.js', array( 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
161 | - wp_register_script( 'google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl=' . EE_Registry::instance()->CFG->registration->recaptcha_language, array( 'espresso_recaptcha' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
162 | - EE_Registry::$i18n_js_strings['no_SPCO_error'] = __( 'It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
163 | - EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __( 'There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
|
164 | - EE_Registry::$i18n_js_strings['recaptcha_fail'] = __( 'Please complete the anti-spam test before proceeding.', 'event_espresso' ); |
|
160 | + wp_register_script('espresso_recaptcha', RECAPTCHA_BASE_URL.'scripts'.DS.'espresso_recaptcha.js', array('single_page_checkout'), EVENT_ESPRESSO_VERSION, TRUE); |
|
161 | + wp_register_script('google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl='.EE_Registry::instance()->CFG->registration->recaptcha_language, array('espresso_recaptcha'), EVENT_ESPRESSO_VERSION, TRUE); |
|
162 | + EE_Registry::$i18n_js_strings['no_SPCO_error'] = __('It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
163 | + EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __('There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
164 | + EE_Registry::$i18n_js_strings['recaptcha_fail'] = __('Please complete the anti-spam test before proceeding.', 'event_espresso'); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * @access public |
173 | 173 | * @param \WP $WP |
174 | 174 | */ |
175 | - public function run( $WP ) { |
|
175 | + public function run($WP) { |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | |
@@ -182,8 +182,7 @@ discard block |
||
182 | 182 | * @return boolean |
183 | 183 | */ |
184 | 184 | public static function not_a_robot() { |
185 | - $not_a_robot = is_bool( EED_Recaptcha::$_not_a_robot ) ? EED_Recaptcha::$_not_a_robot : |
|
186 | - EED_Recaptcha::recaptcha_passed(); |
|
185 | + $not_a_robot = is_bool(EED_Recaptcha::$_not_a_robot) ? EED_Recaptcha::$_not_a_robot : EED_Recaptcha::recaptcha_passed(); |
|
187 | 186 | return $not_a_robot; |
188 | 187 | } |
189 | 188 | |
@@ -199,23 +198,23 @@ discard block |
||
199 | 198 | */ |
200 | 199 | public static function display_recaptcha() { |
201 | 200 | // logged in means you have already passed a turing test of sorts |
202 | - if ( is_user_logged_in() ) { |
|
201 | + if (is_user_logged_in()) { |
|
203 | 202 | return; |
204 | 203 | } |
205 | 204 | // don't display if not using recaptcha or user is logged in |
206 | - if ( EE_Registry::instance()->CFG->registration->use_captcha ) { |
|
205 | + if (EE_Registry::instance()->CFG->registration->use_captcha) { |
|
207 | 206 | // only display if they have NOT passed the test yet |
208 | - if ( ! EED_Recaptcha::$_not_a_robot ) { |
|
209 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
207 | + if ( ! EED_Recaptcha::$_not_a_robot) { |
|
208 | + EE_Registry::instance()->load_helper('Template'); |
|
210 | 209 | EEH_Template::display_template( |
211 | - RECAPTCHA_BASE_PATH . DS . 'templates' . DS . 'recaptcha.template.php', |
|
210 | + RECAPTCHA_BASE_PATH.DS.'templates'.DS.'recaptcha.template.php', |
|
212 | 211 | array( |
213 | 212 | 'recaptcha_publickey' => EE_Registry::instance()->CFG->registration->recaptcha_publickey, |
214 | 213 | 'recaptcha_theme' => EE_Registry::instance()->CFG->registration->recaptcha_theme, |
215 | 214 | 'recaptcha_type' => EE_Registry::instance()->CFG->registration->recaptcha_type |
216 | 215 | ) |
217 | 216 | ); |
218 | - wp_enqueue_script( 'google_recaptcha' ); |
|
217 | + wp_enqueue_script('google_recaptcha'); |
|
219 | 218 | } |
220 | 219 | } |
221 | 220 | } |
@@ -246,17 +245,17 @@ discard block |
||
246 | 245 | */ |
247 | 246 | public static function recaptcha_passed() { |
248 | 247 | // logged in means you have already passed a turing test of sorts |
249 | - if ( is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha() ) { |
|
248 | + if (is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha()) { |
|
250 | 249 | return TRUE; |
251 | 250 | } |
252 | 251 | // was test already passed? |
253 | - $recaptcha_passed = EE_Registry::instance()->SSN->get_session_data( 'recaptcha_passed' ); |
|
254 | - $recaptcha_passed = filter_var( $recaptcha_passed, FILTER_VALIDATE_BOOLEAN ); |
|
252 | + $recaptcha_passed = EE_Registry::instance()->SSN->get_session_data('recaptcha_passed'); |
|
253 | + $recaptcha_passed = filter_var($recaptcha_passed, FILTER_VALIDATE_BOOLEAN); |
|
255 | 254 | // verify recaptcha |
256 | 255 | EED_Recaptcha::_get_recaptcha_response(); |
257 | - if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response ) { |
|
256 | + if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response) { |
|
258 | 257 | $recaptcha_passed = EED_Recaptcha::_process_recaptcha_response(); |
259 | - EE_Registry::instance()->SSN->set_session_data( array( 'recaptcha_passed' => $recaptcha_passed )); |
|
258 | + EE_Registry::instance()->SSN->set_session_data(array('recaptcha_passed' => $recaptcha_passed)); |
|
260 | 259 | EE_Registry::instance()->SSN->update(); |
261 | 260 | } |
262 | 261 | EED_Recaptcha::$_not_a_robot = $recaptcha_passed; |
@@ -272,8 +271,8 @@ discard block |
||
272 | 271 | * @param array $recaptcha_response |
273 | 272 | * @return boolean |
274 | 273 | */ |
275 | - public static function recaptcha_response( $recaptcha_response = array() ) { |
|
276 | - if ( EED_Recaptcha::_bypass_recaptcha() ) { |
|
274 | + public static function recaptcha_response($recaptcha_response = array()) { |
|
275 | + if (EED_Recaptcha::_bypass_recaptcha()) { |
|
277 | 276 | $recaptcha_response['bypass_recaptcha'] = TRUE; |
278 | 277 | $recaptcha_response['recaptcha_passed'] = TRUE; |
279 | 278 | } else { |
@@ -293,16 +292,16 @@ discard block |
||
293 | 292 | */ |
294 | 293 | private static function _bypass_recaptcha() { |
295 | 294 | // an array of key value pairs that must match exactly with the incoming request, in order to bypass recaptcha for the current request ONLY |
296 | - $bypass_request_params_array = apply_filters( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array() ); |
|
295 | + $bypass_request_params_array = apply_filters('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array()); |
|
297 | 296 | // does $bypass_request_params_array have any values ? |
298 | - if ( empty( $bypass_request_params_array )) { |
|
297 | + if (empty($bypass_request_params_array)) { |
|
299 | 298 | return FALSE; |
300 | 299 | } |
301 | 300 | // initially set bypass to TRUE |
302 | 301 | $bypass_recaptcha = TRUE; |
303 | - foreach ( $bypass_request_params_array as $key => $value ) { |
|
302 | + foreach ($bypass_request_params_array as $key => $value) { |
|
304 | 303 | // if $key is not found or value doesn't match exactly, then toggle bypass to FALSE, otherwise carry over it's value. This way, one missed setting results in no bypass |
305 | - $bypass_recaptcha = isset( $_REQUEST[ $key ] ) && $_REQUEST[ $key ] === $value ? $bypass_recaptcha : FALSE; |
|
304 | + $bypass_recaptcha = isset($_REQUEST[$key]) && $_REQUEST[$key] === $value ? $bypass_recaptcha : FALSE; |
|
306 | 305 | } |
307 | 306 | return $bypass_recaptcha; |
308 | 307 | } |
@@ -317,7 +316,7 @@ discard block |
||
317 | 316 | * @return boolean |
318 | 317 | */ |
319 | 318 | private static function _get_recaptcha_response() { |
320 | - EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false ); |
|
319 | + EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get('g-recaptcha-response', false); |
|
321 | 320 | } |
322 | 321 | |
323 | 322 | |
@@ -331,26 +330,26 @@ discard block |
||
331 | 330 | */ |
332 | 331 | private static function _process_recaptcha_response() { |
333 | 332 | // verify library is loaded |
334 | - if ( ! class_exists( '\\ReCaptcha\\ReCaptcha' )) { |
|
335 | - require_once( RECAPTCHA_BASE_PATH . DS . 'autoload.php' ); |
|
333 | + if ( ! class_exists('\\ReCaptcha\\ReCaptcha')) { |
|
334 | + require_once(RECAPTCHA_BASE_PATH.DS.'autoload.php'); |
|
336 | 335 | } |
337 | 336 | // The response from reCAPTCHA |
338 | 337 | EED_Recaptcha::_get_recaptcha_response(); |
339 | 338 | $recaptcha_response = EED_Recaptcha::$_recaptcha_response; |
340 | 339 | // Was there a reCAPTCHA response? |
341 | - if ( $recaptcha_response ) { |
|
340 | + if ($recaptcha_response) { |
|
342 | 341 | // if allow_url_fopen is Off, then set a different request method |
343 | - $request_method = ! ini_get( 'allow_url_fopen' ) ? new \ReCaptcha\RequestMethod\SocketPost() : null; |
|
342 | + $request_method = ! ini_get('allow_url_fopen') ? new \ReCaptcha\RequestMethod\SocketPost() : null; |
|
344 | 343 | $recaptcha = new \ReCaptcha\ReCaptcha( |
345 | 344 | EE_Registry::instance()->CFG->registration->recaptcha_privatekey, |
346 | 345 | $request_method |
347 | 346 | ); |
348 | 347 | $recaptcha_response = $recaptcha->verify( |
349 | 348 | EED_Recaptcha::$_recaptcha_response, |
350 | - $_SERVER[ 'REMOTE_ADDR' ] |
|
349 | + $_SERVER['REMOTE_ADDR'] |
|
351 | 350 | ); |
352 | 351 | } |
353 | - if ( $recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess() ) { |
|
352 | + if ($recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess()) { |
|
354 | 353 | return TRUE; |
355 | 354 | } |
356 | 355 | // sorry... it appears you can't don't know what soup or hamburgers are !!! |
@@ -385,8 +384,8 @@ discard block |
||
385 | 384 | */ |
386 | 385 | protected static function _recaptcha_settings_form() { |
387 | 386 | |
388 | - EE_Registry::instance()->load_helper( 'HTML' ); |
|
389 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
387 | + EE_Registry::instance()->load_helper('HTML'); |
|
388 | + EE_Registry::instance()->load_helper('Template'); |
|
390 | 389 | |
391 | 390 | return new EE_Form_Section_Proper( |
392 | 391 | array( |
@@ -396,12 +395,12 @@ discard block |
||
396 | 395 | 'subsections' => apply_filters( |
397 | 396 | 'FHEE__EED_Recaptcha___recaptcha_settings_form__form_subsections', |
398 | 397 | array( |
399 | - 'main_settings_hdr' => new EE_Form_Section_HTML( EEH_HTML::h2( __( 'reCAPTCHA Anti-spam Settings', 'event_espresso' ) . EEH_Template::get_help_tab_link( 'recaptcha_info' ))), |
|
398 | + 'main_settings_hdr' => new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Anti-spam Settings', 'event_espresso').EEH_Template::get_help_tab_link('recaptcha_info'))), |
|
400 | 399 | 'main_settings' => EED_Recaptcha::_recaptcha_main_settings(), |
401 | - 'appearance_settings_hdr' => new EE_Form_Section_HTML( EEH_HTML::h2( __( 'reCAPTCHA Appearance', 'event_espresso' ) )), |
|
400 | + 'appearance_settings_hdr' => new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Appearance', 'event_espresso'))), |
|
402 | 401 | 'appearance_settings' => EED_Recaptcha::_recaptcha_appearance_settings(), |
403 | 402 | // 'recaptcha_example' => new EE_Form_Section_HTML( EED_Recaptcha::display_recaptcha() ), |
404 | - 'required_fields_note' => new EE_Form_Section_HTML( EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' )) |
|
403 | + 'required_fields_note' => new EE_Form_Section_HTML(EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text')) |
|
405 | 404 | ) |
406 | 405 | ) |
407 | 406 | ) |
@@ -428,28 +427,28 @@ discard block |
||
428 | 427 | array( |
429 | 428 | 'use_captcha' => new EE_Yes_No_Input( |
430 | 429 | array( |
431 | - 'html_label_text' => __( 'Use reCAPTCHA', 'event_espresso' ), |
|
430 | + 'html_label_text' => __('Use reCAPTCHA', 'event_espresso'), |
|
432 | 431 | 'html_help_text' => sprintf( |
433 | - __( 'reCAPTCHA is a free service that protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso' ), |
|
432 | + __('reCAPTCHA is a free service that protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso'), |
|
434 | 433 | '<a href="https://www.google.com/recaptcha/intro/index.html">', |
435 | 434 | '</a>' |
436 | 435 | ), |
437 | - 'default' => isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE, |
|
436 | + 'default' => isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE, |
|
438 | 437 | 'display_html_label_text' => FALSE |
439 | 438 | ) |
440 | 439 | ), |
441 | 440 | 'recaptcha_publickey' => new EE_Text_Input( |
442 | 441 | array( |
443 | - 'html_label_text' => __( 'Site Key', 'event_espresso' ), |
|
444 | - 'html_help_text' => __( 'The site key is used to display the widget on your site.', 'event_espresso' ), |
|
445 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : '' |
|
442 | + 'html_label_text' => __('Site Key', 'event_espresso'), |
|
443 | + 'html_help_text' => __('The site key is used to display the widget on your site.', 'event_espresso'), |
|
444 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : '' |
|
446 | 445 | ) |
447 | 446 | ), |
448 | 447 | 'recaptcha_privatekey' => new EE_Text_Input( |
449 | 448 | array( |
450 | - 'html_label_text' => __( 'Secret Key', 'event_espresso' ), |
|
451 | - 'html_help_text' => __( 'The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso' ), |
|
452 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : '' |
|
449 | + 'html_label_text' => __('Secret Key', 'event_espresso'), |
|
450 | + 'html_help_text' => __('The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso'), |
|
451 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : '' |
|
453 | 452 | ) |
454 | 453 | ) |
455 | 454 | ) |
@@ -481,81 +480,81 @@ discard block |
||
481 | 480 | array( |
482 | 481 | 'recaptcha_theme' => new EE_Radio_Button_Input( |
483 | 482 | array( |
484 | - 'light' => __( 'Light', 'event_espresso' ), |
|
485 | - 'dark' => __( 'Dark', 'event_espresso' ) |
|
483 | + 'light' => __('Light', 'event_espresso'), |
|
484 | + 'dark' => __('Dark', 'event_espresso') |
|
486 | 485 | ), |
487 | 486 | array( |
488 | - 'html_label_text' => __( 'Theme', 'event_espresso' ), |
|
489 | - 'html_help_text' => __( 'The color theme of the widget.', 'event_espresso' ), |
|
490 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light', |
|
487 | + 'html_label_text' => __('Theme', 'event_espresso'), |
|
488 | + 'html_help_text' => __('The color theme of the widget.', 'event_espresso'), |
|
489 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light', |
|
491 | 490 | 'display_html_label_text' => FALSE |
492 | 491 | ) |
493 | 492 | ), |
494 | 493 | 'recaptcha_type' => new EE_Radio_Button_Input( |
495 | 494 | array( |
496 | - 'image' => __( 'Image', 'event_espresso' ), |
|
497 | - 'audio' => __( 'Audio', 'event_espresso' ) |
|
495 | + 'image' => __('Image', 'event_espresso'), |
|
496 | + 'audio' => __('Audio', 'event_espresso') |
|
498 | 497 | ), |
499 | 498 | array( |
500 | - 'html_label_text' => __( 'Type', 'event_espresso' ), |
|
501 | - 'html_help_text' => __( 'The type of CAPTCHA to serve.', 'event_espresso' ), |
|
502 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_type ) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image', |
|
499 | + 'html_label_text' => __('Type', 'event_espresso'), |
|
500 | + 'html_help_text' => __('The type of CAPTCHA to serve.', 'event_espresso'), |
|
501 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_type) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image', |
|
503 | 502 | 'display_html_label_text' =>FALSE |
504 | 503 | ) |
505 | 504 | ), |
506 | 505 | 'recaptcha_language' => new EE_Select_Input( |
507 | 506 | array( |
508 | - 'ar' => __( 'Arabic', 'event_espresso' ), |
|
509 | - 'bg' => __( 'Bulgarian', 'event_espresso' ), |
|
510 | - 'ca' => __( 'Catalan', 'event_espresso' ), |
|
511 | - 'zh-CN' => __( 'Chinese (Simplified)', 'event_espresso' ), |
|
512 | - 'zh-TW' => __( 'Chinese (Traditional) ', 'event_espresso' ), |
|
513 | - 'hr' => __( 'Croatian', 'event_espresso' ), |
|
514 | - 'cs' => __( 'Czech', 'event_espresso' ), |
|
515 | - 'da' => __( 'Danish', 'event_espresso' ), |
|
516 | - 'nl' => __( 'Dutch', 'event_espresso' ), |
|
517 | - 'en-GB' => __( 'English (UK)', 'event_espresso' ), |
|
518 | - 'en' => __( 'English (US)', 'event_espresso' ), |
|
519 | - 'fil' => __( 'Filipino', 'event_espresso' ), |
|
520 | - 'fi' => __( 'Finnish', 'event_espresso' ), |
|
521 | - 'fr' => __( 'French', 'event_espresso' ), |
|
522 | - 'fr-CA' => __( 'French (Canadian)', 'event_espresso' ), |
|
523 | - 'de' => __( 'German', 'event_espresso' ), |
|
524 | - 'de-AT' => __( 'German (Austria)', 'event_espresso' ), |
|
525 | - 'de-CH' => __( 'German (Switzerland)', 'event_espresso' ), |
|
526 | - 'el' => __( 'Greek', 'event_espresso' ), |
|
527 | - 'iw' => __( 'Hebrew', 'event_espresso' ), |
|
528 | - 'hi' => __( 'Hindi', 'event_espresso' ), |
|
529 | - 'hu' => __( 'Hungarian', 'event_espresso' ), |
|
530 | - 'id' => __( 'Indonesian', 'event_espresso' ), |
|
531 | - 'it' => __( 'Italian', 'event_espresso' ), |
|
532 | - 'ja' => __( 'Japanese', 'event_espresso' ), |
|
533 | - 'ko' => __( 'Korean', 'event_espresso' ), |
|
534 | - 'lv' => __( 'Latvian', 'event_espresso' ), |
|
535 | - 'lt' => __( 'Lithuanian', 'event_espresso' ), |
|
536 | - 'no' => __( 'Norwegian', 'event_espresso' ), |
|
537 | - 'fa' => __( 'Persian', 'event_espresso' ), |
|
538 | - 'pl' => __( 'Polish', 'event_espresso' ), |
|
539 | - 'pt' => __( 'Portuguese', 'event_espresso' ), |
|
540 | - 'pt-BR' => __( 'Portuguese (Brazil)', 'event_espresso' ), |
|
541 | - 'pt-PT' => __( 'Portuguese (Portugal)', 'event_espresso' ), |
|
542 | - 'ro' => __( 'Romanian', 'event_espresso' ), |
|
543 | - 'ru' => __( 'Russian', 'event_espresso' ), |
|
544 | - 'sr' => __( 'Serbian', 'event_espresso' ), |
|
545 | - 'sk' => __( 'Slovak', 'event_espresso' ), |
|
546 | - 'sl' => __( 'Slovenian', 'event_espresso' ), |
|
547 | - 'es' => __( 'Spanish', 'event_espresso' ), |
|
548 | - 'es-419' => __( 'Spanish (Latin America)', 'event_espresso' ), |
|
549 | - 'sv' => __( 'Swedish', 'event_espresso' ), |
|
550 | - 'th' => __( 'Thai', 'event_espresso' ), |
|
551 | - 'tr' => __( 'Turkish', 'event_espresso' ), |
|
552 | - 'uk' => __( 'Ukrainian', 'event_espresso' ), |
|
553 | - 'vi' => __( 'Vietnamese', 'event_espresso') |
|
507 | + 'ar' => __('Arabic', 'event_espresso'), |
|
508 | + 'bg' => __('Bulgarian', 'event_espresso'), |
|
509 | + 'ca' => __('Catalan', 'event_espresso'), |
|
510 | + 'zh-CN' => __('Chinese (Simplified)', 'event_espresso'), |
|
511 | + 'zh-TW' => __('Chinese (Traditional) ', 'event_espresso'), |
|
512 | + 'hr' => __('Croatian', 'event_espresso'), |
|
513 | + 'cs' => __('Czech', 'event_espresso'), |
|
514 | + 'da' => __('Danish', 'event_espresso'), |
|
515 | + 'nl' => __('Dutch', 'event_espresso'), |
|
516 | + 'en-GB' => __('English (UK)', 'event_espresso'), |
|
517 | + 'en' => __('English (US)', 'event_espresso'), |
|
518 | + 'fil' => __('Filipino', 'event_espresso'), |
|
519 | + 'fi' => __('Finnish', 'event_espresso'), |
|
520 | + 'fr' => __('French', 'event_espresso'), |
|
521 | + 'fr-CA' => __('French (Canadian)', 'event_espresso'), |
|
522 | + 'de' => __('German', 'event_espresso'), |
|
523 | + 'de-AT' => __('German (Austria)', 'event_espresso'), |
|
524 | + 'de-CH' => __('German (Switzerland)', 'event_espresso'), |
|
525 | + 'el' => __('Greek', 'event_espresso'), |
|
526 | + 'iw' => __('Hebrew', 'event_espresso'), |
|
527 | + 'hi' => __('Hindi', 'event_espresso'), |
|
528 | + 'hu' => __('Hungarian', 'event_espresso'), |
|
529 | + 'id' => __('Indonesian', 'event_espresso'), |
|
530 | + 'it' => __('Italian', 'event_espresso'), |
|
531 | + 'ja' => __('Japanese', 'event_espresso'), |
|
532 | + 'ko' => __('Korean', 'event_espresso'), |
|
533 | + 'lv' => __('Latvian', 'event_espresso'), |
|
534 | + 'lt' => __('Lithuanian', 'event_espresso'), |
|
535 | + 'no' => __('Norwegian', 'event_espresso'), |
|
536 | + 'fa' => __('Persian', 'event_espresso'), |
|
537 | + 'pl' => __('Polish', 'event_espresso'), |
|
538 | + 'pt' => __('Portuguese', 'event_espresso'), |
|
539 | + 'pt-BR' => __('Portuguese (Brazil)', 'event_espresso'), |
|
540 | + 'pt-PT' => __('Portuguese (Portugal)', 'event_espresso'), |
|
541 | + 'ro' => __('Romanian', 'event_espresso'), |
|
542 | + 'ru' => __('Russian', 'event_espresso'), |
|
543 | + 'sr' => __('Serbian', 'event_espresso'), |
|
544 | + 'sk' => __('Slovak', 'event_espresso'), |
|
545 | + 'sl' => __('Slovenian', 'event_espresso'), |
|
546 | + 'es' => __('Spanish', 'event_espresso'), |
|
547 | + 'es-419' => __('Spanish (Latin America)', 'event_espresso'), |
|
548 | + 'sv' => __('Swedish', 'event_espresso'), |
|
549 | + 'th' => __('Thai', 'event_espresso'), |
|
550 | + 'tr' => __('Turkish', 'event_espresso'), |
|
551 | + 'uk' => __('Ukrainian', 'event_espresso'), |
|
552 | + 'vi' => __('Vietnamese', 'event_espresso') |
|
554 | 553 | ), |
555 | 554 | array( |
556 | - 'html_label_text' => __( 'Language', 'event_espresso' ), |
|
557 | - 'html_help_text' => __( 'Forces the widget to render in a specific language.', 'event_espresso' ), |
|
558 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en' |
|
555 | + 'html_label_text' => __('Language', 'event_espresso'), |
|
556 | + 'html_help_text' => __('Forces the widget to render in a specific language.', 'event_espresso'), |
|
557 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en' |
|
559 | 558 | ) |
560 | 559 | ) |
561 | 560 | ) |
@@ -603,25 +602,25 @@ discard block |
||
603 | 602 | * @param EE_Registration_Config $EE_Registration_Config |
604 | 603 | * @return array |
605 | 604 | */ |
606 | - public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) { |
|
605 | + public static function update_admin_settings(EE_Registration_Config $EE_Registration_Config) { |
|
607 | 606 | try { |
608 | 607 | $recaptcha_settings_form = EED_Recaptcha::_recaptcha_settings_form(); |
609 | 608 | // if not displaying a form, then check for form submission |
610 | - if ( $recaptcha_settings_form->was_submitted() ) { |
|
609 | + if ($recaptcha_settings_form->was_submitted()) { |
|
611 | 610 | // capture form data |
612 | 611 | $recaptcha_settings_form->receive_form_submission(); |
613 | 612 | // validate form data |
614 | - if ( $recaptcha_settings_form->is_valid() ) { |
|
613 | + if ($recaptcha_settings_form->is_valid()) { |
|
615 | 614 | // grab validated data from form |
616 | 615 | $valid_data = $recaptcha_settings_form->valid_data(); |
617 | 616 | // user proofing recaptcha: If Use reCAPTCHA is set to yes but we dont' have site or secret keys then set Use reCAPTCHA to FALSE and give error message. |
618 | 617 | if ( |
619 | - apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config ) |
|
618 | + apply_filters('FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config) |
|
620 | 619 | && $valid_data['main_settings']['use_captcha'] |
621 | - && ( ! $EE_Registration_Config->use_captcha && ( empty( $valid_data['main_settings']['recaptcha_publickey'] ) || empty( $valid_data['main_settings']['recaptcha_privatekey'] ))) |
|
620 | + && ( ! $EE_Registration_Config->use_captcha && (empty($valid_data['main_settings']['recaptcha_publickey']) || empty($valid_data['main_settings']['recaptcha_privatekey']))) |
|
622 | 621 | ) { |
623 | 622 | $valid_data['main_settings']['use_captcha'] = FALSE; |
624 | - EE_Error::add_error( __('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
623 | + EE_Error::add_error(__('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
625 | 624 | } |
626 | 625 | $EE_Registration_Config->use_captcha = $valid_data['main_settings']['use_captcha']; |
627 | 626 | $EE_Registration_Config->recaptcha_publickey = $valid_data['main_settings']['recaptcha_publickey']; |
@@ -630,12 +629,12 @@ discard block |
||
630 | 629 | $EE_Registration_Config->recaptcha_theme = $valid_data['appearance_settings']['recaptcha_theme']; |
631 | 630 | $EE_Registration_Config->recaptcha_language = $valid_data['appearance_settings']['recaptcha_language']; |
632 | 631 | } else { |
633 | - if ( $recaptcha_settings_form->submission_error_message() != '' ) { |
|
634 | - EE_Error::add_error( $recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
632 | + if ($recaptcha_settings_form->submission_error_message() != '') { |
|
633 | + EE_Error::add_error($recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
635 | 634 | } |
636 | 635 | } |
637 | 636 | } |
638 | - } catch( EE_Error $e ) { |
|
637 | + } catch (EE_Error $e) { |
|
639 | 638 | $e->get_error(); |
640 | 639 | } |
641 | 640 |