<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Edm\Util; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Util\HtmlUtil; use ModStart\Core\Util\RandomUtil; use Module\Edm\Type\EdmRandomType; class EdmTemplateUtil { private static $param = array('name' => '客户名称', 'email' => '客户邮箱', 'id' => '唯一标识', 'unsubscribe_url' => '取消订阅URL，通过在页面插入 <a href="{unsubscribe_url}">取关</a> 实现取消订阅', 'visit_url' => '打开统计URL，通过在页面插入<img src="{visit_url}" />可以统计邮件是否打开', 'number6' => '随机6位数字'); public static function getParam() { return self::$param; } private static function str_replace_first($tRqja, $cvi4c, $UFLoy) { goto TiJUz; UwdWF: if ($kQh9t !== false) { return substr_replace($UFLoy, $cvi4c, $kQh9t, strlen($tRqja)); } goto cx1Kv; cx1Kv: return $UFLoy; goto CFCg2; TiJUz: $kQh9t = strpos($UFLoy, $tRqja); goto UwdWF; CFCg2: } public static function processTemplateParam($ber3G, $MNZ1i, $Ral1i) { goto XwJLX; Mrl_d: $cvi4c = array(); goto IzubT; dsmqe: if (!empty($oxpiO[0])) { foreach ($oxpiO[0] as $Ayp9C => $SxG_W) { $cvi4c = EdmRandomUtil::get($oxpiO[2][$Ayp9C], EdmRandomType::convertFromText($oxpiO[1][$Ayp9C])); if (!empty($cvi4c)) { $Ral1i = self::str_replace_first($SxG_W, $cvi4c, $Ral1i); } } } goto kcsjc; YsJcs: $Ral1i = str_replace($tRqja, $cvi4c, $Ral1i); goto WiGZQ; IzubT: foreach (array('name', 'email') as $F4wee) { $tRqja[] = '{' . $F4wee . '}'; $cvi4c[] = isset($ber3G[$F4wee]) ? $ber3G[$F4wee] : $F4wee; } goto vPvHU; C_vYG: $tRqja[] = '{unsubscribe_url}'; goto Gm_81; XwJLX: $tRqja = array(); goto Mrl_d; S0Due: $cvi4c[] = modstart_config('Edm_DomainUrl') . modstart_web_url('edm/visit/' . $MNZ1i['id'] . '_' . $MNZ1i['alias']); goto B1fHi; oGJ_I: $tRqja[] = '{visit_url}'; goto S0Due; vPvHU: foreach (array('id') as $F4wee) { $tRqja[] = '{' . $F4wee . '}'; $cvi4c[] = isset($MNZ1i[$F4wee]) ? $MNZ1i[$F4wee] : $F4wee; } goto C_vYG; B1fHi: $tRqja[] = '{number6}'; goto Y4Vlo; WiGZQ: preg_match_all('/\\{random:(text|image|rich):(.*?)\\}/', $Ral1i, $oxpiO); goto dsmqe; Y4Vlo: $cvi4c[] = RandomUtil::number(6); goto YsJcs; kcsjc: return $Ral1i; goto YHj5B; Gm_81: $cvi4c[] = modstart_config('Edm_DomainUrl') . modstart_web_url('edm/unsubscribe/' . $MNZ1i['id'] . '_' . $MNZ1i['alias']); goto oGJ_I; YHj5B: } public static function get($FhIQB) { return ModelUtil::get('edm_template', $FhIQB); } public static function processHtml($Ral1i) { $Dwklx = modstart_config('Edm_TemplateUrlCdn'); return HtmlUtil::replaceImageSrcToFull($Ral1i, true, $Dwklx); } }