@@ -80,7 +80,7 @@ |
||
| 80 | 80 | * |
| 81 | 81 | * @since 3.06 |
| 82 | 82 | * |
| 83 | - * @param object $xml The values included in the XML. |
|
| 83 | + * @param SimpleXMLElement $xml The values included in the XML. |
|
| 84 | 84 | */ |
| 85 | 85 | private static function set_new_form_name( &$xml ) { |
| 86 | 86 | if ( ! isset( $xml->form ) ) { |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | return; |
| 122 | 122 | } |
| 123 | 123 | |
| 124 | - $selected_xml = isset( $form['xml'] ) && isset( $form['xml'][ $selected_form ] ) ? $form['xml'][ $selected_form ] : ''; |
|
| 124 | + $selected_xml = isset( $form['xml'] ) && isset( $form['xml'][$selected_form] ) ? $form['xml'][$selected_form] : ''; |
|
| 125 | 125 | if ( empty( $selected_xml ) || strpos( $selected_xml, 'http' ) !== 0 ) { |
| 126 | 126 | return; |
| 127 | 127 | } |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | * @since 4.06.02 |
| 134 | 134 | */ |
| 135 | 135 | private static function get_selected_in_form( $form, $value = 'form' ) { |
| 136 | - if ( ! empty( $form ) && isset( $form[ $value ] ) && ! empty( $form[ $value ] ) ) { |
|
| 137 | - return $form[ $value ]; |
|
| 136 | + if ( ! empty( $form ) && isset( $form[$value] ) && ! empty( $form[$value] ) ) { |
|
| 137 | + return $form[$value]; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | return ''; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | if ( $for === 'view' ) { |
| 166 | - $item_key = is_array( $view_keys ) ? $view_keys[ $form_key ] : $view_keys; |
|
| 166 | + $item_key = is_array( $view_keys ) ? $view_keys[$form_key] : $view_keys; |
|
| 167 | 167 | $shortcode = '[display-frm-data id=%1$s filter=limited]'; |
| 168 | 168 | } elseif ( $for === 'form' ) { |
| 169 | 169 | $item_key = $form_key; |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | continue; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - $page_ids[ $for ] = wp_insert_post( |
|
| 181 | + $page_ids[$for] = wp_insert_post( |
|
| 182 | 182 | array( |
| 183 | 183 | 'post_title' => $name, |
| 184 | 184 | 'post_type' => 'page', |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash |
| 320 | 320 | $file_type = sanitize_option( 'upload_path', $_FILES['frm_import_file']['name'] ); |
| 321 | 321 | $file_type = strtolower( pathinfo( $file_type, PATHINFO_EXTENSION ) ); |
| 322 | - if ( 'xml' !== $file_type && isset( $export_format[ $file_type ] ) ) { |
|
| 322 | + if ( 'xml' !== $file_type && isset( $export_format[$file_type] ) ) { |
|
| 323 | 323 | // allow other file types to be imported |
| 324 | 324 | do_action( 'frm_before_import_' . $file_type ); |
| 325 | 325 | |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | foreach ( $type as $tb_type ) { |
| 403 | 403 | $where = array(); |
| 404 | 404 | $join = ''; |
| 405 | - $table = $tables[ $tb_type ]; |
|
| 405 | + $table = $tables[$tb_type]; |
|
| 406 | 406 | |
| 407 | 407 | $select = $table . '.id'; |
| 408 | 408 | $query_vars = array(); |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | $table . '.parent_form_id' => $args['ids'], |
| 418 | 418 | ); |
| 419 | 419 | } else { |
| 420 | - $where[ $table . '.status !' ] = 'draft'; |
|
| 420 | + $where[$table . '.status !'] = 'draft'; |
|
| 421 | 421 | } |
| 422 | 422 | break; |
| 423 | 423 | case 'actions': |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | case 'items': |
| 431 | 431 | // $join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; |
| 432 | 432 | if ( $args['ids'] ) { |
| 433 | - $where[ $table . '.form_id' ] = $args['ids']; |
|
| 433 | + $where[$table . '.form_id'] = $args['ids']; |
|
| 434 | 434 | } |
| 435 | 435 | break; |
| 436 | 436 | case 'styles': |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | } |
| 472 | 472 | } |
| 473 | 473 | |
| 474 | - $records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select ); |
|
| 474 | + $records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select ); |
|
| 475 | 475 | unset( $tb_type ); |
| 476 | 476 | } |
| 477 | 477 | |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | $no_export_fields = FrmField::no_save_fields(); |
| 617 | 617 | foreach ( $csv_fields as $k => $f ) { |
| 618 | 618 | if ( in_array( $f->type, $no_export_fields, true ) ) { |
| 619 | - unset( $csv_fields[ $k ] ); |
|
| 619 | + unset( $csv_fields[$k] ); |
|
| 620 | 620 | } |
| 621 | 621 | } |
| 622 | 622 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * |
| 110 | 110 | * @param string $type |
| 111 | 111 | * |
| 112 | - * @return array |
|
| 112 | + * @return string |
|
| 113 | 113 | */ |
| 114 | 114 | public static function get_default_field_options( $type ) { |
| 115 | 115 | $field_type = FrmFieldFactory::get_field_type( $type ); |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * |
| 213 | 213 | * @param object $field |
| 214 | 214 | * |
| 215 | - * @return array |
|
| 215 | + * @return stdClass |
|
| 216 | 216 | */ |
| 217 | 217 | private static function get_original_field( $field ) { |
| 218 | 218 | $original_type = FrmField::get_option( $field, 'original_type' ); |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | * |
| 241 | 241 | * @param string $type |
| 242 | 242 | * |
| 243 | - * @return array |
|
| 243 | + * @return string |
|
| 244 | 244 | */ |
| 245 | 245 | public static function get_default_field( $type ) { |
| 246 | 246 | $field_type = FrmFieldFactory::get_field_type( $type ); |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | * @since 2.0 |
| 266 | 266 | * |
| 267 | 267 | * @param $field |
| 268 | - * @param $error |
|
| 268 | + * @param string $error |
|
| 269 | 269 | * |
| 270 | 270 | * @return string |
| 271 | 271 | */ |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | if ( in_array( $type, array( 'data', 'lookup' ) ) ) { |
| 27 | 27 | $values['field_options']['data_type'] = $setting; |
| 28 | 28 | } else { |
| 29 | - $values['field_options'][ $setting ] = 1; |
|
| 29 | + $values['field_options'][$setting] = 1; |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | foreach ( $defaults as $opt => $default ) { |
| 136 | - $values[ $opt ] = isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default; |
|
| 136 | + $values[$opt] = isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default; |
|
| 137 | 137 | |
| 138 | 138 | if ( $check_post ) { |
| 139 | - self::get_posted_field_setting( $opt . '_' . $field->id, $values[ $opt ] ); |
|
| 139 | + self::get_posted_field_setting( $opt . '_' . $field->id, $values[$opt] ); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | unset( $opt, $default ); |
@@ -180,20 +180,20 @@ discard block |
||
| 180 | 180 | * @param mixed $value |
| 181 | 181 | */ |
| 182 | 182 | private static function get_posted_field_setting( $setting, &$value ) { |
| 183 | - if ( ! isset( $_POST['field_options'][ $setting ] ) ) { |
|
| 183 | + if ( ! isset( $_POST['field_options'][$setting] ) ) { |
|
| 184 | 184 | return; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | if ( strpos( $setting, 'html' ) !== false ) { |
| 188 | 188 | // Strip slashes from HTML but not regex or script tags. |
| 189 | 189 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 190 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); |
|
| 190 | + $value = wp_unslash( $_POST['field_options'][$setting] ); |
|
| 191 | 191 | } elseif ( strpos( $setting, 'format_' ) === 0 ) { |
| 192 | 192 | // TODO: Remove stripslashes on output, and use on input only. |
| 193 | - $value = sanitize_text_field( $_POST['field_options'][ $setting ] ); // WPCS: sanitization ok. |
|
| 193 | + $value = sanitize_text_field( $_POST['field_options'][$setting] ); // WPCS: sanitization ok. |
|
| 194 | 194 | } else { |
| 195 | 195 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized |
| 196 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); |
|
| 196 | + $value = wp_unslash( $_POST['field_options'][$setting] ); |
|
| 197 | 197 | FrmAppHelper::sanitize_value( 'wp_kses_post', $value ); |
| 198 | 198 | } |
| 199 | 199 | } |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | $values['default_value'] = FrmAppHelper::maybe_json_encode( $field->default_value ); |
| 267 | 267 | |
| 268 | 268 | foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
| 269 | - $values[ $col ] = $field->{$col}; |
|
| 269 | + $values[$col] = $field->{$col}; |
|
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | ); |
| 307 | 307 | |
| 308 | 308 | $msg = FrmField::get_option( $field, $error ); |
| 309 | - $msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg; |
|
| 309 | + $msg = empty( $msg ) ? $defaults[$error]['part'] : $msg; |
|
| 310 | 310 | $msg = do_shortcode( $msg ); |
| 311 | 311 | |
| 312 | 312 | return $msg; |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | $base_name = 'default_value_' . $field['id']; |
| 417 | - $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field ); |
|
| 417 | + $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field ); |
|
| 418 | 418 | |
| 419 | 419 | $default_type = self::get_default_value_type( $field ); |
| 420 | 420 | |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | continue; |
| 713 | 713 | } |
| 714 | 714 | |
| 715 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
| 715 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
| 716 | 716 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
| 717 | 717 | |
| 718 | 718 | $atts['entry'] = $entry; |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | |
| 722 | 722 | if ( $replace_with !== null ) { |
| 723 | 723 | self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with ); |
| 724 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
| 724 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | unset( $atts, $replace_with ); |
@@ -764,8 +764,8 @@ discard block |
||
| 764 | 764 | |
| 765 | 765 | $dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get' ); |
| 766 | 766 | |
| 767 | - if ( isset( $shortcode_values[ $atts['tag'] ] ) ) { |
|
| 768 | - $replace_with = $shortcode_values[ $atts['tag'] ]; |
|
| 767 | + if ( isset( $shortcode_values[$atts['tag']] ) ) { |
|
| 768 | + $replace_with = $shortcode_values[$atts['tag']]; |
|
| 769 | 769 | } elseif ( in_array( $atts['tag'], $dynamic_default ) ) { |
| 770 | 770 | $replace_with = self::dynamic_default_values( $atts['tag'], $atts ); |
| 771 | 771 | } elseif ( $clean_tag == 'user_agent' ) { |
@@ -974,8 +974,8 @@ discard block |
||
| 974 | 974 | self::field_types_for_input( $single_input, $field_selection, $field_types ); |
| 975 | 975 | } elseif ( in_array( $type, $multiple_input ) ) { |
| 976 | 976 | self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
| 977 | - } elseif ( isset( $field_selection[ $type ] ) ) { |
|
| 978 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
| 977 | + } elseif ( isset( $field_selection[$type] ) ) { |
|
| 978 | + $field_types[$type] = $field_selection[$type]; |
|
| 979 | 979 | } |
| 980 | 980 | |
| 981 | 981 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) ); |
@@ -1008,7 +1008,7 @@ discard block |
||
| 1008 | 1008 | |
| 1009 | 1009 | private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
| 1010 | 1010 | foreach ( $inputs as $input ) { |
| 1011 | - $field_types[ $input ] = $fields[ $input ]; |
|
| 1011 | + $field_types[$input] = $fields[$input]; |
|
| 1012 | 1012 | unset( $input ); |
| 1013 | 1013 | } |
| 1014 | 1014 | } |
@@ -1040,7 +1040,7 @@ discard block |
||
| 1040 | 1040 | 'parent' => false, |
| 1041 | 1041 | 'pointer' => false, |
| 1042 | 1042 | ); |
| 1043 | - $args = wp_parse_args( $args, $defaults ); |
|
| 1043 | + $args = wp_parse_args( $args, $defaults ); |
|
| 1044 | 1044 | |
| 1045 | 1045 | $opt_key = $args['opt_key']; |
| 1046 | 1046 | $field = $args['field']; |
@@ -1057,22 +1057,22 @@ discard block |
||
| 1057 | 1057 | // Check posted vals before checking saved values |
| 1058 | 1058 | |
| 1059 | 1059 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
| 1060 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { |
|
| 1060 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { |
|
| 1061 | 1061 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 1062 | - $other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
| 1062 | + $other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ) : ''; |
|
| 1063 | 1063 | } else { |
| 1064 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); |
|
| 1064 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ); |
|
| 1065 | 1065 | } |
| 1066 | 1066 | |
| 1067 | 1067 | return $other_val; |
| 1068 | 1068 | |
| 1069 | - } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { |
|
| 1069 | + } elseif ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { |
|
| 1070 | 1070 | // For normal fields |
| 1071 | 1071 | |
| 1072 | 1072 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 1073 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
| 1073 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ) : ''; |
|
| 1074 | 1074 | } else { |
| 1075 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); |
|
| 1075 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']] ) ); |
|
| 1076 | 1076 | } |
| 1077 | 1077 | |
| 1078 | 1078 | return $other_val; |
@@ -1082,8 +1082,8 @@ discard block |
||
| 1082 | 1082 | if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) { |
| 1083 | 1083 | // Check if there is an "other" val in saved value and make sure the |
| 1084 | 1084 | // "other" val is not equal to the Other checkbox option |
| 1085 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
| 1086 | - $other_val = $field['value'][ $opt_key ]; |
|
| 1085 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
| 1086 | + $other_val = $field['value'][$opt_key]; |
|
| 1087 | 1087 | } |
| 1088 | 1088 | } else { |
| 1089 | 1089 | /** |
@@ -1095,8 +1095,8 @@ discard block |
||
| 1095 | 1095 | // Multi-select dropdowns - key is not preserved |
| 1096 | 1096 | if ( is_array( $field['value'] ) ) { |
| 1097 | 1097 | $o_key = array_search( $temp_val, $field['value'] ); |
| 1098 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
| 1099 | - unset( $field['value'][ $o_key ], $o_key ); |
|
| 1098 | + if ( isset( $field['value'][$o_key] ) ) { |
|
| 1099 | + unset( $field['value'][$o_key], $o_key ); |
|
| 1100 | 1100 | } |
| 1101 | 1101 | } elseif ( $temp_val == $field['value'] ) { |
| 1102 | 1102 | // For radio and regular dropdowns |
@@ -1138,7 +1138,7 @@ discard block |
||
| 1138 | 1138 | return $other_args; |
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | - $other_opt = true; |
|
| 1141 | + $other_opt = true; |
|
| 1142 | 1142 | |
| 1143 | 1143 | self::set_other_name( $args, $other_args ); |
| 1144 | 1144 | self::set_other_value( $args, $other_args ); |
@@ -1287,7 +1287,7 @@ discard block |
||
| 1287 | 1287 | } |
| 1288 | 1288 | if ( is_array( $val ) ) { |
| 1289 | 1289 | foreach ( $val as $k => $v ) { |
| 1290 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
| 1290 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
| 1291 | 1291 | unset( $k, $v ); |
| 1292 | 1292 | } |
| 1293 | 1293 | } else { |
@@ -1625,19 +1625,19 @@ discard block |
||
| 1625 | 1625 | } |
| 1626 | 1626 | |
| 1627 | 1627 | public static function get_bulk_prefilled_opts( array &$prepop ) { |
| 1628 | - $prepop[ __( 'Countries', 'formidable' ) ] = self::get_countries(); |
|
| 1628 | + $prepop[__( 'Countries', 'formidable' )] = self::get_countries(); |
|
| 1629 | 1629 | |
| 1630 | 1630 | $states = self::get_us_states(); |
| 1631 | 1631 | $state_abv = array_keys( $states ); |
| 1632 | 1632 | sort( $state_abv ); |
| 1633 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
| 1633 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
| 1634 | 1634 | |
| 1635 | 1635 | $states = array_values( $states ); |
| 1636 | 1636 | sort( $states ); |
| 1637 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
| 1637 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
| 1638 | 1638 | unset( $state_abv, $states ); |
| 1639 | 1639 | |
| 1640 | - $prepop[ __( 'Age', 'formidable' ) ] = array( |
|
| 1640 | + $prepop[__( 'Age', 'formidable' )] = array( |
|
| 1641 | 1641 | __( 'Under 18', 'formidable' ), |
| 1642 | 1642 | __( '18-24', 'formidable' ), |
| 1643 | 1643 | __( '25-34', 'formidable' ), |
@@ -1648,7 +1648,7 @@ discard block |
||
| 1648 | 1648 | __( 'Prefer Not to Answer', 'formidable' ), |
| 1649 | 1649 | ); |
| 1650 | 1650 | |
| 1651 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = array( |
|
| 1651 | + $prepop[__( 'Satisfaction', 'formidable' )] = array( |
|
| 1652 | 1652 | __( 'Very Satisfied', 'formidable' ), |
| 1653 | 1653 | __( 'Satisfied', 'formidable' ), |
| 1654 | 1654 | __( 'Neutral', 'formidable' ), |
@@ -1657,7 +1657,7 @@ discard block |
||
| 1657 | 1657 | __( 'N/A', 'formidable' ), |
| 1658 | 1658 | ); |
| 1659 | 1659 | |
| 1660 | - $prepop[ __( 'Importance', 'formidable' ) ] = array( |
|
| 1660 | + $prepop[__( 'Importance', 'formidable' )] = array( |
|
| 1661 | 1661 | __( 'Very Important', 'formidable' ), |
| 1662 | 1662 | __( 'Important', 'formidable' ), |
| 1663 | 1663 | __( 'Neutral', 'formidable' ), |
@@ -1666,7 +1666,7 @@ discard block |
||
| 1666 | 1666 | __( 'N/A', 'formidable' ), |
| 1667 | 1667 | ); |
| 1668 | 1668 | |
| 1669 | - $prepop[ __( 'Agreement', 'formidable' ) ] = array( |
|
| 1669 | + $prepop[__( 'Agreement', 'formidable' )] = array( |
|
| 1670 | 1670 | __( 'Strongly Agree', 'formidable' ), |
| 1671 | 1671 | __( 'Agree', 'formidable' ), |
| 1672 | 1672 | __( 'Neutral', 'formidable' ), |
@@ -278,6 +278,9 @@ discard block |
||
| 278 | 278 | FrmAppHelper::show_search_box( compact( 'text', 'input_id' ) ); |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | + /** |
|
| 282 | + * @param string $param_name |
|
| 283 | + */ |
|
| 281 | 284 | private function hidden_search_inputs( $param_name ) { |
| 282 | 285 | if ( ! empty( $_REQUEST[ $param_name ] ) ) { |
| 283 | 286 | $value = sanitize_text_field( wp_unslash( $_REQUEST[ $param_name ] ) ); |
@@ -418,6 +421,9 @@ discard block |
||
| 418 | 421 | return $action; |
| 419 | 422 | } |
| 420 | 423 | |
| 424 | + /** |
|
| 425 | + * @param string $action_name |
|
| 426 | + */ |
|
| 421 | 427 | private static function get_bulk_action( $action_name ) { |
| 422 | 428 | $action = false; |
| 423 | 429 | $action_param = self::get_param( |
@@ -230,8 +230,8 @@ discard block |
||
| 230 | 230 | return $this->get_pagenum(); |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - if ( isset( $this->_pagination_args[ $key ] ) ) { |
|
| 234 | - return $this->_pagination_args[ $key ]; |
|
| 233 | + if ( isset( $this->_pagination_args[$key] ) ) { |
|
| 234 | + return $this->_pagination_args[$key]; |
|
| 235 | 235 | } |
| 236 | 236 | } |
| 237 | 237 | |
@@ -279,8 +279,8 @@ discard block |
||
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | private function hidden_search_inputs( $param_name ) { |
| 282 | - if ( ! empty( $_REQUEST[ $param_name ] ) ) { |
|
| 283 | - $value = sanitize_text_field( wp_unslash( $_REQUEST[ $param_name ] ) ); |
|
| 282 | + if ( ! empty( $_REQUEST[$param_name] ) ) { |
|
| 283 | + $value = sanitize_text_field( wp_unslash( $_REQUEST[$param_name] ) ); |
|
| 284 | 284 | echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $value ) . '" />'; |
| 285 | 285 | } |
| 286 | 286 | } |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | |
| 325 | 325 | echo "<ul class='subsubsub'>\n"; |
| 326 | 326 | foreach ( $views as $class => $view ) { |
| 327 | - $views[ $class ] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
| 327 | + $views[$class] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
| 328 | 328 | } |
| 329 | 329 | echo implode( " |</li>\n", $views ) . "</li>\n"; // WPCS: XSS ok. |
| 330 | 330 | echo '</ul>'; |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | 'next' => __( 'Next page', 'formidable' ), |
| 683 | 683 | ); |
| 684 | 684 | |
| 685 | - return $labels[ $link ]; |
|
| 685 | + return $labels[$link]; |
|
| 686 | 686 | } |
| 687 | 687 | |
| 688 | 688 | private function current_url() { |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | |
| 776 | 776 | // If the primary column doesn't exist fall back to the |
| 777 | 777 | // first non-checkbox column. |
| 778 | - if ( ! isset( $columns[ $default ] ) ) { |
|
| 778 | + if ( ! isset( $columns[$default] ) ) { |
|
| 779 | 779 | $default = self::get_default_primary_column_name(); |
| 780 | 780 | } |
| 781 | 781 | |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | */ |
| 790 | 790 | $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id ); |
| 791 | 791 | |
| 792 | - if ( empty( $column ) || ! isset( $columns[ $column ] ) ) { |
|
| 792 | + if ( empty( $column ) || ! isset( $columns[$column] ) ) { |
|
| 793 | 793 | $column = $default; |
| 794 | 794 | } |
| 795 | 795 | |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | // In 4.3, we added a fourth argument for primary column. |
| 812 | 812 | $column_headers = array( array(), array(), array(), $this->get_primary_column_name() ); |
| 813 | 813 | foreach ( $this->_column_headers as $key => $value ) { |
| 814 | - $column_headers[ $key ] = $value; |
|
| 814 | + $column_headers[$key] = $value; |
|
| 815 | 815 | } |
| 816 | 816 | |
| 817 | 817 | return $column_headers; |
@@ -844,7 +844,7 @@ discard block |
||
| 844 | 844 | $data[1] = false; |
| 845 | 845 | } |
| 846 | 846 | |
| 847 | - $sortable[ $id ] = $data; |
|
| 847 | + $sortable[$id] = $data; |
|
| 848 | 848 | } |
| 849 | 849 | |
| 850 | 850 | $primary = $this->get_primary_column_name(); |
@@ -921,8 +921,8 @@ discard block |
||
| 921 | 921 | $class[] = 'column-primary'; |
| 922 | 922 | } |
| 923 | 923 | |
| 924 | - if ( isset( $sortable[ $column_key ] ) ) { |
|
| 925 | - list( $orderby, $desc_first ) = $sortable[ $column_key ]; |
|
| 924 | + if ( isset( $sortable[$column_key] ) ) { |
|
| 925 | + list( $orderby, $desc_first ) = $sortable[$column_key]; |
|
| 926 | 926 | |
| 927 | 927 | if ( $current_orderby == $orderby ) { |
| 928 | 928 | $order = 'asc' == $current_order ? 'desc' : 'asc'; |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | /** |
| 184 | 184 | * @since 2.0 |
| 185 | - * @return The class for this icon |
|
| 185 | + * @return string class for this icon |
|
| 186 | 186 | */ |
| 187 | 187 | public static function icon_key_to_class( $key, $icon = '+', $type = 'arrow' ) { |
| 188 | 188 | if ( 'arrow' == $type && is_numeric( $key ) ) { |
@@ -379,6 +379,7 @@ discard block |
||
| 379 | 379 | |
| 380 | 380 | /** |
| 381 | 381 | * @since 2.3 |
| 382 | + * @param string $default |
|
| 382 | 383 | */ |
| 383 | 384 | private static function get_color_output( $default, &$color ) { |
| 384 | 385 | $color = trim( $color ); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | '-' => 'down', |
| 192 | 192 | '+' => 'up', |
| 193 | 193 | ); |
| 194 | - $class = 'frm_arrow' . $arrow[ $icon ]; |
|
| 194 | + $class = 'frm_arrow' . $arrow[$icon]; |
|
| 195 | 195 | } else { |
| 196 | 196 | //frm_minus1_icon |
| 197 | 197 | $key = str_replace( 'p', '', $key ); |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | '-' => 'minus', |
| 200 | 200 | '+' => 'plus', |
| 201 | 201 | ); |
| 202 | - $class = 'frm_' . $plus[ $icon ]; |
|
| 202 | + $class = 'frm_' . $plus[$icon]; |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | if ( $key ) { |
@@ -219,8 +219,8 @@ discard block |
||
| 219 | 219 | ?> |
| 220 | 220 | <div class="btn-group" id="frm_<?php echo esc_attr( $name ); ?>_select"> |
| 221 | 221 | <button class="multiselect dropdown-toggle btn btn-default" data-toggle="dropdown" type="button"> |
| 222 | - <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '+', $type ) ); ?> |
|
| 223 | - <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[ $name ], '-', $type ) ); ?> |
|
| 222 | + <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '+', $type ) ); ?> |
|
| 223 | + <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $style->post_content[$name], '-', $type ) ); ?> |
|
| 224 | 224 | <b class="caret"></b> |
| 225 | 225 | </button> |
| 226 | 226 | <ul class="multiselect-container frm-dropdown-menu"> |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | <li <?php echo ( $style->post_content['collapse_icon'] == $key ) ? 'class="active"' : ''; ?>> |
| 229 | 229 | <a href="javascript:void(0);"> |
| 230 | 230 | <label> |
| 231 | - <input type="radio" value="<?php echo esc_attr( $key ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" <?php checked( $style->post_content[ $name ], $key ); ?>/> |
|
| 231 | + <input type="radio" value="<?php echo esc_attr( $key ); ?>" name="<?php echo esc_attr( $frm_style->get_field_name( $name ) ); ?>" <?php checked( $style->post_content[$name], $key ); ?>/> |
|
| 232 | 232 | <span> |
| 233 | 233 | <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $key, '+', $type ) ); ?> |
| 234 | 234 | <?php FrmAppHelper::icon_by_class( 'frmfont ' . self::icon_key_to_class( $key, '-', $type ) ); ?> |
@@ -310,15 +310,15 @@ discard block |
||
| 310 | 310 | $vars = array_diff( $vars, $remove ); |
| 311 | 311 | |
| 312 | 312 | foreach ( $vars as $var ) { |
| 313 | - if ( ! isset( $settings[ $var ] ) ) { |
|
| 313 | + if ( ! isset( $settings[$var] ) ) { |
|
| 314 | 314 | continue; |
| 315 | 315 | } |
| 316 | - if ( ! isset( $defaults[ $var ] ) ) { |
|
| 317 | - $defaults[ $var ] = ''; |
|
| 316 | + if ( ! isset( $defaults[$var] ) ) { |
|
| 317 | + $defaults[$var] = ''; |
|
| 318 | 318 | } |
| 319 | - $show = empty( $defaults ) || ( $settings[ $var ] !== '' && $settings[ $var ] !== $defaults[ $var ] ); |
|
| 319 | + $show = empty( $defaults ) || ( $settings[$var] !== '' && $settings[$var] !== $defaults[$var] ); |
|
| 320 | 320 | if ( $show ) { |
| 321 | - echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[ $var ] ) : esc_html( $settings[ $var ] ) ) . ';'; // WPCS: XSS ok. |
|
| 321 | + echo '--' . esc_html( str_replace( '_', '-', $var ) ) . ':' . ( $var === 'font' ? FrmAppHelper::kses( $settings[$var] ) : esc_html( $settings[$var] ) ) . ';'; // WPCS: XSS ok. |
|
| 322 | 322 | } |
| 323 | 323 | } |
| 324 | 324 | } |
@@ -358,14 +358,14 @@ discard block |
||
| 358 | 358 | $settings['style_class'] = 'frm_style_' . $style->post_name . '.'; |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | - $settings['style_class'] .= 'with_frm_style'; |
|
| 361 | + $settings['style_class'] .= 'with_frm_style'; |
|
| 362 | 362 | $settings['font'] = stripslashes( $settings['font'] ); |
| 363 | 363 | $settings['change_margin'] = self::description_margin_for_screensize( $settings['width'] ); |
| 364 | 364 | |
| 365 | 365 | $checkbox_opts = array( 'important_style', 'auto_width', 'submit_style', 'collapse_icon', 'center_form' ); |
| 366 | 366 | foreach ( $checkbox_opts as $opt ) { |
| 367 | - if ( ! isset( $settings[ $opt ] ) ) { |
|
| 368 | - $settings[ $opt ] = 0; |
|
| 367 | + if ( ! isset( $settings[$opt] ) ) { |
|
| 368 | + $settings[$opt] = 0; |
|
| 369 | 369 | } |
| 370 | 370 | } |
| 371 | 371 | |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | $css = ''; |
| 390 | 390 | } |
| 391 | 391 | foreach ( $opts as $opt ) { |
| 392 | - self::get_color_output( $css, $settings[ $opt ] ); |
|
| 392 | + self::get_color_output( $css, $settings[$opt] ); |
|
| 393 | 393 | } |
| 394 | 394 | } |
| 395 | 395 | } |
@@ -166,7 +166,7 @@ |
||
| 166 | 166 | * @since 2.02.05 |
| 167 | 167 | * |
| 168 | 168 | * @param string $key |
| 169 | - * @param int|string $value |
|
| 169 | + * @param string $value |
|
| 170 | 170 | * @param string $where |
| 171 | 171 | */ |
| 172 | 172 | private static function add_query_placeholder( $key, $value, &$where ) { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | foreach ( $args as $key => $value ) { |
| 64 | - $where .= empty( $where ) ? $base_where : $condition; |
|
| 64 | + $where .= empty( $where ) ? $base_where : $condition; |
|
| 65 | 65 | $array_inc_null = ( ! is_numeric( $key ) && is_array( $value ) && in_array( null, $value ) ); |
| 66 | 66 | if ( is_numeric( $key ) || $array_inc_null ) { |
| 67 | 67 | $where .= ' ( '; |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | |
| 97 | 97 | if ( strpos( $key, 'created_at' ) !== false || strpos( $key, 'updated_at' ) !== false ) { |
| 98 | 98 | $k = explode( ' ', $key ); |
| 99 | - $where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key ); |
|
| 99 | + $where .= ' DATE_FORMAT(' . reset( $k ) . ', %s) ' . str_replace( reset( $k ), '', $key ); |
|
| 100 | 100 | $values[] = '%Y-%m-%d %H:%i:%s'; |
| 101 | 101 | } else { |
| 102 | 102 | $where .= ' ' . $key; |
@@ -116,12 +116,12 @@ discard block |
||
| 116 | 116 | $where .= ' OR '; |
| 117 | 117 | } |
| 118 | 118 | $start = false; |
| 119 | - $where .= $key . ' %s'; |
|
| 119 | + $where .= $key . ' %s'; |
|
| 120 | 120 | $values[] = '%' . self::esc_like( $v ) . '%'; |
| 121 | 121 | } |
| 122 | 122 | $where .= ')'; |
| 123 | 123 | } elseif ( ! empty( $value ) ) { |
| 124 | - $where .= ' in (' . self::prepare_array_values( $value, '%s' ) . ')'; |
|
| 124 | + $where .= ' in (' . self::prepare_array_values( $value, '%s' ) . ')'; |
|
| 125 | 125 | $values = array_merge( $values, $value ); |
| 126 | 126 | } |
| 127 | 127 | } elseif ( strpos( $lowercase_key, 'like' ) !== false ) { |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | $where .= 'like'; |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - $where .= ' %s'; |
|
| 144 | + $where .= ' %s'; |
|
| 145 | 145 | $values[] = $start . self::esc_like( $value ) . $end; |
| 146 | 146 | |
| 147 | 147 | } elseif ( $value === null ) { |
@@ -306,8 +306,8 @@ discard block |
||
| 306 | 306 | ); |
| 307 | 307 | |
| 308 | 308 | $where_is = strtolower( $where_is ); |
| 309 | - if ( isset( $switch_to[ $where_is ] ) ) { |
|
| 310 | - return ' ' . $switch_to[ $where_is ]; |
|
| 309 | + if ( isset( $switch_to[$where_is] ) ) { |
|
| 310 | + return ' ' . $switch_to[$where_is]; |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | // > and < need a little more work since we don't want them switched to >= and <= |
@@ -360,13 +360,13 @@ discard block |
||
| 360 | 360 | $temp_args = $args; |
| 361 | 361 | foreach ( $temp_args as $k => $v ) { |
| 362 | 362 | if ( $v == '' ) { |
| 363 | - unset( $args[ $k ] ); |
|
| 363 | + unset( $args[$k] ); |
|
| 364 | 364 | continue; |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | $db_name = strtoupper( str_replace( '_', ' ', $k ) ); |
| 368 | 368 | if ( strpos( $v, $db_name ) === false ) { |
| 369 | - $args[ $k ] = $db_name . ' ' . $v; |
|
| 369 | + $args[$k] = $db_name . ' ' . $v; |
|
| 370 | 370 | } |
| 371 | 371 | } |
| 372 | 372 | |
@@ -440,13 +440,13 @@ discard block |
||
| 440 | 440 | private static function esc_query_args( &$args ) { |
| 441 | 441 | foreach ( $args as $param => $value ) { |
| 442 | 442 | if ( $param == 'order_by' ) { |
| 443 | - $args[ $param ] = self::esc_order( $value ); |
|
| 443 | + $args[$param] = self::esc_order( $value ); |
|
| 444 | 444 | } elseif ( $param == 'limit' ) { |
| 445 | - $args[ $param ] = self::esc_limit( $value ); |
|
| 445 | + $args[$param] = self::esc_limit( $value ); |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - if ( $args[ $param ] == '' ) { |
|
| 449 | - unset( $args[ $param ] ); |
|
| 448 | + if ( $args[$param] == '' ) { |
|
| 449 | + unset( $args[$param] ); |
|
| 450 | 450 | } |
| 451 | 451 | } |
| 452 | 452 | } |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | $limit = explode( ',', trim( $limit ) ); |
| 530 | 530 | foreach ( $limit as $k => $l ) { |
| 531 | 531 | if ( is_numeric( $l ) ) { |
| 532 | - $limit[ $k ] = $l; |
|
| 532 | + $limit[$k] = $l; |
|
| 533 | 533 | } |
| 534 | 534 | } |
| 535 | 535 | |
@@ -665,7 +665,7 @@ discard block |
||
| 665 | 665 | */ |
| 666 | 666 | public static function add_key_to_group_cache( $key, $group ) { |
| 667 | 667 | $cached = self::get_group_cached_keys( $group ); |
| 668 | - $cached[ $key ] = $key; |
|
| 668 | + $cached[$key] = $key; |
|
| 669 | 669 | wp_cache_set( 'cached_keys', $cached, $group, 300 ); |
| 670 | 670 | } |
| 671 | 671 | |
@@ -202,6 +202,7 @@ discard block |
||
| 202 | 202 | * |
| 203 | 203 | * @param int $id |
| 204 | 204 | * @param array $values |
| 205 | + * @param string $update_type |
|
| 205 | 206 | * |
| 206 | 207 | * @return boolean|int $query_results |
| 207 | 208 | */ |
@@ -612,6 +613,9 @@ discard block |
||
| 612 | 613 | return $new_values; |
| 613 | 614 | } |
| 614 | 615 | |
| 616 | + /** |
|
| 617 | + * @param string $name |
|
| 618 | + */ |
|
| 615 | 619 | private static function get_entry_value( $values, $name, $default ) { |
| 616 | 620 | return isset( $values[ $name ] ) ? $values[ $name ] : $default; |
| 617 | 621 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $metas = FrmEntryMeta::get_entry_meta_info( $entry_exist ); |
| 77 | 77 | $field_metas = array(); |
| 78 | 78 | foreach ( $metas as $meta ) { |
| 79 | - $field_metas[ $meta->field_id ] = $meta->meta_value; |
|
| 79 | + $field_metas[$meta->field_id] = $meta->meta_value; |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | // If prev entry is empty and current entry is not, they are not duplicates |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | $query = "SELECT it.*, fr.name as form_name, fr.form_key as form_key FROM {$wpdb->prefix}frm_items it |
| 304 | 304 | LEFT OUTER JOIN {$wpdb->prefix}frm_forms fr ON it.form_id=fr.id WHERE "; |
| 305 | 305 | |
| 306 | - $query .= is_numeric( $id ) ? 'it.id=%d' : 'it.item_key=%s'; |
|
| 306 | + $query .= is_numeric( $id ) ? 'it.id=%d' : 'it.item_key=%s'; |
|
| 307 | 307 | $query_args = array( $id ); |
| 308 | 308 | $query = $wpdb->prepare( $query, $query_args ); // WPCS: unprepared SQL ok. |
| 309 | 309 | |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | private static function prepare_entries( &$entries ) { |
| 349 | 349 | foreach ( $entries as $k => $entry ) { |
| 350 | 350 | self::prepare_entry( $entry ); |
| 351 | - $entries[ $k ] = $entry; |
|
| 351 | + $entries[$k] = $entry; |
|
| 352 | 352 | } |
| 353 | 353 | } |
| 354 | 354 | |
@@ -373,20 +373,20 @@ discard block |
||
| 373 | 373 | foreach ( $metas as $meta_val ) { |
| 374 | 374 | if ( $meta_val->item_id == $entry->id ) { |
| 375 | 375 | FrmAppHelper::unserialize_or_decode( $meta_val->meta_value ); |
| 376 | - $entry->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
| 376 | + $entry->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
| 377 | 377 | if ( $include_key ) { |
| 378 | - $entry->metas[ $meta_val->field_key ] = $entry->metas[ $meta_val->field_id ]; |
|
| 378 | + $entry->metas[$meta_val->field_key] = $entry->metas[$meta_val->field_id]; |
|
| 379 | 379 | } |
| 380 | 380 | continue; |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | // include sub entries in an array |
| 384 | - if ( ! isset( $entry_metas[ $meta_val->field_id ] ) ) { |
|
| 385 | - $entry->metas[ $meta_val->field_id ] = array(); |
|
| 384 | + if ( ! isset( $entry_metas[$meta_val->field_id] ) ) { |
|
| 385 | + $entry->metas[$meta_val->field_id] = array(); |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | FrmAppHelper::unserialize_or_decode( $meta_val->meta_value ); |
| 389 | - $entry->metas[ $meta_val->field_id ][] = $meta_val->meta_value; |
|
| 389 | + $entry->metas[$meta_val->field_id][] = $meta_val->meta_value; |
|
| 390 | 390 | |
| 391 | 391 | unset( $meta_val ); |
| 392 | 392 | } |
@@ -433,13 +433,13 @@ discard block |
||
| 433 | 433 | |
| 434 | 434 | if ( $inc_form ) { |
| 435 | 435 | $fields = 'it.*, fr.name as form_name,fr.form_key as form_key'; |
| 436 | - $table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id '; |
|
| 436 | + $table .= 'LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_forms fr ON it.form_id=fr.id '; |
|
| 437 | 437 | } |
| 438 | 438 | |
| 439 | 439 | if ( preg_match( '/ meta_([0-9]+)/', $order_by, $order_matches ) ) { |
| 440 | 440 | // sort by a requested field |
| 441 | 441 | $field_id = (int) $order_matches[1]; |
| 442 | - $fields .= ', (SELECT meta_value FROM ' . $wpdb->prefix . 'frm_item_metas WHERE field_id = ' . $field_id . ' AND item_id = it.id) as meta_' . $field_id; |
|
| 442 | + $fields .= ', (SELECT meta_value FROM ' . $wpdb->prefix . 'frm_item_metas WHERE field_id = ' . $field_id . ' AND item_id = it.id) as meta_' . $field_id; |
|
| 443 | 443 | unset( $order_matches, $field_id ); |
| 444 | 444 | } |
| 445 | 445 | |
@@ -479,16 +479,16 @@ discard block |
||
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | foreach ( $metas as $m_key => $meta_val ) { |
| 482 | - if ( ! isset( $entries[ $meta_val->item_id ] ) ) { |
|
| 482 | + if ( ! isset( $entries[$meta_val->item_id] ) ) { |
|
| 483 | 483 | continue; |
| 484 | 484 | } |
| 485 | 485 | |
| 486 | - if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) { |
|
| 487 | - $entries[ $meta_val->item_id ]->metas = array(); |
|
| 486 | + if ( ! isset( $entries[$meta_val->item_id]->metas ) ) { |
|
| 487 | + $entries[$meta_val->item_id]->metas = array(); |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | FrmAppHelper::unserialize_or_decode( $meta_val->meta_value ); |
| 491 | - $entries[ $meta_val->item_id ]->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
| 491 | + $entries[$meta_val->item_id]->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
| 492 | 492 | unset( $m_key, $meta_val ); |
| 493 | 493 | } |
| 494 | 494 | |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | private static function get_entry_value( $values, $name, $default ) { |
| 649 | - return isset( $values[ $name ] ) ? $values[ $name ] : $default; |
|
| 649 | + return isset( $values[$name] ) ? $values[$name] : $default; |
|
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | /** |
@@ -338,6 +338,7 @@ |
||
| 338 | 338 | * @param string|array $where |
| 339 | 339 | * @param string $order_by |
| 340 | 340 | * @param string $limit |
| 341 | + * @param boolean $unique |
|
| 341 | 342 | */ |
| 342 | 343 | private static function get_ids_query( $where, $order_by, $limit, $unique, $args, array &$query ) { |
| 343 | 344 | global $wpdb; |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | global $wpdb; |
| 56 | 56 | |
| 57 | - $values = array( |
|
| 57 | + $values = array( |
|
| 58 | 58 | 'item_id' => $entry_id, |
| 59 | 59 | 'field_id' => $field_id, |
| 60 | 60 | ); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | if ( ( is_array( $meta_value ) && empty( $meta_value ) ) || ( ! is_array( $meta_value ) && trim( $meta_value ) == '' ) ) { |
| 130 | 130 | // remove blank fields |
| 131 | - unset( $values[ $field_id ] ); |
|
| 131 | + unset( $values[$field_id] ); |
|
| 132 | 132 | } else { |
| 133 | 133 | // if value exists, then update it |
| 134 | 134 | self::update_entry_meta( $entry_id, $field_id, '', $meta_value ); |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | */ |
| 194 | 194 | public static function get_meta_value( $entry, $field_id ) { |
| 195 | 195 | if ( isset( $entry->metas ) ) { |
| 196 | - return isset( $entry->metas[ $field_id ] ) ? $entry->metas[ $field_id ] : false; |
|
| 196 | + return isset( $entry->metas[$field_id] ) ? $entry->metas[$field_id] : false; |
|
| 197 | 197 | } else { |
| 198 | 198 | return self::get_entry_meta_by_field( $entry->id, $field_id ); |
| 199 | 199 | } |
@@ -211,8 +211,8 @@ discard block |
||
| 211 | 211 | $cached = FrmDb::check_cache( $entry_id, 'frm_entry' ); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | - if ( $cached && isset( $cached->metas ) && isset( $cached->metas[ $field_id ] ) ) { |
|
| 215 | - $result = $cached->metas[ $field_id ]; |
|
| 214 | + if ( $cached && isset( $cached->metas ) && isset( $cached->metas[$field_id] ) ) { |
|
| 215 | + $result = $cached->metas[$field_id]; |
|
| 216 | 216 | |
| 217 | 217 | return wp_unslash( $result ); |
| 218 | 218 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | if ( is_numeric( $field_id ) ) { |
| 223 | 223 | $query['field_id'] = $field_id; |
| 224 | 224 | } else { |
| 225 | - $get_table .= ' it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id'; |
|
| 225 | + $get_table .= ' it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id'; |
|
| 226 | 226 | $query['fi.field_key'] = $field_id; |
| 227 | 227 | } |
| 228 | 228 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | 'stripslashes' => true, |
| 241 | 241 | 'is_draft' => false, |
| 242 | 242 | ); |
| 243 | - $args = wp_parse_args( $args, $defaults ); |
|
| 243 | + $args = wp_parse_args( $args, $defaults ); |
|
| 244 | 244 | |
| 245 | 245 | $query = array(); |
| 246 | 246 | self::meta_field_query( $field_id, $order, $limit, $args, $query ); |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | foreach ( $values as $k => $v ) { |
| 257 | 257 | FrmAppHelper::unserialize_or_decode( $v ); |
| 258 | - $values[ $k ] = $v; |
|
| 258 | + $values[$k] = $v; |
|
| 259 | 259 | unset( $k, $v ); |
| 260 | 260 | } |
| 261 | 261 | |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | |
| 313 | 313 | foreach ( $results as $k => $result ) { |
| 314 | 314 | FrmAppHelper::unserialize_or_decode( $result->meta_value ); |
| 315 | - $results[ $k ]->meta_value = wp_unslash( $result->meta_value ); |
|
| 315 | + $results[$k]->meta_value = wp_unslash( $result->meta_value ); |
|
| 316 | 316 | unset( $k, $result ); |
| 317 | 317 | } |
| 318 | 318 | |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | 'user_id' => '', |
| 326 | 326 | 'group_by' => '', |
| 327 | 327 | ); |
| 328 | - $args = wp_parse_args( $args, $defaults ); |
|
| 328 | + $args = wp_parse_args( $args, $defaults ); |
|
| 329 | 329 | |
| 330 | 330 | $query = array(); |
| 331 | 331 | self::get_ids_query( $where, $order_by, $limit, $unique, $args, $query ); |
@@ -31,6 +31,10 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | protected $option_label = ''; |
| 33 | 33 | |
| 34 | + /** |
|
| 35 | + * @param string $option_key |
|
| 36 | + * @param string $option |
|
| 37 | + */ |
|
| 34 | 38 | public function __construct( $option_key, $option, $args = array() ) { |
| 35 | 39 | $this->option_key = $option_key; |
| 36 | 40 | $this->option = $option; |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | public $id = 0; // the id of the post |
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | - * @param int|string $id The id of the stylsheet or 'default' |
|
| 8 | + * @param integer $id The id of the stylsheet or 'default' |
|
| 9 | 9 | */ |
| 10 | 10 | public function __construct( $id = 0 ) { |
| 11 | 11 | $this->id = $id; |
@@ -150,6 +150,9 @@ discard block |
||
| 150 | 150 | set_transient( 'frmpro_css', $css, MONTH_IN_SECONDS ); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | + /** |
|
| 154 | + * @param string $filename |
|
| 155 | + */ |
|
| 153 | 156 | private function get_css_content( $filename ) { |
| 154 | 157 | $css = '/* ' . __( 'WARNING: Any changes made to this file will be lost when your Formidable settings are updated', 'formidable' ) . ' */' . "\n"; |
| 155 | 158 | |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $new_instance = (array) $new_instance; |
| 54 | 54 | $this->id = $new_instance['ID']; |
| 55 | 55 | if ( $id != $this->id || ! $_POST || ! isset( $_POST['frm_style_setting'] ) ) { |
| 56 | - $all_instances[ $number ] = $new_instance; |
|
| 56 | + $all_instances[$number] = $new_instance; |
|
| 57 | 57 | |
| 58 | 58 | if ( $new_instance['menu_order'] && $_POST && empty( $_POST['prev_menu_order'] ) && isset( $_POST['frm_style_setting']['menu_order'] ) ) { |
| 59 | 59 | // this style was set to default, so remove default setting on previous default style |
@@ -81,22 +81,22 @@ discard block |
||
| 81 | 81 | $default_settings = $this->get_defaults(); |
| 82 | 82 | |
| 83 | 83 | foreach ( $default_settings as $setting => $default ) { |
| 84 | - if ( ! isset( $new_instance['post_content'][ $setting ] ) ) { |
|
| 85 | - $new_instance['post_content'][ $setting ] = $default; |
|
| 84 | + if ( ! isset( $new_instance['post_content'][$setting] ) ) { |
|
| 85 | + $new_instance['post_content'][$setting] = $default; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | if ( $this->is_color( $setting ) ) { |
| 89 | - $new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] ); |
|
| 89 | + $new_instance['post_content'][$setting] = str_replace( '#', '', $new_instance['post_content'][$setting] ); |
|
| 90 | 90 | } elseif ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) |
| 91 | - && ! isset( $new_instance['post_content'][ $setting ] ) |
|
| 91 | + && ! isset( $new_instance['post_content'][$setting] ) |
|
| 92 | 92 | ) { |
| 93 | - $new_instance['post_content'][ $setting ] = 0; |
|
| 93 | + $new_instance['post_content'][$setting] = 0; |
|
| 94 | 94 | } elseif ( $setting == 'font' ) { |
| 95 | - $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
| 95 | + $new_instance['post_content'][$setting] = $this->force_balanced_quotation( $new_instance['post_content'][$setting] ); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - $all_instances[ $number ] = $new_instance; |
|
| 99 | + $all_instances[$number] = $new_instance; |
|
| 100 | 100 | |
| 101 | 101 | $action_ids[] = $this->save( $new_instance ); |
| 102 | 102 | |
@@ -268,13 +268,13 @@ discard block |
||
| 268 | 268 | $style->post_content = $this->override_defaults( $style->post_content ); |
| 269 | 269 | $style->post_content = wp_parse_args( $style->post_content, $default_values ); |
| 270 | 270 | |
| 271 | - $styles[ $style->ID ] = $style; |
|
| 271 | + $styles[$style->ID] = $style; |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | if ( ! $default_style ) { |
| 275 | 275 | $default_style = reset( $styles ); |
| 276 | 276 | |
| 277 | - $styles[ $default_style->ID ]->menu_order = 1; |
|
| 277 | + $styles[$default_style->ID]->menu_order = 1; |
|
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | return $styles; |