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


PHP HTTP::absoluteURLs方法代码示例

本文整理汇总了PHP中HTTP::absoluteURLs方法的典型用法代码示例。如果您正苦于以下问题:PHP HTTP::absoluteURLs方法的具体用法?PHP HTTP::absoluteURLs怎么用?PHP HTTP::absoluteURLs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTTP的用法示例。


在下文中一共展示了HTTP::absoluteURLs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateNewsletterEmail

 public function updateNewsletterEmail(NewsletterEmail $email)
 {
     $newsletter = $email->Newsletter();
     if ($newsletter->ContentSource != 'page' || !$newsletter->SourcePageID) {
         return;
     }
     $page = $newsletter->SourcePage();
     $response = Director::test($page->RelativeLink());
     $body = $this->emogrify($response->getBody());
     $body = str_replace('xmlns="http://www.w3.org/1999/xhtml"', '', HTTP::absoluteURLs($body));
     $re = '/\\.src\\s*=' . str_replace('/', '\\/', Director::absoluteBaseURL()) . '/';
     $body = preg_replace($re, '.src =', $body);
     // undo the fudging that happens to keywords
     $body = preg_replace('/"[^"]*%7B%24(\\w+)%7D/', '"{\\$$1}', $body);
     $email->setBody(DBField::create('HTMLText', $body));
 }
开发者ID:nyeholt,项目名称:silverstripe-newsletter-pagesource,代码行数:16,代码来源:NewsletterEmailPageSourceExtension.php

示例2: emogrify_html

 /**
  * turns an html document into a formatted html document
  * using the emogrify method.
  * @param $html
  * @return String HTML
  */
 public static function emogrify_html($html)
 {
     //get required files
     $baseFolder = Director::baseFolder();
     if (!class_exists('\\Pelago\\Emogrifier')) {
         require_once $baseFolder . '/ecommerce/thirdparty/Emogrifier.php';
     }
     $cssFileLocation = Director::baseFolder() . "/" . EcommerceConfig::get("Order_Email", "css_file_location");
     $cssFileHandler = fopen($cssFileLocation, 'r');
     $css = fread($cssFileHandler, filesize($cssFileLocation));
     fclose($cssFileHandler);
     $emogrifier = new \Pelago\Emogrifier($html, $css);
     $html = $emogrifier->emogrify();
     //make links absolute!
     $html = HTTP::absoluteURLs($html);
     return $html;
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:23,代码来源:Order_Email.php

示例3: testURISchemes

 /**
  * 	Make sure URI schemes are not rewritten
  */
 public function testURISchemes()
 {
     $this->withBaseURL('http://www.silverstripe.org/', function ($test) {
         // mailto
         $test->assertEquals('<a href=\'mailto:admin@silverstripe.org\'>Email Us</a>', HTTP::absoluteURLs('<a href=\'mailto:admin@silverstripe.org\'>Email Us</a>'), 'Email links are not rewritten');
         // data uri
         $test->assertEquals('<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38' . 'GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />', HTTP::absoluteURLs('<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH' . 'ElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot" />'), 'Data URI links are not rewritten');
         // call
         $test->assertEquals('<a href="callto:12345678" />', HTTP::absoluteURLs('<a href="callto:12345678" />'), 'Call to links are not rewritten');
     });
 }
开发者ID:fanggu,项目名称:loveyourwater_ss_v3.1.6,代码行数:14,代码来源:HTTPTest.php

示例4: AbsoluteLinks

 function AbsoluteLinks()
 {
     return HTTP::absoluteURLs($this->value);
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:4,代码来源:Text.php

示例5: process

 public function process()
 {
     $fromTime = $this->since ? $this->since : 0;
     $members = $this->members;
     $nextId = array_shift($members);
     $this->members = $members;
     $member = Member::get()->byID($nextId);
     $microBlogService = $this->microBlogService;
     // if we don't have a 'since' time, we need to only scan from 'now' onwards, to prevent _every_
     // post from being collected
     if (!$fromTime) {
         $fromTime = time();
     }
     $since = date('Y-m-d 00:00:00', $fromTime);
     if ($member && $member->ID) {
         $this->transactionManager->run(function () use($microBlogService, $since, $member) {
             $posts = $microBlogService->globalFeed(array('ParentID' => 0, 'ThreadOwnerID:not' => $member->ID, 'Created:GreaterThan' => $since), $orderBy = 'ID DESC', $since = null, $number = 10, $markViewed = false);
             if (!count($posts)) {
                 return;
             }
             $content = SSViewer::execute_template('DigestEmail', ArrayData::create(array('Posts' => $posts, 'Member' => $member)));
             $content = HTTP::absoluteURLs($content);
             $config = SiteConfig::current_site_config();
             $mail = new Email();
             $mail->setTo($member->Email);
             $mail->setBody($content);
             $mail->setSubject($config->Title . ' digest');
             if ($config->FromEmail) {
                 $mail->setFrom($config->FromEmail);
             }
             $mail->send();
         }, $member);
     }
     $this->currentStep++;
     if (count($members) == 0) {
         if (!$this->sendTime) {
             $this->sendTime = '23:55:00';
         }
         $nextTime = $this->type == 'weekly' ? '+1 week' : '+1 day';
         $nextDate = date('Y-m-d ' . $this->sendTime, strtotime($nextTime));
         $nextJob = new MicroPostDigestJob(time(), $this->type, $this->groupId, $this->sendTime);
         singleton('QueuedJobService')->queueJob($nextJob, $nextDate);
         $this->isComplete = true;
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-microblog,代码行数:45,代码来源:MicroPostDigestJob.php

示例6: processPaymentConfirmationText

 /**
  * display a text message after order creation
  *
  * @param Order $orderObj the order object
  * 
  * @return void
  *
  * @author Sascha Koehler <skoehler@pixeltricks.de>
  * @copyright 2011 pixeltricks GmbH
  * @since 06.01.2011
  */
 public function processPaymentConfirmationText($orderObj)
 {
     parent::processPaymentConfirmationText($orderObj);
     $variables = array('SilvercartOrder' => $orderObj);
     $templateVariables = new ArrayData($variables);
     switch ($this->PaymentChannel) {
         case 'invoice':
             $textTemplate = new SSViewer_FromString($this->InvoiceInfo);
             break;
         case 'prepayment':
         default:
             $textTemplate = new SSViewer_FromString($this->TextBankAccountInfo);
     }
     $text = HTTP::absoluteURLs($textTemplate->process($templateVariables));
     return $text;
 }
开发者ID:silvercart,项目名称:payment_prepayment,代码行数:27,代码来源:SilvercartPaymentPrepayment.php

示例7: parseVariables

 /**
  * Load all the template variables into the internal variables, including
  * the template into body.	Called before send() or debugSend()
  * $isPlain=true will cause the template to be ignored, otherwise the GenericEmail template will be used
  * and it won't be plain email :)
  */
 protected function parseVariables($isPlain = false)
 {
     $origState = Config::inst()->get('SSViewer', 'source_file_comments');
     Config::inst()->update('SSViewer', 'source_file_comments', false);
     if (!$this->parseVariables_done) {
         $this->parseVariables_done = true;
         // Parse $ variables in the base parameters
         $data = $this->templateData();
         // Process a .SS template file
         $fullBody = $this->body;
         if ($this->ss_template && !$isPlain) {
             // Requery data so that updated versions of To, From, Subject, etc are included
             $data = $this->templateData();
             $template = new SSViewer($this->ss_template);
             if ($template->exists()) {
                 $fullBody = $template->process($data);
             }
         }
         // Rewrite relative URLs
         $this->body = HTTP::absoluteURLs($fullBody);
     }
     Config::inst()->update('SSViewer', 'source_file_comments', $origState);
     return $this;
 }
开发者ID:congaaids,项目名称:silverstripe-framework,代码行数:30,代码来源:Email.php

示例8: AbsoluteLinks

 /**
  * Return the value of the field with relative links converted to absolute urls (with placeholders parsed).
  * @return string
  */
 public function AbsoluteLinks()
 {
     return HTTP::absoluteURLs($this->forTemplate());
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:8,代码来源:HTMLText.php

示例9: render

 function render()
 {
     if (!($templateName = $this->RenderTemplate)) {
         $templateName = 'SimpleNewsletterTemplate';
     }
     // Block stylesheets and JS that are not required (email templates should have inline CSS/JS)
     Requirements::clear();
     // Create recipient with some test data
     $recipient = new Recipient(Recipient::$test_data);
     $newsletterEmail = new NewsletterEmail($this, $recipient, true);
     return HTTP::absoluteURLs($newsletterEmail->getData()->renderWith($templateName));
 }
开发者ID:helpfulrobot,项目名称:silverstripe-newsletter,代码行数:12,代码来源:Newsletter.php

示例10: digest

 public function digest()
 {
     if (!Permission::check('ADMIN')) {
         return $this->httpError(403);
     }
     $posts = $this->microBlogService->globalFeed(array('Created:GreaterThan' => date('Y-m-d 00:00:00', strtotime('-1 month'))), $orderBy = 'ID DESC', $since = null, $number = 10, $markViewed = false);
     if (!count($posts)) {
         return;
     }
     $content = SSViewer::execute_template('DigestEmail', ArrayData::create(array('Posts' => $posts, 'Member' => Member::currentUser())));
     $content = HTTP::absoluteURLs($content);
     echo $content;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-microblog,代码行数:13,代码来源:TimelineController.php

示例11: Content

 /**
  * Overloaded from {@link Widget->Content()}
  * to allow for controller/form linking.
  *
  * @return string HTML
  *
  * @author Sebastian Diel <sdiel@pixeltricks.de>
  * @since 20.06.2013
  */
 public function Content()
 {
     $renderData = array('Controller' => $this);
     $template = new SSViewer_FromString($this->getField('FreeText'));
     $freeText = HTTP::absoluteURLs($template->process(new ArrayData($renderData)));
     $data = new ArrayData(array('FreeText' => $freeText, 'LinkText' => $this->LinkText, 'Link' => $this->Link));
     return $this->customise($data)->renderWith($this->widget->class);
 }
开发者ID:silvercart,项目名称:silvercart,代码行数:17,代码来源:SilvercartTextWithLinkWidget.php

示例12: send

 /**
  * sends email to defined address
  *
  * @param string $identifier  identifier for email template
  * @param string $to          recipients email address
  * @param array  $variables   array with template variables that can be called in the template
  * @param array  $attachments absolute filename to an attachment file
  *
  * @return bool
  *
  * @author Sebastian Diel <sdiel@pixeltricks.de>,
  *         Sascha Koehler <skoehler@pixeltricks.de>
  * @since 16.06.2014
  */
 public static function send($identifier, $to, $variables = array(), $attachments = null)
 {
     $mailObj = SilvercartShopEmail::get()->filter('Identifier', $identifier)->first();
     if (!$mailObj) {
         return false;
     }
     $emailText = trim($mailObj->EmailText);
     if (is_null($emailText) || empty($emailText)) {
         return false;
     }
     $emailSubject = trim($mailObj->Subject);
     if (is_null($emailSubject) || empty($emailSubject)) {
         return false;
     }
     if (!is_array($variables)) {
         $variables = array();
     }
     $templateVariables = new ArrayData($variables);
     $emailTextTemplate = new SSViewer_FromString($mailObj->EmailText);
     $emailText = HTTP::absoluteURLs($emailTextTemplate->process($templateVariables));
     $emailSubjectTemplate = new SSViewer_FromString($mailObj->Subject);
     $emailSubject = HTTP::absoluteURLs($emailSubjectTemplate->process($templateVariables));
     $email = new Email(SilvercartConfig::EmailSender(), $to, $emailSubject, $mailObj->EmailText);
     $email->setTemplate('SilvercartShopEmail');
     $email->populateTemplate(array('ShopEmailSubject' => $emailSubject, 'ShopEmailMessage' => $emailText));
     self::attachFiles($email, $attachments);
     $email->send();
     if (SilvercartConfig::GlobalEmailRecipient() != '') {
         $email = new Email(SilvercartConfig::EmailSender(), SilvercartConfig::GlobalEmailRecipient(), $emailSubject, $mailObj->EmailText);
         $email->setTemplate('SilvercartShopEmail');
         $email->populateTemplate(array('ShopEmailSubject' => $emailSubject, 'ShopEmailMessage' => $emailText));
         $email->send();
     }
     //Send the email to additional standard receipients from the n:m
     //relation AdditionalReceipients;
     //Email address is validated.
     if ($mailObj->AdditionalReceipients()->exists()) {
         foreach ($mailObj->AdditionalReceipients() as $additionalReceipient) {
             if ($additionalReceipient->getEmailAddressWithName() && Email::validEmailAddress($additionalReceipient->Email)) {
                 $to = $additionalReceipient->getEmailAddressWithName();
             } elseif ($additionalReceipient->getEmailAddress() && Email::validEmailAddress($additionalReceipient->Email)) {
                 $to = $additionalReceipient->getEmailAddress();
             } else {
                 continue;
             }
             $email = new Email(SilvercartConfig::EmailSender(), $to, $emailSubject, $mailObj->EmailText);
             $email->setTemplate('SilvercartShopEmail');
             $email->populateTemplate(array('ShopEmailSubject' => $emailSubject, 'ShopEmailMessage' => $emailText));
             self::attachFiles($email, $attachments);
             $email->send();
         }
     }
 }
开发者ID:silvercart,项目名称:silvercart,代码行数:67,代码来源:SilvercartShopEmail.php

示例13: parseVariables

	/**
	 * Load all the template variables into the internal variables, including
	 * the template into body.  Called before send() or debugSend()
	 * $isPlain=true will cause the template to be ignored, otherwise the GenericEmail template will be used
	 * and it won't be plain email :) 
	 */
	protected function parseVariables($isPlain = false) {
		if(!$this->parseVariables_done) {
			$this->parseVariables_done = true;

			// Parse $ variables in the base parameters
			$data = $this->templateData();
			
			foreach(array('from','to','subject','body', 'plaintext_body', 'cc', 'bcc') as $param) {
				$template = SSViewer::fromString($this->$param);
				$this->$param = $template->process($data);
			}
			
			// Process a .SS template file
			$fullBody = $this->body;
			if($this->ss_template && !$isPlain) {
				// Requery data so that updated versions of To, From, Subject, etc are included
				$data = $this->templateData();
				
				$template = new SSViewer($this->ss_template);
				
				if($template->exists()) {
					$fullBody = $template->process($data);
				}
			}
			
			// Rewrite relative URLs
			$this->body = HTTP::absoluteURLs($fullBody);
		}
	}
开发者ID:neopba,项目名称:silverstripe-book,代码行数:35,代码来源:Email.php

示例14: AbsoluteLinks

 /**
  * Return the value of the field with relative links converted to absolute urls.
  * @return string
  */
 public function AbsoluteLinks()
 {
     return HTTP::absoluteURLs($this->RAW());
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:8,代码来源:Text.php

示例15: preview

 /**
  * Preview a {@link Newsletter} draft.
  *
  * @param SS_HTTPRequest $request Request parameters
  */
 public function preview($request)
 {
     $newsletterID = (int) $request->param('ID');
     $newsletter = DataObject::get_by_id('Newsletter', $newsletterID);
     $templateName = $newsletter && $newsletter->Parent()->Template ? $newsletter->Parent()->Template : 'GenericEmail';
     // Block stylesheets and JS that are not required (email templates should have inline CSS/JS)
     Requirements::clear();
     $email = new NewsletterEmail($newsletter);
     return HTTP::absoluteURLs($email->getData()->renderWith($templateName));
 }
开发者ID:roed,项目名称:silverstripe-newsletter,代码行数:15,代码来源:NewsletterAdmin.php


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