本文整理汇总了PHP中ViewableData::baseHref方法的典型用法代码示例。如果您正苦于以下问题:PHP ViewableData::baseHref方法的具体用法?PHP ViewableData::baseHref怎么用?PHP ViewableData::baseHref使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewableData
的用法示例。
在下文中一共展示了ViewableData::baseHref方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRenderedNewsletterContent
static function getRenderedNewsletterContent($campaignPage, $member = null)
{
$param = $member ? "memberid=" . $member->ID . "&mail=" . $member->Email : "";
$link = Director::makeRelative($campaignPage->Link());
$response = Director::test($link . "/render/?" . $param);
$content = $response->getBody();
if (strlen(trim($campaignPage->ImageStyle)) > 0) {
$content = preg_replace('#(<img(.*)[/]?>)#U', '<img \\2 style="' . $campaignPage->ImageStyle . '" />', $content);
}
if (strlen(trim($campaignPage->LinkStyle)) > 0) {
$content = preg_replace('#(<a (.*)[/]?>)#U', '<a \\2 style="' . $campaignPage->LinkStyle . '" >', $content);
}
if (strlen(trim($campaignPage->TableStyle)) > 0) {
$content = preg_replace('#(<table(.*)[/]?>)#U', '<table \\2 style="' . $campaignPage->TableStyle . '" >', $content);
}
if (strlen(trim($campaignPage->TableCellAttribute)) > 0) {
$content = preg_replace('#(<td(.*)[/]?>)#U', '<td \\2 ' . $campaignPage->TableCellAttribute . '>', $content);
}
if (strlen(trim($campaignPage->TableCellStyle)) > 0) {
$content = preg_replace('#(<td(.*)[/]?>)#U', '<td \\2 style="' . $campaignPage->TableCellStyle . '">', $content);
}
if (strlen(trim($campaignPage->HeadingStyle)) > 0) {
$content = preg_replace('#((<h)([0-9].*)[/]?>)#U', '\\2\\3 style="' . $campaignPage->HeadingStyle . '" >', $content);
}
if (strlen(trim($campaignPage->ParagraphStyle)) > 0) {
$content = preg_replace('#(<p(.*)[/]?>)#U', '<p \\2 style="' . $campaignPage->ParagraphStyle . '" >', $content);
}
if (strlen(trim($campaignPage->HorizontalRuleStyle)) > 0) {
$content = preg_replace('#(<hr(.*)[/]?>)#U', '<hr \\2 style="' . $campaignPage->HorizontalRuleStyle . '" />', $content);
}
if (self::$makeRelativeToAbsoluteURLS) {
$base = Director::absoluteBaseURL();
$s = $content;
$sl = "\\'";
$s = str_replace('src="assets/', 'src="' . ViewableData::baseHref() . 'assets/', $s);
$s = str_replace('href="assets/', 'href="' . ViewableData::baseHref() . 'assets/', $s);
$s = str_replace('/render/?', '?', $s);
$base = Director::protocolAndHost();
$s = preg_replace('#(href)="([^:"]*)("|(?:(?:%20|\\s|\\+)[^"]*"))#', '$1="' . $base . '$2$3', $s);
$content = $s;
}
return $content;
}
示例2: doSubmitSignupForm
function doSubmitSignupForm($data, $form)
{
$email = Convert::Raw2SQL($data['Email']);
// exit($email);
$firstName = Convert::Raw2SQL($data['FirstName']);
$surname = Convert::Raw2SQL($data['Surname']);
$gender = Convert::Raw2SQL($data['Gender']);
$id = (int) $data['NewsletterCategoryID'];
$newsletterCategory = DataObject::get_by_id("NewsletterCategory", (int) $id);
$sql = "Email LIKE '{$email}' AND NewsletterCategoryID = " . $id;
if ($m = DataObject::get("NewsletterMember", $sql)) {
$this->AlreadySignedUp = true;
} else {
$this->ConfirmMailSended = true;
$newsletterPage = DataObject::get_one("NewsletterHolder");
$n = new NewsletterMember();
$hash = $n->Hash = substr(md5(time() . rand(0, 10000) . $email), 0, 8);
$n->Email = "";
$n->Confirm = $email;
$n->Surname = $surname;
$n->FirstName = $firstName;
$n->Gender = $gender;
$n->NewsletterCategoryID = $id;
$n->write();
$this->Member = $n;
if ($m = DataObject::get("NewsletterBlacklist", $sql)) {
foreach ($m as $mm) {
$mm->delete();
}
}
$this->Title = $title = _t("Newsletter.Mail.SignupTitle", "Thanks for you signup for our newlsetter");
$emailMessage = new Email(DataObject::get_one("NewsletterHolder")->sendFromEmail(), $email, $title);
$emailMessage->setTemplate('NewsletterMail_SignupMessage');
$emailMessage->populateTemplate(array("Member" => $n, "ConfirmURL" => $url = $newsletterPage->URLSegment . "/confirm/?hash={$hash}&email={$email}", "ConfirmLink" => '<a href="' . ViewableData::baseHref() . $url . '">' . ViewableData::baseHref() . $url . '</a>', "Newsletter" => $newsletterCategory, "NewsletterCategory" => $newsletterCategory));
$emailMessage->send();
}
return array();
}
示例3: logout
function logout()
{
Director::redirect(ViewableData::baseHref() . "Security/Logout");
}