本文整理汇总了PHP中Subscriber::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Subscriber::getName方法的具体用法?PHP Subscriber::getName怎么用?PHP Subscriber::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subscriber
的用法示例。
在下文中一共展示了Subscriber::getName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _wpr_process_sendmail_parameters
function _wpr_process_sendmail_parameters($sid, $params, $footerMessage = "")
{
global $wpdb;
$subscriber = new Subscriber($sid);
$newsletter = _wpr_newsletter_get($subscriber->getNewsletterId());
//if the fromname field is set in the newsletter, then use that value otherwise use the blog name.
$fromname = !empty($params['fromname']) ? $params['fromname'] : !empty($newsletter->fromname) ? $newsletter->fromname : get_bloginfo("name");
if ($newsletter->reply_to) {
$replyto = $newsletter->reply_to;
}
$unsuburl = wpr_get_unsubscription_url($sid);
$subject = $params['subject'];
$address = get_option("wpr_address");
$textUnSubMessage = "\n\n{$address}\n\n" . __("To unsubscribe or change subscription options visit", 'wpr_autoresponder') . ":\r\n\r\n{$unsuburl}";
$reply_to = $newsletter->reply_to;
$htmlbody = trim($params['htmlbody']);
$textbody = $params['textbody'];
$subject = $params['subject'];
//append the address and the unsub link to the email
$address = "<br>\n<br>\n" . nl2br(get_option("wpr_address")) . "<br>\n<br>\n";
$htmlUnSubscribeMessage = "<br><br>" . $address . "<br><br>" . __("To unsubscribe or change subscriber options visit:", 'wpr_autoresponder') . "<br />\n\r\n <a href=\"{$unsuburl}\">{$unsuburl}</a>";
$htmlenabled = $params['htmlenabled'] ? 1 : 0;
if (!empty($htmlbody)) {
if ($footerMessage && !empty($htmlbody)) {
$htmlbody .= nl2br($footerMessage) . "<br>\n<br>\n";
}
if (strstr($htmlbody, "[!unsubscribe!]")) {
$htmlbody = str_replace("[!unsubscribe!]", $unsuburl, $htmlbody);
} else {
$htmlbody .= $htmlUnSubscribeMessage;
}
}
if ($footerMessage) {
$params['textbody'] .= $footerMessage . "\n\n";
}
if (strstr($params['textbody'], "[!unsubscribe!]")) {
$textbody = str_replace("[!unsubscribe!]", $unsuburl, $textbody);
} else {
$textbody = $params['textbody'] . $textUnSubMessage;
}
$textbody = addslashes($textbody);
$htmlbody = addslashes($htmlbody);
$subject = addslashes($subject);
$time = time();
$subject = str_replace("[!name!]", $subscriber->getName(), $subject);
$textbody = str_replace("[!name!]", $subscriber->getName(), $textbody);
$htmlbody = str_replace("[!name!]", $subscriber->getName(), $htmlbody);
$delivery_type = !empty($params['delivery_type']) ? $params['delivery_type'] : 0;
$email_type = !empty($params['email_type']) ? $params['email_type'] : 'misc';
$meta_key = !empty($params['meta_key']) ? $params['meta_key'] : "Misc-{$sid}-{$time}";
$hash = make_hash(array_merge(array('sid' => $sid), $params));
$from = !empty($params['fromemail']) ? $params['fromemail'] : !empty($newsletter->fromemail) ? $newsletter->fromemail : get_bloginfo('admin_email');
$parameters = array('from' => $from, 'fromname' => $fromname, 'to' => $subscriber->email, 'reply_to' => $reply_to, 'subject' => $subject, 'htmlbody' => $htmlbody, 'textbody' => $textbody, 'headers' => '', 'htmlenabled' => $htmlenabled, 'delivery_type' => $delivery_type, 'email_type' => $email_type, 'meta_key' => $meta_key, 'hash' => $hash);
return $parameters;
}
示例2: replaceCustomFieldValues
public static function replaceCustomFieldValues($string, Subscriber $subscriber)
{
$name = $subscriber->getName();
$string = str_replace("[!name!]", $name, $string);
$values = $subscriber->getCustomFieldValuesByLabels();
foreach ($values as $name => $value) {
$string = str_replace("[!{$name}!]", $value, $string);
}
return $string;
}