@@ -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; |
@@ -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; |
@@ -145,8 +145,8 @@ discard block |
||
| 145 | 145 | $settings = $this->default_options(); |
| 146 | 146 | |
| 147 | 147 | foreach ( $settings as $setting => $default ) { |
| 148 | - if ( isset( $params[ 'frm_' . $setting ] ) ) { |
|
| 149 | - $this->{$setting} = $params[ 'frm_' . $setting ]; |
|
| 148 | + if ( isset( $params['frm_' . $setting] ) ) { |
|
| 149 | + $this->{$setting} = $params['frm_' . $setting]; |
|
| 150 | 150 | } elseif ( ! isset( $this->{$setting} ) ) { |
| 151 | 151 | $this->{$setting} = $default; |
| 152 | 152 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | $checkboxes = array( 'mu_menu', 're_multi', 'use_html', 'jquery_css', 'accordion_js', 'fade_form', 'old_css', 'no_ips', 'tracking', 'admin_bar' ); |
| 253 | 253 | foreach ( $checkboxes as $set ) { |
| 254 | - $this->$set = isset( $params[ 'frm_' . $set ] ) ? $params[ 'frm_' . $set ] : 0; |
|
| 254 | + $this->$set = isset( $params['frm_' . $set] ) ? $params['frm_' . $set] : 0; |
|
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $frm_roles = FrmAppHelper::frm_capabilities(); |
| 262 | 262 | $roles = get_editable_roles(); |
| 263 | 263 | foreach ( $frm_roles as $frm_role => $frm_role_description ) { |
| 264 | - $this->$frm_role = (array) ( isset( $params[ $frm_role ] ) ? $params[ $frm_role ] : 'administrator' ); |
|
| 264 | + $this->$frm_role = (array) ( isset( $params[$frm_role] ) ? $params[$frm_role] : 'administrator' ); |
|
| 265 | 265 | |
| 266 | 266 | // Make sure administrators always have permissions |
| 267 | 267 | if ( ! in_array( 'administrator', $this->$frm_role ) ) { |
@@ -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,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 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | return $errors; |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | - if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values[ 'frm_submit_entry_' . $values['form_id'] ] ) || ! wp_verify_nonce( $values[ 'frm_submit_entry_' . $values['form_id'] ], 'frm_submit_entry_nonce' ) ) ) { |
|
| 14 | + if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values['frm_submit_entry_' . $values['form_id']] ) || ! wp_verify_nonce( $values['frm_submit_entry_' . $values['form_id']], 'frm_submit_entry_nonce' ) ) ) { |
|
| 15 | 15 | $errors['form'] = __( 'You do not have permission to do that', 'formidable' ); |
| 16 | 16 | } |
| 17 | 17 | |
@@ -65,10 +65,10 @@ discard block |
||
| 65 | 65 | 'key_pointer' => '', // the pointer in the posted array |
| 66 | 66 | 'exclude' => array(), // exclude these field types from validation |
| 67 | 67 | ); |
| 68 | - $args = wp_parse_args( $args, $defaults ); |
|
| 68 | + $args = wp_parse_args( $args, $defaults ); |
|
| 69 | 69 | |
| 70 | 70 | if ( empty( $args['parent_field_id'] ) ) { |
| 71 | - $value = isset( $values['item_meta'][ $args['id'] ] ) ? $values['item_meta'][ $args['id'] ] : ''; |
|
| 71 | + $value = isset( $values['item_meta'][$args['id']] ) ? $values['item_meta'][$args['id']] : ''; |
|
| 72 | 72 | } else { |
| 73 | 73 | // value is from a nested form |
| 74 | 74 | $value = $values; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
| 92 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
| 92 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
| 93 | 93 | } elseif ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) { // WPCS: CSRF ok. |
| 94 | 94 | $_POST['item_name'] = $value; |
| 95 | 95 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | $pattern = self::phone_format( $field ); |
| 143 | 143 | |
| 144 | 144 | if ( ! preg_match( $pattern, $value ) ) { |
| 145 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
| 145 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | |
| 379 | 379 | // Send any potentially useful $_SERVER vars, but avoid sending junk we don't need. |
| 380 | 380 | if ( $include_value ) { |
| 381 | - $datas[ $key ] = $value; |
|
| 381 | + $datas[$key] = $value; |
|
| 382 | 382 | } |
| 383 | 383 | unset( $key, $value ); |
| 384 | 384 | } |
@@ -90,7 +90,8 @@ |
||
| 90 | 90 | |
| 91 | 91 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
| 92 | 92 | $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
| 93 | - } elseif ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) { // WPCS: CSRF ok. |
|
| 93 | + } elseif ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) { |
|
| 94 | +// WPCS: CSRF ok. |
|
| 94 | 95 | $_POST['item_name'] = $value; |
| 95 | 96 | } |
| 96 | 97 | |
@@ -44,6 +44,9 @@ discard block |
||
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | + /** |
|
| 48 | + * @param boolean $exclude |
|
| 49 | + */ |
|
| 47 | 50 | private static function get_fields_to_validate( $values, $exclude ) { |
| 48 | 51 | $where = apply_filters( 'frm_posted_field_ids', array( 'fi.form_id' => $values['form_id'] ) ); |
| 49 | 52 | |
@@ -293,6 +296,9 @@ discard block |
||
| 293 | 296 | * For WP 5.5 compatibility. |
| 294 | 297 | * |
| 295 | 298 | * @since 4.06.02 |
| 299 | + * @param string $content |
|
| 300 | + * @param string $ip |
|
| 301 | + * @param string $user_agent |
|
| 296 | 302 | */ |
| 297 | 303 | private static function check_disallowed_words( $author, $email, $url, $content, $ip, $user_agent ) { |
| 298 | 304 | if ( function_exists( 'wp_check_comment_disallowed_list' ) ) { |
@@ -306,6 +312,7 @@ discard block |
||
| 306 | 312 | * For WP 5.5 compatibility. |
| 307 | 313 | * |
| 308 | 314 | * @since 4.06.02 |
| 315 | + * @return string |
|
| 309 | 316 | */ |
| 310 | 317 | private static function get_disallowed_words() { |
| 311 | 318 | $keys = get_option( 'disallowed_keys' ); |
@@ -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 | } |
@@ -6,6 +6,6 @@ |
||
| 6 | 6 | $type = $field['type']; |
| 7 | 7 | do_action( 'frm_after_checkbox', compact( 'field', 'field_name', 'type' ) ); |
| 8 | 8 | } else { |
| 9 | - $read_only = $field['read_only']; |
|
| 9 | + $read_only = $field['read_only']; |
|
| 10 | 10 | include( dirname( __FILE__ ) . '/' . $field['type'] . '-field.php' ); |
| 11 | 11 | } |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | if ( isset( $values['fields'] ) && ! empty( $values['fields'] ) ) { |
| 23 | 23 | $values['count'] = 0; |
| 24 | 24 | foreach ( $values['fields'] as $field ) { |
| 25 | - $values['count']++; |
|
| 25 | + $values['count'] ++; |
|
| 26 | 26 | FrmFieldsController::load_single_field( $field, $values ); |
| 27 | 27 | unset( $field ); |
| 28 | 28 | } |