本文整理匯總了PHP中Pimcore\Model\Object\Concrete::getGender方法的典型用法代碼示例。如果您正苦於以下問題:PHP Concrete::getGender方法的具體用法?PHP Concrete::getGender怎麽用?PHP Concrete::getGender使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pimcore\Model\Object\Concrete
的用法示例。
在下文中一共展示了Concrete::getGender方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sendMail
/**
* @param Model\Tool\Newsletter\Config $newsletter
* @param Object\Concrete $object
*/
public static function sendMail($newsletter, $object, $emailAddress = null, $hostUrl = null)
{
$params = ["gender" => $object->getGender(), 'firstname' => $object->getFirstname(), 'lastname' => $object->getLastname(), "email" => $object->getEmail(), 'token' => $object->getProperty("token"), "object" => $object];
$mail = new Mail();
$mail->setIgnoreDebugMode(true);
if (\Pimcore\Config::getSystemConfig()->newsletter->usespecific) {
$mail->init("newsletter");
}
if (!Tool::getHostUrl() && $hostUrl) {
$mail->setHostUrl($hostUrl);
}
if ($emailAddress) {
$mail->addTo($emailAddress);
} else {
$mail->addTo($object->getEmail());
}
$mail->setDocument(Document::getById($newsletter->getDocument()));
$mail->setParams($params);
// render the document and rewrite the links (if analytics is enabled)
if ($newsletter->getGoogleAnalytics()) {
if ($content = $mail->getBodyHtmlRendered()) {
include_once "simple_html_dom.php";
$html = str_get_html($content);
if ($html) {
$links = $html->find("a");
foreach ($links as $link) {
if (preg_match("/^(mailto)/", trim(strtolower($link->href)))) {
continue;
}
$glue = "?";
if (strpos($link->href, "?")) {
$glue = "&";
}
$link->href = $link->href . $glue . "utm_source=Newsletter&utm_medium=Email&utm_campaign=" . $newsletter->getName();
}
$content = $html->save();
$html->clear();
unset($html);
}
$mail->setBodyHtml($content);
}
}
$mail->send();
}