@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $this->beta = ! empty( $this->api_data['beta'] ) ? true : false; |
45 | 45 | $this->cache_key = md5( serialize( $this->slug . $this->version . $this->api_data['license'] . $this->beta ) ); |
46 | 46 | |
47 | - $frm_edd_plugin_data[ $this->slug ] = $this->api_data; |
|
47 | + $frm_edd_plugin_data[$this->slug] = $this->api_data; |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Fires after the $frm_edd_plugin_data is setup. |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | $_transient_data = new stdClass(); |
94 | 94 | } |
95 | 95 | |
96 | - if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) { |
|
96 | + if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[$this->name] ) && false === $this->wp_override ) { |
|
97 | 97 | return $_transient_data; |
98 | 98 | } |
99 | 99 | |
@@ -120,12 +120,12 @@ discard block |
||
120 | 120 | $version_info->plugin = $this->name; |
121 | 121 | } |
122 | 122 | |
123 | - $_transient_data->response[ $this->name ] = $version_info; |
|
123 | + $_transient_data->response[$this->name] = $version_info; |
|
124 | 124 | |
125 | 125 | } |
126 | 126 | |
127 | 127 | $_transient_data->last_checked = time(); |
128 | - $_transient_data->checked[ $this->name ] = $this->version; |
|
128 | + $_transient_data->checked[$this->name] = $this->version; |
|
129 | 129 | |
130 | 130 | } |
131 | 131 | |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) { |
190 | 190 | $new_sections = array(); |
191 | 191 | foreach ( $_data->sections as $key => $value ) { |
192 | - $new_sections[ $key ] = $value; |
|
192 | + $new_sections[$key] = $value; |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | $_data->sections = $new_sections; |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) { |
200 | 200 | $new_banners = array(); |
201 | 201 | foreach ( $_data->banners as $key => $value ) { |
202 | - $new_banners[ $key ] = $value; |
|
202 | + $new_banners[$key] = $value; |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | $_data->banners = $new_banners; |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | } |
317 | 317 | |
318 | 318 | $slug = sanitize_text_field( $_REQUEST['slug'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
319 | - $data = $frm_edd_plugin_data[ $slug ]; |
|
319 | + $data = $frm_edd_plugin_data[$slug]; |
|
320 | 320 | $beta = ! empty( $data['beta'] ) ? true : false; |
321 | 321 | $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
322 | 322 | $version_info = $this->get_cached_version_info( $cache_key ); |
@@ -303,11 +303,13 @@ |
||
303 | 303 | |
304 | 304 | global $frm_edd_plugin_data; |
305 | 305 | |
306 | - if ( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' !== $_REQUEST['edd_sl_action'] ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
306 | + if ( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' !== $_REQUEST['edd_sl_action'] ) { |
|
307 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
307 | 308 | return; |
308 | 309 | } |
309 | 310 | |
310 | - if ( empty( $_REQUEST['plugin'] ) || empty( $_REQUEST['slug'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
311 | + if ( empty( $_REQUEST['plugin'] ) || empty( $_REQUEST['slug'] ) ) { |
|
312 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
311 | 313 | return; |
312 | 314 | } |
313 | 315 |
@@ -42,7 +42,8 @@ |
||
42 | 42 | } |
43 | 43 | |
44 | 44 | // Only do this for single site installs. |
45 | - if ( isset( $_GET['activate-multi'] ) || is_network_admin() ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
45 | + if ( isset( $_GET['activate-multi'] ) || is_network_admin() ) { |
|
46 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
46 | 47 | return; |
47 | 48 | } |
48 | 49 |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function add_settings( $sections ) { |
185 | 185 | wp_enqueue_style( 'formidable-pro-fields' ); |
186 | - $sections[ $this->plugin_slug ] = array( |
|
186 | + $sections[$this->plugin_slug] = array( |
|
187 | 187 | 'class' => $this, |
188 | 188 | 'function' => 'settings_page', |
189 | 189 | 'name' => $this->plugin_name(), |
@@ -349,9 +349,9 @@ discard block |
||
349 | 349 | // Set the current step. |
350 | 350 | if ( ! isset( $step['current'] ) ) { |
351 | 351 | if ( $step['complete'] ) { |
352 | - $steps[ $k ]['current'] = false; |
|
352 | + $steps[$k]['current'] = false; |
|
353 | 353 | } else { |
354 | - $steps[ $k ]['current'] = ! $has_current; |
|
354 | + $steps[$k]['current'] = ! $has_current; |
|
355 | 355 | $has_current = true; |
356 | 356 | } |
357 | 357 | } elseif ( $step['current'] ) { |
@@ -361,10 +361,10 @@ discard block |
||
361 | 361 | // Set disabled buttons. |
362 | 362 | $class = isset( $step['button_class'] ) ? $step['button_class'] : ''; |
363 | 363 | $class .= ' button-primary frm-button-primary'; |
364 | - if ( ! $steps[ $k ]['current'] ) { |
|
364 | + if ( ! $steps[$k]['current'] ) { |
|
365 | 365 | $class .= ' frm_grey disabled'; |
366 | 366 | } |
367 | - $steps[ $k ]['button_class'] = $class; |
|
367 | + $steps[$k]['button_class'] = $class; |
|
368 | 368 | }//end foreach |
369 | 369 | |
370 | 370 | return $steps; |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | $addons = $api->get_api_info(); |
520 | 520 | |
521 | 521 | $id = $this->download_id(); |
522 | - $has_file = isset( $addons[ $id ] ) && isset( $addons[ $id ]['beta'] ); |
|
522 | + $has_file = isset( $addons[$id] ) && isset( $addons[$id]['beta'] ); |
|
523 | 523 | |
524 | 524 | if ( ! $step['current'] ) { |
525 | 525 | ?> |
@@ -534,10 +534,10 @@ discard block |
||
534 | 534 | |
535 | 535 | if ( ! $has_file ) { |
536 | 536 | echo '<p class="frm_error_style">' . esc_html__( 'We didn\'t find anything to import. Please contact our team.', 'formidable' ) . '</p>'; |
537 | - } elseif ( ! isset( $addons[ $id ]['beta']['package'] ) ) { |
|
537 | + } elseif ( ! isset( $addons[$id]['beta']['package'] ) ) { |
|
538 | 538 | echo '<p class="frm_error_style">' . esc_html__( 'Looks like you may not have a current subscription for this solution. Please check your account.', 'formidable' ) . '</p>'; |
539 | 539 | } else { |
540 | - $xml = $addons[ $id ]['beta']['package']; |
|
540 | + $xml = $addons[$id]['beta']['package']; |
|
541 | 541 | if ( is_array( $xml ) ) { |
542 | 542 | $xml = reset( $xml ); |
543 | 543 | } |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | foreach ( $options as $info ) { |
615 | 615 | // Count the number of options displayed for css. |
616 | 616 | if ( $count > 1 && ! isset( $info['img'] ) ) { |
617 | - --$count; |
|
617 | + -- $count; |
|
618 | 618 | } |
619 | 619 | } |
620 | 620 | $width = floor( ( 533 - ( ( $count - 1 ) * 20 ) ) / $count ); |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | foreach ( $forms as $form ) { |
705 | 705 | $was_imported = isset( $form['form'] ) ? FrmForm::get_id_by_key( $form['form'] ) : false; |
706 | 706 | if ( $was_imported ) { |
707 | - $imported[ $form['form'] ] = $was_imported; |
|
707 | + $imported[$form['form']] = $was_imported; |
|
708 | 708 | } |
709 | 709 | } |
710 | 710 |
@@ -749,8 +749,8 @@ discard block |
||
749 | 749 | */ |
750 | 750 | public static function get_shortcode_tag( $shortcodes, $short_key, $args ) { |
751 | 751 | _deprecated_function( __FUNCTION__, '3.0', 'FrmShortcodeHelper::get_shortcode_tag' ); |
752 | - return FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key, $args ); |
|
753 | - } |
|
752 | + return FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key, $args ); |
|
753 | + } |
|
754 | 754 | |
755 | 755 | /** |
756 | 756 | * @deprecated 3.01 |
@@ -763,52 +763,52 @@ discard block |
||
763 | 763 | /** |
764 | 764 | * @deprecated 3.02.03 |
765 | 765 | */ |
766 | - public static function jquery_themes() { |
|
766 | + public static function jquery_themes() { |
|
767 | 767 | _deprecated_function( __FUNCTION__, '3.02.03', 'FrmProStylesController::jquery_themes' ); |
768 | 768 | |
769 | - $themes = array( |
|
770 | - 'ui-lightness' => 'UI Lightness', |
|
771 | - 'ui-darkness' => 'UI Darkness', |
|
772 | - 'smoothness' => 'Smoothness', |
|
773 | - 'start' => 'Start', |
|
774 | - 'redmond' => 'Redmond', |
|
775 | - 'sunny' => 'Sunny', |
|
776 | - 'overcast' => 'Overcast', |
|
777 | - 'le-frog' => 'Le Frog', |
|
778 | - 'flick' => 'Flick', |
|
769 | + $themes = array( |
|
770 | + 'ui-lightness' => 'UI Lightness', |
|
771 | + 'ui-darkness' => 'UI Darkness', |
|
772 | + 'smoothness' => 'Smoothness', |
|
773 | + 'start' => 'Start', |
|
774 | + 'redmond' => 'Redmond', |
|
775 | + 'sunny' => 'Sunny', |
|
776 | + 'overcast' => 'Overcast', |
|
777 | + 'le-frog' => 'Le Frog', |
|
778 | + 'flick' => 'Flick', |
|
779 | 779 | 'pepper-grinder' => 'Pepper Grinder', |
780 | - 'eggplant' => 'Eggplant', |
|
781 | - 'dark-hive' => 'Dark Hive', |
|
782 | - 'cupertino' => 'Cupertino', |
|
783 | - 'south-street' => 'South Street', |
|
784 | - 'blitzer' => 'Blitzer', |
|
785 | - 'humanity' => 'Humanity', |
|
786 | - 'hot-sneaks' => 'Hot Sneaks', |
|
787 | - 'excite-bike' => 'Excite Bike', |
|
788 | - 'vader' => 'Vader', |
|
789 | - 'dot-luv' => 'Dot Luv', |
|
790 | - 'mint-choc' => 'Mint Choc', |
|
791 | - 'black-tie' => 'Black Tie', |
|
792 | - 'trontastic' => 'Trontastic', |
|
793 | - 'swanky-purse' => 'Swanky Purse', |
|
794 | - ); |
|
780 | + 'eggplant' => 'Eggplant', |
|
781 | + 'dark-hive' => 'Dark Hive', |
|
782 | + 'cupertino' => 'Cupertino', |
|
783 | + 'south-street' => 'South Street', |
|
784 | + 'blitzer' => 'Blitzer', |
|
785 | + 'humanity' => 'Humanity', |
|
786 | + 'hot-sneaks' => 'Hot Sneaks', |
|
787 | + 'excite-bike' => 'Excite Bike', |
|
788 | + 'vader' => 'Vader', |
|
789 | + 'dot-luv' => 'Dot Luv', |
|
790 | + 'mint-choc' => 'Mint Choc', |
|
791 | + 'black-tie' => 'Black Tie', |
|
792 | + 'trontastic' => 'Trontastic', |
|
793 | + 'swanky-purse' => 'Swanky Purse', |
|
794 | + ); |
|
795 | 795 | |
796 | 796 | $themes = apply_filters( 'frm_jquery_themes', $themes ); |
797 | - return $themes; |
|
798 | - } |
|
797 | + return $themes; |
|
798 | + } |
|
799 | 799 | |
800 | 800 | /** |
801 | 801 | * @deprecated 3.02.03 |
802 | 802 | */ |
803 | - public static function enqueue_jquery_css() { |
|
803 | + public static function enqueue_jquery_css() { |
|
804 | 804 | _deprecated_function( __FUNCTION__, '3.02.03', 'FrmProStylesController::enqueue_jquery_css' ); |
805 | 805 | |
806 | 806 | $form = self::get_form_for_page(); |
807 | 807 | $theme_css = FrmStylesController::get_style_val( 'theme_css', $form ); |
808 | - if ( $theme_css != -1 ) { |
|
808 | + if ( $theme_css != -1 ) { |
|
809 | 809 | wp_enqueue_style( 'jquery-theme', self::jquery_css_url( $theme_css ), array(), FrmAppHelper::plugin_version() ); |
810 | - } |
|
811 | - } |
|
810 | + } |
|
811 | + } |
|
812 | 812 | |
813 | 813 | /** |
814 | 814 | * @deprecated 3.02.03 |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | } |
822 | 822 | |
823 | 823 | return FrmProStylesController::jquery_css_url( $theme_css ); |
824 | - } |
|
824 | + } |
|
825 | 825 | |
826 | 826 | /** |
827 | 827 | * @deprecated 3.02.03 |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
28 | 28 | |
29 | 29 | $action = isset( $_REQUEST['frm_action'] ) ? 'frm_action' : 'action'; |
30 | - $action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[ $action ]; |
|
30 | + $action = empty( $values ) ? FrmAppHelper::get_param( $action, '', 'get', 'sanitize_title' ) : $values[$action]; |
|
31 | 31 | |
32 | 32 | if ( $action === 'create' ) { |
33 | 33 | FrmFormsController::update( $values ); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | $values = FrmFormsHelper::setup_new_vars( $values ); |
38 | - $id = FrmForm::create( $values ); |
|
38 | + $id = FrmForm::create( $values ); |
|
39 | 39 | $values['id'] = $id; |
40 | 40 | |
41 | 41 | FrmFormsController::edit( $values ); |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | if ( is_array( $sub_field ) ) { |
60 | 60 | $sub_field = wp_parse_args( $sub_field, $defaults ); |
61 | 61 | $sub_field['name'] = $name; |
62 | - $this->sub_fields[ $name ] = $sub_field; |
|
62 | + $this->sub_fields[$name] = $sub_field; |
|
63 | 63 | continue; |
64 | 64 | } |
65 | 65 | |
66 | 66 | if ( is_string( $sub_field ) ) { |
67 | - $this->sub_fields[ $name ] = wp_parse_args( |
|
67 | + $this->sub_fields[$name] = wp_parse_args( |
|
68 | 68 | array( |
69 | 69 | 'name' => $name, |
70 | 70 | 'label' => $sub_field, |
@@ -116,9 +116,9 @@ discard block |
||
116 | 116 | } |
117 | 117 | |
118 | 118 | if ( is_string( $option ) ) { |
119 | - $extra_options[ $key . '_' . $option ] = ''; |
|
119 | + $extra_options[$key . '_' . $option] = ''; |
|
120 | 120 | } elseif ( ! empty( $option['name'] ) ) { |
121 | - $extra_options[ $key . '_' . $option['name'] ] = ''; |
|
121 | + $extra_options[$key . '_' . $option['name']] = ''; |
|
122 | 122 | } |
123 | 123 | } |
124 | 124 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | foreach ( $this->sub_fields as $name => $sub_field ) { |
142 | 142 | $sub_field['name'] = $name; |
143 | 143 | $wrapper_classes = 'frm_grid_container frm_sub_field_options frm_sub_field_options-' . $sub_field['name']; |
144 | - if ( ! isset( $processed_sub_fields[ $name ] ) ) { |
|
144 | + if ( ! isset( $processed_sub_fields[$name] ) ) { |
|
145 | 145 | // Options for this subfield should be hidden. |
146 | 146 | $wrapper_classes .= ' frm_hidden'; |
147 | 147 | } |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $default_value = array(); |
172 | 172 | |
173 | 173 | foreach ( $this->sub_fields as $name => $sub_field ) { |
174 | - $default_value[ $name ] = ''; |
|
174 | + $default_value[$name] = ''; |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | return $default_value; |
@@ -343,8 +343,8 @@ discard block |
||
343 | 343 | // Placeholder. |
344 | 344 | if ( in_array( 'placeholder', $sub_field['options'], true ) ) { |
345 | 345 | $placeholders = FrmField::get_option( $field, 'placeholder' ); |
346 | - if ( ! empty( $placeholders[ $sub_field['name'] ] ) ) { |
|
347 | - $field['placeholder'] = $placeholders[ $sub_field['name'] ]; |
|
346 | + if ( ! empty( $placeholders[$sub_field['name']] ) ) { |
|
347 | + $field['placeholder'] = $placeholders[$sub_field['name']]; |
|
348 | 348 | } |
349 | 349 | } |
350 | 350 | |
@@ -401,9 +401,9 @@ discard block |
||
401 | 401 | |
402 | 402 | // Validate not empty. |
403 | 403 | foreach ( $sub_fields as $name => $sub_field ) { |
404 | - if ( empty( $sub_field['optional'] ) && empty( $args['value'][ $name ] ) ) { |
|
405 | - $errors[ 'field' . $args['id'] . '-' . $name ] = ''; |
|
406 | - $errors[ 'field' . $args['id'] ] = $blank_msg; |
|
404 | + if ( empty( $sub_field['optional'] ) && empty( $args['value'][$name] ) ) { |
|
405 | + $errors['field' . $args['id'] . '-' . $name] = ''; |
|
406 | + $errors['field' . $args['id']] = $blank_msg; |
|
407 | 407 | } |
408 | 408 | } |
409 | 409 | |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | $field_key = isset( $this->field->field_key ) ? $this->field->field_key : $this->field['field_key']; |
423 | 423 | $sub_fields = $this->get_processed_sub_fields(); |
424 | 424 | foreach ( $sub_fields as $name => $sub_field ) { |
425 | - $headings[ $field_id . '_' . $name ] = $field_name . ' (' . $field_key . ') - ' . $sub_field['label']; |
|
425 | + $headings[$field_id . '_' . $name] = $field_name . ' (' . $field_key . ') - ' . $sub_field['label']; |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | return $headings; |
@@ -6,7 +6,7 @@ |
||
6 | 6 | $data_keys = array_keys( $data ); |
7 | 7 | $params = array(); |
8 | 8 | foreach ( $data_keys as $key ) { |
9 | - $params[ 'data-' . $key ] = $data[ $key ]; |
|
9 | + $params['data-' . $key] = $data[$key]; |
|
10 | 10 | } |
11 | 11 | $params['class'] = 'frm_show_upgrade frm_noallow'; |
12 | 12 | $params['href'] = '#'; |
@@ -87,7 +87,8 @@ |
||
87 | 87 | |
88 | 88 | if ( ! isset( $imported['form_status'] ) || empty( $imported['form_status'] ) ) { |
89 | 89 | // Check for an error message in the XML. |
90 | - if ( isset( $xml->Code ) && isset( $xml->Message ) ) { // phpcs:ignore WordPress.NamingConventions |
|
90 | + if ( isset( $xml->Code ) && isset( $xml->Message ) ) { |
|
91 | +// phpcs:ignore WordPress.NamingConventions |
|
91 | 92 | $imported['error'] = (string) $xml->Message; // phpcs:ignore WordPress.NamingConventions |
92 | 93 | } |
93 | 94 | } |
@@ -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'][ (int) $old_id ] = $post_id; |
|
956 | + $imported['posts'][(int) $old_id] = $post_id; |
|
957 | 957 | |
958 | 958 | if ( $post['post_type'] === 'frm_display' ) { |
959 | - $view_ids[ (int) $old_id ] = $post_id; |
|
959 | + $view_ids[(int) $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 ( isset( $m['value']['order_by'] ) && ! 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 | } |
@@ -1377,7 +1377,7 @@ discard block |
||
1377 | 1377 | |
1378 | 1378 | $message = '<ul>'; |
1379 | 1379 | foreach ( $result as $type => $results ) { |
1380 | - if ( ! isset( $t_strings[ $type ] ) ) { |
|
1380 | + if ( ! isset( $t_strings[$type] ) ) { |
|
1381 | 1381 | // only print imported and updated |
1382 | 1382 | continue; |
1383 | 1383 | } |
@@ -1389,7 +1389,7 @@ discard block |
||
1389 | 1389 | } |
1390 | 1390 | |
1391 | 1391 | if ( ! empty( $s_message ) ) { |
1392 | - $message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> '; |
|
1392 | + $message .= '<li><strong>' . $t_strings[$type] . ':</strong> '; |
|
1393 | 1393 | $message .= implode( ', ', $s_message ); |
1394 | 1394 | $message .= '</li>'; |
1395 | 1395 | } |
@@ -1441,8 +1441,8 @@ discard block |
||
1441 | 1441 | 'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ), |
1442 | 1442 | ); |
1443 | 1443 | |
1444 | - if ( isset( $strings[ $type ] ) ) { |
|
1445 | - $s_message[] = $strings[ $type ]; |
|
1444 | + if ( isset( $strings[$type] ) ) { |
|
1445 | + $s_message[] = $strings[$type]; |
|
1446 | 1446 | } else { |
1447 | 1447 | $string = ' ' . $m . ' ' . ucfirst( $type ); |
1448 | 1448 | |
@@ -1590,7 +1590,7 @@ discard block |
||
1590 | 1590 | |
1591 | 1591 | foreach ( $options as $key => $option ) { |
1592 | 1592 | if ( is_array( $option ) && ! empty( $option['image'] ) ) { |
1593 | - $options[ $key ]['src'] = wp_get_attachment_url( $option['image'] ); |
|
1593 | + $options[$key]['src'] = wp_get_attachment_url( $option['image'] ); |
|
1594 | 1594 | $updated = true; |
1595 | 1595 | } |
1596 | 1596 | } |
@@ -1619,8 +1619,8 @@ discard block |
||
1619 | 1619 | */ |
1620 | 1620 | private static function remove_defaults( $defaults, &$saved ) { |
1621 | 1621 | foreach ( $saved as $key => $value ) { |
1622 | - if ( isset( $defaults[ $key ] ) && $defaults[ $key ] === $value ) { |
|
1623 | - unset( $saved[ $key ] ); |
|
1622 | + if ( isset( $defaults[$key] ) && $defaults[$key] === $value ) { |
|
1623 | + unset( $saved[$key] ); |
|
1624 | 1624 | } |
1625 | 1625 | } |
1626 | 1626 | } |
@@ -1631,14 +1631,14 @@ discard block |
||
1631 | 1631 | * @since 3.06 |
1632 | 1632 | */ |
1633 | 1633 | private static function remove_default_html( $html_name, $defaults, &$options ) { |
1634 | - if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) { |
|
1634 | + if ( ! isset( $options[$html_name] ) || ! isset( $defaults[$html_name] ) ) { |
|
1635 | 1635 | return; |
1636 | 1636 | } |
1637 | 1637 | |
1638 | - $old_html = str_replace( "\r\n", "\n", $options[ $html_name ] ); |
|
1639 | - $default_html = $defaults[ $html_name ]; |
|
1638 | + $old_html = str_replace( "\r\n", "\n", $options[$html_name] ); |
|
1639 | + $default_html = $defaults[$html_name]; |
|
1640 | 1640 | if ( $old_html == $default_html ) { |
1641 | - unset( $options[ $html_name ] ); |
|
1641 | + unset( $options[$html_name] ); |
|
1642 | 1642 | |
1643 | 1643 | return; |
1644 | 1644 | } |
@@ -1646,7 +1646,7 @@ discard block |
||
1646 | 1646 | // Account for some of the older field default HTML. |
1647 | 1647 | $default_html = str_replace( ' id="frm_desc_field_[key]"', '', $default_html ); |
1648 | 1648 | if ( $old_html == $default_html ) { |
1649 | - unset( $options[ $html_name ] ); |
|
1649 | + unset( $options[$html_name] ); |
|
1650 | 1650 | } |
1651 | 1651 | } |
1652 | 1652 | |
@@ -1737,8 +1737,8 @@ discard block |
||
1737 | 1737 | ); |
1738 | 1738 | |
1739 | 1739 | foreach ( $post_settings as $post_setting ) { |
1740 | - if ( isset( $form_options[ $post_setting ] ) ) { |
|
1741 | - $new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ]; |
|
1740 | + if ( isset( $form_options[$post_setting] ) ) { |
|
1741 | + $new_action['post_content'][$post_setting] = $form_options[$post_setting]; |
|
1742 | 1742 | } |
1743 | 1743 | unset( $post_setting ); |
1744 | 1744 | } |
@@ -1776,7 +1776,7 @@ discard block |
||
1776 | 1776 | if ( ! $exists ) { |
1777 | 1777 | // this isn't an email, but we need to use a class that will always be included |
1778 | 1778 | FrmDb::save_json_post( $new_action ); |
1779 | - ++$imported['imported']['actions']; |
|
1779 | + ++ $imported['imported']['actions']; |
|
1780 | 1780 | } |
1781 | 1781 | } |
1782 | 1782 | |
@@ -1809,11 +1809,11 @@ discard block |
||
1809 | 1809 | foreach ( $post_content as $key => $setting ) { |
1810 | 1810 | if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) { |
1811 | 1811 | // Replace old IDs with new IDs |
1812 | - $post_content[ $key ] = str_replace( $old, $new, $setting ); |
|
1812 | + $post_content[$key] = str_replace( $old, $new, $setting ); |
|
1813 | 1813 | } elseif ( is_array( $setting ) && in_array( $key, $array_fields ) ) { |
1814 | 1814 | foreach ( $setting as $k => $val ) { |
1815 | 1815 | // Replace old IDs with new IDs |
1816 | - $post_content[ $key ][ $k ] = str_replace( $old, $new, $val ); |
|
1816 | + $post_content[$key][$k] = str_replace( $old, $new, $val ); |
|
1817 | 1817 | } |
1818 | 1818 | } |
1819 | 1819 | unset( $key, $setting ); |
@@ -1870,7 +1870,7 @@ discard block |
||
1870 | 1870 | |
1871 | 1871 | if ( empty( $exists ) ) { |
1872 | 1872 | FrmDb::save_json_post( $new_notification ); |
1873 | - ++$imported['imported']['actions']; |
|
1873 | + ++ $imported['imported']['actions']; |
|
1874 | 1874 | } |
1875 | 1875 | unset( $new_notification ); |
1876 | 1876 | }//end foreach |
@@ -1889,8 +1889,8 @@ discard block |
||
1889 | 1889 | private static function remove_deprecated_notification_settings( $form_id, $form_options ) { |
1890 | 1890 | $delete_settings = array( 'notification', 'autoresponder', 'email_to' ); |
1891 | 1891 | foreach ( $delete_settings as $index ) { |
1892 | - if ( isset( $form_options[ $index ] ) ) { |
|
1893 | - unset( $form_options[ $index ] ); |
|
1892 | + if ( isset( $form_options[$index] ) ) { |
|
1893 | + unset( $form_options[$index] ); |
|
1894 | 1894 | } |
1895 | 1895 | } |
1896 | 1896 | FrmForm::update( $form_id, array( 'options' => $form_options ) ); |
@@ -1943,12 +1943,12 @@ discard block |
||
1943 | 1943 | 'reply_to_name' => '', |
1944 | 1944 | ); |
1945 | 1945 | foreach ( $reply_fields as $f => $val ) { |
1946 | - if ( isset( $notification[ $f ] ) ) { |
|
1947 | - $atts[ $f ] = $notification[ $f ]; |
|
1948 | - if ( 'custom' == $notification[ $f ] ) { |
|
1949 | - $atts[ $f ] = $notification[ 'cust_' . $f ]; |
|
1950 | - } elseif ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) { |
|
1951 | - $atts[ $f ] = '[' . $atts[ $f ] . ']'; |
|
1946 | + if ( isset( $notification[$f] ) ) { |
|
1947 | + $atts[$f] = $notification[$f]; |
|
1948 | + if ( 'custom' == $notification[$f] ) { |
|
1949 | + $atts[$f] = $notification['cust_' . $f]; |
|
1950 | + } elseif ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) { |
|
1951 | + $atts[$f] = '[' . $atts[$f] . ']'; |
|
1952 | 1952 | } |
1953 | 1953 | } |
1954 | 1954 | unset( $f, $val ); |
@@ -1979,13 +1979,13 @@ discard block |
||
1979 | 1979 | foreach ( $atts['email_to'] as $key => $email_field ) { |
1980 | 1980 | |
1981 | 1981 | if ( is_numeric( $email_field ) ) { |
1982 | - $atts['email_to'][ $key ] = '[' . $email_field . ']'; |
|
1982 | + $atts['email_to'][$key] = '[' . $email_field . ']'; |
|
1983 | 1983 | } |
1984 | 1984 | |
1985 | 1985 | if ( strpos( $email_field, '|' ) ) { |
1986 | 1986 | $email_opt = explode( '|', $email_field ); |
1987 | 1987 | if ( isset( $email_opt[0] ) ) { |
1988 | - $atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
1988 | + $atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']'; |
|
1989 | 1989 | } |
1990 | 1990 | unset( $email_opt ); |
1991 | 1991 | } |
@@ -2006,12 +2006,12 @@ discard block |
||
2006 | 2006 | // Add more fields to the new notification |
2007 | 2007 | $add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' ); |
2008 | 2008 | foreach ( $add_fields as $add_field ) { |
2009 | - if ( isset( $notification[ $add_field ] ) ) { |
|
2010 | - $new_notification['post_content'][ $add_field ] = $notification[ $add_field ]; |
|
2009 | + if ( isset( $notification[$add_field] ) ) { |
|
2010 | + $new_notification['post_content'][$add_field] = $notification[$add_field]; |
|
2011 | 2011 | } elseif ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) { |
2012 | - $new_notification['post_content'][ $add_field ] = 0; |
|
2012 | + $new_notification['post_content'][$add_field] = 0; |
|
2013 | 2013 | } else { |
2014 | - $new_notification['post_content'][ $add_field ] = ''; |
|
2014 | + $new_notification['post_content'][$add_field] = ''; |
|
2015 | 2015 | } |
2016 | 2016 | unset( $add_field ); |
2017 | 2017 | } |
@@ -2035,7 +2035,7 @@ discard block |
||
2035 | 2035 | if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) { |
2036 | 2036 | foreach ( $post_content['conditions'] as $email_key => $val ) { |
2037 | 2037 | if ( is_numeric( $email_key ) ) { |
2038 | - $post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
2038 | + $post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) ); |
|
2039 | 2039 | } |
2040 | 2040 | unset( $email_key, $val ); |
2041 | 2041 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | $max_length = intval( FrmField::get_option( $this->field, 'max' ) ); |
35 | 35 | |
36 | 36 | if ( $max_length && strlen( $args['value'] ) > $max_length ) { |
37 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
37 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | return $errors; |
@@ -119,7 +119,8 @@ |
||
119 | 119 | * @return void |
120 | 120 | */ |
121 | 121 | private static function maybe_hook_into_global_settings_save() { |
122 | - if ( empty( $_POST ) || ! isset( $_POST['style'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
122 | + if ( empty( $_POST ) || ! isset( $_POST['style'] ) ) { |
|
123 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
123 | 124 | // Avoid changing any style data if the style array is not sent in the request. |
124 | 125 | return; |
125 | 126 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | /** |
154 | 154 | * Update the form data on the "Manage Styles" tab after global settings are saved. |
155 | 155 | */ |
156 | - function () { |
|
156 | + function() { |
|
157 | 157 | self::manage_styles(); |
158 | 158 | } |
159 | 159 | ); |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | if ( ! $form_id ) { |
401 | 401 | // TODO: Show a message why a random form is being shown (because no form is assigned to the style). |
402 | 402 | // Fallback to any form. |
403 | - $where = array( |
|
403 | + $where = array( |
|
404 | 404 | 'status' => 'published', |
405 | 405 | // Make sure it's not a repeater. |
406 | 406 | 'parent_form_id' => array( null, 0 ), |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | private static function disable_admin_page_styling_on_submit_buttons() { |
420 | 420 | add_filter( |
421 | 421 | 'frm_submit_button_class', |
422 | - function ( $classes ) { |
|
422 | + function( $classes ) { |
|
423 | 423 | $classes[] = 'frm_no_style_button'; |
424 | 424 | return $classes; |
425 | 425 | } |
@@ -627,13 +627,13 @@ discard block |
||
627 | 627 | private static function force_form_style( $style ) { |
628 | 628 | add_filter( |
629 | 629 | 'frm_add_form_style_class', |
630 | - function ( $class ) use ( $style ) { |
|
631 | - $split = array_filter( |
|
630 | + function( $class ) use ( $style ) { |
|
631 | + $split = array_filter( |
|
632 | 632 | explode( ' ', $class ), |
633 | 633 | /** |
634 | 634 | * @param string $class |
635 | 635 | */ |
636 | - function ( $class ) { |
|
636 | + function( $class ) { |
|
637 | 637 | return $class && 0 !== strpos( $class, 'frm_style_' ); |
638 | 638 | } |
639 | 639 | ); |
@@ -749,8 +749,8 @@ discard block |
||
749 | 749 | |
750 | 750 | $forms = FrmForm::get_published_forms(); |
751 | 751 | foreach ( $forms as $form ) { |
752 | - $new_style = ( isset( $_POST['style'] ) && isset( $_POST['style'][ $form->id ] ) ) ? sanitize_text_field( wp_unslash( $_POST['style'][ $form->id ] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
753 | - $previous_style = ( isset( $_POST['prev_style'] ) && isset( $_POST['prev_style'][ $form->id ] ) ) ? sanitize_text_field( wp_unslash( $_POST['prev_style'][ $form->id ] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
752 | + $new_style = ( isset( $_POST['style'] ) && isset( $_POST['style'][$form->id] ) ) ? sanitize_text_field( wp_unslash( $_POST['style'][$form->id] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
753 | + $previous_style = ( isset( $_POST['prev_style'] ) && isset( $_POST['prev_style'][$form->id] ) ) ? sanitize_text_field( wp_unslash( $_POST['prev_style'][$form->id] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
754 | 754 | if ( $new_style == $previous_style ) { |
755 | 755 | continue; |
756 | 756 | } |
@@ -1159,8 +1159,8 @@ discard block |
||
1159 | 1159 | */ |
1160 | 1160 | public static function get_style_val( $val, $form = 'default' ) { |
1161 | 1161 | $style = self::get_form_style( $form ); |
1162 | - if ( $style && isset( $style->post_content[ $val ] ) ) { |
|
1163 | - return $style->post_content[ $val ]; |
|
1162 | + if ( $style && isset( $style->post_content[$val] ) ) { |
|
1163 | + return $style->post_content[$val]; |
|
1164 | 1164 | } |
1165 | 1165 | } |
1166 | 1166 | |
@@ -1179,7 +1179,7 @@ discard block |
||
1179 | 1179 | } elseif ( 'alt_bg_color' == $name ) { |
1180 | 1180 | $setting = 'bg_color_active'; |
1181 | 1181 | } |
1182 | - $default_styles[ $name ] = $style->post_content[ $setting ]; |
|
1182 | + $default_styles[$name] = $style->post_content[$setting]; |
|
1183 | 1183 | unset( $name, $val ); |
1184 | 1184 | } |
1185 | 1185 | |
@@ -1225,16 +1225,16 @@ discard block |
||
1225 | 1225 | $i = 0; |
1226 | 1226 | $first_open = false; |
1227 | 1227 | |
1228 | - if ( isset( $wp_meta_boxes[ $page ][ $context ] ) ) { |
|
1228 | + if ( isset( $wp_meta_boxes[$page][$context] ) ) { |
|
1229 | 1229 | foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) { |
1230 | - if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) { |
|
1231 | - foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) { |
|
1230 | + if ( isset( $wp_meta_boxes[$page][$context][$priority] ) ) { |
|
1231 | + foreach ( $wp_meta_boxes[$page][$context][$priority] as $box ) { |
|
1232 | 1232 | if ( false === $box || ! $box['title'] ) { |
1233 | 1233 | continue; |
1234 | 1234 | } |
1235 | 1235 | |
1236 | - ++$i; |
|
1237 | - $icon_id = array_key_exists( $box['id'], $icon_ids ) ? $icon_ids[ $box['id'] ] : 'frm-' . $box['id']; |
|
1236 | + ++ $i; |
|
1237 | + $icon_id = array_key_exists( $box['id'], $icon_ids ) ? $icon_ids[$box['id']] : 'frm-' . $box['id']; |
|
1238 | 1238 | |
1239 | 1239 | $open_class = ''; |
1240 | 1240 | if ( ! $first_open ) { |
@@ -67,7 +67,8 @@ |
||
67 | 67 | $new_instance = (array) $new_instance; |
68 | 68 | $this->id = $new_instance['ID']; |
69 | 69 | |
70 | - if ( $id != $this->id || ! $_POST || ! isset( $_POST['frm_style_setting'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
70 | + if ( $id != $this->id || ! $_POST || ! isset( $_POST['frm_style_setting'] ) ) { |
|
71 | +// phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
71 | 72 | // Don't continue if not saving this style. |
72 | 73 | continue; |
73 | 74 | } |
@@ -102,21 +102,21 @@ discard block |
||
102 | 102 | $default_settings = $this->get_defaults(); |
103 | 103 | |
104 | 104 | foreach ( $default_settings as $setting => $default ) { |
105 | - if ( ! isset( $new_instance['post_content'][ $setting ] ) ) { |
|
106 | - $new_instance['post_content'][ $setting ] = $default; |
|
105 | + if ( ! isset( $new_instance['post_content'][$setting] ) ) { |
|
106 | + $new_instance['post_content'][$setting] = $default; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | if ( $this->is_color( $setting ) ) { |
110 | - $color_val = $new_instance['post_content'][ $setting ]; |
|
110 | + $color_val = $new_instance['post_content'][$setting]; |
|
111 | 111 | if ( $color_val !== '' && false !== strpos( $color_val, 'rgb' ) ) { |
112 | 112 | // Maybe sanitize if invalid rgba value is entered. |
113 | 113 | $this->maybe_sanitize_rgba_value( $color_val ); |
114 | 114 | } |
115 | - $new_instance['post_content'][ $setting ] = str_replace( '#', '', $color_val ); |
|
116 | - } elseif ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ), true ) && ! isset( $new_instance['post_content'][ $setting ] ) ) { |
|
117 | - $new_instance['post_content'][ $setting ] = 0; |
|
115 | + $new_instance['post_content'][$setting] = str_replace( '#', '', $color_val ); |
|
116 | + } elseif ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ), true ) && ! isset( $new_instance['post_content'][$setting] ) ) { |
|
117 | + $new_instance['post_content'][$setting] = 0; |
|
118 | 118 | } elseif ( $setting === 'font' ) { |
119 | - $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
119 | + $new_instance['post_content'][$setting] = $this->force_balanced_quotation( $new_instance['post_content'][$setting] ); |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | |
@@ -236,14 +236,14 @@ discard block |
||
236 | 236 | $valid_keys = array_keys( $defaults ); |
237 | 237 | $sanitized_settings = array(); |
238 | 238 | foreach ( $valid_keys as $key ) { |
239 | - if ( isset( $settings[ $key ] ) ) { |
|
240 | - $sanitized_settings[ $key ] = sanitize_textarea_field( $settings[ $key ] ); |
|
239 | + if ( isset( $settings[$key] ) ) { |
|
240 | + $sanitized_settings[$key] = sanitize_textarea_field( $settings[$key] ); |
|
241 | 241 | } else { |
242 | - $sanitized_settings[ $key ] = $defaults[ $key ]; |
|
242 | + $sanitized_settings[$key] = $defaults[$key]; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | if ( 'custom_css' !== $key ) { |
246 | - $sanitized_settings[ $key ] = $this->strip_invalid_characters( $sanitized_settings[ $key ] ); |
|
246 | + $sanitized_settings[$key] = $this->strip_invalid_characters( $sanitized_settings[$key] ); |
|
247 | 247 | } |
248 | 248 | } |
249 | 249 | return $sanitized_settings; |
@@ -493,13 +493,13 @@ discard block |
||
493 | 493 | $style->post_content = $this->override_defaults( $style->post_content ); |
494 | 494 | $style->post_content = wp_parse_args( $style->post_content, $default_values ); |
495 | 495 | |
496 | - $styles[ $style->ID ] = $style; |
|
496 | + $styles[$style->ID] = $style; |
|
497 | 497 | } |
498 | 498 | |
499 | 499 | if ( ! $default_style ) { |
500 | 500 | $default_style = reset( $styles ); |
501 | 501 | |
502 | - $styles[ $default_style->ID ]->menu_order = 1; |
|
502 | + $styles[$default_style->ID]->menu_order = 1; |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | return $styles; |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | continue; |
744 | 744 | } |
745 | 745 | |
746 | - if ( $value && $char === $value[ strlen( $value ) - 1 ] ) { |
|
746 | + if ( $value && $char === $value[strlen( $value ) - 1] ) { |
|
747 | 747 | $value = $char . $value; |
748 | 748 | } else { |
749 | 749 | $value .= $char; |