@@ -36,7 +36,7 @@ |
||
| 36 | 36 | public function validate( $args ) { |
| 37 | 37 | $errors = array(); |
| 38 | 38 | if ( $args['value'] != '' && ! is_email( $args['value'] ) ) { |
| 39 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 39 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | return $errors; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | 'sep' => ', ', |
| 40 | 40 | 'html' => false, |
| 41 | 41 | ); |
| 42 | - $atts = wp_parse_args( $atts, $defaults ); |
|
| 42 | + $atts = wp_parse_args( $atts, $defaults ); |
|
| 43 | 43 | |
| 44 | 44 | if ( $atts['html'] ) { |
| 45 | 45 | $atts['sep'] = ' '; |
@@ -61,9 +61,9 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | // validate the url format |
| 63 | 63 | if ( ! empty( $value ) && ! preg_match( '/^http(s)?:\/\/(?:localhost|(?:[\da-z\.-]+\.[\da-z\.-]+))/i', $value ) ) { |
| 64 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 64 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 65 | 65 | } elseif ( $this->field->required == '1' && empty( $value ) ) { |
| 66 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'blank' ); |
|
| 66 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'blank' ); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | return $errors; |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | $checked = FrmAppHelper::get_param( 'recaptcha_checked', '', 'post', 'sanitize_text_field' ); |
| 150 | 150 | if ( ! isset( $_POST['recaptcha_checked'] ) || ! wp_verify_nonce( $checked, 'frm_ajax' ) ) { |
| 151 | 151 | // There was no captcha submitted. |
| 152 | - $errors[ 'field' . $args['id'] ] = __( 'The captcha is missing from this form', 'formidable' ); |
|
| 152 | + $errors['field' . $args['id']] = __( 'The captcha is missing from this form', 'formidable' ); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | return $errors; |
@@ -163,11 +163,11 @@ discard block |
||
| 163 | 163 | if ( isset( $response['success'] ) && ! $response['success'] ) { |
| 164 | 164 | // What happens when the CAPTCHA was entered incorrectly |
| 165 | 165 | $invalid_message = FrmField::get_option( $this->field, 'invalid' ); |
| 166 | - $errors[ 'field' . $args['id'] ] = ( $invalid_message == '' ? $frm_settings->re_msg : $invalid_message ); |
|
| 166 | + $errors['field' . $args['id']] = ( $invalid_message == '' ? $frm_settings->re_msg : $invalid_message ); |
|
| 167 | 167 | } elseif ( is_wp_error( $resp ) ) { |
| 168 | 168 | $error_string = $resp->get_error_message(); |
| 169 | - $errors[ 'field' . $args['id'] ] = __( 'There was a problem verifying your recaptcha', 'formidable' ); |
|
| 170 | - $errors[ 'field' . $args['id'] ] .= ' ' . $error_string; |
|
| 169 | + $errors['field' . $args['id']] = __( 'There was a problem verifying your recaptcha', 'formidable' ); |
|
| 170 | + $errors['field' . $args['id']] .= ' ' . $error_string; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | return $errors; |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | foreach ( $settings as $setting => $default ) { |
| 152 | - if ( isset( $params[ 'frm_' . $setting ] ) ) { |
|
| 153 | - $this->{$setting} = $params[ 'frm_' . $setting ]; |
|
| 152 | + if ( isset( $params['frm_' . $setting] ) ) { |
|
| 153 | + $this->{$setting} = $params['frm_' . $setting]; |
|
| 154 | 154 | } elseif ( ! isset( $this->{$setting} ) ) { |
| 155 | 155 | $this->{$setting} = $default; |
| 156 | 156 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | $checkboxes = array( 'mu_menu', 're_multi', 'use_html', 'jquery_css', 'accordion_js', 'fade_form', 'old_css', 'no_ips', 'tracking' ); |
| 257 | 257 | foreach ( $checkboxes as $set ) { |
| 258 | - $this->$set = isset( $params[ 'frm_' . $set ] ) ? $params[ 'frm_' . $set ] : 0; |
|
| 258 | + $this->$set = isset( $params['frm_' . $set] ) ? $params['frm_' . $set] : 0; |
|
| 259 | 259 | } |
| 260 | 260 | } |
| 261 | 261 | |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | $frm_roles = FrmAppHelper::frm_capabilities(); |
| 266 | 266 | $roles = get_editable_roles(); |
| 267 | 267 | foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
| 268 | - $this->$frm_role = (array) ( isset( $params[ $frm_role ] ) ? $params[ $frm_role ] : 'administrator' ); |
|
| 268 | + $this->$frm_role = (array) ( isset( $params[$frm_role] ) ? $params[$frm_role] : 'administrator' ); |
|
| 269 | 269 | |
| 270 | 270 | // Make sure administrators always have permissions |
| 271 | 271 | if ( ! in_array( 'administrator', $this->$frm_role ) ) { |
@@ -56,7 +56,8 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | private function translate_settings( $settings ) { |
| 59 | - if ( $settings ) { //workaround for W3 total cache conflict |
|
| 59 | + if ( $settings ) { |
|
| 60 | +//workaround for W3 total cache conflict |
|
| 60 | 61 | return unserialize( serialize( $settings ) ); |
| 61 | 62 | } |
| 62 | 63 | |
@@ -68,7 +69,8 @@ discard block |
||
| 68 | 69 | } |
| 69 | 70 | |
| 70 | 71 | // If unserializing didn't work |
| 71 | - if ( $settings ) { //workaround for W3 total cache conflict |
|
| 72 | + if ( $settings ) { |
|
| 73 | +//workaround for W3 total cache conflict |
|
| 72 | 74 | $settings = unserialize( serialize( $settings ) ); |
| 73 | 75 | } else { |
| 74 | 76 | $settings = $this; |
@@ -146,7 +146,7 @@ |
||
| 146 | 146 | |
| 147 | 147 | $next_dir = ''; |
| 148 | 148 | foreach ( $dir_names as $dir ) { |
| 149 | - $next_dir .= '/' . $dir; |
|
| 149 | + $next_dir .= '/' . $dir; |
|
| 150 | 150 | $needed_dirs[] = $this->uploads['basedir'] . $next_dir; |
| 151 | 151 | } |
| 152 | 152 | |
@@ -71,12 +71,12 @@ |
||
| 71 | 71 | $show_intervals = array( 50, 200, 500 ); |
| 72 | 72 | $asked = $this->review_status['asked']; |
| 73 | 73 | |
| 74 | - if ( ! isset( $show_intervals[ $asked ] ) ) { |
|
| 74 | + if ( ! isset( $show_intervals[$asked] ) ) { |
|
| 75 | 75 | return; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | $entries = FrmEntry::getRecordCount(); |
| 79 | - $count = $show_intervals[ $asked ]; |
|
| 79 | + $count = $show_intervals[$asked]; |
|
| 80 | 80 | $user = wp_get_current_user(); |
| 81 | 81 | |
| 82 | 82 | // Only show review request if the site has collected enough entries |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * @param array $atts |
| 72 | 72 | */ |
| 73 | 73 | private function init_style_settings( $atts ) { |
| 74 | - $style_settings = array( |
|
| 74 | + $style_settings = array( |
|
| 75 | 75 | 'border_color' => 'dddddd', |
| 76 | 76 | 'bg_color' => 'f7f7f7', |
| 77 | 77 | 'text_color' => '444444', |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | $this->style_settings = apply_filters( 'frm_show_entry_styles', $style_settings ); |
| 83 | 83 | |
| 84 | 84 | foreach ( $this->style_settings as $key => $setting ) { |
| 85 | - if ( isset( $atts[ $key ] ) && $atts[ $key ] !== '' ) { |
|
| 86 | - $this->style_settings[ $key ] = $atts[ $key ]; |
|
| 85 | + if ( isset( $atts[$key] ) && $atts[$key] !== '' ) { |
|
| 86 | + $this->style_settings[$key] = $atts[$key]; |
|
| 87 | 87 | } |
| 88 | 88 | |
| 89 | 89 | if ( $this->is_color_setting( $key ) ) { |
| 90 | - $this->style_settings[ $key ] = $this->get_color_markup( $this->style_settings[ $key ] ); |
|
| 90 | + $this->style_settings[$key] = $this->get_color_markup( $this->style_settings[$key] ); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
@@ -41,8 +41,8 @@ discard block |
||
| 41 | 41 | * @param array $atts |
| 42 | 42 | */ |
| 43 | 43 | private function _set( $param, $atts ) { |
| 44 | - if ( isset( $atts[ $param ] ) ) { |
|
| 45 | - $this->{$param} = $atts[ $param ]; |
|
| 44 | + if ( isset( $atts[$param] ) ) { |
|
| 45 | + $this->{$param} = $atts[$param]; |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | $exclude = array( 'field_obj', 'html' ); |
| 88 | 88 | foreach ( $exclude as $ex ) { |
| 89 | - if ( isset( $atts[ $ex ] ) ) { |
|
| 90 | - unset( $this->pass_args[ $ex ] ); |
|
| 89 | + if ( isset( $atts[$ex] ) ) { |
|
| 90 | + unset( $this->pass_args[$ex] ); |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | } |
@@ -99,8 +99,8 @@ discard block |
||
| 99 | 99 | * @param array $set |
| 100 | 100 | */ |
| 101 | 101 | private function set_from_field( $atts, $set ) { |
| 102 | - if ( isset( $atts[ $set['param'] ] ) ) { |
|
| 103 | - $this->{$set['param']} = $atts[ $set['param'] ]; |
|
| 102 | + if ( isset( $atts[$set['param']] ) ) { |
|
| 103 | + $this->{$set['param']} = $atts[$set['param']]; |
|
| 104 | 104 | } else { |
| 105 | 105 | $this->{$set['param']} = $this->field_obj->get_field_column( $set['default'] ); |
| 106 | 106 | } |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | private function replace_error_shortcode() { |
| 227 | 227 | $this->maybe_add_error_id(); |
| 228 | - $error = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? $this->pass_args['errors'][ 'field' . $this->field_id ] : false; |
|
| 228 | + $error = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? $this->pass_args['errors']['field' . $this->field_id] : false; |
|
| 229 | 229 | FrmShortcodeHelper::remove_inline_conditions( ! empty( $error ), 'error', $error, $this->html ); |
| 230 | 230 | } |
| 231 | 231 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @since 3.06.02 |
| 237 | 237 | */ |
| 238 | 238 | private function maybe_add_error_id() { |
| 239 | - if ( ! isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) { |
|
| 239 | + if ( ! isset( $this->pass_args['errors']['field' . $this->field_id] ) ) { |
|
| 240 | 240 | return; |
| 241 | 241 | } |
| 242 | 242 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $this->html, $shortcodes, PREG_PATTERN_ORDER ); |
| 317 | 317 | |
| 318 | 318 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
| 319 | - $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
| 319 | + $shortcode_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
| 320 | 320 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
| 321 | 321 | |
| 322 | 322 | $replace_with = ''; |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | $replace_with = $this->replace_input_shortcode( $shortcode_atts ); |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - $this->html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $this->html ); |
|
| 330 | + $this->html = str_replace( $shortcodes[0][$short_key], $replace_with, $this->html ); |
|
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | unset( $shortcode_atts['class'] ); |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - if ( isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ) { |
|
| 362 | + if ( isset( $this->pass_args['errors']['field' . $this->field_id] ) ) { |
|
| 363 | 363 | $shortcode_atts['aria-invalid'] = 'true'; |
| 364 | 364 | } |
| 365 | 365 | |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | */ |
| 417 | 417 | private function get_field_div_classes() { |
| 418 | 418 | // Add error class |
| 419 | - $classes = isset( $this->pass_args['errors'][ 'field' . $this->field_id ] ) ? ' frm_blank_field' : ''; |
|
| 419 | + $classes = isset( $this->pass_args['errors']['field' . $this->field_id] ) ? ' frm_blank_field' : ''; |
|
| 420 | 420 | |
| 421 | 421 | // Add label position class |
| 422 | 422 | $settings = $this->field_obj->display_field_settings(); |
@@ -59,8 +59,8 @@ |
||
| 59 | 59 | protected function init_saved_value( $entry ) { |
| 60 | 60 | if ( $this->field->type === 'html' ) { |
| 61 | 61 | $this->saved_value = $this->field->description; |
| 62 | - } elseif ( isset( $entry->metas[ $this->field->id ] ) ) { |
|
| 63 | - $this->saved_value = $entry->metas[ $this->field->id ]; |
|
| 62 | + } elseif ( isset( $entry->metas[$this->field->id] ) ) { |
|
| 63 | + $this->saved_value = $entry->metas[$this->field->id]; |
|
| 64 | 64 | } else { |
| 65 | 65 | $this->saved_value = ''; |
| 66 | 66 | } |