| @@ -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 | - 'name' => __( 'Captcha', 'formidable' ), | |
| 81 | + 'name' => __( 'Captcha/Spam', '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,37 @@ | ||
| 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 ( is_callable( 'FrmProSettingsController::add_currency_settings' ) ) { | |
| 211 | + FrmProSettingsController::add_currency_settings(); | |
| 212 | + return; | |
| 213 | + } | |
| 214 | + | |
| 215 | + $currencies = FrmCurrencyHelper::get_currencies(); | |
| 216 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/_currency.php'; | |
| 197 | 217 | } |
| 198 | 218 | |
| 199 | 219 | /** |
| 200 | 220 | * @since 4.0 |
| @@ -201,9 +221,9 @@ | ||
| 201 | 221 | */ |
| 202 | 222 | public static function message_settings() { |
| 203 | 223 | $frm_settings = FrmAppHelper::get_settings(); |
| 204 | 224 | |
| 205 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/messages.php' ); | |
| 225 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/messages.php'; | |
| 206 | 226 | } |
| 207 | 227 | |
| 208 | 228 | /** |
| 209 | 229 | * @since 4.0 |
| @@ -211,9 +231,9 @@ | ||
| 211 | 231 | public static function captcha_settings() { |
| 212 | 232 | $frm_settings = FrmAppHelper::get_settings(); |
| 213 | 233 | $captcha_lang = FrmAppHelper::locales( 'captcha' ); |
| 214 | 234 | |
| 215 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/captcha/captcha.php' ); | |
| 235 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/captcha/captcha.php'; | |
| 216 | 236 | } |
| 217 | 237 | |
| 218 | 238 | /** |
| 219 | 239 | * @since 4.0 |
| @@ -221,9 +241,9 @@ | ||
| 221 | 241 | public static function permission_settings() { |
| 222 | 242 | $frm_settings = FrmAppHelper::get_settings(); |
| 223 | 243 | $frm_roles = FrmAppHelper::frm_capabilities(); |
| 224 | 244 | |
| 225 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/permissions.php' ); | |
| 245 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/permissions.php'; | |
| 226 | 246 | } |
| 227 | 247 | |
| 228 | 248 | /** |
| 229 | 249 | * @since 4.0 |
| @@ -230,15 +250,15 @@ | ||
| 230 | 250 | */ |
| 231 | 251 | public static function misc_settings() { |
| 232 | 252 | $frm_settings = FrmAppHelper::get_settings(); |
| 233 | 253 | |
| 234 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/misc.php' ); | |
| 254 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/misc.php'; | |
| 235 | 255 | } |
| 236 | 256 | |
| 237 | 257 | /** |
| 238 | 258 | * Save form data submitted from the Global settings page. |
| 239 | 259 | * |
| 240 | - * @param string|bool $stop_load | |
| 260 | + * @param bool|string $stop_load | |
| 241 | 261 | * |
| 242 | 262 | * @return void |
| 243 | 263 | */ |
| 244 | 264 | public static function process_form( $stop_load = false ) { |
| @@ -247,9 +267,15 @@ | ||
| 247 | 267 | $frm_settings = FrmAppHelper::get_settings(); |
| 248 | 268 | $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' ); |
| 249 | 269 | |
| 250 | 270 | if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) { |
| 251 | - wp_die( esc_html( $frm_settings->admin_permission ) ); | |
| 271 | + $error_args = array( | |
| 272 | + 'title' => __( 'Verification failed', 'formidable' ), | |
| 273 | + 'body' => $frm_settings->admin_permission, | |
| 274 | + 'cancel_text' => __( 'Cancel', 'formidable' ), | |
| 275 | + ); | |
| 276 | + FrmAppController::show_error_modal( $error_args ); | |
| 277 | + return; | |
| 252 | 278 | } |
| 253 | 279 | |
| 254 | 280 | $errors = array(); |
| 255 | 281 | $message = ''; |
| @@ -289,9 +315,9 @@ | ||
| 289 | 315 | $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
| 290 | 316 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
| 291 | 317 | FrmAppHelper::include_svg(); |
| 292 | 318 | |
| 293 | - if ( $action == 'process-form' ) { | |
| 319 | + if ( $action === 'process-form' ) { | |
| 294 | 320 | self::process_form( $stop_load ); |
| 295 | 321 | } elseif ( $stop_load != 'stop_load' ) { |
| 296 | 322 | self::display_form(); |
| 297 | 323 | } |
| @@ -302,32 +328,13 @@ | ||
| 302 | 328 | * |
| 303 | 329 | * @since 3.04.02 |
| 304 | 330 | */ |
| 305 | 331 | public static function settings_cta( $view ) { |
| 306 | - | |
| 307 | 332 | if ( get_option( 'frm_lite_settings_upgrade', false ) ) { |
| 308 | 333 | return; |
| 309 | 334 | } |
| 310 | 335 | |
| 311 | - $features = array( | |
| 312 | - __( 'Extra form features like file uploads, pagination, etc', 'formidable' ), | |
| 313 | - __( 'Repeaters & cascading fields for advanced forms', 'formidable' ), | |
| 314 | - __( 'Flexibly view, search, edit, and delete entries anywhere', 'formidable' ), | |
| 315 | - __( 'Display entries with virtually limitless Formidable views', 'formidable' ), | |
| 316 | - __( 'Create surveys & polls', 'formidable' ), | |
| 317 | - __( 'WordPress user registration and login forms', 'formidable' ), | |
| 318 | - __( 'Create Stripe, PayPal or Authorize.net payment forms', 'formidable' ), | |
| 319 | - __( 'Powerful conditional logic for smart forms', 'formidable' ), | |
| 320 | - __( 'Integrations with 1000+ marketing & payment services', 'formidable' ), | |
| 321 | - __( 'Collect digital signatures', 'formidable' ), | |
| 322 | - __( 'Accept user-submitted content with Post submissions', 'formidable' ), | |
| 323 | - __( 'Email routing', 'formidable' ), | |
| 324 | - __( 'Create calculator forms', 'formidable' ), | |
| 325 | - __( 'Save draft entries and return later', 'formidable' ), | |
| 326 | - __( 'Analyze form data with graphs & stats', 'formidable' ), | |
| 327 | - ); | |
| 328 | - | |
| 329 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/settings_cta.php' ); | |
| 336 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/settings_cta.php'; | |
| 330 | 337 | } |
| 331 | 338 | |
| 332 | 339 | /** |
| 333 | 340 | * Dismiss upgrade notice at the bottom on the plugin settings pages. |
| @@ -334,8 +341,9 @@ | ||
| 334 | 341 | * |
| 335 | 342 | * @since 3.04.02 |
| 336 | 343 | */ |
| 337 | 344 | public static function settings_cta_dismiss() { |
| 345 | + check_ajax_referer( 'frm_ajax', 'nonce' ); | |
| 338 | 346 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 339 | 347 | |
| 340 | 348 | update_option( 'frm_lite_settings_upgrade', time(), 'no' ); |
| 341 | 349 | |
| @@ -352,9 +360,9 @@ | ||
| 352 | 360 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 353 | 361 | |
| 354 | 362 | global $wpdb; |
| 355 | 363 | |
| 356 | - $term = FrmAppHelper::get_param( 'term', '', 'get', 'sanitize_text_field' ); | |
| 364 | + $term = FrmAppHelper::get_param( 'term', '', 'get', 'sanitize_text_field' ); | |
| 357 | 365 | $post_type = FrmAppHelper::get_param( 'post_type', 'page', 'get', 'sanitize_text_field' ); |
| 358 | 366 | |
| 359 | 367 | $where = array( |
| 360 | 368 | 'post_status' => 'publish', |
| @@ -377,14 +385,6 @@ | ||
| 377 | 385 | ); |
| 378 | 386 | } |
| 379 | 387 | |
| 380 | 388 | 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 | 389 | } |
| 390 | 390 | } |