| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
|
| 6 |
use YayMail\Page\Source\UpdateElement; |
| 7 |
$custom_shortcode = new YayMail\MailBuilder\Shortcodes( $template, '', false ); |
| 8 |
$arrData = array( $custom_shortcode, $args, $template ); |
| 9 |
do_action_ref_array( 'yaymail_addon_defined_shorcode', array( &$arrData ) ); |
| 10 |
|
| 11 |
$updateElement = new UpdateElement(); |
| 12 |
$yaymail_elements = get_post_meta( $postID, '_yaymail_elements', true ); |
| 13 |
$yaymail_elements = $updateElement->merge_new_props_to_elements( $yaymail_elements ); |
| 14 |
$yaymail_settings = get_option( 'yaymail_settings' ); |
| 15 |
$emailBackgroundColor = get_post_meta( $postID, '_email_backgroundColor_settings', true ) ? get_post_meta( $postID, '_email_backgroundColor_settings', true ) : '#ECECEC'; |
| 16 |
$text_link_color = get_post_meta( $postID, '_yaymail_email_textLinkColor_settings', true ) ? get_post_meta( $postID, '_yaymail_email_textLinkColor_settings', true ) : '#7f54b3'; |
| 17 |
$general_attrs = array( 'tableWidth' => str_replace( 'px', '', $yaymail_settings['container_width'] ) ); |
| 18 |
$yaymail_template = get_post_meta( $postID, '_yaymail_template', true ); |
| 19 |
?> |
| 20 |
<!DOCTYPE html><html <?php language_attributes(); ?> ><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="x-apple-disable-message-reformatting"><style>a{color: <?php echo esc_attr( $text_link_color ); ?> !important}h1{font-family:inherit;text-shadow:unset;text-align:inherit}h2,h3{font-family:inherit;color:inherit;text-align:inherit}.yaymail-inline-block{display:inline-block} |
| 21 |
<?php |
| 22 |
if ( is_plugin_active( 'yaymail-addon-for-automatewoo/yaymail-automatewoo.php' ) || is_plugin_active( 'email-customizer-automatewoo/yaymail-automatewoo.php' ) ) { |
| 23 |
if ( function_exists( 'aw_get_template' ) ) { |
| 24 |
aw_get_template( 'email/styles.php' ); |
| 25 |
} |
| 26 |
} |
| 27 |
?> |
| 28 |
</style></head><body style="background: <?php echo esc_attr( $emailBackgroundColor ); ?>" <?php echo is_rtl() ? 'rightmargin' : 'leftmargin'; ?>="0" marginwidth="0" topmargin="0" marginheight="0" offset="0"><table style="background: <?php echo esc_attr( $emailBackgroundColor ); ?>" border="0" cellpadding="0" cellspacing="0" height="100%" width="100%" class="<?php echo esc_attr( 'yaymail-template-' . $yaymail_template ); ?>"> |
| 29 |
<?php |
| 30 |
foreach ( $yaymail_elements as $key => $element ) { |
| 31 |
?> |
| 32 |
<tr><td> |
| 33 |
<?php |
| 34 |
$reg_pattern = '/\[([a-z0-9A-Z_]+)\]/'; |
| 35 |
if ( isset( $element['settingRow']['content'] ) ) { |
| 36 |
$content = $element['settingRow']['content']; |
| 37 |
$contentTitle = isset( $element['settingRow']['contentTitle'] ) ? $element['settingRow']['contentTitle'] : ''; |
| 38 |
|
| 39 |
// Add $atts for content if has shortcode |
| 40 |
preg_match_all( $reg_pattern, $content, $result ); |
| 41 |
if ( ! empty( $result[0] ) ) { |
| 42 |
foreach ( $result[0] as $key => $shortcode ) { |
| 43 |
$textcolor = isset( $element['settingRow']['textColor'] ) ? ' textcolor=' . $element['settingRow']['textColor'] : ''; |
| 44 |
$bordercolor = isset( $element['settingRow']['borderColor'] ) ? ' bordercolor=' . $element['settingRow']['borderColor'] : ''; |
| 45 |
$titlecolor = isset( $element['settingRow']['titleColor'] ) ? ' titlecolor=' . $element['settingRow']['titleColor'] : ''; |
| 46 |
$fontfamily = isset( $element['settingRow']['family'] ) ? ' fontfamily=' . str_replace( ' ', '', str_replace( array( '\'', '"' ), '', $element['settingRow']['family'] ) ) : ''; |
| 47 |
$newshortcode = substr( $shortcode, 0, -1 ); |
| 48 |
$newshortcode .= $textcolor . $bordercolor . $titlecolor . $fontfamily . ']'; |
| 49 |
$content = str_replace( $shortcode, $newshortcode, $content ); |
| 50 |
} |
| 51 |
$element['settingRow']['content'] = $content; |
| 52 |
} |
| 53 |
// Add $atts for contentTitle if has shortcode |
| 54 |
if ( $contentTitle ) { |
| 55 |
preg_match_all( $reg_pattern, $contentTitle, $result ); |
| 56 |
if ( ! empty( $result[0] ) ) { |
| 57 |
foreach ( $result[0] as $key => $shortcode ) { |
| 58 |
$textcolor = isset( $element['settingRow']['textColor'] ) ? ' textcolor=' . $element['settingRow']['textColor'] : ''; |
| 59 |
$bordercolor = isset( $element['settingRow']['borderColor'] ) ? ' bordercolor=' . $element['settingRow']['borderColor'] : ''; |
| 60 |
$titlecolor = isset( $element['settingRow']['titleColor'] ) ? ' titlecolor=' . $element['settingRow']['titleColor'] : ''; |
| 61 |
$fontfamily = isset( $element['settingRow']['family'] ) ? ' fontfamily=' . str_replace( ' ', '', str_replace( array( '\'', '"' ), '', $element['settingRow']['family'] ) ) : ''; |
| 62 |
$newshortcode = substr( $shortcode, 0, -1 ); |
| 63 |
$newshortcode .= $textcolor . $bordercolor . $titlecolor . $fontfamily . ']'; |
| 64 |
$contentTitle = str_replace( $shortcode, $newshortcode, $contentTitle ); |
| 65 |
} |
| 66 |
$element['settingRow']['contentTitle'] = $contentTitle; |
| 67 |
} |
| 68 |
} |
| 69 |
|
| 70 |
// Add $atts for content of shipment tracking if has shortcode |
| 71 |
if ( '[yaymail_order_meta:_wc_shipment_tracking_items]' === $content ) { |
| 72 |
$shortcode = $content; |
| 73 |
$textcolor = isset( $element['settingRow']['textColor'] ) ? ' textcolor=' . $element['settingRow']['textColor'] : ''; |
| 74 |
$bordercolor = isset( $element['settingRow']['borderColor'] ) ? ' bordercolor=' . $element['settingRow']['borderColor'] : ''; |
| 75 |
$titlecolor = isset( $element['settingRow']['titleColor'] ) ? ' titlecolor=' . $element['settingRow']['titleColor'] : ''; |
| 76 |
$fontfamily = isset( $element['settingRow']['family'] ) ? ' fontfamily=' . str_replace( ' ', '', str_replace( array( '\'', '"' ), '', $element['settingRow']['family'] ) ) : ''; |
| 77 |
$newshortcode = substr( $shortcode, 0, -1 ); |
| 78 |
$newshortcode .= $textcolor . $bordercolor . $titlecolor . $fontfamily . ']'; |
| 79 |
$content = str_replace( $shortcode, $newshortcode, $content ); |
| 80 |
$element['settingRow']['content'] = $content; |
| 81 |
} |
| 82 |
} |
| 83 |
if ( has_filter( 'yaymail_addon_for_conditional_logic' ) && isset( $element['settingRow']['arrConditionLogic'] ) ) { |
| 84 |
if ( ! empty( $element['settingRow']['arrConditionLogic'] ) ) { |
| 85 |
$conditional_Logic = apply_filters( 'yaymail_addon_for_conditional_logic', false, $args, $element['settingRow'] ); |
| 86 |
if ( $conditional_Logic ) { |
| 87 |
do_action( 'Yaymail' . $element['type'], $args, $element['settingRow'], $general_attrs, $element['id'], $postID, $isInColumns = false ); |
| 88 |
} |
| 89 |
} else { |
| 90 |
if ( 'OneColumn' === $element['type'] || 'TwoColumns' === $element['type'] || 'ThreeColumns' === $element['type'] || 'FourColumns' === $element['type'] ) { |
| 91 |
for ( $column = 1; $column <= 4; $column++ ) { |
| 92 |
if ( isset( $element['settingRow'][ 'column' . $column ] ) ) { |
| 93 |
foreach ( $element['settingRow'][ 'column' . $column ] as $column_key => $column_element ) { |
| 94 |
if ( isset( $column_element['settingRow']['arrConditionLogic'] ) && ! empty( $column_element['settingRow']['arrConditionLogic'] ) ) { |
| 95 |
$conditional_Logic = apply_filters( 'yaymail_addon_for_conditional_logic', false, $args, $column_element['settingRow'] ); |
| 96 |
if ( ! $conditional_Logic ) { |
| 97 |
unset( $element['settingRow'][ 'column' . $column ][ $column_key ] ); |
| 98 |
} |
| 99 |
} |
| 100 |
} |
| 101 |
} |
| 102 |
} |
| 103 |
} |
| 104 |
do_action( 'Yaymail' . $element['type'], $args, $element['settingRow'], $general_attrs, $element['id'], $postID, $isInColumns = false ); |
| 105 |
} |
| 106 |
} else { |
| 107 |
do_action( 'Yaymail' . $element['type'], $args, $element['settingRow'], $general_attrs, $element['id'], $postID, $isInColumns = false ); |
| 108 |
} |
| 109 |
|
| 110 |
?> |
| 111 |
</td></tr> |
| 112 |
<?php |
| 113 |
} |
| 114 |
?> |
| 115 |
</table></body></html> |
| 116 |
|
| 117 |
|
| 118 |
|