@@ -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 ) ) { |
@@ -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 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | ); |
351 | 351 | |
352 | 352 | $msg = FrmField::get_option( $field, $error ); |
353 | - $msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg; |
|
353 | + $msg = empty( $msg ) ? $defaults[$error]['part'] : $msg; |
|
354 | 354 | $msg = do_shortcode( $msg ); |
355 | 355 | |
356 | 356 | $msg = self::maybe_replace_substrings_with_field_name( $msg, $error, $field ); |
@@ -618,7 +618,7 @@ discard block |
||
618 | 618 | 'title' => '', |
619 | 619 | 'inside_class' => 'inside', |
620 | 620 | ); |
621 | - $args = array_merge( $defaults, $args ); |
|
621 | + $args = array_merge( $defaults, $args ); |
|
622 | 622 | |
623 | 623 | include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/inline-modal.php'; |
624 | 624 | } |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | continue; |
854 | 854 | } |
855 | 855 | |
856 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
856 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
857 | 857 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
858 | 858 | |
859 | 859 | $atts['entry'] = $entry; |
@@ -863,7 +863,7 @@ discard block |
||
863 | 863 | if ( $replace_with !== null ) { |
864 | 864 | $replace_with = self::trigger_shortcode_atts( $replace_with, $atts ); |
865 | 865 | self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with ); |
866 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
866 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
867 | 867 | } |
868 | 868 | |
869 | 869 | unset( $atts, $replace_with ); |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | $supported_atts = array( 'remove_accents', 'sanitize', 'sanitize_url' ); |
882 | 882 | $included_atts = array_intersect( $supported_atts, array_keys( $atts ) ); |
883 | 883 | foreach ( $included_atts as $included_att ) { |
884 | - if ( '0' === $atts[ $included_att ] ) { |
|
884 | + if ( '0' === $atts[$included_att] ) { |
|
885 | 885 | // Skip any option that uses 0 so sanitize_url=0 does not encode. |
886 | 886 | continue; |
887 | 887 | } |
@@ -954,8 +954,8 @@ discard block |
||
954 | 954 | |
955 | 955 | $dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get' ); |
956 | 956 | |
957 | - if ( isset( $shortcode_values[ $atts['tag'] ] ) ) { |
|
958 | - $replace_with = $shortcode_values[ $atts['tag'] ]; |
|
957 | + if ( isset( $shortcode_values[$atts['tag']] ) ) { |
|
958 | + $replace_with = $shortcode_values[$atts['tag']]; |
|
959 | 959 | } elseif ( in_array( $atts['tag'], $dynamic_default, true ) ) { |
960 | 960 | $replace_with = self::dynamic_default_values( $atts['tag'], $atts ); |
961 | 961 | } elseif ( $clean_tag === 'user_agent' ) { |
@@ -1171,8 +1171,8 @@ discard block |
||
1171 | 1171 | self::field_types_for_input( $single_input, $field_selection, $field_types ); |
1172 | 1172 | } elseif ( in_array( $type, $multiple_input, true ) ) { |
1173 | 1173 | self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
1174 | - } elseif ( isset( $field_selection[ $type ] ) ) { |
|
1175 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
1174 | + } elseif ( isset( $field_selection[$type] ) ) { |
|
1175 | + $field_types[$type] = $field_selection[$type]; |
|
1176 | 1176 | } |
1177 | 1177 | |
1178 | 1178 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type', 'field_selection' ) ); |
@@ -1205,7 +1205,7 @@ discard block |
||
1205 | 1205 | |
1206 | 1206 | private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
1207 | 1207 | foreach ( $inputs as $input ) { |
1208 | - $field_types[ $input ] = $fields[ $input ]; |
|
1208 | + $field_types[$input] = $fields[$input]; |
|
1209 | 1209 | unset( $input ); |
1210 | 1210 | } |
1211 | 1211 | } |
@@ -1237,7 +1237,7 @@ discard block |
||
1237 | 1237 | 'parent' => false, |
1238 | 1238 | 'pointer' => false, |
1239 | 1239 | ); |
1240 | - $args = wp_parse_args( $args, $defaults ); |
|
1240 | + $args = wp_parse_args( $args, $defaults ); |
|
1241 | 1241 | |
1242 | 1242 | $opt_key = $args['opt_key']; |
1243 | 1243 | $field = $args['field']; |
@@ -1253,25 +1253,25 @@ discard block |
||
1253 | 1253 | |
1254 | 1254 | // Check posted vals before checking saved values |
1255 | 1255 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
1256 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1256 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1257 | 1257 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
1258 | 1258 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
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 ] ) ) : ''; |
|
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] ) ) : ''; |
|
1260 | 1260 | } else { |
1261 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1261 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1262 | 1262 | } |
1263 | 1263 | |
1264 | 1264 | return $other_val; |
1265 | 1265 | } |
1266 | 1266 | |
1267 | - 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']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1268 | 1268 | // For normal fields |
1269 | 1269 | |
1270 | 1270 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
1271 | 1271 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
1272 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
1272 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ) : ''; |
|
1273 | 1273 | } else { |
1274 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1274 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
1275 | 1275 | } |
1276 | 1276 | |
1277 | 1277 | return $other_val; |
@@ -1281,8 +1281,8 @@ discard block |
||
1281 | 1281 | if ( $field['type'] === 'checkbox' && is_array( $field['value'] ) ) { |
1282 | 1282 | // Check if there is an "other" val in saved value and make sure the |
1283 | 1283 | // "other" val is not equal to the Other checkbox option |
1284 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
1285 | - $other_val = $field['value'][ $opt_key ]; |
|
1284 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
1285 | + $other_val = $field['value'][$opt_key]; |
|
1286 | 1286 | } |
1287 | 1287 | } else { |
1288 | 1288 | /** |
@@ -1294,8 +1294,8 @@ discard block |
||
1294 | 1294 | // Multi-select dropdowns - key is not preserved |
1295 | 1295 | if ( is_array( $field['value'] ) ) { |
1296 | 1296 | $o_key = array_search( $temp_val, $field['value'] ); |
1297 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
1298 | - unset( $field['value'][ $o_key ], $o_key ); |
|
1297 | + if ( isset( $field['value'][$o_key] ) ) { |
|
1298 | + unset( $field['value'][$o_key], $o_key ); |
|
1299 | 1299 | } |
1300 | 1300 | } elseif ( $temp_val == $field['value'] ) { |
1301 | 1301 | // For radio and regular dropdowns |
@@ -1502,7 +1502,7 @@ discard block |
||
1502 | 1502 | if ( is_array( $val ) ) { |
1503 | 1503 | foreach ( $val as $k => $v ) { |
1504 | 1504 | if ( is_string( $v ) ) { |
1505 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
1505 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
1506 | 1506 | unset( $k, $v ); |
1507 | 1507 | } |
1508 | 1508 | } |
@@ -1855,7 +1855,7 @@ discard block |
||
1855 | 1855 | $countries['class'] = 'frm-countries-opts'; |
1856 | 1856 | } |
1857 | 1857 | |
1858 | - $prepop[ __( 'Countries', 'formidable' ) ] = $countries; |
|
1858 | + $prepop[__( 'Countries', 'formidable' )] = $countries; |
|
1859 | 1859 | |
1860 | 1860 | // State abv. |
1861 | 1861 | $states = self::get_us_states(); |
@@ -1865,7 +1865,7 @@ discard block |
||
1865 | 1865 | $state_abv['class'] = 'frm-state-abv-opts'; |
1866 | 1866 | } |
1867 | 1867 | |
1868 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
1868 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
1869 | 1869 | |
1870 | 1870 | // States. |
1871 | 1871 | $states = array_values( $states ); |
@@ -1874,7 +1874,7 @@ discard block |
||
1874 | 1874 | $states['class'] = 'frm-states-opts'; |
1875 | 1875 | } |
1876 | 1876 | |
1877 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
1877 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
1878 | 1878 | unset( $state_abv, $states ); |
1879 | 1879 | |
1880 | 1880 | // Age. |
@@ -1892,7 +1892,7 @@ discard block |
||
1892 | 1892 | $ages['class'] = 'frm-age-opts'; |
1893 | 1893 | } |
1894 | 1894 | |
1895 | - $prepop[ __( 'Age', 'formidable' ) ] = $ages; |
|
1895 | + $prepop[__( 'Age', 'formidable' )] = $ages; |
|
1896 | 1896 | |
1897 | 1897 | // Satisfaction. |
1898 | 1898 | $satisfaction = array( |
@@ -1907,7 +1907,7 @@ discard block |
||
1907 | 1907 | $satisfaction['class'] = 'frm-satisfaction-opts'; |
1908 | 1908 | } |
1909 | 1909 | |
1910 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = $satisfaction; |
|
1910 | + $prepop[__( 'Satisfaction', 'formidable' )] = $satisfaction; |
|
1911 | 1911 | |
1912 | 1912 | // Importance. |
1913 | 1913 | $importance = array( |
@@ -1922,7 +1922,7 @@ discard block |
||
1922 | 1922 | $importance['class'] = 'frm-importance-opts'; |
1923 | 1923 | } |
1924 | 1924 | |
1925 | - $prepop[ __( 'Importance', 'formidable' ) ] = $importance; |
|
1925 | + $prepop[__( 'Importance', 'formidable' )] = $importance; |
|
1926 | 1926 | |
1927 | 1927 | // Agreement. |
1928 | 1928 | $agreement = array( |
@@ -1937,7 +1937,7 @@ discard block |
||
1937 | 1937 | $agreement['class'] = 'frm-agreement-opts'; |
1938 | 1938 | } |
1939 | 1939 | |
1940 | - $prepop[ __( 'Agreement', 'formidable' ) ] = $agreement; |
|
1940 | + $prepop[__( 'Agreement', 'formidable' )] = $agreement; |
|
1941 | 1941 | |
1942 | 1942 | // Likely. |
1943 | 1943 | $likely = array( |
@@ -1952,7 +1952,7 @@ discard block |
||
1952 | 1952 | $likely['class'] = 'frm-likely-opts'; |
1953 | 1953 | } |
1954 | 1954 | |
1955 | - $prepop[ __( 'Likely', 'formidable' ) ] = $likely; |
|
1955 | + $prepop[__( 'Likely', 'formidable' )] = $likely; |
|
1956 | 1956 | |
1957 | 1957 | $prepop = apply_filters( 'frm_bulk_field_choices', $prepop ); |
1958 | 1958 | } |
@@ -2173,16 +2173,16 @@ discard block |
||
2173 | 2173 | */ |
2174 | 2174 | private static function fill_image_setting_options( $options, &$args ) { |
2175 | 2175 | foreach ( $options as $key => $option ) { |
2176 | - $args['options'][ $key ] = $option; |
|
2176 | + $args['options'][$key] = $option; |
|
2177 | 2177 | |
2178 | 2178 | if ( ! empty( $option['addon'] ) ) { |
2179 | - $args['options'][ $key ]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
2179 | + $args['options'][$key]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
2180 | 2180 | } |
2181 | 2181 | |
2182 | - unset( $args['options'][ $key ]['addon'] ); |
|
2182 | + unset( $args['options'][$key]['addon'] ); |
|
2183 | 2183 | $fill = array( 'upgrade', 'message', 'content' ); |
2184 | 2184 | foreach ( $fill as $f ) { |
2185 | - unset( $args['options'][ $key ][ $f ], $f ); |
|
2185 | + unset( $args['options'][$key][$f], $f ); |
|
2186 | 2186 | } |
2187 | 2187 | } |
2188 | 2188 | } |
@@ -2203,8 +2203,8 @@ discard block |
||
2203 | 2203 | |
2204 | 2204 | $fill = array( 'upgrade', 'message', 'content' ); |
2205 | 2205 | foreach ( $fill as $f ) { |
2206 | - if ( isset( $option[ $f ] ) ) { |
|
2207 | - $custom_attrs[ 'data-' . $f ] = $option[ $f ]; |
|
2206 | + if ( isset( $option[$f] ) ) { |
|
2207 | + $custom_attrs['data-' . $f] = $option[$f]; |
|
2208 | 2208 | } |
2209 | 2209 | } |
2210 | 2210 | |
@@ -2269,7 +2269,7 @@ discard block |
||
2269 | 2269 | |
2270 | 2270 | return array_filter( |
2271 | 2271 | $rows, |
2272 | - function ( $row ) { |
|
2272 | + function( $row ) { |
|
2273 | 2273 | FrmAppHelper::unserialize_or_decode( $row->field_options ); |
2274 | 2274 | return is_array( $row->field_options ) && ! empty( $row->field_options['draft'] ); |
2275 | 2275 | } |
@@ -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 |
@@ -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 | ); |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * @param array|object $field |
75 | 75 | * @return string |
76 | 76 | */ |
77 | - function ( $position, $field ) { |
|
77 | + function( $position, $field ) { |
|
78 | 78 | if ( is_array( $field ) ) { |
79 | 79 | $this->default_label_position_field_ids[] = (int) $field['id']; |
80 | 80 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @param array|object $field |
92 | 92 | * @return string |
93 | 93 | */ |
94 | - function ( $classes, $field ) { |
|
94 | + function( $classes, $field ) { |
|
95 | 95 | if ( is_array( $field ) && in_array( (int) $field['id'], $this->default_label_position_field_ids, true ) ) { |
96 | 96 | $classes .= ' frm-default-label-position'; |
97 | 97 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | * @param string $target_field_type |
119 | 119 | * @return bool |
120 | 120 | */ |
121 | - function ( $show, $field_type ) { |
|
121 | + function( $show, $field_type ) { |
|
122 | 122 | if ( 'captcha' === $field_type ) { |
123 | 123 | $show = false; |
124 | 124 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param int $form_id |
147 | 147 | * @return stdClass|null |
148 | 148 | */ |
149 | - function ( $form ) { |
|
149 | + function( $form ) { |
|
150 | 150 | if ( is_object( $form ) && is_array( $form->options ) ) { |
151 | 151 | $form->options['js_validate'] = false; |
152 | 152 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | |
197 | 197 | $frm_settings = FrmAppHelper::get_settings(); |
198 | 198 | if ( 'none' === $frm_settings->load_style ) { |
199 | - $notes[] = function () { |
|
199 | + $notes[] = function() { |
|
200 | 200 | printf( |
201 | 201 | // translators: %1$s: Anchor tag open, %2$s: Anchor tag close. |
202 | 202 | esc_html__( 'Formidable styles are disabled. This needs to be enabled in %1$sGlobal Settings%2$s.', 'formidable' ), |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | return; |
355 | 355 | } |
356 | 356 | |
357 | - unset( $dependencies[ $index ] ); |
|
357 | + unset( $dependencies[$index] ); |
|
358 | 358 | $dependencies = array_values( $dependencies ); |
359 | 359 | |
360 | 360 | $styles->registered['wp-admin']->deps = $dependencies; |
@@ -223,8 +223,8 @@ discard block |
||
223 | 223 | return $this->get_pagenum(); |
224 | 224 | } |
225 | 225 | |
226 | - if ( isset( $this->_pagination_args[ $key ] ) ) { |
|
227 | - return $this->_pagination_args[ $key ]; |
|
226 | + if ( isset( $this->_pagination_args[$key] ) ) { |
|
227 | + return $this->_pagination_args[$key]; |
|
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
@@ -269,8 +269,8 @@ discard block |
||
269 | 269 | } |
270 | 270 | |
271 | 271 | private function hidden_search_inputs( $param_name ) { |
272 | - if ( ! empty( $_REQUEST[ $param_name ] ) ) { |
|
273 | - $value = sanitize_text_field( wp_unslash( $_REQUEST[ $param_name ] ) ); |
|
272 | + if ( ! empty( $_REQUEST[$param_name] ) ) { |
|
273 | + $value = sanitize_text_field( wp_unslash( $_REQUEST[$param_name] ) ); |
|
274 | 274 | echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $value ) . '" />'; |
275 | 275 | } |
276 | 276 | } |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | |
313 | 313 | echo "<ul class='subsubsub'>\n"; |
314 | 314 | foreach ( $views as $class => $view ) { |
315 | - $views[ $class ] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
315 | + $views[$class] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view; |
|
316 | 316 | } |
317 | 317 | echo implode( " |</li>\n", $views ) . "</li>\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
318 | 318 | echo '</ul>'; |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | |
462 | 462 | $out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">'; |
463 | 463 | foreach ( $actions as $action => $link ) { |
464 | - ++$i; |
|
464 | + ++ $i; |
|
465 | 465 | $sep = $i == $action_count ? '' : ' | '; |
466 | 466 | $out .= "<span class='$action'>$link$sep</span>"; |
467 | 467 | } |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | 'next' => __( 'Next page', 'formidable' ), |
685 | 685 | ); |
686 | 686 | |
687 | - return $labels[ $link ]; |
|
687 | + return $labels[$link]; |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | private function current_url() { |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | |
775 | 775 | // If the primary column doesn't exist fall back to the |
776 | 776 | // first non-checkbox column. |
777 | - if ( ! isset( $columns[ $default ] ) ) { |
|
777 | + if ( ! isset( $columns[$default] ) ) { |
|
778 | 778 | $default = self::get_default_primary_column_name(); |
779 | 779 | } |
780 | 780 | |
@@ -788,7 +788,7 @@ discard block |
||
788 | 788 | */ |
789 | 789 | $column = apply_filters( 'list_table_primary_column', $default, $this->screen->id ); |
790 | 790 | |
791 | - if ( empty( $column ) || ! isset( $columns[ $column ] ) ) { |
|
791 | + if ( empty( $column ) || ! isset( $columns[$column] ) ) { |
|
792 | 792 | $column = $default; |
793 | 793 | } |
794 | 794 | |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | // In 4.3, we added a fourth argument for primary column. |
810 | 810 | $column_headers = array( array(), array(), array(), $this->get_primary_column_name() ); |
811 | 811 | foreach ( $this->_column_headers as $key => $value ) { |
812 | - $column_headers[ $key ] = $value; |
|
812 | + $column_headers[$key] = $value; |
|
813 | 813 | } |
814 | 814 | |
815 | 815 | return $column_headers; |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | $data[1] = false; |
843 | 843 | } |
844 | 844 | |
845 | - $sortable[ $id ] = $data; |
|
845 | + $sortable[$id] = $data; |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | $primary = $this->get_primary_column_name(); |
@@ -898,7 +898,7 @@ discard block |
||
898 | 898 | static $cb_counter = 1; |
899 | 899 | $columns['cb'] = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All', 'formidable' ) . '</label>'; |
900 | 900 | $columns['cb'] .= '<input id="cb-select-all-' . esc_attr( $cb_counter ) . '" type="checkbox" />'; |
901 | - ++$cb_counter; |
|
901 | + ++ $cb_counter; |
|
902 | 902 | } |
903 | 903 | |
904 | 904 | foreach ( $columns as $column_key => $column_display_name ) { |
@@ -920,8 +920,8 @@ discard block |
||
920 | 920 | $class[] = 'column-primary'; |
921 | 921 | } |
922 | 922 | |
923 | - if ( isset( $sortable[ $column_key ] ) ) { |
|
924 | - list( $orderby, $desc_first ) = $sortable[ $column_key ]; |
|
923 | + if ( isset( $sortable[$column_key] ) ) { |
|
924 | + list( $orderby, $desc_first ) = $sortable[$column_key]; |
|
925 | 925 | |
926 | 926 | if ( $current_orderby == $orderby ) { |
927 | 927 | // The sorted column. The `aria-sort` attribute must be set only on the sorted column. |
@@ -1034,7 +1034,7 @@ discard block |
||
1034 | 1034 | * @return bool Returns true if the setting is not set or if it is not false; otherwise, returns false. |
1035 | 1035 | */ |
1036 | 1036 | protected function should_display( $args, $settings ) { |
1037 | - return ! isset( $args[ $settings ] ) || false !== $args[ $settings ]; |
|
1037 | + return ! isset( $args[$settings] ) || false !== $args[$settings]; |
|
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | /** |
@@ -14,20 +14,26 @@ |
||
14 | 14 | <h4><?php echo esc_html( $counter['heading'] ); ?></h4> |
15 | 15 | <?php if ( isset( $counter['cta'] ) && isset( $counter['cta']['display'] ) && true === $counter['cta']['display'] ) : ?> |
16 | 16 | <a href="<?php echo esc_url( $counter['cta']['link'] ); ?>"><?php echo esc_html( $counter['cta']['title'] ); ?></a> |
17 | - <?php else : ?> |
|
17 | + <?php else { |
|
18 | + : ?> |
|
18 | 19 | <?php if ( 'currency' === $counter['type'] ) : ?> |
19 | 20 | <div class="frm-flex-box frm-gap-md"> |
20 | 21 | <?php foreach ( $counter['items'] as $item ) : ?> |
21 | 22 | <b> |
22 | - <?php echo esc_attr( $item['counter_label']['symbol_left'] ); ?> |
|
23 | + <?php echo esc_attr( $item['counter_label']['symbol_left'] ); |
|
24 | +} |
|
25 | +?> |
|
23 | 26 | <span class="frm-counter" data-type="<?php echo esc_attr( $counter['type'] ); ?>" data-locale="<?php echo esc_attr( get_locale() ); ?>" data-counter="<?php echo (int) $item['counter']; ?>"><?php echo (int) $item['counter']; ?></span> |
24 | 27 | <?php echo esc_attr( $item['counter_label']['symbol_right'] ); ?> |
25 | 28 | </b> |
26 | 29 | <?php endforeach; ?> |
27 | 30 | </div> |
28 | - <?php else : ?> |
|
31 | + <?php else { |
|
32 | + : ?> |
|
29 | 33 | <b> |
30 | - <span class="frm-counter" data-type="<?php echo esc_attr( $counter['type'] ); ?>" data-locale="<?php echo esc_attr( get_locale() ); ?>" data-counter="<?php echo (int) $counter['counter']; ?>"><?php echo (int) $counter['counter']; ?></span> |
|
34 | + <span class="frm-counter" data-type="<?php echo esc_attr( $counter['type'] ); |
|
35 | +} |
|
36 | +?>" data-locale="<?php echo esc_attr( get_locale() ); ?>" data-counter="<?php echo (int) $counter['counter']; ?>"><?php echo (int) $counter['counter']; ?></span> |
|
31 | 37 | </b> |
32 | 38 | <?php endif; ?> |
33 | 39 | <?php endif; ?> |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | return; |
164 | 164 | } |
165 | 165 | |
166 | - $selected_xml = isset( $form['xml'] ) && isset( $form['xml'][ $selected_form ] ) ? $form['xml'][ $selected_form ] : ''; |
|
166 | + $selected_xml = isset( $form['xml'] ) && isset( $form['xml'][$selected_form] ) ? $form['xml'][$selected_form] : ''; |
|
167 | 167 | if ( empty( $selected_xml ) || strpos( $selected_xml, 'http' ) !== 0 ) { |
168 | 168 | return; |
169 | 169 | } |
@@ -178,8 +178,8 @@ discard block |
||
178 | 178 | * @param string $value |
179 | 179 | */ |
180 | 180 | private static function get_selected_in_form( $form, $value = 'form' ) { |
181 | - if ( ! empty( $form ) && ! empty( $form[ $value ] ) ) { |
|
182 | - return $form[ $value ]; |
|
181 | + if ( ! empty( $form ) && ! empty( $form[$value] ) ) { |
|
182 | + return $form[$value]; |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | return ''; |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } |
209 | 209 | |
210 | 210 | if ( $for === 'view' ) { |
211 | - $item_key = is_array( $view_keys ) ? $view_keys[ $form_key ] : $view_keys; |
|
211 | + $item_key = is_array( $view_keys ) ? $view_keys[$form_key] : $view_keys; |
|
212 | 212 | $shortcode = '[display-frm-data id=%1$s filter=limited]'; |
213 | 213 | } elseif ( $for === 'form' ) { |
214 | 214 | $item_key = $form_key; |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | continue; |
224 | 224 | } |
225 | 225 | |
226 | - $page_ids[ $for ] = wp_insert_post( |
|
226 | + $page_ids[$for] = wp_insert_post( |
|
227 | 227 | array( |
228 | 228 | 'post_title' => $name, |
229 | 229 | 'post_type' => 'page', |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing |
377 | 377 | $file_type = sanitize_option( 'upload_path', $_FILES['frm_import_file']['name'] ); |
378 | 378 | $file_type = strtolower( pathinfo( $file_type, PATHINFO_EXTENSION ) ); |
379 | - if ( 'xml' !== $file_type && isset( $export_format[ $file_type ] ) ) { |
|
379 | + if ( 'xml' !== $file_type && isset( $export_format[$file_type] ) ) { |
|
380 | 380 | // allow other file types to be imported |
381 | 381 | do_action( 'frm_before_import_' . $file_type ); |
382 | 382 | |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | foreach ( $type as $tb_type ) { |
471 | 471 | $where = array(); |
472 | 472 | $join = ''; |
473 | - $table = $tables[ $tb_type ]; |
|
473 | + $table = $tables[$tb_type]; |
|
474 | 474 | |
475 | 475 | $select = $table . '.id'; |
476 | 476 | $query_vars = array(); |
@@ -485,7 +485,7 @@ discard block |
||
485 | 485 | $table . '.parent_form_id' => $args['ids'], |
486 | 486 | ); |
487 | 487 | } else { |
488 | - $where[ $table . '.status !' ] = 'draft'; |
|
488 | + $where[$table . '.status !'] = 'draft'; |
|
489 | 489 | } |
490 | 490 | break; |
491 | 491 | case 'actions': |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | case 'items': |
499 | 499 | // $join = "INNER JOIN {$wpdb->prefix}frm_item_metas im ON ($table.id = im.item_id)"; |
500 | 500 | if ( $args['ids'] ) { |
501 | - $where[ $table . '.form_id' ] = $args['ids']; |
|
501 | + $where[$table . '.form_id'] = $args['ids']; |
|
502 | 502 | } |
503 | 503 | break; |
504 | 504 | case 'styles': |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | } |
540 | 540 | }//end switch |
541 | 541 | |
542 | - $records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select ); |
|
542 | + $records[$tb_type] = FrmDb::get_col( $table . $join, $where, $select ); |
|
543 | 543 | unset( $tb_type ); |
544 | 544 | }//end foreach |
545 | 545 | |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | $no_export_fields = FrmField::no_save_fields(); |
735 | 735 | foreach ( $csv_fields as $k => $f ) { |
736 | 736 | if ( in_array( $f->type, $no_export_fields, true ) ) { |
737 | - unset( $csv_fields[ $k ] ); |
|
737 | + unset( $csv_fields[$k] ); |
|
738 | 738 | } |
739 | 739 | } |
740 | 740 |
@@ -126,7 +126,8 @@ |
||
126 | 126 | |
127 | 127 | if ( empty( $imported['form_status'] ) ) { |
128 | 128 | // Check for an error message in the XML. |
129 | - if ( isset( $xml->Code ) && isset( $xml->Message ) ) { // phpcs:ignore WordPress.NamingConventions |
|
129 | + if ( isset( $xml->Code ) && isset( $xml->Message ) ) { |
|
130 | +// phpcs:ignore WordPress.NamingConventions |
|
130 | 131 | $imported['error'] = (string) $xml->Message; // phpcs:ignore WordPress.NamingConventions |
131 | 132 | } |
132 | 133 | } |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $content_before_channel_tag, |
93 | 93 | 1 |
94 | 94 | ); |
95 | - $xml_string = $content_before_channel_tag . substr( $xml_string, $channel_start_position ); |
|
95 | + $xml_string = $content_before_channel_tag . substr( $xml_string, $channel_start_position ); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
@@ -176,8 +176,8 @@ discard block |
||
176 | 176 | ); |
177 | 177 | |
178 | 178 | if ( $term && is_array( $term ) ) { |
179 | - ++$imported['imported']['terms']; |
|
180 | - $imported['terms'][ (int) $t->term_id ] = $term['term_id']; |
|
179 | + ++ $imported['imported']['terms']; |
|
180 | + $imported['terms'][(int) $t->term_id] = $term['term_id']; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | unset( $term, $t ); |
@@ -229,11 +229,11 @@ discard block |
||
229 | 229 | if ( $form_id ) { |
230 | 230 | if ( empty( $form['parent_form_id'] ) ) { |
231 | 231 | // Don't include the repeater form in the imported count. |
232 | - ++$imported['imported']['forms']; |
|
232 | + ++ $imported['imported']['forms']; |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | // Keep track of whether this specific form was updated or not. |
236 | - $imported['form_status'][ $form_id ] = 'imported'; |
|
236 | + $imported['form_status'][$form_id] = 'imported'; |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | // Update field ids/keys to new ones. |
249 | 249 | do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) ); |
250 | 250 | |
251 | - $imported['forms'][ (int) $item->id ] = $form_id; |
|
251 | + $imported['forms'][(int) $item->id] = $form_id; |
|
252 | 252 | |
253 | 253 | // Send pre 2.0 form options through function that creates actions. |
254 | 254 | self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true ); |
@@ -318,19 +318,19 @@ discard block |
||
318 | 318 | FrmForm::update( $form_id, $form ); |
319 | 319 | if ( empty( $form['parent_form_id'] ) ) { |
320 | 320 | // Don't include the repeater form in the updated count. |
321 | - ++$imported['updated']['forms']; |
|
321 | + ++ $imported['updated']['forms']; |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | // Keep track of whether this specific form was updated or not |
325 | - $imported['form_status'][ $form_id ] = 'updated'; |
|
325 | + $imported['form_status'][$form_id] = 'updated'; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | private static function get_form_fields( $form_id ) { |
329 | 329 | $form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' ); |
330 | 330 | $old_fields = array(); |
331 | 331 | foreach ( $form_fields as $f ) { |
332 | - $old_fields[ $f->id ] = $f; |
|
333 | - $old_fields[ $f->field_key ] = $f->id; |
|
332 | + $old_fields[$f->id] = $f; |
|
333 | + $old_fields[$f->field_key] = $f->id; |
|
334 | 334 | unset( $f ); |
335 | 335 | } |
336 | 336 | $form_fields = $old_fields; |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | */ |
388 | 388 | private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) { |
389 | 389 | if ( $parent_form_id ) { |
390 | - $child_forms[ $form_id ] = $parent_form_id; |
|
390 | + $child_forms[$form_id] = $parent_form_id; |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | |
@@ -402,9 +402,9 @@ discard block |
||
402 | 402 | */ |
403 | 403 | private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) { |
404 | 404 | foreach ( $child_forms as $child_form_id => $old_parent_form_id ) { |
405 | - if ( isset( $imported_forms[ $old_parent_form_id ] ) && (int) $imported_forms[ $old_parent_form_id ] !== (int) $old_parent_form_id ) { |
|
405 | + if ( isset( $imported_forms[$old_parent_form_id] ) && (int) $imported_forms[$old_parent_form_id] !== (int) $old_parent_form_id ) { |
|
406 | 406 | // Update all children with this old parent_form_id |
407 | - $new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ]; |
|
407 | + $new_parent_form_id = (int) $imported_forms[$old_parent_form_id]; |
|
408 | 408 | FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) ); |
409 | 409 | do_action( 'frm_update_child_form_parent_id', $child_form_id, $new_parent_form_id ); |
410 | 410 | } |
@@ -434,34 +434,34 @@ discard block |
||
434 | 434 | |
435 | 435 | if ( ! empty( $this_form ) ) { |
436 | 436 | // check for field to edit by field id |
437 | - if ( isset( $form_fields[ $f['id'] ] ) ) { |
|
437 | + if ( isset( $form_fields[$f['id']] ) ) { |
|
438 | 438 | FrmField::update( $f['id'], $f ); |
439 | - ++$imported['updated']['fields']; |
|
439 | + ++ $imported['updated']['fields']; |
|
440 | 440 | |
441 | - unset( $form_fields[ $f['id'] ] ); |
|
441 | + unset( $form_fields[$f['id']] ); |
|
442 | 442 | |
443 | 443 | // Unset old field key. |
444 | - if ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
445 | - unset( $form_fields[ $f['field_key'] ] ); |
|
444 | + if ( isset( $form_fields[$f['field_key']] ) ) { |
|
445 | + unset( $form_fields[$f['field_key']] ); |
|
446 | 446 | } |
447 | - } elseif ( isset( $form_fields[ $f['field_key'] ] ) ) { |
|
448 | - $keys_by_original_field_id[ $f['id'] ] = $f['field_key']; |
|
447 | + } elseif ( isset( $form_fields[$f['field_key']] ) ) { |
|
448 | + $keys_by_original_field_id[$f['id']] = $f['field_key']; |
|
449 | 449 | |
450 | 450 | $old_field_id = $f['id']; |
451 | 451 | |
452 | 452 | // check for field to edit by field key |
453 | 453 | unset( $f['id'] ); |
454 | 454 | |
455 | - FrmField::update( $form_fields[ $f['field_key'] ], $f ); |
|
456 | - ++$imported['updated']['fields']; |
|
455 | + FrmField::update( $form_fields[$f['field_key']], $f ); |
|
456 | + ++ $imported['updated']['fields']; |
|
457 | 457 | |
458 | 458 | self::do_after_field_imported_action( $f, $form_fields, $old_field_id ); |
459 | 459 | |
460 | 460 | // Unset old field id. |
461 | - unset( $form_fields[ $form_fields[ $f['field_key'] ] ] ); |
|
461 | + unset( $form_fields[$form_fields[$f['field_key']]] ); |
|
462 | 462 | |
463 | 463 | // Unset old field key. |
464 | - unset( $form_fields[ $f['field_key'] ] ); |
|
464 | + unset( $form_fields[$f['field_key']] ); |
|
465 | 465 | } else { |
466 | 466 | // If no matching field id or key in this form, create the field. |
467 | 467 | self::create_imported_field( $f, $imported ); |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | */ |
502 | 502 | private static function do_after_field_imported_action( $field_array, $form_fields, $old_field_id ) { |
503 | 503 | // Assign field array the update field's ID. |
504 | - $field_array['id'] = $form_fields[ $field_array['field_key'] ]; |
|
504 | + $field_array['id'] = $form_fields[$field_array['field_key']]; |
|
505 | 505 | |
506 | 506 | /** |
507 | 507 | * Fires when an existing field is imported. |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | * @param int $field_id |
513 | 513 | * @param int $old_field_id |
514 | 514 | */ |
515 | - do_action( 'frm_after_existing_field_is_imported', $field_array, $form_fields[ $field_array['field_key'] ], $old_field_id ); |
|
515 | + do_action( 'frm_after_existing_field_is_imported', $field_array, $form_fields[$field_array['field_key']], $old_field_id ); |
|
516 | 516 | } |
517 | 517 | |
518 | 518 | private static function fill_field( $field, $form_id ) { |
@@ -608,8 +608,8 @@ discard block |
||
608 | 608 | if ( $f['type'] === 'form' || ( $f['type'] === 'divider' && FrmField::is_option_true( $f['field_options'], 'repeat' ) ) ) { |
609 | 609 | if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) { |
610 | 610 | $form_select = (int) $f['field_options']['form_select']; |
611 | - if ( isset( $imported['forms'][ $form_select ] ) ) { |
|
612 | - $f['field_options']['form_select'] = $imported['forms'][ $form_select ]; |
|
611 | + if ( isset( $imported['forms'][$form_select] ) ) { |
|
612 | + $f['field_options']['form_select'] = $imported['forms'][$form_select]; |
|
613 | 613 | } |
614 | 614 | } |
615 | 615 | } |
@@ -630,8 +630,8 @@ discard block |
||
630 | 630 | |
631 | 631 | if ( FrmField::is_option_true_in_array( $f['field_options'], 'get_values_form' ) ) { |
632 | 632 | $old_form = $f['field_options']['get_values_form']; |
633 | - if ( isset( $imported['forms'][ $old_form ] ) ) { |
|
634 | - $f['field_options']['get_values_form'] = $imported['forms'][ $old_form ]; |
|
633 | + if ( isset( $imported['forms'][$old_form] ) ) { |
|
634 | + $f['field_options']['get_values_form'] = $imported['forms'][$old_form]; |
|
635 | 635 | } |
636 | 636 | } |
637 | 637 | } |
@@ -652,12 +652,12 @@ discard block |
||
652 | 652 | private static function migrate_placeholders( &$f ) { |
653 | 653 | $update_values = self::migrate_field_placeholder( $f, 'clear_on_focus' ); |
654 | 654 | foreach ( $update_values as $k => $v ) { |
655 | - $f[ $k ] = $v; |
|
655 | + $f[$k] = $v; |
|
656 | 656 | } |
657 | 657 | |
658 | 658 | $update_values = self::migrate_field_placeholder( $f, 'default_blank' ); |
659 | 659 | foreach ( $update_values as $k => $v ) { |
660 | - $f[ $k ] = $v; |
|
660 | + $f[$k] = $v; |
|
661 | 661 | } |
662 | 662 | } |
663 | 663 | |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | public static function migrate_field_placeholder( $field, $type ) { |
672 | 672 | $field = (array) $field; |
673 | 673 | $field_options = $field['field_options']; |
674 | - if ( empty( $field_options[ $type ] ) || empty( $field['default_value'] ) ) { |
|
674 | + if ( empty( $field_options[$type] ) || empty( $field['default_value'] ) ) { |
|
675 | 675 | return array(); |
676 | 676 | } |
677 | 677 | |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | } |
698 | 698 | |
699 | 699 | if ( $opt == $default_value ) { |
700 | - unset( $options[ $opt_key ] ); |
|
700 | + unset( $options[$opt_key] ); |
|
701 | 701 | break; |
702 | 702 | } |
703 | 703 | } |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | |
725 | 725 | $new_id = FrmField::create( $f ); |
726 | 726 | if ( $new_id != false ) { |
727 | - ++$imported['imported']['fields']; |
|
727 | + ++ $imported['imported']['fields']; |
|
728 | 728 | do_action( 'frm_after_field_is_imported', $f, $new_id ); |
729 | 729 | } |
730 | 730 | } |
@@ -753,10 +753,10 @@ discard block |
||
753 | 753 | |
754 | 754 | $image_id = FrmProFileImport::import_attachment( $option['src'], $field_object ); |
755 | 755 | // Remove the src from options as it isn't required after import. |
756 | - unset( $field['options'][ $key ]['src'] ); |
|
756 | + unset( $field['options'][$key]['src'] ); |
|
757 | 757 | |
758 | 758 | if ( is_numeric( $image_id ) ) { |
759 | - $field['options'][ $key ]['image'] = $image_id; |
|
759 | + $field['options'][$key]['image'] = $image_id; |
|
760 | 760 | } |
761 | 761 | } |
762 | 762 | |
@@ -924,8 +924,8 @@ discard block |
||
924 | 924 | } else { |
925 | 925 | if ( $post['post_type'] === 'frm_display' ) { |
926 | 926 | $post['post_content'] = self::maybe_prepare_json_view_content( $post['post_content'] ); |
927 | - } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][ $post['post_parent'] ] ) ) { |
|
928 | - $post['post_parent'] = $imported['posts'][ $post['post_parent'] ]; |
|
927 | + } elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][$post['post_parent']] ) ) { |
|
928 | + $post['post_parent'] = $imported['posts'][$post['post_parent']]; |
|
929 | 929 | } |
930 | 930 | // Create/update post now |
931 | 931 | $post_id = wp_insert_post( $post ); |
@@ -936,27 +936,27 @@ discard block |
||
936 | 936 | } |
937 | 937 | |
938 | 938 | if ( false !== strpos( $post['post_content'], '[display-frm-data' ) || false !== strpos( $post['post_content'], '[formidable' ) ) { |
939 | - $posts_with_shortcodes[ $post_id ] = $post; |
|
939 | + $posts_with_shortcodes[$post_id] = $post; |
|
940 | 940 | } |
941 | 941 | |
942 | 942 | self::update_postmeta( $post, $post_id ); |
943 | 943 | self::update_layout( $post, $post_id ); |
944 | 944 | |
945 | 945 | $this_type = 'posts'; |
946 | - if ( isset( $post_types[ $post['post_type'] ] ) ) { |
|
947 | - $this_type = $post_types[ $post['post_type'] ]; |
|
946 | + if ( isset( $post_types[$post['post_type']] ) ) { |
|
947 | + $this_type = $post_types[$post['post_type']]; |
|
948 | 948 | } |
949 | 949 | |
950 | 950 | if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) { |
951 | - ++$imported['updated'][ $this_type ]; |
|
951 | + ++ $imported['updated'][$this_type]; |
|
952 | 952 | } else { |
953 | - ++$imported['imported'][ $this_type ]; |
|
953 | + ++ $imported['imported'][$this_type]; |
|
954 | 954 | } |
955 | 955 | |
956 | - $imported['posts'][ $old_id ] = $post_id; |
|
956 | + $imported['posts'][$old_id] = $post_id; |
|
957 | 957 | |
958 | 958 | if ( $post['post_type'] === 'frm_display' ) { |
959 | - $view_ids[ $old_id ] = $post_id; |
|
959 | + $view_ids[$old_id] = $post_id; |
|
960 | 960 | } |
961 | 961 | |
962 | 962 | do_action( 'frm_after_import_view', $post_id, $post ); |
@@ -1117,9 +1117,9 @@ discard block |
||
1117 | 1117 | $post['attachment_url'] = (string) $item->attachment_url; |
1118 | 1118 | } |
1119 | 1119 | |
1120 | - if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) { |
|
1120 | + if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) { |
|
1121 | 1121 | // update to new form id |
1122 | - $post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ]; |
|
1122 | + $post['menu_order'] = $imported['forms'][(int) $post['menu_order']]; |
|
1123 | 1123 | } |
1124 | 1124 | |
1125 | 1125 | // Don't allow default styles to take over a site's default style |
@@ -1156,8 +1156,8 @@ discard block |
||
1156 | 1156 | ); |
1157 | 1157 | |
1158 | 1158 | // Switch old form and field ids to new ones. |
1159 | - if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][ (int) $m['value'] ] ) ) { |
|
1160 | - $m['value'] = $imported['forms'][ (int) $m['value'] ]; |
|
1159 | + if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][(int) $m['value']] ) ) { |
|
1160 | + $m['value'] = $imported['forms'][(int) $m['value']]; |
|
1161 | 1161 | } else { |
1162 | 1162 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
1163 | 1163 | |
@@ -1168,15 +1168,15 @@ discard block |
||
1168 | 1168 | } elseif ( 'frm_options' === $m['key'] ) { |
1169 | 1169 | |
1170 | 1170 | foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) { |
1171 | - if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) { |
|
1172 | - $m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ]; |
|
1171 | + if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) { |
|
1172 | + $m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]]; |
|
1173 | 1173 | } |
1174 | 1174 | } |
1175 | 1175 | |
1176 | 1176 | $check_dup_array = array(); |
1177 | 1177 | if ( ! empty( $m['value']['order_by'] ) ) { |
1178 | - if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) { |
|
1179 | - $m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ]; |
|
1178 | + if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) { |
|
1179 | + $m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']]; |
|
1180 | 1180 | } elseif ( is_array( $m['value']['order_by'] ) ) { |
1181 | 1181 | $check_dup_array[] = 'order_by'; |
1182 | 1182 | } |
@@ -1187,9 +1187,9 @@ discard block |
||
1187 | 1187 | } |
1188 | 1188 | |
1189 | 1189 | foreach ( $check_dup_array as $check_k ) { |
1190 | - foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) { |
|
1191 | - if ( isset( $frm_duplicate_ids[ $mv ] ) ) { |
|
1192 | - $m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ]; |
|
1190 | + foreach ( (array) $m['value'][$check_k] as $mk => $mv ) { |
|
1191 | + if ( isset( $frm_duplicate_ids[$mv] ) ) { |
|
1192 | + $m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv]; |
|
1193 | 1193 | } |
1194 | 1194 | unset( $mk, $mv ); |
1195 | 1195 | } |
@@ -1202,11 +1202,11 @@ discard block |
||
1202 | 1202 | $m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] ); |
1203 | 1203 | } |
1204 | 1204 | |
1205 | - $post['postmeta'][ (string) $meta->meta_key ] = $m['value']; |
|
1205 | + $post['postmeta'][(string) $meta->meta_key] = $m['value']; |
|
1206 | 1206 | } |
1207 | 1207 | |
1208 | 1208 | private static function populate_layout( &$post, $layout ) { |
1209 | - $post['layout'][ (string) $layout->type ] = (string) $layout->data; |
|
1209 | + $post['layout'][(string) $layout->type] = (string) $layout->data; |
|
1210 | 1210 | } |
1211 | 1211 | |
1212 | 1212 | /** |
@@ -1234,11 +1234,11 @@ discard block |
||
1234 | 1234 | $name = (string) $c; |
1235 | 1235 | } |
1236 | 1236 | |
1237 | - if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) { |
|
1238 | - $post['tax_input'][ $taxonomy ] = array(); |
|
1237 | + if ( ! isset( $post['tax_input'][$taxonomy] ) ) { |
|
1238 | + $post['tax_input'][$taxonomy] = array(); |
|
1239 | 1239 | } |
1240 | 1240 | |
1241 | - $post['tax_input'][ $taxonomy ][] = $name; |
|
1241 | + $post['tax_input'][$taxonomy][] = $name; |
|
1242 | 1242 | unset( $name ); |
1243 | 1243 | }//end foreach |
1244 | 1244 | } |
@@ -1378,7 +1378,7 @@ discard block |
||
1378 | 1378 | |
1379 | 1379 | $message = '<ul>'; |
1380 | 1380 | foreach ( $result as $type => $results ) { |
1381 | - if ( ! isset( $t_strings[ $type ] ) ) { |
|
1381 | + if ( ! isset( $t_strings[$type] ) ) { |
|
1382 | 1382 | // only print imported and updated |
1383 | 1383 | continue; |
1384 | 1384 | } |
@@ -1390,7 +1390,7 @@ discard block |
||
1390 | 1390 | } |
1391 | 1391 | |
1392 | 1392 | if ( ! empty( $s_message ) ) { |
1393 | - $message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> '; |
|
1393 | + $message .= '<li><strong>' . $t_strings[$type] . ':</strong> '; |
|
1394 | 1394 | $message .= implode( ', ', $s_message ); |
1395 | 1395 | $message .= '</li>'; |
1396 | 1396 | } |
@@ -1442,8 +1442,8 @@ discard block |
||
1442 | 1442 | 'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ), |
1443 | 1443 | ); |
1444 | 1444 | |
1445 | - if ( isset( $strings[ $type ] ) ) { |
|
1446 | - $s_message[] = $strings[ $type ]; |
|
1445 | + if ( isset( $strings[$type] ) ) { |
|
1446 | + $s_message[] = $strings[$type]; |
|
1447 | 1447 | } else { |
1448 | 1448 | $string = ' ' . $m . ' ' . ucfirst( $type ); |
1449 | 1449 | |
@@ -1591,7 +1591,7 @@ discard block |
||
1591 | 1591 | |
1592 | 1592 | foreach ( $options as $key => $option ) { |
1593 | 1593 | if ( is_array( $option ) && ! empty( $option['image'] ) ) { |
1594 | - $options[ $key ]['src'] = wp_get_attachment_url( $option['image'] ); |
|
1594 | + $options[$key]['src'] = wp_get_attachment_url( $option['image'] ); |
|
1595 | 1595 | $updated = true; |
1596 | 1596 | } |
1597 | 1597 | } |
@@ -1620,8 +1620,8 @@ discard block |
||
1620 | 1620 | */ |
1621 | 1621 | private static function remove_defaults( $defaults, &$saved ) { |
1622 | 1622 | foreach ( $saved as $key => $value ) { |
1623 | - if ( isset( $defaults[ $key ] ) && $defaults[ $key ] === $value ) { |
|
1624 | - unset( $saved[ $key ] ); |
|
1623 | + if ( isset( $defaults[$key] ) && $defaults[$key] === $value ) { |
|
1624 | + unset( $saved[$key] ); |
|
1625 | 1625 | } |
1626 | 1626 | } |
1627 | 1627 | } |
@@ -1632,14 +1632,14 @@ discard block |
||
1632 | 1632 | * @since 3.06 |
1633 | 1633 | */ |
1634 | 1634 | private static function remove_default_html( $html_name, $defaults, &$options ) { |
1635 | - if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) { |
|
1635 | + if ( ! isset( $options[$html_name] ) || ! isset( $defaults[$html_name] ) ) { |
|
1636 | 1636 | return; |
1637 | 1637 | } |
1638 | 1638 | |
1639 | - $old_html = str_replace( "\r\n", "\n", $options[ $html_name ] ); |
|
1640 | - $default_html = $defaults[ $html_name ]; |
|
1639 | + $old_html = str_replace( "\r\n", "\n", $options[$html_name] ); |
|
1640 | + $default_html = $defaults[$html_name]; |
|
1641 | 1641 | if ( $old_html == $default_html ) { |
1642 | - unset( $options[ $html_name ] ); |
|
1642 | + unset( $options[$html_name] ); |
|
1643 | 1643 | |
1644 | 1644 | return; |
1645 | 1645 | } |
@@ -1647,7 +1647,7 @@ discard block |
||
1647 | 1647 | // Account for some of the older field default HTML. |
1648 | 1648 | $default_html = str_replace( ' id="frm_desc_field_[key]"', '', $default_html ); |
1649 | 1649 | if ( $old_html == $default_html ) { |
1650 | - unset( $options[ $html_name ] ); |
|
1650 | + unset( $options[$html_name] ); |
|
1651 | 1651 | } |
1652 | 1652 | } |
1653 | 1653 | |
@@ -1738,8 +1738,8 @@ discard block |
||
1738 | 1738 | ); |
1739 | 1739 | |
1740 | 1740 | foreach ( $post_settings as $post_setting ) { |
1741 | - if ( isset( $form_options[ $post_setting ] ) ) { |
|
1742 | - $new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ]; |
|
1741 | + if ( isset( $form_options[$post_setting] ) ) { |
|
1742 | + $new_action['post_content'][$post_setting] = $form_options[$post_setting]; |
|
1743 | 1743 | } |
1744 | 1744 | unset( $post_setting ); |
1745 | 1745 | } |
@@ -1777,7 +1777,7 @@ discard block |
||
1777 | 1777 | if ( ! $exists ) { |
1778 | 1778 | // this isn't an email, but we need to use a class that will always be included |
1779 | 1779 | FrmDb::save_json_post( $new_action ); |
1780 | - ++$imported['imported']['actions']; |
|
1780 | + ++ $imported['imported']['actions']; |
|
1781 | 1781 | } |
1782 | 1782 | } |
1783 | 1783 | |
@@ -1810,11 +1810,11 @@ discard block |
||
1810 | 1810 | foreach ( $post_content as $key => $setting ) { |
1811 | 1811 | if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) { |
1812 | 1812 | // Replace old IDs with new IDs |
1813 | - $post_content[ $key ] = str_replace( $old, $new, $setting ); |
|
1813 | + $post_content[$key] = str_replace( $old, $new, $setting ); |
|
1814 | 1814 | } elseif ( is_array( $setting ) && in_array( $key, $array_fields ) ) { |
1815 | 1815 | foreach ( $setting as $k => $val ) { |
1816 | 1816 | // Replace old IDs with new IDs |
1817 | - $post_content[ $key ][ $k ] = str_replace( $old, $new, $val ); |
|
1817 | + $post_content[$key][$k] = str_replace( $old, $new, $val ); |
|
1818 | 1818 | } |
1819 | 1819 | } |
1820 | 1820 | unset( $key, $setting ); |
@@ -1871,7 +1871,7 @@ discard block |
||
1871 | 1871 | |
1872 | 1872 | if ( empty( $exists ) ) { |
1873 | 1873 | FrmDb::save_json_post( $new_notification ); |
1874 | - ++$imported['imported']['actions']; |
|
1874 | + ++ $imported['imported']['actions']; |
|
1875 | 1875 | } |
1876 | 1876 | unset( $new_notification ); |
1877 | 1877 | }//end foreach |
@@ -1890,8 +1890,8 @@ discard block |
||
1890 | 1890 | private static function remove_deprecated_notification_settings( $form_id, $form_options ) { |
1891 | 1891 | $delete_settings = array( 'notification', 'autoresponder', 'email_to' ); |
1892 | 1892 | foreach ( $delete_settings as $index ) { |
1893 | - if ( isset( $form_options[ $index ] ) ) { |
|
1894 | - unset( $form_options[ $index ] ); |
|
1893 | + if ( isset( $form_options[$index] ) ) { |
|
1894 | + unset( $form_options[$index] ); |
|
1895 | 1895 | } |
1896 | 1896 | } |
1897 | 1897 | FrmForm::update( $form_id, array( 'options' => $form_options ) ); |
@@ -1944,12 +1944,12 @@ discard block |
||
1944 | 1944 | 'reply_to_name' => '', |
1945 | 1945 | ); |
1946 | 1946 | foreach ( $reply_fields as $f => $val ) { |
1947 | - if ( isset( $notification[ $f ] ) ) { |
|
1948 | - $atts[ $f ] = $notification[ $f ]; |
|
1949 | - if ( 'custom' == $notification[ $f ] ) { |
|
1950 | - $atts[ $f ] = $notification[ 'cust_' . $f ]; |
|
1951 | - } elseif ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) { |
|
1952 | - $atts[ $f ] = '[' . $atts[ $f ] . ']'; |
|
1947 | + if ( isset( $notification[$f] ) ) { |
|
1948 | + $atts[$f] = $notification[$f]; |
|
1949 | + if ( 'custom' == $notification[$f] ) { |
|
1950 | + $atts[$f] = $notification['cust_' . $f]; |
|
1951 | + } elseif ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) { |
|
1952 | + $atts[$f] = '[' . $atts[$f] . ']'; |
|
1953 | 1953 | } |
1954 | 1954 | } |
1955 | 1955 | unset( $f, $val ); |
@@ -1980,13 +1980,13 @@ discard block |
||
1980 | 1980 | foreach ( $atts['email_to'] as $key => $email_field ) { |
1981 | 1981 | |
1982 | 1982 | if ( is_numeric( $email_field ) ) { |
1983 | - $atts['email_to'][ $key ] = '[' . $email_field . ']'; |
|
1983 | + $atts['email_to'][$key] = '[' . $email_field . ']'; |
|
1984 | 1984 | } |
1985 | 1985 | |
1986 | 1986 | if ( strpos( $email_field, '|' ) ) { |
1987 | 1987 | $email_opt = explode( '|', $email_field ); |
1988 | 1988 | if ( isset( $email_opt[0] ) ) { |
1989 | - $atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
1989 | + $atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
1990 | 1990 | } |
1991 | 1991 | unset( $email_opt ); |
1992 | 1992 | } |
@@ -2007,12 +2007,12 @@ discard block |
||
2007 | 2007 | // Add more fields to the new notification |
2008 | 2008 | $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' ); |
2009 | 2009 | foreach ( $add_fields as $add_field ) { |
2010 | - if ( isset( $notification[ $add_field ] ) ) { |
|
2011 | - $new_notification['post_content'][ $add_field ] = $notification[ $add_field ]; |
|
2010 | + if ( isset( $notification[$add_field] ) ) { |
|
2011 | + $new_notification['post_content'][$add_field] = $notification[$add_field]; |
|
2012 | 2012 | } elseif ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) { |
2013 | - $new_notification['post_content'][ $add_field ] = 0; |
|
2013 | + $new_notification['post_content'][$add_field] = 0; |
|
2014 | 2014 | } else { |
2015 | - $new_notification['post_content'][ $add_field ] = ''; |
|
2015 | + $new_notification['post_content'][$add_field] = ''; |
|
2016 | 2016 | } |
2017 | 2017 | unset( $add_field ); |
2018 | 2018 | } |
@@ -2036,7 +2036,7 @@ discard block |
||
2036 | 2036 | if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) { |
2037 | 2037 | foreach ( $post_content['conditions'] as $email_key => $val ) { |
2038 | 2038 | if ( is_numeric( $email_key ) ) { |
2039 | - $post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
2039 | + $post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
2040 | 2040 | } |
2041 | 2041 | unset( $email_key, $val ); |
2042 | 2042 | } |