Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions classes/controllers/FrmStylesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,13 @@ public static function get_file_name() {
* @return string
*/
private static function get_css_version( $css_key, $version ) {
if ( 'formidable' === $css_key ) {
$this_version = get_option( 'frm_last_style_update' );
if ( 'formidable' !== $css_key ) {
return $version;
}

if ( ! $this_version ) {
$this_version = $version;
}
} else {
$this_version = get_option( 'frm_last_style_update' );

if ( ! $this_version ) {
$this_version = $version;
}

Expand Down
26 changes: 13 additions & 13 deletions classes/helpers/FrmFieldsHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1773,9 +1773,9 @@ public static function get_other_field_html_id( $type, $html_id, $opt_key = fals
}

/**
* @param string $val
* @param array|string $val
*
* @return string
* @return array|string
*/
public static function switch_field_ids( $val ) {
global $frm_duplicate_ids;
Expand Down Expand Up @@ -1811,21 +1811,21 @@ public static function switch_field_ids( $val ) {
unset( $old, $new );
}//end foreach

if ( is_array( $val ) ) {
foreach ( $val as $k => $v ) {
if ( is_string( $v ) ) {
if ( 'custom_html' === $k ) {
$val[ $k ] = self::switch_ids_except_strings( $replace, $replace_with, array( '[if description]', '[description]', '[/if description]' ), $v );
unset( $k, $v );
continue;
}
if ( ! is_array( $val ) ) {
return str_replace( $replace, $replace_with, $val );
}

$val[ $k ] = str_replace( $replace, $replace_with, $v );
foreach ( $val as $k => $v ) {
if ( is_string( $v ) ) {
if ( 'custom_html' === $k ) {
$val[ $k ] = self::switch_ids_except_strings( $replace, $replace_with, array( '[if description]', '[description]', '[/if description]' ), $v );
unset( $k, $v );
continue;
}

$val[ $k ] = str_replace( $replace, $replace_with, $v );
unset( $k, $v );
}
} else {
$val = str_replace( $replace, $replace_with, $val );
}

return $val;
Expand Down
22 changes: 11 additions & 11 deletions classes/helpers/FrmShortcodeHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,17 @@ public static function get_shortcode_tag( $shortcodes, $short_key, $args = array

$with_tags = $args['conditional_check'] ? 3 : 2;

if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
$tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
$tag = str_replace( ']', '', $tag );
$tag = str_replace( chr( 194 ) . chr( 160 ), ' ', $tag );
$tags = preg_split( '/\s+/', $tag, 2 );

if ( is_array( $tags ) ) {
$tag = $tags[0];
}
} else {
$tag = $shortcodes[ $with_tags - 1 ][ $short_key ];
if ( empty( $shortcodes[ $with_tags ][ $short_key ] ) ) {
return $shortcodes[ $with_tags - 1 ][ $short_key ];
}

$tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] );
$tag = str_replace( ']', '', $tag );
$tag = str_replace( chr( 194 ) . chr( 160 ), ' ', $tag );
$tags = preg_split( '/\s+/', $tag, 2 );

if ( is_array( $tags ) ) {
$tag = $tags[0];
}

return $tag;
Expand Down
44 changes: 22 additions & 22 deletions classes/models/fields/FrmFieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -1002,22 +1002,22 @@ public function prepare_field_html( $args ) {

$args = $this->fill_display_field_values( $args );

if ( $this->has_html ) {
$args['html'] = $this->before_replace_html_shortcodes( $args, FrmAppHelper::maybe_kses( FrmField::get_option( $this->field, 'custom_html' ) ) );
$args['errors'] = is_array( $args['errors'] ) ? $args['errors'] : array();
$args['field_obj'] = $this;

$label = FrmFieldsHelper::label_position( $this->field['label'], $this->field, $args['form'] );
$this->set_field_column( 'label', $label );

$html_shortcode = new FrmFieldFormHtml( $args );
$html = $html_shortcode->get_html();
$html = $this->after_replace_html_shortcodes( $args, $html );
$html_shortcode->remove_collapse_shortcode( $html );
} else {
$html = $this->include_front_field_input( $args, array() );
if ( ! $this->has_html ) {
return $this->include_front_field_input( $args, array() );
}

$args['html'] = $this->before_replace_html_shortcodes( $args, FrmAppHelper::maybe_kses( FrmField::get_option( $this->field, 'custom_html' ) ) );
$args['errors'] = is_array( $args['errors'] ) ? $args['errors'] : array();
$args['field_obj'] = $this;

$label = FrmFieldsHelper::label_position( $this->field['label'], $this->field, $args['form'] );
$this->set_field_column( 'label', $label );

$html_shortcode = new FrmFieldFormHtml( $args );
$html = $html_shortcode->get_html();
$html = $this->after_replace_html_shortcodes( $args, $html );
$html_shortcode->remove_collapse_shortcode( $html );

return $html;
}

Expand Down Expand Up @@ -1380,15 +1380,15 @@ protected function show_hidden_values( $args ) {
$selected_value = $args['field_value'] ?? $this->field['value'];
$hidden = '';

if ( is_array( $selected_value ) ) {
$args['save_array'] = true;

foreach ( $selected_value as $selected ) {
$hidden .= $this->show_single_hidden( $selected, $args );
}
} else {
if ( ! is_array( $selected_value ) ) {
$args['save_array'] = $this->is_readonly_array();
$hidden .= $this->show_single_hidden( $selected_value, $args );
return $hidden . $this->show_single_hidden( $selected_value, $args );
}

$args['save_array'] = true;

foreach ( $selected_value as $selected ) {
$hidden .= $this->show_single_hidden( $selected, $args );
}

return $hidden;
Expand Down
Loading