@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | if ( in_array( $type, array( 'data', 'lookup' ), true ) ) { |
| 32 | 32 | $values['field_options']['data_type'] = $setting; |
| 33 | 33 | } else { |
| 34 | - $values['field_options'][ $setting ] = 1; |
|
| 34 | + $values['field_options'][$setting] = 1; |
|
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | |
@@ -149,10 +149,10 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | foreach ( $defaults as $opt => $default ) { |
| 152 | - $values[ $opt ] = isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default; |
|
| 152 | + $values[$opt] = isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default; |
|
| 153 | 153 | |
| 154 | 154 | if ( $check_post ) { |
| 155 | - self::get_posted_field_setting( $opt . '_' . $field->id, $values[ $opt ] ); |
|
| 155 | + self::get_posted_field_setting( $opt . '_' . $field->id, $values[$opt] ); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | unset( $opt, $default ); |
@@ -228,18 +228,18 @@ discard block |
||
| 228 | 228 | * @param mixed $value |
| 229 | 229 | */ |
| 230 | 230 | private static function get_posted_field_setting( $setting, &$value ) { |
| 231 | - if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 231 | + if ( ! isset( $_POST['field_options'][$setting] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 232 | 232 | return; |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | if ( strpos( $setting, 'html' ) !== false ) { |
| 236 | 236 | // Strip slashes from HTML but not regex or script tags. |
| 237 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 237 | + $value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 238 | 238 | } elseif ( strpos( $setting, 'format_' ) === 0 ) { |
| 239 | 239 | // TODO: Remove stripslashes on output, and use on input only. |
| 240 | - $value = sanitize_text_field( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing |
|
| 240 | + $value = sanitize_text_field( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing |
|
| 241 | 241 | } else { |
| 242 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 242 | + $value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 243 | 243 | FrmAppHelper::sanitize_value( 'wp_kses_post', $value ); |
| 244 | 244 | } |
| 245 | 245 | } |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | $values['default_value'] = FrmAppHelper::maybe_json_encode( $field->default_value ); |
| 313 | 313 | |
| 314 | 314 | foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
| 315 | - $values[ $col ] = $field->{$col}; |
|
| 315 | + $values[$col] = $field->{$col}; |
|
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | 318 | |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | ); |
| 352 | 352 | |
| 353 | 353 | $msg = FrmField::get_option( $field, $error ); |
| 354 | - $msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg; |
|
| 354 | + $msg = empty( $msg ) ? $defaults[$error]['part'] : $msg; |
|
| 355 | 355 | $msg = do_shortcode( $msg ); |
| 356 | 356 | |
| 357 | 357 | $msg = self::maybe_replace_substrings_with_field_name( $msg, $error, $field ); |
@@ -619,7 +619,7 @@ discard block |
||
| 619 | 619 | 'title' => '', |
| 620 | 620 | 'inside_class' => 'inside', |
| 621 | 621 | ); |
| 622 | - $args = array_merge( $defaults, $args ); |
|
| 622 | + $args = array_merge( $defaults, $args ); |
|
| 623 | 623 | |
| 624 | 624 | include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/inline-modal.php'; |
| 625 | 625 | } |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | continue; |
| 855 | 855 | } |
| 856 | 856 | |
| 857 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
| 857 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
| 858 | 858 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
| 859 | 859 | |
| 860 | 860 | $atts['entry'] = $entry; |
@@ -864,7 +864,7 @@ discard block |
||
| 864 | 864 | if ( $replace_with !== null ) { |
| 865 | 865 | $replace_with = self::trigger_shortcode_atts( $replace_with, $atts ); |
| 866 | 866 | self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with ); |
| 867 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
| 867 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | unset( $atts, $replace_with ); |
@@ -882,7 +882,7 @@ discard block |
||
| 882 | 882 | $supported_atts = array( 'remove_accents', 'sanitize', 'sanitize_url' ); |
| 883 | 883 | $included_atts = array_intersect( $supported_atts, array_keys( $atts ) ); |
| 884 | 884 | foreach ( $included_atts as $included_att ) { |
| 885 | - if ( '0' === $atts[ $included_att ] ) { |
|
| 885 | + if ( '0' === $atts[$included_att] ) { |
|
| 886 | 886 | // Skip any option that uses 0 so sanitize_url=0 does not encode. |
| 887 | 887 | continue; |
| 888 | 888 | } |
@@ -955,8 +955,8 @@ discard block |
||
| 955 | 955 | |
| 956 | 956 | $dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get' ); |
| 957 | 957 | |
| 958 | - if ( isset( $shortcode_values[ $atts['tag'] ] ) ) { |
|
| 959 | - $replace_with = $shortcode_values[ $atts['tag'] ]; |
|
| 958 | + if ( isset( $shortcode_values[$atts['tag']] ) ) { |
|
| 959 | + $replace_with = $shortcode_values[$atts['tag']]; |
|
| 960 | 960 | } elseif ( in_array( $atts['tag'], $dynamic_default ) ) { |
| 961 | 961 | $replace_with = self::dynamic_default_values( $atts['tag'], $atts ); |
| 962 | 962 | } elseif ( $clean_tag === 'user_agent' ) { |
@@ -1169,8 +1169,8 @@ discard block |
||
| 1169 | 1169 | self::field_types_for_input( $single_input, $field_selection, $field_types ); |
| 1170 | 1170 | } elseif ( in_array( $type, $multiple_input ) ) { |
| 1171 | 1171 | self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
| 1172 | - } elseif ( isset( $field_selection[ $type ] ) ) { |
|
| 1173 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
| 1172 | + } elseif ( isset( $field_selection[$type] ) ) { |
|
| 1173 | + $field_types[$type] = $field_selection[$type]; |
|
| 1174 | 1174 | } |
| 1175 | 1175 | |
| 1176 | 1176 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type', 'field_selection' ) ); |
@@ -1203,7 +1203,7 @@ discard block |
||
| 1203 | 1203 | |
| 1204 | 1204 | private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
| 1205 | 1205 | foreach ( $inputs as $input ) { |
| 1206 | - $field_types[ $input ] = $fields[ $input ]; |
|
| 1206 | + $field_types[$input] = $fields[$input]; |
|
| 1207 | 1207 | unset( $input ); |
| 1208 | 1208 | } |
| 1209 | 1209 | } |
@@ -1235,7 +1235,7 @@ discard block |
||
| 1235 | 1235 | 'parent' => false, |
| 1236 | 1236 | 'pointer' => false, |
| 1237 | 1237 | ); |
| 1238 | - $args = wp_parse_args( $args, $defaults ); |
|
| 1238 | + $args = wp_parse_args( $args, $defaults ); |
|
| 1239 | 1239 | |
| 1240 | 1240 | $opt_key = $args['opt_key']; |
| 1241 | 1241 | $field = $args['field']; |
@@ -1251,25 +1251,25 @@ discard block |
||
| 1251 | 1251 | |
| 1252 | 1252 | // Check posted vals before checking saved values |
| 1253 | 1253 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
| 1254 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1254 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1255 | 1255 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 1256 | 1256 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 1257 | - $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 ] ) ) : ''; |
|
| 1257 | + $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] ) ) : ''; |
|
| 1258 | 1258 | } else { |
| 1259 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1259 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1260 | 1260 | } |
| 1261 | 1261 | |
| 1262 | 1262 | return $other_val; |
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | - if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1265 | + if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1266 | 1266 | // For normal fields |
| 1267 | 1267 | |
| 1268 | 1268 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 1269 | 1269 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 1270 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
| 1270 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ) : ''; |
|
| 1271 | 1271 | } else { |
| 1272 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1272 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1273 | 1273 | } |
| 1274 | 1274 | |
| 1275 | 1275 | return $other_val; |
@@ -1279,8 +1279,8 @@ discard block |
||
| 1279 | 1279 | if ( $field['type'] === 'checkbox' && is_array( $field['value'] ) ) { |
| 1280 | 1280 | // Check if there is an "other" val in saved value and make sure the |
| 1281 | 1281 | // "other" val is not equal to the Other checkbox option |
| 1282 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
| 1283 | - $other_val = $field['value'][ $opt_key ]; |
|
| 1282 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
| 1283 | + $other_val = $field['value'][$opt_key]; |
|
| 1284 | 1284 | } |
| 1285 | 1285 | } else { |
| 1286 | 1286 | /** |
@@ -1292,8 +1292,8 @@ discard block |
||
| 1292 | 1292 | // Multi-select dropdowns - key is not preserved |
| 1293 | 1293 | if ( is_array( $field['value'] ) ) { |
| 1294 | 1294 | $o_key = array_search( $temp_val, $field['value'] ); |
| 1295 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
| 1296 | - unset( $field['value'][ $o_key ], $o_key ); |
|
| 1295 | + if ( isset( $field['value'][$o_key] ) ) { |
|
| 1296 | + unset( $field['value'][$o_key], $o_key ); |
|
| 1297 | 1297 | } |
| 1298 | 1298 | } elseif ( $temp_val == $field['value'] ) { |
| 1299 | 1299 | // For radio and regular dropdowns |
@@ -1503,7 +1503,7 @@ discard block |
||
| 1503 | 1503 | if ( is_array( $val ) ) { |
| 1504 | 1504 | foreach ( $val as $k => $v ) { |
| 1505 | 1505 | if ( is_string( $v ) ) { |
| 1506 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
| 1506 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
| 1507 | 1507 | unset( $k, $v ); |
| 1508 | 1508 | } |
| 1509 | 1509 | } |
@@ -1856,7 +1856,7 @@ discard block |
||
| 1856 | 1856 | $countries['class'] = 'frm-countries-opts'; |
| 1857 | 1857 | } |
| 1858 | 1858 | |
| 1859 | - $prepop[ __( 'Countries', 'formidable' ) ] = $countries; |
|
| 1859 | + $prepop[__( 'Countries', 'formidable' )] = $countries; |
|
| 1860 | 1860 | |
| 1861 | 1861 | // State abv. |
| 1862 | 1862 | $states = self::get_us_states(); |
@@ -1866,7 +1866,7 @@ discard block |
||
| 1866 | 1866 | $state_abv['class'] = 'frm-state-abv-opts'; |
| 1867 | 1867 | } |
| 1868 | 1868 | |
| 1869 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
| 1869 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
| 1870 | 1870 | |
| 1871 | 1871 | // States. |
| 1872 | 1872 | $states = array_values( $states ); |
@@ -1875,7 +1875,7 @@ discard block |
||
| 1875 | 1875 | $states['class'] = 'frm-states-opts'; |
| 1876 | 1876 | } |
| 1877 | 1877 | |
| 1878 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
| 1878 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
| 1879 | 1879 | unset( $state_abv, $states ); |
| 1880 | 1880 | |
| 1881 | 1881 | // Age. |
@@ -1893,7 +1893,7 @@ discard block |
||
| 1893 | 1893 | $ages['class'] = 'frm-age-opts'; |
| 1894 | 1894 | } |
| 1895 | 1895 | |
| 1896 | - $prepop[ __( 'Age', 'formidable' ) ] = $ages; |
|
| 1896 | + $prepop[__( 'Age', 'formidable' )] = $ages; |
|
| 1897 | 1897 | |
| 1898 | 1898 | // Satisfaction. |
| 1899 | 1899 | $satisfaction = array( |
@@ -1908,7 +1908,7 @@ discard block |
||
| 1908 | 1908 | $satisfaction['class'] = 'frm-satisfaction-opts'; |
| 1909 | 1909 | } |
| 1910 | 1910 | |
| 1911 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = $satisfaction; |
|
| 1911 | + $prepop[__( 'Satisfaction', 'formidable' )] = $satisfaction; |
|
| 1912 | 1912 | |
| 1913 | 1913 | // Importance. |
| 1914 | 1914 | $importance = array( |
@@ -1923,7 +1923,7 @@ discard block |
||
| 1923 | 1923 | $importance['class'] = 'frm-importance-opts'; |
| 1924 | 1924 | } |
| 1925 | 1925 | |
| 1926 | - $prepop[ __( 'Importance', 'formidable' ) ] = $importance; |
|
| 1926 | + $prepop[__( 'Importance', 'formidable' )] = $importance; |
|
| 1927 | 1927 | |
| 1928 | 1928 | // Agreement. |
| 1929 | 1929 | $agreement = array( |
@@ -1938,7 +1938,7 @@ discard block |
||
| 1938 | 1938 | $agreement['class'] = 'frm-agreement-opts'; |
| 1939 | 1939 | } |
| 1940 | 1940 | |
| 1941 | - $prepop[ __( 'Agreement', 'formidable' ) ] = $agreement; |
|
| 1941 | + $prepop[__( 'Agreement', 'formidable' )] = $agreement; |
|
| 1942 | 1942 | |
| 1943 | 1943 | // Likely. |
| 1944 | 1944 | $likely = array( |
@@ -1953,7 +1953,7 @@ discard block |
||
| 1953 | 1953 | $likely['class'] = 'frm-likely-opts'; |
| 1954 | 1954 | } |
| 1955 | 1955 | |
| 1956 | - $prepop[ __( 'Likely', 'formidable' ) ] = $likely; |
|
| 1956 | + $prepop[__( 'Likely', 'formidable' )] = $likely; |
|
| 1957 | 1957 | |
| 1958 | 1958 | $prepop = apply_filters( 'frm_bulk_field_choices', $prepop ); |
| 1959 | 1959 | } |
@@ -2174,16 +2174,16 @@ discard block |
||
| 2174 | 2174 | */ |
| 2175 | 2175 | private static function fill_image_setting_options( $options, &$args ) { |
| 2176 | 2176 | foreach ( $options as $key => $option ) { |
| 2177 | - $args['options'][ $key ] = $option; |
|
| 2177 | + $args['options'][$key] = $option; |
|
| 2178 | 2178 | |
| 2179 | 2179 | if ( ! empty( $option['addon'] ) ) { |
| 2180 | - $args['options'][ $key ]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
| 2180 | + $args['options'][$key]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
| 2181 | 2181 | } |
| 2182 | 2182 | |
| 2183 | - unset( $args['options'][ $key ]['addon'] ); |
|
| 2183 | + unset( $args['options'][$key]['addon'] ); |
|
| 2184 | 2184 | $fill = array( 'upgrade', 'message', 'content' ); |
| 2185 | 2185 | foreach ( $fill as $f ) { |
| 2186 | - unset( $args['options'][ $key ][ $f ], $f ); |
|
| 2186 | + unset( $args['options'][$key][$f], $f ); |
|
| 2187 | 2187 | } |
| 2188 | 2188 | } |
| 2189 | 2189 | } |
@@ -2204,8 +2204,8 @@ discard block |
||
| 2204 | 2204 | |
| 2205 | 2205 | $fill = array( 'upgrade', 'message', 'content' ); |
| 2206 | 2206 | foreach ( $fill as $f ) { |
| 2207 | - if ( isset( $option[ $f ] ) ) { |
|
| 2208 | - $custom_attrs[ 'data-' . $f ] = $option[ $f ]; |
|
| 2207 | + if ( isset( $option[$f] ) ) { |
|
| 2208 | + $custom_attrs['data-' . $f] = $option[$f]; |
|
| 2209 | 2209 | } |
| 2210 | 2210 | } |
| 2211 | 2211 | |
@@ -2270,7 +2270,7 @@ discard block |
||
| 2270 | 2270 | |
| 2271 | 2271 | return array_filter( |
| 2272 | 2272 | $rows, |
| 2273 | - function ( $row ) { |
|
| 2273 | + function( $row ) { |
|
| 2274 | 2274 | FrmAppHelper::unserialize_or_decode( $row->field_options ); |
| 2275 | 2275 | return is_array( $row->field_options ) && ! empty( $row->field_options['draft'] ); |
| 2276 | 2276 | } |
@@ -228,7 +228,8 @@ discard block |
||
| 228 | 228 | * @param mixed $value |
| 229 | 229 | */ |
| 230 | 230 | private static function get_posted_field_setting( $setting, &$value ) { |
| 231 | - if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 231 | + if ( ! isset( $_POST['field_options'][ $setting ] ) ) { |
|
| 232 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 232 | 233 | return; |
| 233 | 234 | } |
| 234 | 235 | |
@@ -1251,7 +1252,8 @@ discard block |
||
| 1251 | 1252 | |
| 1252 | 1253 | // Check posted vals before checking saved values |
| 1253 | 1254 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
| 1254 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1255 | + if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { |
|
| 1256 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1255 | 1257 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 1256 | 1258 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 1257 | 1259 | $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 ] ) ) : ''; |
@@ -1262,7 +1264,8 @@ discard block |
||
| 1262 | 1264 | return $other_val; |
| 1263 | 1265 | } |
| 1264 | 1266 | |
| 1265 | - if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1267 | + if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { |
|
| 1268 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1266 | 1269 | // For normal fields |
| 1267 | 1270 | |
| 1268 | 1271 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
@@ -113,8 +113,8 @@ |
||
| 113 | 113 | $label = 'category' === $term->taxonomy || 'tag' === $term->taxonomy ? $term->taxonomy : 'term'; |
| 114 | 114 | ?> |
| 115 | 115 | <term><term_id><?php echo esc_html( $term->term_id ); ?></term_id><term_taxonomy><?php echo esc_html( $term->taxonomy ); ?></term_taxonomy><?php |
| 116 | - if ( ! empty( $parent_slugs[ $term->parent ] ) ) { |
|
| 117 | - echo '<term_parent>' . esc_html( $parent_slugs[ $term->parent ] ) . '</term_parent>'; |
|
| 116 | + if ( ! empty( $parent_slugs[$term->parent] ) ) { |
|
| 117 | + echo '<term_parent>' . esc_html( $parent_slugs[$term->parent] ) . '</term_parent>'; |
|
| 118 | 118 | } |
| 119 | 119 | if ( ! empty( $term->name ) ) { |
| 120 | 120 | echo '<term_name>' . FrmXMLHelper::cdata( $term->name ) . '</term_name>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | 'class' => '', |
| 29 | 29 | 'inc_children' => 'exclude', |
| 30 | 30 | ); |
| 31 | - $args = wp_parse_args( $args, $defaults ); |
|
| 31 | + $args = wp_parse_args( $args, $defaults ); |
|
| 32 | 32 | |
| 33 | 33 | if ( ! $args['field_id'] ) { |
| 34 | 34 | $args['field_id'] = $field_name; |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public static function add_html_attr( $class, $param, &$add_html ) { |
| 72 | 72 | if ( ! empty( $class ) ) { |
| 73 | - $add_html[ $param ] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
| 73 | + $add_html[$param] = sanitize_title( $param ) . '="' . esc_attr( trim( sanitize_text_field( $class ) ) ) . '"'; |
|
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | |
@@ -298,8 +298,8 @@ discard block |
||
| 298 | 298 | 'description' => '', |
| 299 | 299 | ); |
| 300 | 300 | foreach ( $defaults as $var => $default ) { |
| 301 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 302 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 301 | + if ( ! isset( $values[$var] ) ) { |
|
| 302 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | |
@@ -314,8 +314,8 @@ discard block |
||
| 314 | 314 | 'parent_form_id' => 0, |
| 315 | 315 | ); |
| 316 | 316 | foreach ( $defaults as $var => $default ) { |
| 317 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 318 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 317 | + if ( ! isset( $values[$var] ) ) { |
|
| 318 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | unset( $defaults ); |
@@ -352,16 +352,16 @@ discard block |
||
| 352 | 352 | $defaults = self::get_default_opts(); |
| 353 | 353 | foreach ( $defaults as $var => $default ) { |
| 354 | 354 | if ( is_array( $default ) ) { |
| 355 | - if ( ! isset( $values[ $var ] ) ) { |
|
| 356 | - $values[ $var ] = $record && isset( $record->options[ $var ] ) ? $record->options[ $var ] : array(); |
|
| 355 | + if ( ! isset( $values[$var] ) ) { |
|
| 356 | + $values[$var] = $record && isset( $record->options[$var] ) ? $record->options[$var] : array(); |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | foreach ( $default as $k => $v ) { |
| 360 | - $values[ $var ][ $k ] = $post_values && isset( $post_values[ $var ][ $k ] ) ? $post_values[ $var ][ $k ] : ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) ? $record->options[ $var ][ $k ] : $v ); |
|
| 360 | + $values[$var][$k] = $post_values && isset( $post_values[$var][$k] ) ? $post_values[$var][$k] : ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) ? $record->options[$var][$k] : $v ); |
|
| 361 | 361 | |
| 362 | 362 | if ( is_array( $v ) ) { |
| 363 | 363 | foreach ( $v as $k1 => $v1 ) { |
| 364 | - $values[ $var ][ $k ][ $k1 ] = $post_values && isset( $post_values[ $var ][ $k ][ $k1 ] ) ? $post_values[ $var ][ $k ][ $k1 ] : ( $record && isset( $record->options[ $var ] ) && isset( $record->options[ $var ][ $k ] ) && isset( $record->options[ $var ][ $k ][ $k1 ] ) ? $record->options[ $var ][ $k ][ $k1 ] : $v1 ); |
|
| 364 | + $values[$var][$k][$k1] = $post_values && isset( $post_values[$var][$k][$k1] ) ? $post_values[$var][$k][$k1] : ( $record && isset( $record->options[$var] ) && isset( $record->options[$var][$k] ) && isset( $record->options[$var][$k][$k1] ) ? $record->options[$var][$k][$k1] : $v1 ); |
|
| 365 | 365 | unset( $k1, $v1 ); |
| 366 | 366 | } |
| 367 | 367 | } |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | unset( $k, $v ); |
| 370 | 370 | } |
| 371 | 371 | } else { |
| 372 | - $values[ $var ] = $post_values && isset( $post_values['options'][ $var ] ) ? $post_values['options'][ $var ] : ( $record && isset( $record->options[ $var ] ) ? $record->options[ $var ] : $default ); |
|
| 372 | + $values[$var] = $post_values && isset( $post_values['options'][$var] ) ? $post_values['options'][$var] : ( $record && isset( $record->options[$var] ) ? $record->options[$var] : $default ); |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | unset( $var, $default ); |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | public static function fill_form_options( &$options, $values ) { |
| 416 | 416 | $defaults = self::get_default_opts(); |
| 417 | 417 | foreach ( $defaults as $var => $default ) { |
| 418 | - $options[ $var ] = isset( $values['options'][ $var ] ) ? $values['options'][ $var ] : $default; |
|
| 418 | + $options[$var] = isset( $values['options'][$var] ) ? $values['options'][$var] : $default; |
|
| 419 | 419 | unset( $var, $default ); |
| 420 | 420 | } |
| 421 | 421 | } |
@@ -590,7 +590,7 @@ discard block |
||
| 590 | 590 | public static function insert_opt_html( $args ) { |
| 591 | 591 | $class = isset( $args['class'] ) ? $args['class'] : ''; |
| 592 | 592 | $fields = FrmField::all_field_selection(); |
| 593 | - $field = isset( $fields[ $args['type'] ] ) ? $fields[ $args['type'] ] : array(); |
|
| 593 | + $field = isset( $fields[$args['type']] ) ? $fields[$args['type']] : array(); |
|
| 594 | 594 | |
| 595 | 595 | self::prepare_field_type( $field ); |
| 596 | 596 | |
@@ -691,7 +691,7 @@ discard block |
||
| 691 | 691 | $last_field = false; |
| 692 | 692 | foreach ( $fields as $field ) { |
| 693 | 693 | if ( $prev_order === $field->field_order ) { |
| 694 | - ++$add_order; |
|
| 694 | + ++ $add_order; |
|
| 695 | 695 | } |
| 696 | 696 | |
| 697 | 697 | if ( $add_order ) { |
@@ -1156,8 +1156,8 @@ discard block |
||
| 1156 | 1156 | $link .= ' onclick="return confirm(\'' . esc_attr( $link_details['confirm'] ) . '\')"'; |
| 1157 | 1157 | } |
| 1158 | 1158 | |
| 1159 | - $label = ( isset( $link_details[ $length ] ) ? $link_details[ $length ] : $link_details['label'] ); |
|
| 1160 | - if ( $length == 'icon' && isset( $link_details[ $length ] ) ) { |
|
| 1159 | + $label = ( isset( $link_details[$length] ) ? $link_details[$length] : $link_details['label'] ); |
|
| 1160 | + if ( $length == 'icon' && isset( $link_details[$length] ) ) { |
|
| 1161 | 1161 | $label = '<span class="' . $label . '" title="' . esc_attr( $link_details['label'] ) . '" aria-hidden="true"></span>'; |
| 1162 | 1162 | $link .= ' aria-label="' . esc_attr( $link_details['label'] ) . '"'; |
| 1163 | 1163 | } |
@@ -1304,7 +1304,7 @@ discard block |
||
| 1304 | 1304 | $status = 'publish'; |
| 1305 | 1305 | } |
| 1306 | 1306 | |
| 1307 | - $name = $nice_names[ $status ]; |
|
| 1307 | + $name = $nice_names[$status]; |
|
| 1308 | 1308 | |
| 1309 | 1309 | return $name; |
| 1310 | 1310 | } |
@@ -1368,7 +1368,7 @@ discard block |
||
| 1368 | 1368 | $icon = $icons['']; |
| 1369 | 1369 | if ( count( $categories ) === 1 ) { |
| 1370 | 1370 | $category = reset( $categories ); |
| 1371 | - $icon = isset( $icons[ $category ] ) ? $icons[ $category ] : $icon; |
|
| 1371 | + $icon = isset( $icons[$category] ) ? $icons[$category] : $icon; |
|
| 1372 | 1372 | } elseif ( ! empty( $categories ) ) { |
| 1373 | 1373 | $icons = array_intersect_key( $icons, array_flip( $categories ) ); |
| 1374 | 1374 | $icon = reset( $icons ); |
@@ -1506,7 +1506,7 @@ discard block |
||
| 1506 | 1506 | |
| 1507 | 1507 | foreach ( $item['categories'] as $k => $category ) { |
| 1508 | 1508 | if ( in_array( $category, $plans, true ) ) { |
| 1509 | - unset( $item['categories'][ $k ] ); |
|
| 1509 | + unset( $item['categories'][$k] ); |
|
| 1510 | 1510 | |
| 1511 | 1511 | if ( in_array( $category, array( 'Creator', 'Personal' ), true ) ) { |
| 1512 | 1512 | // Show the current package name. |
@@ -1708,9 +1708,9 @@ discard block |
||
| 1708 | 1708 | } |
| 1709 | 1709 | |
| 1710 | 1710 | foreach ( $shortcodes[0] as $key => $shortcode ) { |
| 1711 | - $options = trim( $shortcodes[3][ $key ] ); |
|
| 1711 | + $options = trim( $shortcodes[3][$key] ); |
|
| 1712 | 1712 | |
| 1713 | - if ( in_array( $shortcodes[1][ $key ], array( 'if ' ), true ) ) { |
|
| 1713 | + if ( in_array( $shortcodes[1][$key], array( 'if ' ), true ) ) { |
|
| 1714 | 1714 | // Skip if shortcodes. |
| 1715 | 1715 | continue; |
| 1716 | 1716 | } |
@@ -1720,7 +1720,7 @@ discard block |
||
| 1720 | 1720 | continue; |
| 1721 | 1721 | } |
| 1722 | 1722 | |
| 1723 | - $new_shortcode = '[' . $shortcodes[2][ $key ]; |
|
| 1723 | + $new_shortcode = '[' . $shortcodes[2][$key]; |
|
| 1724 | 1724 | if ( $options ) { |
| 1725 | 1725 | $new_shortcode .= ' ' . $options; |
| 1726 | 1726 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | unset( $filename ); |
| 130 | 130 | |
| 131 | - $comment_count = FrmDb::get_count( |
|
| 131 | + $comment_count = FrmDb::get_count( |
|
| 132 | 132 | 'frm_item_metas', |
| 133 | 133 | array( |
| 134 | 134 | 'item_id' => $atts['entry_ids'], |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | private static function prepare_csv_headings() { |
| 247 | 247 | $headings = array(); |
| 248 | 248 | self::csv_headings( $headings ); |
| 249 | - $headings = apply_filters( |
|
| 249 | + $headings = apply_filters( |
|
| 250 | 250 | 'frm_csv_columns', |
| 251 | 251 | $headings, |
| 252 | 252 | self::$form_id, |
@@ -270,10 +270,10 @@ discard block |
||
| 270 | 270 | $field_headings = array(); |
| 271 | 271 | $separate_values = array( 'user_id', 'file', 'data', 'date' ); |
| 272 | 272 | if ( ! empty( $col->field_options['separate_value'] ) && ! in_array( $col->type, $separate_values, true ) ) { |
| 273 | - $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 273 | + $field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | - $field_headings[ $col->id ] = strip_tags( $col->name ); |
|
| 276 | + $field_headings[$col->id] = strip_tags( $col->name ); |
|
| 277 | 277 | $field_headings = apply_filters( |
| 278 | 278 | 'frm_csv_field_columns', |
| 279 | 279 | $field_headings, |
@@ -294,14 +294,14 @@ discard block |
||
| 294 | 294 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
| 295 | 295 | $repeater_id = $col->field_options['in_section']; |
| 296 | 296 | // Set a placeholder to maintain order for repeater fields. |
| 297 | - $headings[ 'repeater' . $repeater_id ] = array(); |
|
| 297 | + $headings['repeater' . $repeater_id] = array(); |
|
| 298 | 298 | |
| 299 | - if ( ! isset( $fields_by_repeater_id[ $repeater_id ] ) ) { |
|
| 300 | - $fields_by_repeater_id[ $repeater_id ] = array(); |
|
| 299 | + if ( ! isset( $fields_by_repeater_id[$repeater_id] ) ) { |
|
| 300 | + $fields_by_repeater_id[$repeater_id] = array(); |
|
| 301 | 301 | $repeater_ids[] = $repeater_id; |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | - $fields_by_repeater_id[ $repeater_id ][] = $col; |
|
| 304 | + $fields_by_repeater_id[$repeater_id][] = $col; |
|
| 305 | 305 | |
| 306 | 306 | continue; |
| 307 | 307 | } |
@@ -320,8 +320,8 @@ discard block |
||
| 320 | 320 | $end = strpos( $row->meta_value, ':{' ); |
| 321 | 321 | $length = substr( $row->meta_value, $start, $end - $start ); |
| 322 | 322 | |
| 323 | - if ( $length > $max[ $row->field_id ] ) { |
|
| 324 | - $max[ $row->field_id ] = $length; |
|
| 323 | + if ( $length > $max[$row->field_id] ) { |
|
| 324 | + $max[$row->field_id] = $length; |
|
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | unset( $start, $end, $length, $row, $repeater_meta, $where ); |
@@ -332,17 +332,17 @@ discard block |
||
| 332 | 332 | $repeater_id = str_replace( 'repeater', '', $key ); |
| 333 | 333 | |
| 334 | 334 | $repeater_headings = array(); |
| 335 | - foreach ( $fields_by_repeater_id[ $repeater_id ] as $col ) { |
|
| 335 | + foreach ( $fields_by_repeater_id[$repeater_id] as $col ) { |
|
| 336 | 336 | $repeater_headings += self::field_headings( $col ); |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | - for ( $i = 0; $i < $max[ $repeater_id ]; $i++ ) { |
|
| 339 | + for ( $i = 0; $i < $max[$repeater_id]; $i ++ ) { |
|
| 340 | 340 | foreach ( $repeater_headings as $repeater_key => $repeater_name ) { |
| 341 | - $flat[ $repeater_key . '[' . $i . ']' ] = $repeater_name; |
|
| 341 | + $flat[$repeater_key . '[' . $i . ']'] = $repeater_name; |
|
| 342 | 342 | } |
| 343 | 343 | } |
| 344 | 344 | } else { |
| 345 | - $flat[ $key ] = $heading; |
|
| 345 | + $flat[$key] = $heading; |
|
| 346 | 346 | } |
| 347 | 347 | } |
| 348 | 348 | |
@@ -355,10 +355,10 @@ discard block |
||
| 355 | 355 | }//end if |
| 356 | 356 | |
| 357 | 357 | if ( self::$comment_count ) { |
| 358 | - for ( $i = 0; $i < self::$comment_count; $i++ ) { |
|
| 359 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
| 360 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
| 361 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
| 358 | + for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
|
| 359 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
| 360 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
| 361 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
| 362 | 362 | } |
| 363 | 363 | unset( $i ); |
| 364 | 364 | } |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | |
| 404 | 404 | private static function prepare_next_csv_rows( $next_set ) { |
| 405 | 405 | // order by parent_item_id so children will be first |
| 406 | - $where = array( |
|
| 406 | + $where = array( |
|
| 407 | 407 | 'or' => 1, |
| 408 | 408 | 'id' => $next_set, |
| 409 | 409 | 'parent_item_id' => $next_set, |
@@ -449,32 +449,32 @@ discard block |
||
| 449 | 449 | continue; |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | - if ( ! isset( $entries[ self::$entry->parent_item_id ] ) ) { |
|
| 453 | - $entries[ self::$entry->parent_item_id ] = new stdClass(); |
|
| 454 | - $entries[ self::$entry->parent_item_id ]->metas = array(); |
|
| 452 | + if ( ! isset( $entries[self::$entry->parent_item_id] ) ) { |
|
| 453 | + $entries[self::$entry->parent_item_id] = new stdClass(); |
|
| 454 | + $entries[self::$entry->parent_item_id]->metas = array(); |
|
| 455 | 455 | } |
| 456 | 456 | |
| 457 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 458 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
| 459 | - } elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 457 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 458 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
| 459 | + } elseif ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 460 | 460 | // if the data is here, it should be an array but if this field has collected data |
| 461 | 461 | // both while inside and outside of the repeating section, it's possible this is a string. |
| 462 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
| 462 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
| 463 | 463 | } |
| 464 | 464 | |
| 465 | 465 | // Add the repeated values. |
| 466 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
| 466 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
| 467 | 467 | }//end foreach |
| 468 | 468 | |
| 469 | 469 | self::$entry->metas = self::fill_missing_repeater_metas( self::$entry->metas, $entries ); |
| 470 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
| 470 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
| 471 | 471 | }//end if |
| 472 | 472 | |
| 473 | 473 | // add the embedded form id |
| 474 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
| 475 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
| 474 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
| 475 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
| 476 | 476 | } |
| 477 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
| 477 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
| 478 | 478 | } |
| 479 | 479 | |
| 480 | 480 | /** |
@@ -495,19 +495,19 @@ discard block |
||
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | $repeater_id = $field->field_options['in_section']; |
| 498 | - if ( ! isset( self::$fields_by_repeater_id[ $repeater_id ] ) ) { |
|
| 498 | + if ( ! isset( self::$fields_by_repeater_id[$repeater_id] ) ) { |
|
| 499 | 499 | return $metas; |
| 500 | 500 | } |
| 501 | 501 | |
| 502 | - foreach ( self::$fields_by_repeater_id[ $repeater_id ] as $repeater_child ) { |
|
| 503 | - if ( ! isset( $metas[ $repeater_child->id ] ) ) { |
|
| 504 | - $metas[ $repeater_child->id ] = ''; |
|
| 502 | + foreach ( self::$fields_by_repeater_id[$repeater_id] as $repeater_child ) { |
|
| 503 | + if ( ! isset( $metas[$repeater_child->id] ) ) { |
|
| 504 | + $metas[$repeater_child->id] = ''; |
|
| 505 | 505 | |
| 506 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) || ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] ) ) { |
|
| 507 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ] = array(); |
|
| 506 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) || ! is_array( $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] ) ) { |
|
| 507 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id] = array(); |
|
| 508 | 508 | } |
| 509 | 509 | |
| 510 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ][] = ''; |
|
| 510 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id][] = ''; |
|
| 511 | 511 | } |
| 512 | 512 | } |
| 513 | 513 | |
@@ -526,7 +526,7 @@ discard block |
||
| 526 | 526 | |
| 527 | 527 | private static function add_field_values_to_csv( &$row ) { |
| 528 | 528 | foreach ( self::$fields as $col ) { |
| 529 | - $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false; |
|
| 529 | + $field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false; |
|
| 530 | 530 | |
| 531 | 531 | FrmFieldsHelper::prepare_field_value( $field_value, $col->type ); |
| 532 | 532 | self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) ); |
@@ -545,20 +545,20 @@ discard block |
||
| 545 | 545 | if ( ! empty( $col->field_options['separate_value'] ) ) { |
| 546 | 546 | $label_key = $col->id . '_label'; |
| 547 | 547 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
| 548 | - $row[ $label_key ] = array(); |
|
| 548 | + $row[$label_key] = array(); |
|
| 549 | 549 | |
| 550 | 550 | if ( is_array( $field_value ) ) { |
| 551 | 551 | foreach ( $field_value as $value ) { |
| 552 | - $row[ $label_key ][] = self::get_separate_value_label( $value, $col ); |
|
| 552 | + $row[$label_key][] = self::get_separate_value_label( $value, $col ); |
|
| 553 | 553 | } |
| 554 | 554 | } |
| 555 | 555 | } else { |
| 556 | - $row[ $label_key ] = self::get_separate_value_label( $field_value, $col ); |
|
| 556 | + $row[$label_key] = self::get_separate_value_label( $field_value, $col ); |
|
| 557 | 557 | } |
| 558 | 558 | unset( $label_key ); |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | - $row[ $col->id ] = $field_value; |
|
| 561 | + $row[$col->id] = $field_value; |
|
| 562 | 562 | |
| 563 | 563 | unset( $col, $field_value ); |
| 564 | 564 | }//end foreach |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | 'show_icon' => false, |
| 582 | 582 | 'entry_id' => self::$entry->id, |
| 583 | 583 | 'sep' => self::$separator, |
| 584 | - 'embedded_field_id' => isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[ self::$entry->id ] ) ? 'form' . self::$entry->embedded_fields[ self::$entry->id ] : 0, |
|
| 584 | + 'embedded_field_id' => isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[self::$entry->id] ) ? 'form' . self::$entry->embedded_fields[self::$entry->id] : 0, |
|
| 585 | 585 | ) |
| 586 | 586 | ); |
| 587 | 587 | } |
@@ -596,8 +596,8 @@ discard block |
||
| 596 | 596 | // This is combo field inside repeater. The heading key has this format: [86_first[0]]. |
| 597 | 597 | foreach ( $sub_value as $sub_key => $sub_sub_value ) { |
| 598 | 598 | $column_key = $atts['col']->id . '_' . $sub_key . '[' . $key . ']'; |
| 599 | - if ( ! is_numeric( $sub_key ) && isset( self::$headings[ $column_key ] ) ) { |
|
| 600 | - $row[ $column_key ] = $sub_sub_value; |
|
| 599 | + if ( ! is_numeric( $sub_key ) && isset( self::$headings[$column_key] ) ) { |
|
| 600 | + $row[$column_key] = $sub_sub_value; |
|
| 601 | 601 | } |
| 602 | 602 | } |
| 603 | 603 | |
@@ -605,8 +605,8 @@ discard block |
||
| 605 | 605 | } |
| 606 | 606 | |
| 607 | 607 | $column_key = $atts['col']->id . '_' . $key; |
| 608 | - if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) { |
|
| 609 | - $row[ $column_key ] = $sub_value; |
|
| 608 | + if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) { |
|
| 609 | + $row[$column_key] = $sub_value; |
|
| 610 | 610 | } |
| 611 | 611 | } |
| 612 | 612 | } |
@@ -631,18 +631,18 @@ discard block |
||
| 631 | 631 | $echo = 'echo' === self::$mode; |
| 632 | 632 | |
| 633 | 633 | foreach ( self::$headings as $k => $heading ) { |
| 634 | - if ( isset( $rows[ $k ] ) ) { |
|
| 635 | - $row = $rows[ $k ]; |
|
| 634 | + if ( isset( $rows[$k] ) ) { |
|
| 635 | + $row = $rows[$k]; |
|
| 636 | 636 | } else { |
| 637 | 637 | $row = ''; |
| 638 | 638 | // array indexed data is not at $rows[ $k ] |
| 639 | - if ( $k[ strlen( $k ) - 1 ] === ']' ) { |
|
| 639 | + if ( $k[strlen( $k ) - 1] === ']' ) { |
|
| 640 | 640 | $start = strrpos( $k, '[' ); |
| 641 | - $key = substr( $k, 0, $start++ ); |
|
| 641 | + $key = substr( $k, 0, $start ++ ); |
|
| 642 | 642 | $index = substr( $k, $start, strlen( $k ) - 1 - $start ); |
| 643 | 643 | |
| 644 | - if ( isset( $rows[ $key ] ) && isset( $rows[ $key ][ $index ] ) ) { |
|
| 645 | - $row = $rows[ $key ][ $index ]; |
|
| 644 | + if ( isset( $rows[$key] ) && isset( $rows[$key][$index] ) ) { |
|
| 645 | + $row = $rows[$key][$index]; |
|
| 646 | 646 | } |
| 647 | 647 | |
| 648 | 648 | unset( $start, $key, $index ); |
@@ -138,11 +138,11 @@ discard block |
||
| 138 | 138 | private static function has_dark_background( $style ) { |
| 139 | 139 | $key = 'fieldset_bg_color'; |
| 140 | 140 | |
| 141 | - if ( empty( $style->post_content[ $key ] ) ) { |
|
| 141 | + if ( empty( $style->post_content[$key] ) ) { |
|
| 142 | 142 | return false; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | - $color = $style->post_content[ $key ]; |
|
| 145 | + $color = $style->post_content[$key]; |
|
| 146 | 146 | |
| 147 | 147 | if ( 0 === strpos( $color, 'rgba' ) ) { |
| 148 | 148 | preg_match_all( '/([\\d.]+)/', $color, $matches ); |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | * @param stdClass $style_object |
| 202 | 202 | * @param array $style |
| 203 | 203 | */ |
| 204 | - $param_filter = function ( $params, $args ) use ( $style_object, $style ) { |
|
| 204 | + $param_filter = function( $params, $args ) use ( $style_object, $style ) { |
|
| 205 | 205 | if ( $args['style'] !== $style_object ) { |
| 206 | 206 | return $params; |
| 207 | 207 | } |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | ), |
| 215 | 215 | '/style-templates/' . $style['slug'] |
| 216 | 216 | ); |
| 217 | - $params['data-requires'] = FrmFormsHelper::get_plan_required( $style ); |
|
| 217 | + $params['data-requires'] = FrmFormsHelper::get_plan_required( $style ); |
|
| 218 | 218 | return $params; |
| 219 | 219 | }; |
| 220 | 220 | } else { |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * @param array $style |
| 226 | 226 | * @return array |
| 227 | 227 | */ |
| 228 | - $param_filter = function ( $params ) use ( $style ) { |
|
| 228 | + $param_filter = function( $params ) use ( $style ) { |
|
| 229 | 229 | $params['data-template-key'] = $style['slug']; |
| 230 | 230 | return $params; |
| 231 | 231 | }; |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | continue; |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - $value = $style->post_content[ $key ]; |
|
| 280 | + $value = $style->post_content[$key]; |
|
| 281 | 281 | |
| 282 | 282 | $is_hex = in_array( $key, $color_settings, true ) && $value && '#' !== $value[0] && false === strpos( $value, 'rgb' ) && $value !== 'transparent'; |
| 283 | 283 | if ( $is_hex ) { |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | * @param int $count Used for pagination. |
| 397 | 397 | * @return void |
| 398 | 398 | */ |
| 399 | - function ( $style, $key ) { |
|
| 399 | + function( $style, $key ) { |
|
| 400 | 400 | if ( ! is_numeric( $key ) ) { |
| 401 | 401 | // Skip active_sub/expires keys. |
| 402 | 402 | return; |
@@ -423,10 +423,10 @@ discard block |
||
| 423 | 423 | * @param int $count Used for pagination. |
| 424 | 424 | * @return void |
| 425 | 425 | */ |
| 426 | - function ( $style ) use ( &$count ) { |
|
| 426 | + function( $style ) use ( &$count ) { |
|
| 427 | 427 | $hidden = $count > self::PAGE_SIZE - 1; |
| 428 | 428 | $this->echo_style_card( $style, $hidden ); |
| 429 | - ++$count; |
|
| 429 | + ++ $count; |
|
| 430 | 430 | } |
| 431 | 431 | ); |
| 432 | 432 | |
@@ -484,7 +484,7 @@ discard block |
||
| 484 | 484 | * @param WP_Post $style |
| 485 | 485 | * @return bool |
| 486 | 486 | */ |
| 487 | - function ( $style ) { |
|
| 487 | + function( $style ) { |
|
| 488 | 488 | return $this->default_style->ID !== $style->ID; |
| 489 | 489 | } |
| 490 | 490 | ); |
@@ -149,8 +149,8 @@ discard block |
||
| 149 | 149 | $field_val = ''; |
| 150 | 150 | if ( is_object( $this->field ) ) { |
| 151 | 151 | $field_val = $this->field->{$column}; |
| 152 | - } elseif ( is_array( $this->field ) && isset( $this->field[ $column ] ) ) { |
|
| 153 | - $field_val = $this->field[ $column ]; |
|
| 152 | + } elseif ( is_array( $this->field ) && isset( $this->field[$column] ) ) { |
|
| 153 | + $field_val = $this->field[$column]; |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | return $field_val; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | if ( is_object( $this->field ) ) { |
| 165 | 165 | $this->field->{$column} = $value; |
| 166 | 166 | } elseif ( is_array( $this->field ) ) { |
| 167 | - $this->field[ $column ] = $value; |
|
| 167 | + $this->field[$column] = $value; |
|
| 168 | 168 | } |
| 169 | 169 | } |
| 170 | 170 | |
@@ -598,7 +598,7 @@ discard block |
||
| 598 | 598 | printf( |
| 599 | 599 | /* translators: %s: Field type */ |
| 600 | 600 | esc_html__( '%s Options', 'formidable' ), |
| 601 | - esc_html( $all_field_types[ $args['display']['type'] ]['name'] ) |
|
| 601 | + esc_html( $all_field_types[$args['display']['type']]['name'] ) |
|
| 602 | 602 | ); |
| 603 | 603 | FrmAppHelper::icon_by_class( 'frmfont frm_arrowdown6_icon', array( 'aria-hidden' => 'true' ) ); |
| 604 | 604 | ?> |
@@ -706,8 +706,8 @@ discard block |
||
| 706 | 706 | |
| 707 | 707 | $fields = array_merge( $fields, $pro_fields ); |
| 708 | 708 | |
| 709 | - if ( isset( $fields[ $this->type ] ) ) { |
|
| 710 | - $name = is_array( $fields[ $this->type ] ) ? $fields[ $this->type ]['name'] : $fields[ $this->type ]; |
|
| 709 | + if ( isset( $fields[$this->type] ) ) { |
|
| 710 | + $name = is_array( $fields[$this->type] ) ? $fields[$this->type]['name'] : $fields[$this->type]; |
|
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | return $name; |
@@ -724,7 +724,7 @@ discard block |
||
| 724 | 724 | * @return array |
| 725 | 725 | */ |
| 726 | 726 | public function get_default_field_options() { |
| 727 | - $opts = array( |
|
| 727 | + $opts = array( |
|
| 728 | 728 | 'size' => '', |
| 729 | 729 | 'max' => '', |
| 730 | 730 | 'label' => '', |
@@ -1145,8 +1145,8 @@ discard block |
||
| 1145 | 1145 | $selected = $values['field_value']; |
| 1146 | 1146 | |
| 1147 | 1147 | if ( isset( $values['combo_name'] ) ) { |
| 1148 | - $options = $options[ $values['combo_name'] ]; |
|
| 1149 | - $selected = is_array( $selected ) && isset( $selected[ $values['combo_name'] ] ) ? $selected[ $values['combo_name'] ] : ''; |
|
| 1148 | + $options = $options[$values['combo_name']]; |
|
| 1149 | + $selected = is_array( $selected ) && isset( $selected[$values['combo_name']] ) ? $selected[$values['combo_name']] : ''; |
|
| 1150 | 1150 | } |
| 1151 | 1151 | |
| 1152 | 1152 | $input = $this->select_tag( $values ); |
@@ -1197,7 +1197,7 @@ discard block |
||
| 1197 | 1197 | } |
| 1198 | 1198 | |
| 1199 | 1199 | protected function fill_display_field_values( $args = array() ) { |
| 1200 | - $defaults = array( |
|
| 1200 | + $defaults = array( |
|
| 1201 | 1201 | 'field_name' => 'item_meta[' . $this->get_field_column( 'id' ) . ']', |
| 1202 | 1202 | 'field_id' => $this->get_field_column( 'id' ), |
| 1203 | 1203 | 'field_plus_id' => '', |
@@ -1250,7 +1250,7 @@ discard block |
||
| 1250 | 1250 | } |
| 1251 | 1251 | } |
| 1252 | 1252 | |
| 1253 | - if ( isset( $args['errors'][ 'field' . $args['field_id'] ] ) && ! $custom_error_fields ) { |
|
| 1253 | + if ( isset( $args['errors']['field' . $args['field_id']] ) && ! $custom_error_fields ) { |
|
| 1254 | 1254 | if ( $error_comes_first ) { |
| 1255 | 1255 | array_unshift( $describedby, 'frm_error_' . $args['html_id'] ); |
| 1256 | 1256 | } else { |
@@ -1329,11 +1329,11 @@ discard block |
||
| 1329 | 1329 | |
| 1330 | 1330 | $field_id = $this->get_field_column( 'id' ); |
| 1331 | 1331 | if ( ! array_key_exists( $field_id, $frm_validated_unique_values ) ) { |
| 1332 | - $frm_validated_unique_values[ $field_id ] = array(); |
|
| 1332 | + $frm_validated_unique_values[$field_id] = array(); |
|
| 1333 | 1333 | return false; |
| 1334 | 1334 | } |
| 1335 | 1335 | |
| 1336 | - $already_validated_this_value = in_array( $value, $frm_validated_unique_values[ $field_id ], true ); |
|
| 1336 | + $already_validated_this_value = in_array( $value, $frm_validated_unique_values[$field_id], true ); |
|
| 1337 | 1337 | return $already_validated_this_value; |
| 1338 | 1338 | } |
| 1339 | 1339 | |
@@ -1358,7 +1358,7 @@ discard block |
||
| 1358 | 1358 | private function value_validated_as_unique( $value ) { |
| 1359 | 1359 | global $frm_validated_unique_values; |
| 1360 | 1360 | $field_id = $this->get_field_column( 'id' ); |
| 1361 | - $frm_validated_unique_values[ $field_id ][] = $value; |
|
| 1361 | + $frm_validated_unique_values[$field_id][] = $value; |
|
| 1362 | 1362 | } |
| 1363 | 1363 | |
| 1364 | 1364 | public function get_value_to_save( $value, $atts ) { |
@@ -1394,8 +1394,8 @@ discard block |
||
| 1394 | 1394 | $value = $this->prepare_display_value( $value, $atts ); |
| 1395 | 1395 | |
| 1396 | 1396 | if ( is_array( $value ) ) { |
| 1397 | - if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[ $atts['show'] ] ) ) { |
|
| 1398 | - $value = $value[ $atts['show'] ]; |
|
| 1397 | + if ( isset( $atts['show'] ) && $atts['show'] && isset( $value[$atts['show']] ) ) { |
|
| 1398 | + $value = $value[$atts['show']]; |
|
| 1399 | 1399 | } elseif ( ! isset( $atts['return_array'] ) || ! $atts['return_array'] ) { |
| 1400 | 1400 | $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', '; |
| 1401 | 1401 | $value = implode( $sep, $value ); |
@@ -1525,8 +1525,8 @@ discard block |
||
| 1525 | 1525 | $saved_entries = $atts['ids']; |
| 1526 | 1526 | $new_value = array(); |
| 1527 | 1527 | foreach ( (array) $value as $old_child_id ) { |
| 1528 | - if ( isset( $saved_entries[ $old_child_id ] ) ) { |
|
| 1529 | - $new_value[] = $saved_entries[ $old_child_id ]; |
|
| 1528 | + if ( isset( $saved_entries[$old_child_id] ) ) { |
|
| 1529 | + $new_value[] = $saved_entries[$old_child_id]; |
|
| 1530 | 1530 | } |
| 1531 | 1531 | } |
| 1532 | 1532 | |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | protected function get_field_value( $args ) { |
| 59 | 59 | $user_ID = get_current_user_id(); |
| 60 | 60 | $user_ID = ( $user_ID ? $user_ID : '' ); |
| 61 | - $posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][ $this->field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 61 | + $posted_value = ( FrmAppHelper::is_admin() && $_POST && isset( $_POST['item_meta'][$this->field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 62 | 62 | $action = ( isset( $args['action'] ) ? $args['action'] : ( isset( $args['form_action'] ) ? $args['form_action'] : '' ) ); |
| 63 | 63 | $updating = $action == 'update'; |
| 64 | 64 | return is_numeric( $this->field['value'] ) || $posted_value || $updating ? $this->field['value'] : $user_ID; |
@@ -300,8 +300,8 @@ discard block |
||
| 300 | 300 | require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 301 | 301 | } |
| 302 | 302 | $plugins = get_plugins(); |
| 303 | - if ( isset( $plugins[ $plugin ] ) && ! empty( $plugins[ $plugin ]['Version'] ) ) { |
|
| 304 | - return $plugins[ $plugin ]['Version']; |
|
| 303 | + if ( isset( $plugins[$plugin] ) && ! empty( $plugins[$plugin]['Version'] ) ) { |
|
| 304 | + return $plugins[$plugin]['Version']; |
|
| 305 | 305 | } |
| 306 | 306 | return false; |
| 307 | 307 | } |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | $values = FrmAppHelper::maybe_filter_array( $values, array( 'name', 'description' ) ); |
| 373 | 373 | |
| 374 | 374 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
| 375 | - $new_values[ $col ] = $values[ $col ]; |
|
| 375 | + $new_values[$col] = $values[$col]; |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | $new_values['options'] = self::maybe_filter_options( $values['options'] ); |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
| 384 | 384 | |
| 385 | 385 | if ( isset( $values['id'] ) ) { |
| 386 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
| 386 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
| 387 | 387 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
| 388 | 388 | } |
| 389 | 389 | |
@@ -392,9 +392,9 @@ discard block |
||
| 392 | 392 | foreach ( $new_values as $k => $v ) { |
| 393 | 393 | if ( is_array( $v ) ) { |
| 394 | 394 | if ( $k === 'default_value' ) { |
| 395 | - $new_values[ $k ] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 395 | + $new_values[$k] = FrmAppHelper::maybe_json_encode( $v ); |
|
| 396 | 396 | } else { |
| 397 | - $new_values[ $k ] = serialize( $v ); |
|
| 397 | + $new_values[$k] = serialize( $v ); |
|
| 398 | 398 | } |
| 399 | 399 | } |
| 400 | 400 | unset( $k, $v ); |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | if ( isset( $values['id'] ) ) { |
| 417 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
| 417 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | return $new_id; |
@@ -474,7 +474,7 @@ discard block |
||
| 474 | 474 | public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
| 475 | 475 | global $frm_duplicate_ids; |
| 476 | 476 | |
| 477 | - $where = array( |
|
| 477 | + $where = array( |
|
| 478 | 478 | array( |
| 479 | 479 | 'or' => 1, |
| 480 | 480 | 'fi.form_id' => $old_form_id, |
@@ -520,8 +520,8 @@ discard block |
||
| 520 | 520 | |
| 521 | 521 | $values = apply_filters( 'frm_duplicated_field', $values ); |
| 522 | 522 | $new_id = self::create( $values ); |
| 523 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
| 524 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
| 523 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
| 524 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
| 525 | 525 | unset( $field ); |
| 526 | 526 | }//end foreach |
| 527 | 527 | } |
@@ -565,11 +565,11 @@ discard block |
||
| 565 | 565 | |
| 566 | 566 | // serialize array values |
| 567 | 567 | foreach ( array( 'field_options', 'options' ) as $opt ) { |
| 568 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
| 568 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
| 569 | 569 | if ( 'field_options' === $opt ) { |
| 570 | - $values[ $opt ] = self::maybe_filter_options( $values[ $opt ] ); |
|
| 570 | + $values[$opt] = self::maybe_filter_options( $values[$opt] ); |
|
| 571 | 571 | } |
| 572 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
| 572 | + $values[$opt] = serialize( $values[$opt] ); |
|
| 573 | 573 | } |
| 574 | 574 | } |
| 575 | 575 | if ( isset( $values['default_value'] ) && is_array( $values['default_value'] ) ) { |
@@ -721,7 +721,7 @@ discard block |
||
| 721 | 721 | 'id' => $id, |
| 722 | 722 | 'field_key' => $id, |
| 723 | 723 | ); |
| 724 | - $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
| 724 | + $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
|
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | return $type; |
@@ -747,8 +747,8 @@ discard block |
||
| 747 | 747 | continue; |
| 748 | 748 | } |
| 749 | 749 | |
| 750 | - $fields[ $result->id ] = $result; |
|
| 751 | - ++$count; |
|
| 750 | + $fields[$result->id] = $result; |
|
| 751 | + ++ $count; |
|
| 752 | 752 | if ( $limit == 1 ) { |
| 753 | 753 | $fields = $result; |
| 754 | 754 | break; |
@@ -792,8 +792,8 @@ discard block |
||
| 792 | 792 | $fields = array(); |
| 793 | 793 | $count = 0; |
| 794 | 794 | foreach ( $results as $result ) { |
| 795 | - ++$count; |
|
| 796 | - $fields[ $result->id ] = $result; |
|
| 795 | + ++ $count; |
|
| 796 | + $fields[$result->id] = $result; |
|
| 797 | 797 | if ( ! empty( $limit ) && $count >= $limit ) { |
| 798 | 798 | break; |
| 799 | 799 | } |
@@ -907,7 +907,7 @@ discard block |
||
| 907 | 907 | $query_type = $limit == ' LIMIT 1' || $limit == 1 ? 'row' : 'results'; |
| 908 | 908 | |
| 909 | 909 | if ( is_array( $where ) ) { |
| 910 | - $args = array( |
|
| 910 | + $args = array( |
|
| 911 | 911 | 'order_by' => $order_by, |
| 912 | 912 | 'limit' => $limit, |
| 913 | 913 | ); |
@@ -938,9 +938,9 @@ discard block |
||
| 938 | 938 | FrmDb::set_cache( $result->field_key, $result, 'frm_field' ); |
| 939 | 939 | |
| 940 | 940 | self::prepare_options( $result ); |
| 941 | - $results[ $r_key ]->field_options = $result->field_options; |
|
| 942 | - $results[ $r_key ]->options = $result->options; |
|
| 943 | - $results[ $r_key ]->default_value = $result->default_value; |
|
| 941 | + $results[$r_key]->field_options = $result->field_options; |
|
| 942 | + $results[$r_key]->options = $result->options; |
|
| 943 | + $results[$r_key]->default_value = $result->default_value; |
|
| 944 | 944 | |
| 945 | 945 | unset( $r_key, $result ); |
| 946 | 946 | } |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | |
| 997 | 997 | if ( count( $next_fields ) >= self::$transient_size ) { |
| 998 | 998 | // if this transient is full, check for another |
| 999 | - ++$next; |
|
| 999 | + ++ $next; |
|
| 1000 | 1000 | self::get_next_transient( $fields, $base_name, $next ); |
| 1001 | 1001 | } |
| 1002 | 1002 | } |
@@ -1024,7 +1024,7 @@ discard block |
||
| 1024 | 1024 | return; |
| 1025 | 1025 | } |
| 1026 | 1026 | |
| 1027 | - ++$next; |
|
| 1027 | + ++ $next; |
|
| 1028 | 1028 | } |
| 1029 | 1029 | } |
| 1030 | 1030 | |
@@ -1162,7 +1162,7 @@ discard block |
||
| 1162 | 1162 | * @return bool |
| 1163 | 1163 | */ |
| 1164 | 1164 | public static function is_option_true_in_array( $field, $option ) { |
| 1165 | - return ! empty( $field[ $option ] ); |
|
| 1165 | + return ! empty( $field[$option] ); |
|
| 1166 | 1166 | } |
| 1167 | 1167 | |
| 1168 | 1168 | /** |
@@ -1171,7 +1171,7 @@ discard block |
||
| 1171 | 1171 | * @return bool |
| 1172 | 1172 | */ |
| 1173 | 1173 | public static function is_option_true_in_object( $field, $option ) { |
| 1174 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
| 1174 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
| 1175 | 1175 | } |
| 1176 | 1176 | |
| 1177 | 1177 | /** |
@@ -1180,7 +1180,7 @@ discard block |
||
| 1180 | 1180 | * @return bool |
| 1181 | 1181 | */ |
| 1182 | 1182 | public static function is_option_empty_in_array( $field, $option ) { |
| 1183 | - return empty( $field[ $option ] ); |
|
| 1183 | + return empty( $field[$option] ); |
|
| 1184 | 1184 | } |
| 1185 | 1185 | |
| 1186 | 1186 | /** |
@@ -1189,7 +1189,7 @@ discard block |
||
| 1189 | 1189 | * @return bool |
| 1190 | 1190 | */ |
| 1191 | 1191 | public static function is_option_empty_in_object( $field, $option ) { |
| 1192 | - return empty( $field->field_options[ $option ] ); |
|
| 1192 | + return empty( $field->field_options[$option] ); |
|
| 1193 | 1193 | } |
| 1194 | 1194 | |
| 1195 | 1195 | /** |
@@ -1198,7 +1198,7 @@ discard block |
||
| 1198 | 1198 | * @return bool |
| 1199 | 1199 | */ |
| 1200 | 1200 | public static function is_option_value_in_object( $field, $option ) { |
| 1201 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
| 1201 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
| 1202 | 1202 | } |
| 1203 | 1203 | |
| 1204 | 1204 | /** |
@@ -1224,10 +1224,10 @@ discard block |
||
| 1224 | 1224 | * @return mixed |
| 1225 | 1225 | */ |
| 1226 | 1226 | public static function get_option_in_array( $field, $option ) { |
| 1227 | - if ( isset( $field[ $option ] ) ) { |
|
| 1228 | - $this_option = $field[ $option ]; |
|
| 1229 | - } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][ $option ] ) ) { |
|
| 1230 | - $this_option = $field['field_options'][ $option ]; |
|
| 1227 | + if ( isset( $field[$option] ) ) { |
|
| 1228 | + $this_option = $field[$option]; |
|
| 1229 | + } elseif ( isset( $field['field_options'] ) && is_array( $field['field_options'] ) && isset( $field['field_options'][$option] ) ) { |
|
| 1230 | + $this_option = $field['field_options'][$option]; |
|
| 1231 | 1231 | } else { |
| 1232 | 1232 | $this_option = ''; |
| 1233 | 1233 | } |
@@ -1236,7 +1236,7 @@ discard block |
||
| 1236 | 1236 | } |
| 1237 | 1237 | |
| 1238 | 1238 | public static function get_option_in_object( $field, $option ) { |
| 1239 | - return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : ''; |
|
| 1239 | + return isset( $field->field_options[$option] ) ? $field->field_options[$option] : ''; |
|
| 1240 | 1240 | } |
| 1241 | 1241 | |
| 1242 | 1242 | /** |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | if ( $new_val !== $value ) { |
| 212 | - $new_values[ $key ] = $new_val; |
|
| 212 | + $new_values[$key] = $new_val; |
|
| 213 | 213 | } |
| 214 | 214 | }//end foreach |
| 215 | 215 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | foreach ( $values as $value_key => $value ) { |
| 242 | 242 | if ( $value_key && in_array( $value_key, $form_fields ) ) { |
| 243 | - $new_values[ $value_key ] = $value; |
|
| 243 | + $new_values[$value_key] = $value; |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
@@ -323,15 +323,15 @@ discard block |
||
| 323 | 323 | $existing_keys = array_keys( $values['item_meta'] ); |
| 324 | 324 | foreach ( $all_fields as $fid ) { |
| 325 | 325 | if ( ! in_array( $fid->id, $existing_keys ) && ( isset( $values['frm_fields_submitted'] ) && in_array( $fid->id, $values['frm_fields_submitted'] ) ) || isset( $values['options'] ) ) { |
| 326 | - $values['item_meta'][ $fid->id ] = ''; |
|
| 326 | + $values['item_meta'][$fid->id] = ''; |
|
| 327 | 327 | } |
| 328 | - $field_array[ $fid->id ] = $fid; |
|
| 328 | + $field_array[$fid->id] = $fid; |
|
| 329 | 329 | } |
| 330 | 330 | unset( $all_fields ); |
| 331 | 331 | |
| 332 | 332 | foreach ( $values['item_meta'] as $field_id => $default_value ) { |
| 333 | - if ( isset( $field_array[ $field_id ] ) ) { |
|
| 334 | - $field = $field_array[ $field_id ]; |
|
| 333 | + if ( isset( $field_array[$field_id] ) ) { |
|
| 334 | + $field = $field_array[$field_id]; |
|
| 335 | 335 | } else { |
| 336 | 336 | $field = FrmField::getOne( $field_id ); |
| 337 | 337 | } |
@@ -340,7 +340,7 @@ discard block |
||
| 340 | 340 | continue; |
| 341 | 341 | } |
| 342 | 342 | |
| 343 | - $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options'][ 'custom_html_' . $field_id ] ) ); |
|
| 343 | + $is_settings_page = ( isset( $values['options'] ) || isset( $values['field_options']['custom_html_' . $field_id] ) ); |
|
| 344 | 344 | if ( $is_settings_page ) { |
| 345 | 345 | self::get_settings_page_html( $values, $field ); |
| 346 | 346 | |
@@ -356,22 +356,22 @@ discard block |
||
| 356 | 356 | $update_options = apply_filters( 'frm_field_options_to_update', $update_options ); |
| 357 | 357 | |
| 358 | 358 | foreach ( $update_options as $opt => $default ) { |
| 359 | - $field->field_options[ $opt ] = isset( $values['field_options'][ $opt . '_' . $field_id ] ) ? $values['field_options'][ $opt . '_' . $field_id ] : $default; |
|
| 360 | - self::sanitize_field_opt( $opt, $field->field_options[ $opt ] ); |
|
| 359 | + $field->field_options[$opt] = isset( $values['field_options'][$opt . '_' . $field_id] ) ? $values['field_options'][$opt . '_' . $field_id] : $default; |
|
| 360 | + self::sanitize_field_opt( $opt, $field->field_options[$opt] ); |
|
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | $field->field_options = apply_filters( 'frm_update_field_options', $field->field_options, $field, $values ); |
| 364 | 364 | |
| 365 | 365 | $new_field = array( |
| 366 | 366 | 'field_options' => $field->field_options, |
| 367 | - 'default_value' => isset( $values[ 'default_value_' . $field_id ] ) ? FrmAppHelper::maybe_json_encode( $values[ 'default_value_' . $field_id ] ) : '', |
|
| 367 | + 'default_value' => isset( $values['default_value_' . $field_id] ) ? FrmAppHelper::maybe_json_encode( $values['default_value_' . $field_id] ) : '', |
|
| 368 | 368 | ); |
| 369 | 369 | |
| 370 | - if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options'][ 'options_' . $field_id ] ) && is_array( $values['field_options'][ 'options_' . $field_id ] ) ) { |
|
| 371 | - foreach ( $values['field_options'][ 'options_' . $field_id ] as $option_key => $option ) { |
|
| 370 | + if ( ! FrmAppHelper::allow_unfiltered_html() && isset( $values['field_options']['options_' . $field_id] ) && is_array( $values['field_options']['options_' . $field_id] ) ) { |
|
| 371 | + foreach ( $values['field_options']['options_' . $field_id] as $option_key => $option ) { |
|
| 372 | 372 | if ( is_array( $option ) ) { |
| 373 | 373 | foreach ( $option as $key => $item ) { |
| 374 | - $values['field_options'][ 'options_' . $field_id ][ $option_key ][ $key ] = FrmAppHelper::kses( $item, 'all' ); |
|
| 374 | + $values['field_options']['options_' . $field_id][$option_key][$key] = FrmAppHelper::kses( $item, 'all' ); |
|
| 375 | 375 | } |
| 376 | 376 | } |
| 377 | 377 | } |
@@ -401,8 +401,8 @@ discard block |
||
| 401 | 401 | */ |
| 402 | 402 | private static function maybe_update_max_option( $field, $values, &$new_field ) { |
| 403 | 403 | if ( $field->type === 'textarea' && |
| 404 | - ! empty( $values['field_options'][ 'type_' . $field->id ] ) && |
|
| 405 | - in_array( $values['field_options'][ 'type_' . $field->id ], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 404 | + ! empty( $values['field_options']['type_' . $field->id] ) && |
|
| 405 | + in_array( $values['field_options']['type_' . $field->id], array( 'text', 'email', 'url', 'password', 'phone' ), true ) ) { |
|
| 406 | 406 | |
| 407 | 407 | $new_field['field_options']['max'] = ''; |
| 408 | 408 | |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | * Update posted field setting so that new 'max' option is displayed after form is saved and page reloads. |
| 411 | 411 | * FrmFieldsHelper::fill_default_field_opts populates field options by calling self::get_posted_field_setting. |
| 412 | 412 | */ |
| 413 | - $_POST['field_options'][ 'max_' . $field->id ] = ''; |
|
| 413 | + $_POST['field_options']['max_' . $field->id] = ''; |
|
| 414 | 414 | } |
| 415 | 415 | } |
| 416 | 416 | |
@@ -486,11 +486,11 @@ discard block |
||
| 486 | 486 | * Updating the settings page |
| 487 | 487 | */ |
| 488 | 488 | private static function get_settings_page_html( $values, &$field ) { |
| 489 | - if ( isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ) { |
|
| 489 | + if ( isset( $values['field_options']['custom_html_' . $field->id] ) ) { |
|
| 490 | 490 | $prev_opts = array(); |
| 491 | 491 | $fallback_html = isset( $field->field_options['custom_html'] ) ? $field->field_options['custom_html'] : FrmFieldsHelper::get_default_html( $field->type ); |
| 492 | 492 | |
| 493 | - $field->field_options['custom_html'] = isset( $values['field_options'][ 'custom_html_' . $field->id ] ) ? $values['field_options'][ 'custom_html_' . $field->id ] : $fallback_html; |
|
| 493 | + $field->field_options['custom_html'] = isset( $values['field_options']['custom_html_' . $field->id] ) ? $values['field_options']['custom_html_' . $field->id] : $fallback_html; |
|
| 494 | 494 | } elseif ( $field->type == 'hidden' || $field->type == 'user_id' ) { |
| 495 | 495 | $prev_opts = $field->field_options; |
| 496 | 496 | } |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | foreach ( $field_cols as $col => $default ) { |
| 517 | 517 | $default = $default === '' ? $field->{$col} : $default; |
| 518 | 518 | |
| 519 | - $new_field[ $col ] = isset( $values['field_options'][ $col . '_' . $field->id ] ) ? $values['field_options'][ $col . '_' . $field->id ] : $default; |
|
| 519 | + $new_field[$col] = isset( $values['field_options'][$col . '_' . $field->id] ) ? $values['field_options'][$col . '_' . $field->id] : $default; |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | // Don't save the template option. |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | if ( ! isset( $form->options['trash_time'] ) || $form->options['trash_time'] < $delete_timestamp ) { |
| 697 | 697 | self::destroy( $form->id ); |
| 698 | 698 | if ( empty( $form->parent_form_id ) ) { |
| 699 | - ++$count; |
|
| 699 | + ++ $count; |
|
| 700 | 700 | } |
| 701 | 701 | } |
| 702 | 702 | |
@@ -920,16 +920,16 @@ discard block |
||
| 920 | 920 | foreach ( $results as $row ) { |
| 921 | 921 | if ( 'trash' != $row->status ) { |
| 922 | 922 | if ( $row->is_template ) { |
| 923 | - ++$counts['template']; |
|
| 923 | + ++ $counts['template']; |
|
| 924 | 924 | } else { |
| 925 | - ++$counts['published']; |
|
| 925 | + ++ $counts['published']; |
|
| 926 | 926 | } |
| 927 | 927 | } else { |
| 928 | - ++$counts['trash']; |
|
| 928 | + ++ $counts['trash']; |
|
| 929 | 929 | } |
| 930 | 930 | |
| 931 | 931 | if ( 'draft' == $row->status ) { |
| 932 | - ++$counts['draft']; |
|
| 932 | + ++ $counts['draft']; |
|
| 933 | 933 | } |
| 934 | 934 | |
| 935 | 935 | unset( $row ); |
@@ -970,8 +970,8 @@ discard block |
||
| 970 | 970 | self::maybe_get_form( $form ); |
| 971 | 971 | } |
| 972 | 972 | |
| 973 | - if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][ $form->id ] ) ) { |
|
| 974 | - return $frm_vars['form_params'][ $form->id ]; |
|
| 973 | + if ( isset( $frm_vars['form_params'] ) && is_array( $frm_vars['form_params'] ) && isset( $frm_vars['form_params'][$form->id] ) ) { |
|
| 974 | + return $frm_vars['form_params'][$form->id]; |
|
| 975 | 975 | } |
| 976 | 976 | |
| 977 | 977 | $action_var = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
@@ -1000,15 +1000,15 @@ discard block |
||
| 1000 | 1000 | // If there are two forms on the same page, make sure not to submit both. |
| 1001 | 1001 | foreach ( $default_values as $var => $default ) { |
| 1002 | 1002 | if ( $var == 'action' ) { |
| 1003 | - $values[ $var ] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1003 | + $values[$var] = FrmAppHelper::get_param( $action_var, $default, 'get', 'sanitize_title' ); |
|
| 1004 | 1004 | } else { |
| 1005 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1005 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1006 | 1006 | } |
| 1007 | 1007 | unset( $var, $default ); |
| 1008 | 1008 | } |
| 1009 | 1009 | } else { |
| 1010 | 1010 | foreach ( $default_values as $var => $default ) { |
| 1011 | - $values[ $var ] = $default; |
|
| 1011 | + $values[$var] = $default; |
|
| 1012 | 1012 | unset( $var, $default ); |
| 1013 | 1013 | } |
| 1014 | 1014 | } |
@@ -1034,7 +1034,7 @@ discard block |
||
| 1034 | 1034 | 'sdir' => '', |
| 1035 | 1035 | ); |
| 1036 | 1036 | foreach ( $defaults as $var => $default ) { |
| 1037 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1037 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1038 | 1038 | } |
| 1039 | 1039 | |
| 1040 | 1040 | return $values; |
@@ -1062,7 +1062,7 @@ discard block |
||
| 1062 | 1062 | 'keep_post' => '', |
| 1063 | 1063 | ); |
| 1064 | 1064 | foreach ( $defaults as $var => $default ) { |
| 1065 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1065 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'sanitize_text_field' ); |
|
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | 1068 | return $values; |
@@ -1165,7 +1165,7 @@ discard block |
||
| 1165 | 1165 | $form = $atts['form']; |
| 1166 | 1166 | $default = isset( $atts['default'] ) ? $atts['default'] : ''; |
| 1167 | 1167 | |
| 1168 | - return isset( $form->options[ $atts['option'] ] ) ? $form->options[ $atts['option'] ] : $default; |
|
| 1168 | + return isset( $form->options[$atts['option']] ) ? $form->options[$atts['option']] : $default; |
|
| 1169 | 1169 | } |
| 1170 | 1170 | |
| 1171 | 1171 | /** |