@@ -14,7 +14,7 @@ |
||
| 14 | 14 | protected function field_settings_for_type() { |
| 15 | 15 | return array( |
| 16 | 16 | 'size' => true, |
| 17 | - 'clear_on_focus' => true, |
|
| 17 | + 'clear_on_focus' => true, |
|
| 18 | 18 | 'invalid' => true, |
| 19 | 19 | ); |
| 20 | 20 | } |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | public function validate( $args ) { |
| 37 | 37 | $errors = array(); |
| 38 | 38 | if ( $args['value'] != '' && ! is_email( $args['value'] ) ) { |
| 39 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 39 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 40 | 40 | } |
| 41 | 41 | return $errors; |
| 42 | 42 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | </div> |
| 6 | 6 | </div> |
| 7 | 7 | <?php |
| 8 | - return; |
|
| 8 | + return; |
|
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | global $frm_vars; |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | // close open collapsible toggle div |
| 56 | 56 | if ( isset($frm_vars['collapse_div']) && $frm_vars['collapse_div'] ) { |
| 57 | - echo "</div>\n"; |
|
| 58 | - unset($frm_vars['collapse_div']); |
|
| 57 | + echo "</div>\n"; |
|
| 58 | + unset($frm_vars['collapse_div']); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | echo FrmFormsHelper::replace_shortcodes($values['after_html'], $form); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( empty($values) || ! isset($values['fields']) || empty($values['fields']) ) { ?> |
|
| 3 | -<div class="frm_forms <?php echo FrmFormsHelper::get_form_style_class($form); ?>" id="frm_form_<?php echo esc_attr( $form->id ) ?>_container"> |
|
| 2 | +if ( empty( $values ) || ! isset( $values['fields'] ) || empty( $values['fields'] ) ) { ?> |
|
| 3 | +<div class="frm_forms <?php echo FrmFormsHelper::get_form_style_class( $form ); ?>" id="frm_form_<?php echo esc_attr( $form->id ) ?>_container"> |
|
| 4 | 4 | <div class="frm_error_style"><strong><?php esc_html_e( 'Oops!', 'formidable' ) ?></strong> <?php printf( esc_html__( 'You did not add any fields to your form. %1$sGo back%2$s and add some.', 'formidable' ), '<a href="' . esc_url( admin_url( '?page=formidable&frm_action=edit&id=' . $form->id ) ) . '">', '</a>' ) ?> |
| 5 | 5 | </div> |
| 6 | 6 | </div> |
@@ -19,15 +19,15 @@ discard block |
||
| 19 | 19 | <fieldset> |
| 20 | 20 | <?php echo FrmFormsHelper::replace_shortcodes( $values['before_html'], $form, $title, $description ); ?> |
| 21 | 21 | <div <?php echo wp_strip_all_tags( apply_filters( 'frm_fields_container_class', 'class="frm_fields_container"' ) ); ?>> |
| 22 | -<?php do_action( 'frm_after_title', compact('form') ) ?> |
|
| 23 | -<input type="hidden" name="frm_action" value="<?php echo esc_attr($form_action) ?>" /> |
|
| 24 | -<input type="hidden" name="form_id" value="<?php echo esc_attr($form->id) ?>" /> |
|
| 25 | -<input type="hidden" name="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" id="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" value="<?php echo esc_attr($frm_hide_fields) ?>" /> |
|
| 26 | -<input type="hidden" name="form_key" value="<?php echo esc_attr($form->form_key) ?>" /> |
|
| 22 | +<?php do_action( 'frm_after_title', compact( 'form' ) ) ?> |
|
| 23 | +<input type="hidden" name="frm_action" value="<?php echo esc_attr( $form_action ) ?>" /> |
|
| 24 | +<input type="hidden" name="form_id" value="<?php echo esc_attr( $form->id ) ?>" /> |
|
| 25 | +<input type="hidden" name="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" id="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" value="<?php echo esc_attr( $frm_hide_fields ) ?>" /> |
|
| 26 | +<input type="hidden" name="form_key" value="<?php echo esc_attr( $form->form_key ) ?>" /> |
|
| 27 | 27 | <input type="hidden" name="item_meta[0]" value="" /> |
| 28 | 28 | <?php wp_nonce_field( 'frm_submit_entry_nonce', 'frm_submit_entry_' . $form->id ); ?> |
| 29 | 29 | <label for="frm_verify_<?php echo esc_attr( $form->id ) ?>" class="frm_screen_reader frm_hidden"><?php esc_html_e( 'If you are human, leave this field blank.', 'formidable' ) ?></label> |
| 30 | -<input type="text" class="frm_hidden frm_verify" id="frm_verify_<?php echo esc_attr( $form->id ) ?>" name="frm_verify" value="<?php echo esc_attr( FrmAppHelper::get_param('frm_verify', '', 'get', 'wp_kses_post' ) ) ?>" <?php FrmFormsHelper::maybe_hide_inline() ?> /> |
|
| 30 | +<input type="text" class="frm_hidden frm_verify" id="frm_verify_<?php echo esc_attr( $form->id ) ?>" name="frm_verify" value="<?php echo esc_attr( FrmAppHelper::get_param( 'frm_verify', '', 'get', 'wp_kses_post' ) ) ?>" <?php FrmFormsHelper::maybe_hide_inline() ?> /> |
|
| 31 | 31 | <?php if ( isset( $id ) ) { ?> |
| 32 | 32 | <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> |
| 33 | 33 | <?php } ?> |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | ?> |
| 42 | 42 | <div class="frm_form_field form-field"> |
| 43 | 43 | <label class="frm_primary_label"><?php esc_html_e( 'Entry Key', 'formidable' ) ?></label> |
| 44 | -<input type="text" name="item_key" value="<?php echo esc_attr($values['item_key']) ?>" /> |
|
| 44 | +<input type="text" name="item_key" value="<?php echo esc_attr( $values['item_key'] ) ?>" /> |
|
| 45 | 45 | </div> |
| 46 | 46 | <?php } else { ?> |
| 47 | -<input type="hidden" name="item_key" value="<?php echo esc_attr($values['item_key']) ?>" /> |
|
| 47 | +<input type="hidden" name="item_key" value="<?php echo esc_attr( $values['item_key'] ) ?>" /> |
|
| 48 | 48 | <?php |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | -do_action('frm_entry_form', $form, $form_action, $errors); |
|
| 51 | +do_action( 'frm_entry_form', $form, $form_action, $errors ); |
|
| 52 | 52 | |
| 53 | 53 | global $frm_vars; |
| 54 | 54 | // close open section div |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // close open collapsible toggle div |
| 61 | -if ( isset($frm_vars['collapse_div']) && $frm_vars['collapse_div'] ) { |
|
| 61 | +if ( isset( $frm_vars['collapse_div'] ) && $frm_vars['collapse_div'] ) { |
|
| 62 | 62 | echo "</div>\n"; |
| 63 | - unset($frm_vars['collapse_div']); |
|
| 63 | + unset( $frm_vars['collapse_div'] ); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | -echo FrmFormsHelper::replace_shortcodes($values['after_html'], $form); |
|
| 66 | +echo FrmFormsHelper::replace_shortcodes( $values['after_html'], $form ); |
|
| 67 | 67 | |
| 68 | 68 | if ( FrmForm::show_submit( $form ) ) { |
| 69 | 69 | |
@@ -76,6 +76,6 @@ discard block |
||
| 76 | 76 | </div> |
| 77 | 77 | </fieldset> |
| 78 | 78 | </div> |
| 79 | -<?php if ( has_action('frm_entries_footer_scripts') ) { ?> |
|
| 79 | +<?php if ( has_action( 'frm_entries_footer_scripts' ) ) { ?> |
|
| 80 | 80 | <script type="text/javascript"><?php do_action( 'frm_entries_footer_scripts', $values['fields'], $form ); ?></script> |
| 81 | 81 | <?php } ?> |
@@ -151,6 +151,7 @@ |
||
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | 153 | * @deprecated 2.04 |
| 154 | + * @param string $val |
|
| 154 | 155 | */ |
| 155 | 156 | private static function get_field_value( $atts, &$val ) { |
| 156 | 157 | _deprecated_function( __FUNCTION__, '2.04', 'instance of FrmEntryValues or FrmProEntryValues' ); |
@@ -98,15 +98,15 @@ discard block |
||
| 98 | 98 | self::prepare_field_output( $atts, $val ); |
| 99 | 99 | |
| 100 | 100 | if ( $atts['format'] != 'text' ) { |
| 101 | - $values[ $f->field_key ] = $val; |
|
| 101 | + $values[$f->field_key] = $val; |
|
| 102 | 102 | if ( $atts['entry'] && $f->type != 'textarea' ) { |
| 103 | - $prev_val = maybe_unserialize( $atts['entry']->metas[ $f->id ] ); |
|
| 103 | + $prev_val = maybe_unserialize( $atts['entry']->metas[$f->id] ); |
|
| 104 | 104 | if ( $prev_val != $val ) { |
| 105 | - $values[ $f->field_key . '-value' ] = $prev_val; |
|
| 105 | + $values[$f->field_key . '-value'] = $prev_val; |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | } else { |
| 109 | - $values[ $f->id ] = array( |
|
| 109 | + $values[$f->id] = array( |
|
| 110 | 110 | 'label' => $f->name, |
| 111 | 111 | 'val' => $val, |
| 112 | 112 | 'type' => $f->type, |
@@ -120,9 +120,9 @@ discard block |
||
| 120 | 120 | private static function fill_missing_fields( $atts, &$values ) { |
| 121 | 121 | _deprecated_function( __FUNCTION__, '2.04', 'instance of FrmEntryValues or FrmProEntryValues' ); |
| 122 | 122 | |
| 123 | - if ( $atts['entry'] && ! isset( $atts['entry']->metas[ $atts['field']->id ] ) ) { |
|
| 123 | + if ( $atts['entry'] && ! isset( $atts['entry']->metas[$atts['field']->id] ) ) { |
|
| 124 | 124 | // In case include_blank is set |
| 125 | - $atts['entry']->metas[ $atts['field']->id ] = ''; |
|
| 125 | + $atts['entry']->metas[$atts['field']->id] = ''; |
|
| 126 | 126 | $atts['entry'] = apply_filters( 'frm_prepare_entry_content', $atts['entry'], array( 'field' => $atts['field'] ) ); |
| 127 | 127 | self::fill_values_from_entry( $atts, $values ); |
| 128 | 128 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | 'type' => $f->type, |
| 151 | 151 | ); |
| 152 | 152 | |
| 153 | - $values[ $f->id ] = apply_filters( 'frm_field_shortcodes_for_default_html_email', $field_shortcodes, $f ); |
|
| 153 | + $values[$f->id] = apply_filters( 'frm_field_shortcodes_for_default_html_email', $field_shortcodes, $f ); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | /** |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | $f = $atts['field']; |
| 163 | 163 | if ( $atts['entry'] ) { |
| 164 | - $prev_val = maybe_unserialize( $atts['entry']->metas[ $f->id ] ); |
|
| 164 | + $prev_val = maybe_unserialize( $atts['entry']->metas[$f->id] ); |
|
| 165 | 165 | $meta = array( |
| 166 | 166 | 'item_id' => $atts['id'], |
| 167 | 167 | 'field_id' => $f->id, |
@@ -285,7 +285,7 @@ |
||
| 285 | 285 | 'type' => $field->type, |
| 286 | 286 | ); |
| 287 | 287 | |
| 288 | - $this->array_content[ $field->id ] = apply_filters( 'frm_field_shortcodes_for_default_html_email', $array, $field ); |
|
| 288 | + $this->array_content[$field->id] = apply_filters( 'frm_field_shortcodes_for_default_html_email', $array, $field ); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | * |
| 364 | 364 | * @since 2.04 |
| 365 | 365 | * |
| 366 | - * @param array $field_values |
|
| 366 | + * @param FrmFieldValue[] $field_values |
|
| 367 | 367 | * @param array $output |
| 368 | 368 | */ |
| 369 | 369 | protected function push_field_values_to_array( $field_values, &$output ) { |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | * |
| 571 | 571 | * @param mixed $value |
| 572 | 572 | * |
| 573 | - * @return mixed|string |
|
| 573 | + * @return FrmFieldValue |
|
| 574 | 574 | */ |
| 575 | 575 | protected function prepare_display_value_for_array( $value ) { |
| 576 | 576 | return $this->strip_html( $value ); |
@@ -585,7 +585,7 @@ discard block |
||
| 585 | 585 | * @param mixed $display_value |
| 586 | 586 | * @param string $field_type |
| 587 | 587 | * |
| 588 | - * @return mixed|string |
|
| 588 | + * @return string |
|
| 589 | 589 | */ |
| 590 | 590 | protected function prepare_display_value_for_html_table( $display_value, $field_type = '' ) { |
| 591 | 591 | $display_value = $this->flatten_array( $display_value ); |
@@ -161,8 +161,8 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | $conditionally_add = array( 'include_fields', 'fields', 'exclude_fields' ); |
| 163 | 163 | foreach ( $conditionally_add as $index ) { |
| 164 | - if ( isset( $atts[ $index ] ) ) { |
|
| 165 | - $entry_atts[ $index ] = $atts[ $index ]; |
|
| 164 | + if ( isset( $atts[$index] ) ) { |
|
| 165 | + $entry_atts[$index] = $atts[$index]; |
|
| 166 | 166 | } |
| 167 | 167 | } |
| 168 | 168 | |
@@ -331,8 +331,8 @@ discard block |
||
| 331 | 331 | |
| 332 | 332 | $unset = array( 'id', 'entry', 'form_id', 'format', 'plain_text' ); |
| 333 | 333 | foreach ( $unset as $param ) { |
| 334 | - if ( isset( $atts[ $param ] ) ) { |
|
| 335 | - unset( $atts[ $param ] ); |
|
| 334 | + if ( isset( $atts[$param] ) ) { |
|
| 335 | + unset( $atts[$param] ); |
|
| 336 | 336 | } |
| 337 | 337 | } |
| 338 | 338 | |
@@ -484,10 +484,10 @@ discard block |
||
| 484 | 484 | if ( $this->include_field_in_content( $field_value ) ) { |
| 485 | 485 | |
| 486 | 486 | $displayed_value = $this->prepare_display_value_for_array( $field_value->get_displayed_value() ); |
| 487 | - $output[ $this->get_key_or_id( $field_value ) ] = $displayed_value; |
|
| 487 | + $output[$this->get_key_or_id( $field_value )] = $displayed_value; |
|
| 488 | 488 | |
| 489 | 489 | if ( $displayed_value !== $field_value->get_saved_value() ) { |
| 490 | - $output[ $this->get_key_or_id( $field_value ) . '-value' ] = $field_value->get_saved_value(); |
|
| 490 | + $output[$this->get_key_or_id( $field_value ) . '-value'] = $field_value->get_saved_value(); |
|
| 491 | 491 | } |
| 492 | 492 | } |
| 493 | 493 | } |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | |
| 876 | 876 | if ( is_array( $value ) ) { |
| 877 | 877 | foreach ( $value as $key => $single_value ) { |
| 878 | - $value[ $key ] = $this->strip_html( $single_value ); |
|
| 878 | + $value[$key] = $this->strip_html( $single_value ); |
|
| 879 | 879 | } |
| 880 | 880 | } else if ( $this->is_plain_text && ! is_array( $value ) ) { |
| 881 | 881 | if ( strpos( $value, '<img' ) !== false ) { |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action('frm_field_input_html', $field) ?> /><?php |
|
| 40 | + ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action( 'frm_field_input_html', $field ) ?> /><?php |
|
| 41 | 41 | |
| 42 | 42 | if ( ! isset( $shortcode_atts ) || ! isset( $shortcode_atts['label'] ) || $shortcode_atts['label'] ) { |
| 43 | 43 | echo ' ' . $opt . '</label>'; |
@@ -18,14 +18,14 @@ |
||
| 18 | 18 | if ( ! isset( $shortcode_atts ) || ! isset( $shortcode_atts['label'] ) || $shortcode_atts['label'] ) { |
| 19 | 19 | ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php |
| 20 | 20 | } |
| 21 | - $checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' '; |
|
| 21 | + $checked = FrmAppHelper::check_selected( $field['value'], $field_val ) ? 'checked="checked" ' : ' '; |
|
| 22 | 22 | |
| 23 | 23 | $other_opt = false; |
| 24 | 24 | $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked ); |
| 25 | 25 | ?> |
| 26 | 26 | <input type="radio" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php |
| 27 | 27 | echo $checked; |
| 28 | - do_action('frm_field_input_html', $field); |
|
| 28 | + do_action( 'frm_field_input_html', $field ); |
|
| 29 | 29 | ?>/><?php |
| 30 | 30 | |
| 31 | 31 | if ( ! isset( $shortcode_atts ) || ! isset( $shortcode_atts['label'] ) || $shortcode_atts['label'] ) { |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | 'captcha' => 'FrmFieldCaptcha', |
| 87 | 87 | ); |
| 88 | 88 | |
| 89 | - $class = isset( $type_classes[ $field_type ] ) ? $type_classes[ $field_type ] : ''; |
|
| 89 | + $class = isset( $type_classes[$field_type] ) ? $type_classes[$field_type] : ''; |
|
| 90 | 90 | return apply_filters( 'frm_get_field_type_class', $class, $field_type ); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @since 3.0 |
| 56 | 56 | * |
| 57 | 57 | * @param string $field_type |
| 58 | - * @param int|array|object $field |
|
| 58 | + * @param integer $field |
|
| 59 | 59 | * |
| 60 | 60 | * @return stdClass |
| 61 | 61 | */ |
@@ -111,6 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | 113 | * @since 3.0 |
| 114 | + * @param string $property |
|
| 114 | 115 | */ |
| 115 | 116 | public static function field_has_property( $type, $property ) { |
| 116 | 117 | $field = self::get_field_type( $type ); |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | protected function extra_field_opts() { |
| 41 | - $form_id = $this->get_field_column('form_id'); |
|
| 41 | + $form_id = $this->get_field_column( 'form_id' ); |
|
| 42 | 42 | return array( |
| 43 | 43 | 'align' => FrmStylesController::get_style_val( 'radio_align', ( empty( $form_id ) ? 'default' : $form_id ) ), |
| 44 | 44 | ); |