| @@ -4,32 +4,59 @@ | ||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | class FrmSettingsController { |
| 7 | 7 | |
| 8 | + /** | |
| 9 | + * Payments sections are removed from the top level and added to a payments section. | |
| 10 | + * | |
| 11 | + * @since 6.22.1 | |
| 12 | + * | |
| 13 | + * @var array | |
| 14 | + */ | |
| 15 | + private static $removed_payments_sections = array(); | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * @return void | |
| 19 | + */ | |
| 8 | 20 | public static function menu() { |
| 9 | 21 | // Make sure admins can see the menu items |
| 10 | 22 | FrmAppHelper::force_capability( 'frm_change_settings' ); |
| 11 | 23 | |
| 12 | - add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' ); | |
| 24 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Global Settings', 'formidable' ), __( 'Global Settings', 'formidable' ), 'frm_change_settings', 'formidable-settings', 'FrmSettingsController::route' ); // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong | |
| 13 | 25 | } |
| 14 | 26 | |
| 27 | + /** | |
| 28 | + * Include license box template on demand. | |
| 29 | + * | |
| 30 | + * @return void | |
| 31 | + */ | |
| 15 | 32 | public static function license_box() { |
| 16 | - $a = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); | |
| 17 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php' ); | |
| 33 | + if ( ! current_user_can( 'activate_plugins' ) ) { | |
| 34 | + return; | |
| 35 | + } | |
| 36 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/license_box.php'; | |
| 18 | 37 | } |
| 19 | 38 | |
| 39 | + /** | |
| 40 | + * @param array $errors | |
| 41 | + * @param string $message | |
| 42 | + * | |
| 43 | + * @return void | |
| 44 | + */ | |
| 20 | 45 | public static function display_form( $errors = array(), $message = '' ) { |
| 21 | 46 | global $frm_vars; |
| 22 | 47 | |
| 23 | 48 | $frm_settings = FrmAppHelper::get_settings(); |
| 49 | + $uploads = wp_upload_dir(); | |
| 50 | + $target_path = $uploads['basedir'] . '/formidable/css'; | |
| 51 | + $sections = self::get_settings_tabs(); | |
| 52 | + $current = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); | |
| 24 | 53 | |
| 25 | - $uploads = wp_upload_dir(); | |
| 26 | - $target_path = $uploads['basedir'] . '/formidable/css'; | |
| 54 | + if ( in_array( $current, array( 'stripe_settings', 'square_settings', 'authorize_net_settings', 'paypal_settings' ), true ) ) { | |
| 55 | + $current = 'payments_settings'; | |
| 56 | + } | |
| 27 | 57 | |
| 28 | - $sections = self::get_settings_tabs(); | |
| 29 | - $current = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); | |
| 30 | - | |
| 31 | - require( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php' ); | |
| 58 | + require FrmAppHelper::plugin_path() . '/classes/views/frm-settings/form.php'; | |
| 32 | 59 | } |
| 33 | 60 | |
| 34 | 61 | /** |
| 35 | 62 | * Get sections to use for Global Settings. |
| @@ -37,62 +64,76 @@ | ||
| 37 | 64 | * @return array<array> |
| 38 | 65 | */ |
| 39 | 66 | private static function get_settings_tabs() { |
| 40 | 67 | $sections = array( |
| 41 | - 'general' => array( | |
| 42 | - 'class' => __CLASS__, | |
| 68 | + 'general' => array( | |
| 69 | + 'class' => self::class, | |
| 43 | 70 | 'function' => 'general_settings', |
| 44 | 71 | 'name' => __( 'General Settings', 'formidable' ), |
| 45 | - 'icon' => 'frm_icon_font frm_settings_icon', | |
| 72 | + 'icon' => 'frmfont frm_settings_icon', | |
| 46 | 73 | ), |
| 47 | - 'messages' => array( | |
| 48 | - 'class' => __CLASS__, | |
| 74 | + 'messages' => array( | |
| 75 | + 'class' => self::class, | |
| 49 | 76 | 'function' => 'message_settings', |
| 50 | 77 | 'name' => __( 'Message Defaults', 'formidable' ), |
| 51 | - 'icon' => 'frm_icon_font frm_stamp_icon', | |
| 78 | + 'icon' => 'frmfont frm_stamp_icon', | |
| 52 | 79 | ), |
| 53 | - 'permissions' => array( | |
| 54 | - 'class' => __CLASS__, | |
| 80 | + 'permissions' => array( | |
| 81 | + 'class' => self::class, | |
| 55 | 82 | 'function' => 'permission_settings', |
| 56 | 83 | 'name' => __( 'Permissions', 'formidable' ), |
| 57 | - 'icon' => 'frm_icon_font frm_lock_icon', | |
| 84 | + 'icon' => 'frmfont frm_lock_icon', | |
| 58 | 85 | ), |
| 59 | - 'custom_css' => array( | |
| 86 | + 'payments' => array( | |
| 87 | + 'name' => __( 'Payments', 'formidable' ), | |
| 88 | + 'icon' => 'frmfont frm_simple_cc_icon', | |
| 89 | + 'class' => self::class, | |
| 90 | + 'function' => 'payments_settings', | |
| 91 | + ), | |
| 92 | + 'custom_css' => array( | |
| 60 | 93 | 'class' => 'FrmStylesController', |
| 61 | 94 | 'function' => 'custom_css', |
| 62 | 95 | 'name' => __( 'Custom CSS', 'formidable' ), |
| 63 | - 'icon' => 'frm_icon_font frm_code_icon', | |
| 96 | + 'icon' => 'frmfont frm_code_icon', | |
| 64 | 97 | ), |
| 65 | 98 | 'manage_styles' => array( |
| 66 | 99 | 'class' => 'FrmStylesController', |
| 67 | 100 | 'function' => 'manage', |
| 68 | 101 | 'name' => __( 'Manage Styles', 'formidable' ), |
| 69 | - 'icon' => 'frm_icon_font frm_pallet_icon', | |
| 102 | + 'icon' => 'frmfont frm_pallet_icon', | |
| 70 | 103 | ), |
| 71 | - 'captcha' => array( | |
| 72 | - 'class' => __CLASS__, | |
| 104 | + 'captcha' => array( | |
| 105 | + 'class' => self::class, | |
| 73 | 106 | 'function' => 'captcha_settings', |
| 74 | - 'name' => __( 'Captcha', 'formidable' ), | |
| 75 | - 'icon' => 'frm_icon_font frm_shield_check_icon', | |
| 107 | + 'name' => __( 'Captcha/Spam', 'formidable' ), | |
| 108 | + 'icon' => 'frmfont frm_shield_check_icon', | |
| 76 | 109 | ), |
| 77 | - 'white_label' => array( | |
| 110 | + 'email' => array( | |
| 111 | + 'class' => self::class, | |
| 112 | + 'function' => 'email_settings', | |
| 113 | + 'name' => __( 'Email', 'formidable' ), | |
| 114 | + 'icon' => 'frmfont frm_email_icon', | |
| 115 | + ), | |
| 116 | + 'white_label' => array( | |
| 78 | 117 | 'name' => __( 'White Labeling', 'formidable' ), |
| 79 | - 'icon' => 'frm_icon_font frm_ghost_icon', | |
| 118 | + 'icon' => 'frmfont frm_ghost_icon', | |
| 80 | 119 | 'html_class' => 'frm_show_upgrade_tab frm_noallow', |
| 81 | 120 | 'data' => array( |
| 82 | 121 | 'medium' => 'white-label', |
| 83 | 122 | 'upgrade' => __( 'White labeling options', 'formidable' ), |
| 84 | 123 | 'screenshot' => 'white-label.png', |
| 124 | + 'learn-more' => FrmAppHelper::get_doc_url( 'features/white-label-form-builder-wordpress', 'white-labeling-global-settings', false ), | |
| 85 | 125 | ), |
| 86 | 126 | ), |
| 87 | - 'inbox' => array( | |
| 127 | + 'inbox' => array( | |
| 88 | 128 | 'name' => __( 'Inbox', 'formidable' ), |
| 89 | - 'icon' => 'frm_icon_font frm_email_icon', | |
| 129 | + 'icon' => 'frmfont frm_email_icon', | |
| 90 | 130 | 'html_class' => 'frm_show_upgrade_tab frm_noallow', |
| 91 | 131 | 'data' => array( |
| 92 | 132 | 'medium' => 'inbox-settings', |
| 93 | 133 | 'upgrade' => __( 'Inbox settings', 'formidable' ), |
| 94 | 134 | 'screenshot' => 'inbox.png', |
| 135 | + 'learn-more' => FrmAppHelper::get_doc_url( 'global-settings-overview/#kb-inbox', 'inbox-global-settings' ), | |
| 95 | 136 | ), |
| 96 | 137 | ), |
| 97 | 138 | ); |
| 98 | 139 | |
| @@ -99,10 +140,11 @@ | ||
| 99 | 140 | if ( apply_filters( 'frm_include_addon_page', false ) ) { |
| 100 | 141 | // If no addons need a license, skip this page |
| 101 | 142 | $show_licenses = false; |
| 102 | 143 | $installed_addons = apply_filters( 'frm_installed_addons', array() ); |
| 144 | + | |
| 103 | 145 | foreach ( $installed_addons as $installed_addon ) { |
| 104 | - if ( ! $installed_addon->is_parent_licence && $installed_addon->plugin_name != 'Formidable Pro' && $installed_addon->needs_license ) { | |
| 146 | + if ( ! $installed_addon->is_parent_licence && $installed_addon->plugin_name !== 'Formidable Pro' && $installed_addon->needs_license ) { | |
| 105 | 147 | $show_licenses = true; |
| 106 | 148 | break; |
| 107 | 149 | } |
| 108 | 150 | } |
| @@ -111,23 +153,24 @@ | ||
| 111 | 153 | $sections['licenses'] = array( |
| 112 | 154 | 'class' => 'FrmAddonsController', |
| 113 | 155 | 'function' => 'license_settings', |
| 114 | 156 | 'name' => __( 'Plugin Licenses', 'formidable' ), |
| 115 | - 'icon' => 'frm_icon_font frm_keyalt_icon', | |
| 157 | + 'icon' => 'frmfont frm_key_icon', | |
| 116 | 158 | 'ajax' => true, |
| 117 | 159 | ); |
| 118 | 160 | } |
| 119 | - } | |
| 161 | + }//end if | |
| 120 | 162 | |
| 121 | 163 | /** |
| 122 | 164 | * @param array<array> $sections |
| 123 | 165 | */ |
| 124 | 166 | $sections = apply_filters( 'frm_add_settings_section', $sections ); |
| 167 | + self::remove_payments_sections( $sections ); | |
| 125 | 168 | |
| 126 | 169 | $sections['misc'] = array( |
| 127 | 170 | 'name' => __( 'Miscellaneous', 'formidable' ), |
| 128 | - 'icon' => 'frm_icon_font frm_shuffle_icon', | |
| 129 | - 'class' => __CLASS__, | |
| 171 | + 'icon' => 'frmfont frm_shuffle_icon', | |
| 172 | + 'class' => self::class, | |
| 130 | 173 | 'function' => 'misc_settings', |
| 131 | 174 | ); |
| 132 | 175 | |
| 133 | 176 | foreach ( $sections as $key => $section ) { |
| @@ -134,9 +177,9 @@ | ||
| 134 | 177 | $original = $section; |
| 135 | 178 | $defaults = array( |
| 136 | 179 | 'html_class' => '', |
| 137 | 180 | 'name' => ucfirst( $key ), |
| 138 | - 'icon' => 'frm_icon_font frm_settings_icon', | |
| 181 | + 'icon' => 'frmfont frm_settings_icon', | |
| 139 | 182 | 'anchor' => $key . '_settings', |
| 140 | 183 | 'data' => array(), |
| 141 | 184 | ); |
| 142 | 185 | |
| @@ -151,13 +194,60 @@ | ||
| 151 | 194 | $section['function'] = $original; |
| 152 | 195 | } |
| 153 | 196 | |
| 154 | 197 | $sections[ $key ] = $section; |
| 198 | + }//end foreach | |
| 199 | + | |
| 200 | + return $sections; | |
| 201 | + } | |
| 202 | + | |
| 203 | + /** | |
| 204 | + * Remove the payments sections (PayPal, Square, Stripe, Authorize.Net) | |
| 205 | + * and show them all on the payments section in separate tabs. | |
| 206 | + * | |
| 207 | + * @since 6.22.1 | |
| 208 | + * | |
| 209 | + * @param array $sections | |
| 210 | + * | |
| 211 | + * @return void | |
| 212 | + */ | |
| 213 | + private static function remove_payments_sections( &$sections ) { | |
| 214 | + $payment_section_keys = array( 'paypal', 'square', 'stripe', 'authorize_net' ); | |
| 215 | + | |
| 216 | + foreach ( $sections as $key => $section ) { | |
| 217 | + if ( ! in_array( $key, $payment_section_keys, true ) ) { | |
| 218 | + continue; | |
| 219 | + } | |
| 220 | + | |
| 221 | + self::$removed_payments_sections[ $key ] = $section; | |
| 222 | + unset( $sections[ $key ] ); | |
| 155 | 223 | } |
| 156 | 224 | |
| 157 | - return $sections; | |
| 225 | + uksort( self::$removed_payments_sections, array( self::class, 'payment_sections_sort_callback' ) ); | |
| 158 | 226 | } |
| 159 | 227 | |
| 228 | + /** | |
| 229 | + * Sort the payments sections (PayPal, Square, Stripe, Authorize.Net) | |
| 230 | + * | |
| 231 | + * @since 6.22.1 | |
| 232 | + * | |
| 233 | + * @param string $a | |
| 234 | + * @param string $b | |
| 235 | + * | |
| 236 | + * @return int | |
| 237 | + */ | |
| 238 | + private static function payment_sections_sort_callback( $a, $b ) { | |
| 239 | + $order = array( 'stripe', 'square', 'paypal', 'authorize_net' ); | |
| 240 | + $first_key = array_search( $a, $order, true ); | |
| 241 | + $second_key = array_search( $b, $order, true ); | |
| 242 | + | |
| 243 | + if ( false === $first_key || false === $second_key ) { | |
| 244 | + return 0; | |
| 245 | + } | |
| 246 | + | |
| 247 | + return $first_key - $second_key; | |
| 248 | + } | |
| 249 | + | |
| 160 | 250 | public static function load_settings_tab() { |
| 161 | 251 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 162 | 252 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 163 | 253 | |
| @@ -162,8 +252,9 @@ | ||
| 162 | 252 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 163 | 253 | |
| 164 | 254 | $section = FrmAppHelper::get_post_param( 'tab', '', 'sanitize_text_field' ); |
| 165 | 255 | $sections = self::get_settings_tabs(); |
| 256 | + | |
| 166 | 257 | if ( ! isset( $sections[ $section ] ) ) { |
| 167 | 258 | wp_die(); |
| 168 | 259 | } |
| 169 | 260 | |
| @@ -171,67 +262,122 @@ | ||
| 171 | 262 | |
| 172 | 263 | if ( isset( $section['class'] ) ) { |
| 173 | 264 | call_user_func( array( $section['class'], $section['function'] ) ); |
| 174 | 265 | } else { |
| 175 | - call_user_func( ( isset( $section['function'] ) ? $section['function'] : $section ) ); | |
| 266 | + call_user_func( $section['function'] ?? $section ); | |
| 176 | 267 | } |
| 268 | + | |
| 177 | 269 | wp_die(); |
| 178 | 270 | } |
| 179 | 271 | |
| 180 | 272 | /** |
| 273 | + * Render the general global settings section. | |
| 274 | + * | |
| 181 | 275 | * @since 4.0 |
| 276 | + * | |
| 277 | + * @return void | |
| 182 | 278 | */ |
| 183 | 279 | public static function general_settings() { |
| 184 | 280 | $frm_settings = FrmAppHelper::get_settings(); |
| 281 | + $uploads = wp_upload_dir(); | |
| 282 | + $target_path = $uploads['basedir'] . '/formidable/css'; | |
| 185 | 283 | |
| 186 | - $uploads = wp_upload_dir(); | |
| 187 | - $target_path = $uploads['basedir'] . '/formidable/css'; | |
| 284 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/general.php'; | |
| 285 | + } | |
| 188 | 286 | |
| 189 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/general.php' ); | |
| 287 | + /** | |
| 288 | + * Render the global currency selector if Pro is up to date. | |
| 289 | + * | |
| 290 | + * @param FrmSettings $frm_settings | |
| 291 | + * | |
| 292 | + * @return void | |
| 293 | + */ | |
| 294 | + public static function maybe_render_currency_selector( $frm_settings ) { | |
| 295 | + if ( is_callable( 'FrmProSettingsController::add_currency_settings' ) ) { | |
| 296 | + FrmProSettingsController::add_currency_settings(); | |
| 297 | + return; | |
| 298 | + } | |
| 299 | + | |
| 300 | + $currencies = FrmCurrencyHelper::get_currencies(); | |
| 301 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/_currency.php'; | |
| 190 | 302 | } |
| 191 | 303 | |
| 192 | 304 | /** |
| 193 | 305 | * @since 4.0 |
| 306 | + * | |
| 307 | + * @return void | |
| 194 | 308 | */ |
| 195 | 309 | public static function message_settings() { |
| 196 | 310 | $frm_settings = FrmAppHelper::get_settings(); |
| 197 | - | |
| 198 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/messages.php' ); | |
| 311 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/messages.php'; | |
| 199 | 312 | } |
| 200 | 313 | |
| 201 | 314 | /** |
| 202 | 315 | * @since 4.0 |
| 316 | + * | |
| 317 | + * @return void | |
| 203 | 318 | */ |
| 204 | 319 | public static function captcha_settings() { |
| 205 | 320 | $frm_settings = FrmAppHelper::get_settings(); |
| 206 | 321 | $captcha_lang = FrmAppHelper::locales( 'captcha' ); |
| 207 | 322 | |
| 208 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/captcha/captcha.php' ); | |
| 323 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/captcha/captcha.php'; | |
| 209 | 324 | } |
| 210 | 325 | |
| 211 | 326 | /** |
| 327 | + * Shows email settings. | |
| 328 | + * | |
| 329 | + * @since 6.25 | |
| 330 | + * | |
| 331 | + * @return void | |
| 332 | + */ | |
| 333 | + public static function email_settings() { | |
| 334 | + $frm_settings = FrmAppHelper::get_settings(); | |
| 335 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/email/email-styles.php'; | |
| 336 | + } | |
| 337 | + | |
| 338 | + /** | |
| 212 | 339 | * @since 4.0 |
| 340 | + * | |
| 341 | + * @return void | |
| 213 | 342 | */ |
| 214 | 343 | public static function permission_settings() { |
| 215 | 344 | $frm_settings = FrmAppHelper::get_settings(); |
| 216 | 345 | $frm_roles = FrmAppHelper::frm_capabilities(); |
| 217 | 346 | |
| 218 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/permissions.php' ); | |
| 347 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/permissions.php'; | |
| 219 | 348 | } |
| 220 | 349 | |
| 221 | 350 | /** |
| 351 | + * @return void | |
| 352 | + */ | |
| 353 | + public static function payments_settings() { | |
| 354 | + $payment_sections = self::$removed_payments_sections; | |
| 355 | + $tab = FrmAppHelper::simple_get( 't', 'sanitize_title', 'general_settings' ); | |
| 356 | + | |
| 357 | + if ( $tab && in_array( $tab, array( 'stripe_settings', 'square_settings', 'authorize_net_settings', 'paypal_settings' ), true ) ) { | |
| 358 | + $tab = str_replace( '_settings', '', $tab ); | |
| 359 | + } else { | |
| 360 | + $tab = 'stripe'; | |
| 361 | + } | |
| 362 | + | |
| 363 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/payments.php'; | |
| 364 | + } | |
| 365 | + | |
| 366 | + /** | |
| 222 | 367 | * @since 4.0 |
| 368 | + * | |
| 369 | + * @return void | |
| 223 | 370 | */ |
| 224 | 371 | public static function misc_settings() { |
| 225 | 372 | $frm_settings = FrmAppHelper::get_settings(); |
| 226 | - | |
| 227 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/misc.php' ); | |
| 373 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/misc.php'; | |
| 228 | 374 | } |
| 229 | 375 | |
| 230 | 376 | /** |
| 231 | 377 | * Save form data submitted from the Global settings page. |
| 232 | 378 | * |
| 233 | - * @param string|bool $stop_load | |
| 379 | + * @param bool|string $stop_load | |
| 234 | 380 | * |
| 235 | 381 | * @return void |
| 236 | 382 | */ |
| 237 | 383 | public static function process_form( $stop_load = false ) { |
| @@ -240,9 +386,15 @@ | ||
| 240 | 386 | $frm_settings = FrmAppHelper::get_settings(); |
| 241 | 387 | $process_form = FrmAppHelper::get_post_param( 'process_form', '', 'sanitize_text_field' ); |
| 242 | 388 | |
| 243 | 389 | if ( ! wp_verify_nonce( $process_form, 'process_form_nonce' ) ) { |
| 244 | - wp_die( esc_html( $frm_settings->admin_permission ) ); | |
| 390 | + $error_args = array( | |
| 391 | + 'title' => __( 'Verification failed', 'formidable' ), | |
| 392 | + 'body' => $frm_settings->admin_permission, | |
| 393 | + 'cancel_text' => __( 'Cancel', 'formidable' ), | |
| 394 | + ); | |
| 395 | + FrmAppController::show_error_modal( $error_args ); | |
| 396 | + return; | |
| 245 | 397 | } |
| 246 | 398 | |
| 247 | 399 | $errors = array(); |
| 248 | 400 | $message = ''; |
| @@ -271,8 +423,10 @@ | ||
| 271 | 423 | /** |
| 272 | 424 | * Include the Update button on the global settings page. |
| 273 | 425 | * |
| 274 | 426 | * @since 4.0.02 |
| 427 | + * | |
| 428 | + * @return void | |
| 275 | 429 | */ |
| 276 | 430 | public static function save_button() { |
| 277 | 431 | echo '<input class="button-primary frm-button-primary" type="submit" |
| 278 | 432 | value="' . esc_attr__( 'Update', 'formidable' ) . '"/>'; |
| @@ -277,16 +431,21 @@ | ||
| 277 | 431 | echo '<input class="button-primary frm-button-primary" type="submit" |
| 278 | 432 | value="' . esc_attr__( 'Update', 'formidable' ) . '"/>'; |
| 279 | 433 | } |
| 280 | 434 | |
| 435 | + /** | |
| 436 | + * @param bool|string $stop_load | |
| 437 | + * | |
| 438 | + * @return void | |
| 439 | + */ | |
| 281 | 440 | public static function route( $stop_load = false ) { |
| 282 | 441 | $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
| 283 | 442 | $action = FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ); |
| 284 | 443 | FrmAppHelper::include_svg(); |
| 285 | 444 | |
| 286 | - if ( $action == 'process-form' ) { | |
| 445 | + if ( $action === 'process-form' ) { | |
| 287 | 446 | self::process_form( $stop_load ); |
| 288 | - } elseif ( $stop_load != 'stop_load' ) { | |
| 447 | + } elseif ( $stop_load !== 'stop_load' ) { | |
| 289 | 448 | self::display_form(); |
| 290 | 449 | } |
| 291 | 450 | } |
| 292 | 451 | |
| @@ -293,34 +452,17 @@ | ||
| 293 | 452 | /** |
| 294 | 453 | * Add CTA to the bottom on the plugin settings pages. |
| 295 | 454 | * |
| 296 | 455 | * @since 3.04.02 |
| 456 | + * | |
| 457 | + * @return void | |
| 297 | 458 | */ |
| 298 | - public static function settings_cta( $view ) { | |
| 299 | - | |
| 459 | + public static function settings_cta() { | |
| 300 | 460 | if ( get_option( 'frm_lite_settings_upgrade', false ) ) { |
| 301 | 461 | return; |
| 302 | 462 | } |
| 303 | 463 | |
| 304 | - $features = array( | |
| 305 | - __( 'Extra form features like file uploads, pagination, etc', 'formidable' ), | |
| 306 | - __( 'Repeaters & cascading fields for advanced forms', 'formidable' ), | |
| 307 | - __( 'Flexibly view, search, edit, and delete entries anywhere', 'formidable' ), | |
| 308 | - __( 'Display entries with virtually limitless Formidable views', 'formidable' ), | |
| 309 | - __( 'Create surveys & polls', 'formidable' ), | |
| 310 | - __( 'WordPress user registration and login forms', 'formidable' ), | |
| 311 | - __( 'Create Stripe, PayPal or Authorize.net payment forms', 'formidable' ), | |
| 312 | - __( 'Powerful conditional logic for smart forms', 'formidable' ), | |
| 313 | - __( 'Integrations with 1000+ marketing & payment services', 'formidable' ), | |
| 314 | - __( 'Collect digital signatures', 'formidable' ), | |
| 315 | - __( 'Accept user-submitted content with Post submissions', 'formidable' ), | |
| 316 | - __( 'Email routing', 'formidable' ), | |
| 317 | - __( 'Create calculator forms', 'formidable' ), | |
| 318 | - __( 'Save draft entries and return later', 'formidable' ), | |
| 319 | - __( 'Analyze form data with graphs & stats', 'formidable' ), | |
| 320 | - ); | |
| 321 | - | |
| 322 | - include( FrmAppHelper::plugin_path() . '/classes/views/frm-settings/settings_cta.php' ); | |
| 464 | + include FrmAppHelper::plugin_path() . '/classes/views/frm-settings/settings_cta.php'; | |
| 323 | 465 | } |
| 324 | 466 | |
| 325 | 467 | /** |
| 326 | 468 | * Dismiss upgrade notice at the bottom on the plugin settings pages. |
| @@ -327,11 +469,12 @@ | ||
| 327 | 469 | * |
| 328 | 470 | * @since 3.04.02 |
| 329 | 471 | */ |
| 330 | 472 | public static function settings_cta_dismiss() { |
| 473 | + check_ajax_referer( 'frm_ajax', 'nonce' ); | |
| 331 | 474 | FrmAppHelper::permission_check( 'frm_change_settings' ); |
| 332 | 475 | |
| 333 | - update_option( 'frm_lite_settings_upgrade', time(), 'no' ); | |
| 476 | + update_option( 'frm_lite_settings_upgrade', time(), false ); | |
| 334 | 477 | |
| 335 | 478 | wp_send_json_success(); |
| 336 | 479 | } |
| 337 | 480 | |
| @@ -345,9 +488,9 @@ | ||
| 345 | 488 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 346 | 489 | |
| 347 | 490 | global $wpdb; |
| 348 | 491 | |
| 349 | - $term = FrmAppHelper::get_param( 'term', '', 'get', 'sanitize_text_field' ); | |
| 492 | + $term = FrmAppHelper::get_param( 'term', '', 'get', 'sanitize_text_field' ); | |
| 350 | 493 | $post_type = FrmAppHelper::get_param( 'post_type', 'page', 'get', 'sanitize_text_field' ); |
| 351 | 494 | |
| 352 | 495 | $where = array( |
| 353 | 496 | 'post_status' => 'publish', |
| @@ -359,11 +502,11 @@ | ||
| 359 | 502 | 'limit' => 25, |
| 360 | 503 | 'order_by' => 'post_title', |
| 361 | 504 | ); |
| 362 | 505 | |
| 363 | - $pages = FrmDb::get_results( $wpdb->posts, $where, 'ID, post_title', $atts ); | |
| 506 | + $pages = FrmDb::get_results( $wpdb->posts, $where, 'ID, post_title', $atts ); | |
| 507 | + $results = array(); | |
| 364 | 508 | |
| 365 | - $results = array(); | |
| 366 | 509 | foreach ( $pages as $page ) { |
| 367 | 510 | $results[] = array( |
| 368 | 511 | 'value' => $page->ID, |
| 369 | 512 | 'label' => $page->post_title, |
| @@ -373,11 +516,22 @@ | ||
| 373 | 516 | wp_send_json( $results ); |
| 374 | 517 | } |
| 375 | 518 | |
| 376 | 519 | /** |
| 377 | - * @deprecated 6.0 use FrmSettingsController::captcha_settings(). | |
| 520 | + * Shows a fake color picker. | |
| 521 | + * | |
| 522 | + * @since 6.25 | |
| 523 | + * | |
| 524 | + * @param string $color Color value. | |
| 525 | + * | |
| 526 | + * @return void | |
| 378 | 527 | */ |
| 379 | - public static function recaptcha_settings() { | |
| 380 | - _deprecated_function( __FUNCTION__, '6.0', 'FrmSettingsController::captcha_settings()' ); | |
| 381 | - self::captcha_settings(); | |
| 528 | + public static function fake_color_picker( $color ) { | |
| 529 | + ?> | |
| 530 | + <div class="wp-picker-container"> | |
| 531 | + <button type="button" class="button wp-color-result" aria-expanded="false" aria-disabled="true" tabindex="-1" style="background-color:<?php echo esc_attr( $color ); ?>;"><?php // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?> | |
| 532 | + <span class="wp-color-result-text" style="color:#a7aaad;"><?php esc_html_e( 'Select Color', 'formidable' ); ?></span> | |
| 533 | + </button> | |
| 534 | + </div> | |
| 535 | + <?php | |
| 382 | 536 | } |
| 383 | 537 | } |