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
36 changes: 19 additions & 17 deletions classes/helpers/FrmCSVExportHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -726,28 +726,30 @@ private static function get_separate_value_label( $field_value, $field ) {
* @return void
*/
private static function add_array_values_to_columns( &$row, $atts ) {
if ( is_array( $atts['field_value'] ) ) {
foreach ( $atts['field_value'] as $key => $sub_value ) {
if ( is_array( $sub_value ) ) {
// This is combo field inside repeater. The heading key has this format: [86_first[0]].
foreach ( $sub_value as $sub_key => $sub_sub_value ) {
$column_key = $atts['col']->id . '_' . $sub_key . '[' . $key . ']';

if ( ! is_numeric( $sub_key ) && isset( self::$headings[ $column_key ] ) ) {
$row[ $column_key ] = $sub_sub_value;
}
}
if ( ! is_array( $atts['field_value'] ) ) {
return;
}

continue;
foreach ( $atts['field_value'] as $key => $sub_value ) {
if ( is_array( $sub_value ) ) {
// This is combo field inside repeater. The heading key has this format: [86_first[0]].
foreach ( $sub_value as $sub_key => $sub_sub_value ) {
$column_key = $atts['col']->id . '_' . $sub_key . '[' . $key . ']';

if ( ! is_numeric( $sub_key ) && isset( self::$headings[ $column_key ] ) ) {
$row[ $column_key ] = $sub_sub_value;
}
}

$column_key = $atts['col']->id . '_' . $key;
continue;
}

if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) {
$row[ $column_key ] = $sub_value;
}
$column_key = $atts['col']->id . '_' . $key;

if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) {
$row[ $column_key ] = $sub_value;
}
}//end if
}
}

/**
Expand Down
70 changes: 36 additions & 34 deletions classes/helpers/FrmXMLHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2357,50 +2357,52 @@ private static function switch_email_condition_field_ids( &$post_content ) {
* @return void
*/
private static function migrate_autoresponder_to_action( $form_options, $form_id, &$notifications ) {
if ( ! empty( $form_options['auto_responder'] ) && ! empty( $form_options['ar_email_message'] ) ) {
// migrate autoresponder
if ( empty( $form_options['auto_responder'] ) || empty( $form_options['ar_email_message'] ) ) {
return;
}

$email_field = $form_options['ar_email_to'] ?? 0;
// migrate autoresponder

if ( str_contains( $email_field, '|' ) ) {
// data from entries field
$email_field = explode( '|', $email_field );
$email_field = $form_options['ar_email_to'] ?? 0;

if ( isset( $email_field[1] ) ) {
$email_field = $email_field[1];
}
}
if ( str_contains( $email_field, '|' ) ) {
// data from entries field
$email_field = explode( '|', $email_field );

if ( is_numeric( $email_field ) && $email_field ) {
$email_field = '[' . $email_field . ']';
if ( isset( $email_field[1] ) ) {
$email_field = $email_field[1];
}
}

$notification = $form_options;
$new_notification2 = array(
'post_content' => array(
'email_message' => $notification['ar_email_message'],
'email_subject' => $notification['ar_email_subject'] ?? '',
'email_to' => $email_field,
'plain_text' => $notification['ar_plain_text'] ?? 0,
'inc_user_info' => 0,
),
'post_name' => $form_id . '_email_' . count( $notifications ),
);
if ( is_numeric( $email_field ) && $email_field ) {
$email_field = '[' . $email_field . ']';
}

$reply_to = $notification['ar_reply_to'] ?? '';
$reply_to_name = $notification['ar_reply_to_name'] ?? '';
$notification = $form_options;
$new_notification2 = array(
'post_content' => array(
'email_message' => $notification['ar_email_message'],
'email_subject' => $notification['ar_email_subject'] ?? '',
'email_to' => $email_field,
'plain_text' => $notification['ar_plain_text'] ?? 0,
'inc_user_info' => 0,
),
'post_name' => $form_id . '_email_' . count( $notifications ),
);

if ( $reply_to ) {
$new_notification2['post_content']['reply_to'] = $reply_to;
}
$reply_to = $notification['ar_reply_to'] ?? '';
$reply_to_name = $notification['ar_reply_to_name'] ?? '';

if ( $reply_to || $reply_to_name ) {
$new_notification2['post_content']['from'] = ( $reply_to_name ? $reply_to_name : '[sitename]' ) . ' <' . ( $reply_to ? $reply_to : '[admin_email]' ) . '>'; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
}
if ( $reply_to ) {
$new_notification2['post_content']['reply_to'] = $reply_to;
}

$notifications[] = $new_notification2;
unset( $new_notification2 );
}//end if
if ( $reply_to || $reply_to_name ) {
$new_notification2['post_content']['from'] = ( $reply_to_name ? $reply_to_name : '[sitename]' ) . ' <' . ( $reply_to ? $reply_to : '[admin_email]' ) . '>'; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
}

$notifications[] = $new_notification2;
unset( $new_notification2 );
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ public function process( File $phpcsFile, $stackPtr ) {
$ifScopeCloser = $tokens[ $ifToken ]['scope_closer'];

// Check if the if statement is the only thing in the function body.
// The next non-whitespace token after the if's closing brace should be the function's closing brace.
// The next non-whitespace/non-comment token after the if's closing brace should be the function's closing brace.
$afterIf = $phpcsFile->findNext(
T_WHITESPACE,
array( T_WHITESPACE, T_COMMENT, T_DOC_COMMENT, T_DOC_COMMENT_OPEN_TAG, T_DOC_COMMENT_CLOSE_TAG, T_DOC_COMMENT_STAR, T_DOC_COMMENT_STRING, T_DOC_COMMENT_TAG, T_DOC_COMMENT_WHITESPACE ),
$ifScopeCloser + 1,
null,
true
Expand Down