PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.14
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.14
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/controllers/FrmSettingsController.php +52 -32 6.46.14 View file →
@@ -20,9 +20,9 @@
20 20 public static function license_box() {
21 21 if ( ! current_user_can( 'activate_plugins' ) ) {
22 22 return;
23 23 }
24 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' );
24 + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php';
25 25 }
26 26
27 27 public static function display_form( $errors = array(), $message = '' ) {
28 28 global $frm_vars;
@@ -34,9 +34,9 @@
34 34
35 35 $sections = self::get_settings_tabs();
36 36 $current = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' );
37 37
38 - require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' );
38 + require FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php';
39 39 }
40 40
41 41 /**
42 42 * Get sections to use for Global Settings.
@@ -44,27 +44,27 @@
44 44 * @return array<array>
45 45 */
46 46 private static function get_settings_tabs() {
47 47 $sections = array(
48 - 'general' => array(
48 + 'general' => array(
49 49 'class' => __CLASS__,
50 50 'function' => 'general_settings',
51 51 'name' => __( 'General Settings', 'formidable' ),
52 52 'icon' => 'frm_icon_font frm_settings_icon',
53 53 ),
54 - 'messages' => array(
54 + 'messages' => array(
55 55 'class' => __CLASS__,
56 56 'function' => 'message_settings',
57 57 'name' => __( 'Message Defaults', 'formidable' ),
58 58 'icon' => 'frm_icon_font frm_stamp_icon',
59 59 ),
60 - 'permissions' => array(
60 + 'permissions' => array(
61 61 'class' => __CLASS__,
62 62 'function' => 'permission_settings',
63 63 'name' => __( 'Permissions', 'formidable' ),
64 64 'icon' => 'frm_icon_font frm_lock_icon',
65 65 ),
66 - 'custom_css' => array(
66 + 'custom_css' => array(
67 67 'class' => 'FrmStylesController',
68 68 'function' => 'custom_css',
69 69 'name' => __( 'Custom CSS', 'formidable' ),
70 70 'icon' => 'frm_icon_font frm_code_icon',
@@ -74,15 +74,15 @@
74 74 'function' => 'manage',
75 75 'name' => __( 'Manage Styles', 'formidable' ),
76 76 'icon' => 'frm_icon_font frm_pallet_icon',
77 77 ),
78 - 'captcha' => array(
78 + 'captcha' => array(
79 79 'class' => __CLASS__,
80 80 'function' => 'captcha_settings',
81 81 'name' => __( 'Captcha', 'formidable' ),
82 82 'icon' => 'frm_icon_font frm_shield_check_icon',
83 83 ),
84 - 'white_label' => array(
84 + 'white_label' => array(
85 85 'name' => __( 'White Labeling', 'formidable' ),
86 86 'icon' => 'frm_icon_font frm_ghost_icon',
87 87 'html_class' => 'frm_show_upgrade_tab frm_noallow',
88 88 'data' => array(
@@ -90,9 +90,9 @@
90 90 'upgrade' => __( 'White labeling options', 'formidable' ),
91 91 'screenshot' => 'white-label.png',
92 92 ),
93 93 ),
94 - 'inbox' => array(
94 + 'inbox' => array(
95 95 'name' => __( 'Inbox', 'formidable' ),
96 96 'icon' => 'frm_icon_font frm_email_icon',
97 97 'html_class' => 'frm_show_upgrade_tab frm_noallow',
98 98 'data' => array(
@@ -118,13 +118,13 @@
118 118 $sections['licenses'] = array(
119 119 'class' => 'FrmAddonsController',
120 120 'function' => 'license_settings',
121 121 'name' => __( 'Plugin Licenses', 'formidable' ),
122 - 'icon' => 'frm_icon_font frm_keyalt_icon',
122 + 'icon' => 'frmfont frm_key_icon',
123 123 'ajax' => true,
124 124 );
125 125 }
126 - }
126 + }//end if
127 127
128 128 /**
129 129 * @param array<array> $sections
130 130 */
@@ -158,9 +158,9 @@
158 158 $section['function'] = $original;
159 159 }
160 160
161 161 $sections[ $key ] = $section;
162 - }
162 + }//end foreach
163 163
164 164 return $sections;
165 165 }
166 166
@@ -184,17 +184,38 @@
184 184 wp_die();
185 185 }
186 186
187 187 /**
188 + * Render the general global settings section.
189 + *
188 190 * @since 4.0
191 + *
192 + * @return void
189 193 */
190 194 public static function general_settings() {
191 195 $frm_settings = FrmAppHelper::get_settings();
196 + $uploads = wp_upload_dir();
197 + $target_path = $uploads['basedir'] . '/formidable/css';
192 198
193 - $uploads = wp_upload_dir();
194 - $target_path = $uploads['basedir'] . '/formidable/css';
199 + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/general.php';
200 + }
195 201
196 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/general.php' );
202 + /**
203 + * Render the global currency selector if Pro is up to date.
204 + *
205 + * @param FrmSettings $frm_settings
206 + * @param string $more_html
207 + * @return void
208 + */
209 + public static function maybe_render_currency_selector( $frm_settings, $more_html ) {
210 + if ( false !== strpos( $more_html, 'id="frm_currency"' ) ) {
211 + // Avoid rendering the Currency setting if it gets rendered from the frm_settings_form hook.
212 + // This is for backward compatibility. If Pro is outdated there won't be two currency dropdowns.
213 + return;
214 + }
215 +
216 + $currencies = FrmCurrencyHelper::get_currencies();
217 + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/_currency.php';
197 218 }
198 219
199 220 /**
200 221 * @since 4.0
@@ -201,9 +222,9 @@
201 222 */
202 223 public static function message_settings() {
203 224 $frm_settings = FrmAppHelper::get_settings();
204 225
205 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/messages.php' );
226 + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/messages.php';
206 227 }
207 228
208 229 /**
209 230 * @since 4.0
@@ -211,9 +232,9 @@
211 232 public static function captcha_settings() {
212 233 $frm_settings = FrmAppHelper::get_settings();
213 234 $captcha_lang = FrmAppHelper::locales( 'captcha' );
214 235
215 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/captcha/captcha.php' );
236 + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/captcha/captcha.php';
216 237 }
217 238
218 239 /**
219 240 * @since 4.0
@@ -221,9 +242,9 @@
221 242 public static function permission_settings() {
222 243 $frm_settings = FrmAppHelper::get_settings();
223 244 $frm_roles = FrmAppHelper::frm_capabilities();
224 245
225 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/permissions.php' );
246 + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/permissions.php';
226 247 }
227 248
228 249 /**
229 250 * @since 4.0
@@ -230,15 +251,15 @@
230 251 */
231 252 public static function misc_settings() {
232 253 $frm_settings = FrmAppHelper::get_settings();
233 254
234 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/misc.php' );
255 + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/misc.php';
235 256 }
236 257
237 258 /**
238 259 * Save form data submitted from the Global settings page.
239 260 *
240 - * @param string|bool $stop_load
261 + * @param bool|string $stop_load
241 262 *
242 263 * @return void
243 264 */
244 265 public static function process_form( $stop_load = false ) {
@@ -247,9 +268,15 @@
247 268 $frm_settings = FrmAppHelper::get_settings();
248 269 $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' );
249 270
250 271 if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) {
251 - wp_die( esc_html( $frm_settings->admin_permission ) );
272 + $error_args = array(
273 + 'title' => __( 'Verification failed', 'formidable' ),
274 + 'body' => $frm_settings->admin_permission,
275 + 'cancel_text' => __( 'Cancel', 'formidable' ),
276 + );
277 + FrmAppController::show_error_modal( $error_args );
278 + return;
252 279 }
253 280
254 281 $errors = array();
255 282 $message = '';
@@ -289,9 +316,9 @@
289 316 $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action';
290 317 $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' );
291 318 FrmAppHelper::include_svg();
292 319
293 - if ( $action == 'process-form' ) {
320 + if ( $action === 'process-form' ) {
294 321 self::process_form( $stop_load );
295 322 } elseif ( $stop_load != 'stop_load' ) {
296 323 self::display_form();
297 324 }
@@ -325,9 +352,9 @@
325 352 __( 'Save draft entries and return later', 'formidable' ),
326 353 __( 'Analyze form data with graphs & stats', 'formidable' ),
327 354 );
328 355
329 - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/settings_cta.php' );
356 + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/settings_cta.php';
330 357 }
331 358
332 359 /**
333 360 * Dismiss upgrade notice at the bottom on the plugin settings pages.
@@ -334,8 +361,9 @@
334 361 *
335 362 * @since 3.04.02
336 363 */
337 364 public static function settings_cta_dismiss() {
365 + check_ajax_referer( 'frm_ajax', 'nonce' );
338 366 FrmAppHelper::permission_check( 'frm_change_settings' );
339 367
340 368 update_option( 'frm_lite_settings_upgrade', time(), 'no' );
341 369
@@ -352,9 +380,9 @@
352 380 check_ajax_referer( 'frm_ajax', 'nonce' );
353 381
354 382 global $wpdb;
355 383
356 - $term = FrmAppHelper::get_param( 'term', '', 'get', 'sanitize_text_field' );
384 + $term = FrmAppHelper::get_param( 'term', '', 'get', 'sanitize_text_field' );
357 385 $post_type = FrmAppHelper::get_param( 'post_type', 'page', 'get', 'sanitize_text_field' );
358 386
359 387 $where = array(
360 388 'post_status' => 'publish',
@@ -377,14 +405,6 @@
377 405 );
378 406 }
379 407
380 408 wp_send_json( $results );
381 - }
382 -
383 - /**
384 - * @deprecated 6.0 use FrmSettingsController::captcha_settings().
385 - */
386 - public static function recaptcha_settings() {
387 - _deprecated_function( __FUNCTION__, '6.0', 'FrmSettingsController::captcha_settings()' );
388 - self::captcha_settings();
389 409 }
390 410 }