当前位置: 首页>>代码示例>>PHP>>正文


PHP ViewableData::baseHref方法代码示例

本文整理汇总了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;
 }
开发者ID:pstaender,项目名称:Newsletter,代码行数:43,代码来源:NewsletterCampaign.php

示例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();
 }
开发者ID:pstaender,项目名称:Newsletter,代码行数:38,代码来源:NewsletterHolder.php

示例3: logout

 function logout()
 {
     Director::redirect(ViewableData::baseHref() . "Security/Logout");
 }
开发者ID:pstaender,项目名称:ShopSystem,代码行数:4,代码来源:ShopUser.php


注:本文中的ViewableData::baseHref方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。