| @@ -134,16 +134,16 @@ | ||
| 134 | 134 | Praesent in risus velit. Donec molestie tincidunt ex sed consequat. Ut ornare fringilla fringilla.', |
| 135 | 135 | ), |
| 136 | 136 | ); |
| 137 | 137 | |
| 138 | - if ( 'plain' !== $style_key ) { | |
| 139 | - $content = self::get_test_rich_text_email_content( $style_key, $table_rows ); | |
| 140 | - } else { | |
| 138 | + if ( 'plain' === $style_key ) { | |
| 141 | 139 | $content = ''; |
| 142 | 140 | |
| 143 | 141 | foreach ( $table_rows as $row ) { |
| 144 | 142 | $content .= $row['label'] . ': ' . $row['value'] . "\r\n"; |
| 145 | 143 | } |
| 144 | + } else { | |
| 145 | + $content = self::get_test_rich_text_email_content( $style_key, $table_rows ); | |
| 146 | 146 | }//end if |
| 147 | 147 | |
| 148 | 148 | return $content; |
| 149 | 149 | } |
| @@ -163,13 +163,11 @@ | ||
| 163 | 163 | $should_remove_border = 'sleek' === $style_key; |
| 164 | 164 | |
| 165 | 165 | // Modern and Compact table styles don't have top and bottom border. |
| 166 | 166 | $should_remove_top_bottom_border = 'classic' !== $style_key; |
| 167 | + $table_generator = self::get_table_generator( $style_key ); | |
| 168 | + $content = $table_generator->generate_table_header(); | |
| 167 | 169 | |
| 168 | - $table_generator = self::get_table_generator( $style_key ); | |
| 169 | - | |
| 170 | - $content = $table_generator->generate_table_header(); | |
| 171 | - | |
| 172 | 170 | // By default, table has the bottom border and table cells have top border. |
| 173 | 171 | if ( $should_remove_top_bottom_border ) { |
| 174 | 172 | $content = $table_generator->remove_border( $content, 'bottom' ); |
| 175 | 173 | } |
| @@ -212,11 +210,9 @@ | ||
| 212 | 210 | a {color:' . esc_attr( $style_settings['link_color'] ) . ';} |
| 213 | 211 | </style>'; |
| 214 | 212 | } |
| 215 | 213 | |
| 216 | - $wrapped_content .= '</head><body>' . $content . '</body></html>'; | |
| 217 | - | |
| 218 | - return $wrapped_content; | |
| 214 | + return $wrapped_content . ( '</head><body>' . $content . '</body></html>' ); | |
| 219 | 215 | } |
| 220 | 216 | |
| 221 | 217 | /** |
| 222 | 218 | * Gets content for the cell of one column table. |
| @@ -275,11 +271,9 @@ | ||
| 275 | 271 | if ( ! $style_key ) { |
| 276 | 272 | die( esc_html( $not_exist_msg ) ); |
| 277 | 273 | } |
| 278 | 274 | |
| 279 | - $styles = self::get_email_styles(); | |
| 280 | - | |
| 281 | - if ( ! isset( $styles[ $style_key ] ) ) { | |
| 275 | + if ( ! isset( self::get_email_styles()[ $style_key ] ) ) { | |
| 282 | 276 | die( esc_html( $not_exist_msg ) ); |
| 283 | 277 | } |
| 284 | 278 | |
| 285 | 279 | $style_key = FrmAppHelper::get_param( 'style_key', '', 'sanitize_text_field' ); |
| @@ -306,23 +300,23 @@ | ||
| 306 | 300 | |
| 307 | 301 | foreach ( $emails as $email ) { |
| 308 | 302 | $email = trim( $email ); |
| 309 | 303 | |
| 310 | - if ( empty( $email ) || ! is_email( $email ) ) { | |
| 304 | + if ( ! $email || ! is_email( $email ) ) { | |
| 311 | 305 | continue; |
| 312 | 306 | } |
| 307 | + | |
| 313 | 308 | $valid_emails[] = $email; |
| 314 | 309 | } |
| 315 | 310 | |
| 316 | - if ( empty( $valid_emails ) ) { | |
| 311 | + if ( ! $valid_emails ) { | |
| 317 | 312 | wp_send_json_error( __( 'Invalid email address', 'formidable' ) ); |
| 318 | 313 | } |
| 319 | 314 | |
| 320 | 315 | $email_style = self::get_default_email_style(); |
| 321 | - | |
| 322 | - $subject = __( 'Formidable Test Email', 'formidable' ); | |
| 323 | - $content = self::get_test_email_content(); | |
| 324 | - $headers = array( | |
| 316 | + $subject = __( 'Formidable Test Email', 'formidable' ); | |
| 317 | + $content = self::get_test_email_content(); | |
| 318 | + $headers = array( | |
| 325 | 319 | self::get_content_type_header( $email_style ), |
| 326 | 320 | ); |
| 327 | 321 | |
| 328 | 322 | FrmUsageController::update_flows_data( 'send_test_email', $email_style ); |
| @@ -396,11 +390,10 @@ | ||
| 396 | 390 | * @return string |
| 397 | 391 | */ |
| 398 | 392 | public static function wrap_email_message( $message ) { |
| 399 | 393 | $style_settings = self::get_email_style_settings(); |
| 394 | + $header_img = ''; | |
| 400 | 395 | |
| 401 | - $header_img = ''; | |
| 402 | - | |
| 403 | 396 | if ( $style_settings['img'] ) { |
| 404 | 397 | $img_align = $style_settings['img_align'] ? $style_settings['img_align'] : 'center'; |
| 405 | 398 | $img_size = $style_settings['img_size'] ? $style_settings['img_size'] : 'thumbnail'; |
| 406 | 399 | $img_url = is_numeric( $style_settings['img'] ) ? wp_get_attachment_image_url( $style_settings['img'], $img_size ) : $style_settings['img']; |
| @@ -448,11 +441,9 @@ | ||
| 448 | 441 | |
| 449 | 442 | // The message. |
| 450 | 443 | $new_message .= self::add_inline_css( 'a', 'color:' . $style_settings['link_color'] . ';', $message ); |
| 451 | 444 | |
| 452 | - $new_message .= '</div></div></div>'; | |
| 453 | - | |
| 454 | - return $new_message; | |
| 445 | + return $new_message . '</div></div></div>'; | |
| 455 | 446 | } |
| 456 | 447 | |
| 457 | 448 | /** |
| 458 | 449 | * Adds inline CSS to a tag in the content. |