@@ -80,20 +80,20 @@ discard block |
||
| 80 | 80 | 'name' => sprintf( |
| 81 | 81 | /* translators: Formidable addon name */ |
| 82 | 82 | esc_html_x( 'Formidable %s', 'Formidable Addon Name', 'formidable' ), |
| 83 | - $addon_list[ $matching_addon ]['name'] |
|
| 83 | + $addon_list[$matching_addon]['name'] |
|
| 84 | 84 | ), |
| 85 | - 'addon' => $addon_list[ $matching_addon ]['slug'], |
|
| 86 | - 'short_description' => $addon_list[ $matching_addon ]['excerpt'], |
|
| 85 | + 'addon' => $addon_list[$matching_addon]['slug'], |
|
| 86 | + 'short_description' => $addon_list[$matching_addon]['excerpt'], |
|
| 87 | 87 | 'slug' => self::$slug, |
| 88 | - 'version' => $addon_list[ $matching_addon ]['version'], |
|
| 88 | + 'version' => $addon_list[$matching_addon]['version'], |
|
| 89 | 89 | ); |
| 90 | 90 | |
| 91 | - if ( ! empty( $addon_list[ $matching_addon ]['external'] ) ) { |
|
| 91 | + if ( ! empty( $addon_list[$matching_addon]['external'] ) ) { |
|
| 92 | 92 | unset( $overrides['name'] ); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Splice in the base addon data. |
| 96 | - $inject = array_merge( $inject, $addon_list[ $matching_addon ], $overrides ); |
|
| 96 | + $inject = array_merge( $inject, $addon_list[$matching_addon], $overrides ); |
|
| 97 | 97 | |
| 98 | 98 | // Add it to the top of the list. |
| 99 | 99 | array_unshift( $result->plugins, $inject ); |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | // Plugin installed, active, feature not enabled; prompt to enable. |
| 309 | 309 | if ( ! $is_active && $is_installed ) { |
| 310 | 310 | if ( current_user_can( 'activate_plugins' ) ) { |
| 311 | - $activate_url = add_query_arg( |
|
| 311 | + $activate_url = add_query_arg( |
|
| 312 | 312 | array( |
| 313 | 313 | 'action' => 'activate', |
| 314 | 314 | '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $plugin['plugin'] ), |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | */ |
| 353 | 353 | protected function is_installed( $plugin ) { |
| 354 | 354 | $all_plugins = FrmAppHelper::get_plugins(); |
| 355 | - return isset( $all_plugins[ $plugin ] ); |
|
| 355 | + return isset( $all_plugins[$plugin] ); |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | /** |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | $templates = $this->get_api_info(); |
| 96 | 96 | $contact_form = 20872734; |
| 97 | - return isset( $templates[ $contact_form ] ) && ! empty( $templates[ $contact_form ]['url'] ); |
|
| 97 | + return isset( $templates[$contact_form] ) && ! empty( $templates[$contact_form]['url'] ); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -169,15 +169,15 @@ discard block |
||
| 169 | 169 | continue; |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - $data['urlByKey'][ $template['key'] ] = $template['url']; |
|
| 172 | + $data['urlByKey'][$template['key']] = $template['url']; |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - if ( ! isset( $data['urlByKey'][ $key ] ) ) { |
|
| 175 | + if ( ! isset( $data['urlByKey'][$key] ) ) { |
|
| 176 | 176 | $error = new WP_Error( 400, 'We were unable to retrieve the template' ); |
| 177 | 177 | wp_send_json_error( $error ); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - $data['url'] = $data['urlByKey'][ $key ]; |
|
| 180 | + $data['url'] = $data['urlByKey'][$key]; |
|
| 181 | 181 | }//end if |
| 182 | 182 | |
| 183 | 183 | wp_send_json_success( $data ); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | $metas = FrmEntryMeta::get_entry_meta_info( $entry_exist ); |
| 81 | 81 | $field_metas = array(); |
| 82 | 82 | foreach ( $metas as $meta ) { |
| 83 | - $field_metas[ $meta->field_id ] = $meta->meta_value; |
|
| 83 | + $field_metas[$meta->field_id] = $meta->meta_value; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | $filtered_vals = array_filter( $values['item_meta'] ); |
@@ -136,10 +136,10 @@ discard block |
||
| 136 | 136 | $reduced = array(); |
| 137 | 137 | foreach ( $filter_vals as $field_id => $value ) { |
| 138 | 138 | $field = FrmFieldFactory::get_field_object( $field_id ); |
| 139 | - $reduced[ $field_id ] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) ); |
|
| 140 | - $reduced[ $field_id ] = $field->set_value_before_save( $reduced[ $field_id ] ); |
|
| 141 | - if ( '' === $reduced[ $field_id ] || ( is_array( $reduced[ $field_id ] ) && 0 === count( $reduced[ $field_id ] ) ) ) { |
|
| 142 | - unset( $reduced[ $field_id ] ); |
|
| 139 | + $reduced[$field_id] = $field->get_value_to_save( $value, array( 'entry_id' => $entry_id ) ); |
|
| 140 | + $reduced[$field_id] = $field->set_value_before_save( $reduced[$field_id] ); |
|
| 141 | + if ( '' === $reduced[$field_id] || ( is_array( $reduced[$field_id] ) && 0 === count( $reduced[$field_id] ) ) ) { |
|
| 142 | + unset( $reduced[$field_id] ); |
|
| 143 | 143 | } |
| 144 | 144 | } |
| 145 | 145 | return $reduced; |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | private static function prepare_entries( &$entries ) { |
| 402 | 402 | foreach ( $entries as $k => $entry ) { |
| 403 | 403 | self::prepare_entry( $entry ); |
| 404 | - $entries[ $k ] = $entry; |
|
| 404 | + $entries[$k] = $entry; |
|
| 405 | 405 | } |
| 406 | 406 | } |
| 407 | 407 | |
@@ -427,19 +427,19 @@ discard block |
||
| 427 | 427 | FrmFieldsHelper::prepare_field_value( $meta_val->meta_value, $meta_val->type ); |
| 428 | 428 | |
| 429 | 429 | if ( $meta_val->item_id == $entry->id ) { |
| 430 | - $entry->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
| 430 | + $entry->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
| 431 | 431 | if ( $include_key ) { |
| 432 | - $entry->metas[ $meta_val->field_key ] = $entry->metas[ $meta_val->field_id ]; |
|
| 432 | + $entry->metas[$meta_val->field_key] = $entry->metas[$meta_val->field_id]; |
|
| 433 | 433 | } |
| 434 | 434 | continue; |
| 435 | 435 | } |
| 436 | 436 | |
| 437 | 437 | // include sub entries in an array |
| 438 | - if ( ! isset( $entry->metas[ $meta_val->field_id ] ) ) { |
|
| 439 | - $entry->metas[ $meta_val->field_id ] = array(); |
|
| 438 | + if ( ! isset( $entry->metas[$meta_val->field_id] ) ) { |
|
| 439 | + $entry->metas[$meta_val->field_id] = array(); |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | - $entry->metas[ $meta_val->field_id ][] = $meta_val->meta_value; |
|
| 442 | + $entry->metas[$meta_val->field_id][] = $meta_val->meta_value; |
|
| 443 | 443 | |
| 444 | 444 | unset( $meta_val ); |
| 445 | 445 | } |
@@ -534,16 +534,16 @@ discard block |
||
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | foreach ( $metas as $m_key => $meta_val ) { |
| 537 | - if ( ! isset( $entries[ $meta_val->item_id ] ) ) { |
|
| 537 | + if ( ! isset( $entries[$meta_val->item_id] ) ) { |
|
| 538 | 538 | continue; |
| 539 | 539 | } |
| 540 | 540 | |
| 541 | - if ( ! isset( $entries[ $meta_val->item_id ]->metas ) ) { |
|
| 542 | - $entries[ $meta_val->item_id ]->metas = array(); |
|
| 541 | + if ( ! isset( $entries[$meta_val->item_id]->metas ) ) { |
|
| 542 | + $entries[$meta_val->item_id]->metas = array(); |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | FrmFieldsHelper::prepare_field_value( $meta_val->meta_value, $meta_val->type ); |
| 546 | - $entries[ $meta_val->item_id ]->metas[ $meta_val->field_id ] = $meta_val->meta_value; |
|
| 546 | + $entries[$meta_val->item_id]->metas[$meta_val->field_id] = $meta_val->meta_value; |
|
| 547 | 547 | unset( $m_key, $meta_val ); |
| 548 | 548 | } |
| 549 | 549 | |
@@ -725,7 +725,7 @@ discard block |
||
| 725 | 725 | } |
| 726 | 726 | |
| 727 | 727 | private static function get_entry_value( $values, $name, $default ) { |
| 728 | - return isset( $values[ $name ] ) ? $values[ $name ] : $default; |
|
| 728 | + return isset( $values[$name] ) ? $values[$name] : $default; |
|
| 729 | 729 | } |
| 730 | 730 | |
| 731 | 731 | /** |
@@ -910,7 +910,7 @@ discard block |
||
| 910 | 910 | private static function maybe_add_captcha_meta( $form_id, $entry_id ) { |
| 911 | 911 | global $frm_vars; |
| 912 | 912 | if ( array_key_exists( 'captcha_scores', $frm_vars ) && array_key_exists( $form_id, $frm_vars['captcha_scores'] ) ) { |
| 913 | - $captcha_score_meta = array( 'captcha_score' => $frm_vars['captcha_scores'][ $form_id ] ); |
|
| 913 | + $captcha_score_meta = array( 'captcha_score' => $frm_vars['captcha_scores'][$form_id] ); |
|
| 914 | 914 | FrmEntryMeta::add_entry_meta( $entry_id, 0, '', maybe_serialize( $captcha_score_meta ) ); |
| 915 | 915 | } |
| 916 | 916 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | private function update_next_execution_time() { |
| 86 | 86 | $config_option_name = $this->config['config-option-name']; |
| 87 | 87 | |
| 88 | - $this->options_data[ $config_option_name ] = $this->get_next_execution(); |
|
| 88 | + $this->options_data[$config_option_name] = $this->get_next_execution(); |
|
| 89 | 89 | $this->update_options_data(); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -104,11 +104,11 @@ discard block |
||
| 104 | 104 | * @return bool |
| 105 | 105 | */ |
| 106 | 106 | private function is_time_to_execute() { |
| 107 | - if ( ! isset( $this->options_data[ $this->config['config-option-name'] ] ) ) { |
|
| 107 | + if ( ! isset( $this->options_data[$this->config['config-option-name']] ) ) { |
|
| 108 | 108 | return true; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - $options = $this->options_data[ $this->config['config-option-name'] ]; |
|
| 111 | + $options = $this->options_data[$this->config['config-option-name']]; |
|
| 112 | 112 | |
| 113 | 113 | return ! ( isset( $options['timestamp'] ) && (int) $options['timestamp'] > $this->get_time() ); |
| 114 | 114 | } |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $to = $this->prepare_email_setting( $this->settings['email_to'], $user_id_args ); |
| 163 | 163 | $to = $this->explode_emails( $to ); |
| 164 | 164 | |
| 165 | - $where = array( |
|
| 165 | + $where = array( |
|
| 166 | 166 | 'it.field_id !' => 0, |
| 167 | 167 | 'it.item_id' => $this->entry->id, |
| 168 | 168 | ); |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | 'entry' => $this->entry, |
| 173 | 173 | 'form' => $this->form, |
| 174 | 174 | ); |
| 175 | - $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
| 175 | + $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
| 176 | 176 | |
| 177 | 177 | $this->to = array_unique( (array) $to ); |
| 178 | 178 | |
@@ -702,11 +702,11 @@ discard block |
||
| 702 | 702 | $name = trim( str_replace( $email, '', $val ) ); |
| 703 | 703 | } else { |
| 704 | 704 | // If user enters a name without an email |
| 705 | - unset( $recipients[ $key ] ); |
|
| 705 | + unset( $recipients[$key] ); |
|
| 706 | 706 | continue; |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | - $recipients[ $key ] = $this->format_from_email( $name, $email ); |
|
| 709 | + $recipients[$key] = $this->format_from_email( $name, $email ); |
|
| 710 | 710 | }//end foreach |
| 711 | 711 | |
| 712 | 712 | return $recipients; |
@@ -856,7 +856,7 @@ discard block |
||
| 856 | 856 | ); |
| 857 | 857 | |
| 858 | 858 | // Remove phone number from to addresses |
| 859 | - unset( $this->to[ $key ] ); |
|
| 859 | + unset( $this->to[$key] ); |
|
| 860 | 860 | }//end if |
| 861 | 861 | }//end foreach |
| 862 | 862 | } |
@@ -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 | |
@@ -165,10 +165,10 @@ discard block |
||
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | foreach ( $defaults as $opt => $default ) { |
| 168 | - $values[ $opt ] = isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default; |
|
| 168 | + $values[$opt] = isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default; |
|
| 169 | 169 | |
| 170 | 170 | if ( $check_post ) { |
| 171 | - self::get_posted_field_setting( $opt . '_' . $field->id, $values[ $opt ] ); |
|
| 171 | + self::get_posted_field_setting( $opt . '_' . $field->id, $values[$opt] ); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | unset( $opt, $default ); |
@@ -244,18 +244,18 @@ discard block |
||
| 244 | 244 | * @param mixed $value |
| 245 | 245 | */ |
| 246 | 246 | private static function get_posted_field_setting( $setting, &$value ) { |
| 247 | - if ( ! isset( $_POST['field_options'][ $setting ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 247 | + if ( ! isset( $_POST['field_options'][$setting] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 248 | 248 | return; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | if ( strpos( $setting, 'html' ) !== false ) { |
| 252 | 252 | // Strip slashes from HTML but not regex or script tags. |
| 253 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 253 | + $value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 254 | 254 | } elseif ( strpos( $setting, 'format_' ) === 0 ) { |
| 255 | 255 | // TODO: Remove stripslashes on output, and use on input only. |
| 256 | - $value = sanitize_text_field( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing |
|
| 256 | + $value = sanitize_text_field( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.NonceVerification.Missing |
|
| 257 | 257 | } else { |
| 258 | - $value = wp_unslash( $_POST['field_options'][ $setting ] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 258 | + $value = wp_unslash( $_POST['field_options'][$setting] ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized, WordPress.Security.NonceVerification.Missing |
|
| 259 | 259 | FrmAppHelper::sanitize_value( 'wp_kses_post', $value ); |
| 260 | 260 | } |
| 261 | 261 | } |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | $values['default_value'] = FrmAppHelper::maybe_json_encode( $field->default_value ); |
| 329 | 329 | |
| 330 | 330 | foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
| 331 | - $values[ $col ] = $field->{$col}; |
|
| 331 | + $values[$col] = $field->{$col}; |
|
| 332 | 332 | } |
| 333 | 333 | } |
| 334 | 334 | |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | ); |
| 367 | 367 | |
| 368 | 368 | $msg = FrmField::get_option( $field, $error ); |
| 369 | - $msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg; |
|
| 369 | + $msg = empty( $msg ) ? $defaults[$error]['part'] : $msg; |
|
| 370 | 370 | $msg = do_shortcode( $msg ); |
| 371 | 371 | |
| 372 | 372 | $msg = self::maybe_replace_substrings_with_field_name( $msg, $error, $field ); |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | 'title' => '', |
| 635 | 635 | 'inside_class' => 'inside', |
| 636 | 636 | ); |
| 637 | - $args = array_merge( $defaults, $args ); |
|
| 637 | + $args = array_merge( $defaults, $args ); |
|
| 638 | 638 | |
| 639 | 639 | include FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/inline-modal.php'; |
| 640 | 640 | } |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | continue; |
| 872 | 872 | } |
| 873 | 873 | |
| 874 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
| 874 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
| 875 | 875 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
| 876 | 876 | |
| 877 | 877 | $atts['entry'] = $entry; |
@@ -881,7 +881,7 @@ discard block |
||
| 881 | 881 | if ( $replace_with !== null ) { |
| 882 | 882 | $replace_with = self::trigger_shortcode_atts( $replace_with, $atts ); |
| 883 | 883 | self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with ); |
| 884 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
| 884 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | unset( $atts, $replace_with ); |
@@ -899,7 +899,7 @@ discard block |
||
| 899 | 899 | $supported_atts = array( 'remove_accents', 'sanitize', 'sanitize_url' ); |
| 900 | 900 | $included_atts = array_intersect( $supported_atts, array_keys( $atts ) ); |
| 901 | 901 | foreach ( $included_atts as $included_att ) { |
| 902 | - if ( '0' === $atts[ $included_att ] ) { |
|
| 902 | + if ( '0' === $atts[$included_att] ) { |
|
| 903 | 903 | // Skip any option that uses 0 so sanitize_url=0 does not encode. |
| 904 | 904 | continue; |
| 905 | 905 | } |
@@ -972,8 +972,8 @@ discard block |
||
| 972 | 972 | |
| 973 | 973 | $dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get', 'default-email', 'default-from-email' ); |
| 974 | 974 | |
| 975 | - if ( isset( $shortcode_values[ $atts['tag'] ] ) ) { |
|
| 976 | - $replace_with = $shortcode_values[ $atts['tag'] ]; |
|
| 975 | + if ( isset( $shortcode_values[$atts['tag']] ) ) { |
|
| 976 | + $replace_with = $shortcode_values[$atts['tag']]; |
|
| 977 | 977 | } elseif ( in_array( $atts['tag'], $dynamic_default, true ) ) { |
| 978 | 978 | $replace_with = self::dynamic_default_values( $atts['tag'], $atts ); |
| 979 | 979 | } elseif ( $clean_tag === 'user_agent' ) { |
@@ -1197,8 +1197,8 @@ discard block |
||
| 1197 | 1197 | self::field_types_for_input( $single_input, $field_selection, $field_types ); |
| 1198 | 1198 | } elseif ( in_array( $type, $multiple_input, true ) ) { |
| 1199 | 1199 | self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
| 1200 | - } elseif ( isset( $field_selection[ $type ] ) ) { |
|
| 1201 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
| 1200 | + } elseif ( isset( $field_selection[$type] ) ) { |
|
| 1201 | + $field_types[$type] = $field_selection[$type]; |
|
| 1202 | 1202 | } |
| 1203 | 1203 | |
| 1204 | 1204 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type', 'field_selection' ) ); |
@@ -1239,7 +1239,7 @@ discard block |
||
| 1239 | 1239 | foreach ( $inputs as $input ) { |
| 1240 | 1240 | // This may not be set if a field type was removed using the frm_available_fields or frm_pro_available_fields filters. |
| 1241 | 1241 | if ( array_key_exists( $input, $fields ) ) { |
| 1242 | - $field_types[ $input ] = $fields[ $input ]; |
|
| 1242 | + $field_types[$input] = $fields[$input]; |
|
| 1243 | 1243 | } |
| 1244 | 1244 | unset( $input ); |
| 1245 | 1245 | } |
@@ -1272,7 +1272,7 @@ discard block |
||
| 1272 | 1272 | 'parent' => false, |
| 1273 | 1273 | 'pointer' => false, |
| 1274 | 1274 | ); |
| 1275 | - $args = wp_parse_args( $args, $defaults ); |
|
| 1275 | + $args = wp_parse_args( $args, $defaults ); |
|
| 1276 | 1276 | |
| 1277 | 1277 | $opt_key = $args['opt_key']; |
| 1278 | 1278 | $field = $args['field']; |
@@ -1288,25 +1288,25 @@ discard block |
||
| 1288 | 1288 | |
| 1289 | 1289 | // Check posted vals before checking saved values |
| 1290 | 1290 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
| 1291 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1291 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1292 | 1292 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 1293 | 1293 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 1294 | - $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 ] ) ) : ''; |
|
| 1294 | + $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] ) ) : ''; |
|
| 1295 | 1295 | } else { |
| 1296 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1296 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1297 | 1297 | } |
| 1298 | 1298 | |
| 1299 | 1299 | return $other_val; |
| 1300 | 1300 | } |
| 1301 | 1301 | |
| 1302 | - if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1302 | + if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1303 | 1303 | // For normal fields |
| 1304 | 1304 | |
| 1305 | 1305 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 1306 | 1306 | // phpcs:ignore WordPress.Security.NonceVerification.Missing |
| 1307 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ) : ''; |
|
| 1307 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ) : ''; |
|
| 1308 | 1308 | } else { |
| 1309 | - $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][ $field['id'] ] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1309 | + $other_val = sanitize_text_field( wp_unslash( $_POST['item_meta']['other'][$field['id']] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Missing |
|
| 1310 | 1310 | } |
| 1311 | 1311 | |
| 1312 | 1312 | return $other_val; |
@@ -1316,8 +1316,8 @@ discard block |
||
| 1316 | 1316 | if ( $field['type'] === 'checkbox' && is_array( $field['value'] ) ) { |
| 1317 | 1317 | // Check if there is an "other" val in saved value and make sure the |
| 1318 | 1318 | // "other" val is not equal to the Other checkbox option |
| 1319 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
| 1320 | - $other_val = $field['value'][ $opt_key ]; |
|
| 1319 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
| 1320 | + $other_val = $field['value'][$opt_key]; |
|
| 1321 | 1321 | } |
| 1322 | 1322 | } else { |
| 1323 | 1323 | /** |
@@ -1329,8 +1329,8 @@ discard block |
||
| 1329 | 1329 | // Multi-select dropdowns - key is not preserved |
| 1330 | 1330 | if ( is_array( $field['value'] ) ) { |
| 1331 | 1331 | $o_key = array_search( $temp_val, $field['value'] ); |
| 1332 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
| 1333 | - unset( $field['value'][ $o_key ], $o_key ); |
|
| 1332 | + if ( isset( $field['value'][$o_key] ) ) { |
|
| 1333 | + unset( $field['value'][$o_key], $o_key ); |
|
| 1334 | 1334 | } |
| 1335 | 1335 | } elseif ( $temp_val == $field['value'] ) { |
| 1336 | 1336 | // For radio and regular dropdowns |
@@ -1538,11 +1538,11 @@ discard block |
||
| 1538 | 1538 | foreach ( $val as $k => $v ) { |
| 1539 | 1539 | if ( is_string( $v ) ) { |
| 1540 | 1540 | if ( 'custom_html' === $k ) { |
| 1541 | - $val[ $k ] = self::switch_ids_except_strings( $replace, $replace_with, array( '[if description]', '[description]', '[/if description]' ), $v ); |
|
| 1541 | + $val[$k] = self::switch_ids_except_strings( $replace, $replace_with, array( '[if description]', '[description]', '[/if description]' ), $v ); |
|
| 1542 | 1542 | unset( $k, $v ); |
| 1543 | 1543 | continue; |
| 1544 | 1544 | } |
| 1545 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
| 1545 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
| 1546 | 1546 | unset( $k, $v ); |
| 1547 | 1547 | } |
| 1548 | 1548 | } |
@@ -1571,8 +1571,8 @@ discard block |
||
| 1571 | 1571 | if ( false === $index ) { |
| 1572 | 1572 | continue; |
| 1573 | 1573 | } |
| 1574 | - unset( $replace[ $index ] ); |
|
| 1575 | - unset( $replace_with[ $index ] ); |
|
| 1574 | + unset( $replace[$index] ); |
|
| 1575 | + unset( $replace_with[$index] ); |
|
| 1576 | 1576 | } |
| 1577 | 1577 | $value = str_replace( $replace, $replace_with, $value ); |
| 1578 | 1578 | return $value; |
@@ -1920,7 +1920,7 @@ discard block |
||
| 1920 | 1920 | $countries['class'] = 'frm-countries-opts'; |
| 1921 | 1921 | } |
| 1922 | 1922 | |
| 1923 | - $prepop[ __( 'Countries', 'formidable' ) ] = $countries; |
|
| 1923 | + $prepop[__( 'Countries', 'formidable' )] = $countries; |
|
| 1924 | 1924 | |
| 1925 | 1925 | // State abv. |
| 1926 | 1926 | $states = self::get_us_states(); |
@@ -1930,7 +1930,7 @@ discard block |
||
| 1930 | 1930 | $state_abv['class'] = 'frm-state-abv-opts'; |
| 1931 | 1931 | } |
| 1932 | 1932 | |
| 1933 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
| 1933 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
| 1934 | 1934 | |
| 1935 | 1935 | // States. |
| 1936 | 1936 | $states = array_values( $states ); |
@@ -1939,7 +1939,7 @@ discard block |
||
| 1939 | 1939 | $states['class'] = 'frm-states-opts'; |
| 1940 | 1940 | } |
| 1941 | 1941 | |
| 1942 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
| 1942 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
| 1943 | 1943 | unset( $state_abv, $states ); |
| 1944 | 1944 | |
| 1945 | 1945 | // Age. |
@@ -1957,7 +1957,7 @@ discard block |
||
| 1957 | 1957 | $ages['class'] = 'frm-age-opts'; |
| 1958 | 1958 | } |
| 1959 | 1959 | |
| 1960 | - $prepop[ __( 'Age', 'formidable' ) ] = $ages; |
|
| 1960 | + $prepop[__( 'Age', 'formidable' )] = $ages; |
|
| 1961 | 1961 | |
| 1962 | 1962 | // Satisfaction. |
| 1963 | 1963 | $satisfaction = array( |
@@ -1972,7 +1972,7 @@ discard block |
||
| 1972 | 1972 | $satisfaction['class'] = 'frm-satisfaction-opts'; |
| 1973 | 1973 | } |
| 1974 | 1974 | |
| 1975 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = $satisfaction; |
|
| 1975 | + $prepop[__( 'Satisfaction', 'formidable' )] = $satisfaction; |
|
| 1976 | 1976 | |
| 1977 | 1977 | // Importance. |
| 1978 | 1978 | $importance = array( |
@@ -1987,7 +1987,7 @@ discard block |
||
| 1987 | 1987 | $importance['class'] = 'frm-importance-opts'; |
| 1988 | 1988 | } |
| 1989 | 1989 | |
| 1990 | - $prepop[ __( 'Importance', 'formidable' ) ] = $importance; |
|
| 1990 | + $prepop[__( 'Importance', 'formidable' )] = $importance; |
|
| 1991 | 1991 | |
| 1992 | 1992 | // Agreement. |
| 1993 | 1993 | $agreement = array( |
@@ -2002,7 +2002,7 @@ discard block |
||
| 2002 | 2002 | $agreement['class'] = 'frm-agreement-opts'; |
| 2003 | 2003 | } |
| 2004 | 2004 | |
| 2005 | - $prepop[ __( 'Agreement', 'formidable' ) ] = $agreement; |
|
| 2005 | + $prepop[__( 'Agreement', 'formidable' )] = $agreement; |
|
| 2006 | 2006 | |
| 2007 | 2007 | // Likely. |
| 2008 | 2008 | $likely = array( |
@@ -2017,7 +2017,7 @@ discard block |
||
| 2017 | 2017 | $likely['class'] = 'frm-likely-opts'; |
| 2018 | 2018 | } |
| 2019 | 2019 | |
| 2020 | - $prepop[ __( 'Likely', 'formidable' ) ] = $likely; |
|
| 2020 | + $prepop[__( 'Likely', 'formidable' )] = $likely; |
|
| 2021 | 2021 | |
| 2022 | 2022 | $prepop = apply_filters( 'frm_bulk_field_choices', $prepop ); |
| 2023 | 2023 | } |
@@ -2238,16 +2238,16 @@ discard block |
||
| 2238 | 2238 | */ |
| 2239 | 2239 | private static function fill_image_setting_options( $options, &$args ) { |
| 2240 | 2240 | foreach ( $options as $key => $option ) { |
| 2241 | - $args['options'][ $key ] = $option; |
|
| 2241 | + $args['options'][$key] = $option; |
|
| 2242 | 2242 | |
| 2243 | 2243 | if ( ! empty( $option['addon'] ) ) { |
| 2244 | - $args['options'][ $key ]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
| 2244 | + $args['options'][$key]['custom_attrs'] = self::fill_image_setting_addon_link( $option ); |
|
| 2245 | 2245 | } |
| 2246 | 2246 | |
| 2247 | - unset( $args['options'][ $key ]['addon'] ); |
|
| 2247 | + unset( $args['options'][$key]['addon'] ); |
|
| 2248 | 2248 | $fill = array( 'upgrade', 'message', 'content' ); |
| 2249 | 2249 | foreach ( $fill as $f ) { |
| 2250 | - unset( $args['options'][ $key ][ $f ], $f ); |
|
| 2250 | + unset( $args['options'][$key][$f], $f ); |
|
| 2251 | 2251 | } |
| 2252 | 2252 | } |
| 2253 | 2253 | } |
@@ -2268,8 +2268,8 @@ discard block |
||
| 2268 | 2268 | |
| 2269 | 2269 | $fill = array( 'upgrade', 'message', 'content' ); |
| 2270 | 2270 | foreach ( $fill as $f ) { |
| 2271 | - if ( isset( $option[ $f ] ) ) { |
|
| 2272 | - $custom_attrs[ 'data-' . $f ] = $option[ $f ]; |
|
| 2271 | + if ( isset( $option[$f] ) ) { |
|
| 2272 | + $custom_attrs['data-' . $f] = $option[$f]; |
|
| 2273 | 2273 | } |
| 2274 | 2274 | } |
| 2275 | 2275 | |
@@ -2335,7 +2335,7 @@ discard block |
||
| 2335 | 2335 | |
| 2336 | 2336 | return array_filter( |
| 2337 | 2337 | $rows, |
| 2338 | - function ( $row ) { |
|
| 2338 | + function( $row ) { |
|
| 2339 | 2339 | FrmAppHelper::unserialize_or_decode( $row->field_options ); |
| 2340 | 2340 | return is_array( $row->field_options ) && ! empty( $row->field_options['draft'] ); |
| 2341 | 2341 | } |
@@ -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 | ); |