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


PHP Director::absoluteBaseURLWithAuth方法代码示例

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


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

示例1: __construct

 /**
  * @param Newsletter $newsletter
  * @param Mailinglists $recipient
  * @param Boolean $fakeRecipient
  */
 function __construct($newsletter, $recipient, $fakeRecipient = false)
 {
     $this->newsletter = $newsletter;
     $this->mailinglists = $newsletter->MailingLists();
     $this->recipient = $recipient;
     $this->fakeRecipient = $fakeRecipient;
     parent::__construct($this->newsletter->SendFrom, $this->recipient->Email);
     $this->populateTemplate(new ArrayData(array('UnsubscribeLink' => $this->UnsubscribeLink(), 'SiteConfig' => DataObject::get_one('SiteConfig'), 'AbsoluteBaseURL' => Director::absoluteBaseURLWithAuth())));
     $this->body = $newsletter->getContentBody();
     $this->subject = $newsletter->Subject;
     $this->ss_template = $newsletter->RenderTemplate;
     if ($this->body && $this->newsletter) {
         $text = $this->body->forTemplate();
         //Recipient Fields ShortCode parsing
         $bodyViewer = new SSViewer_FromString($text);
         $text = $bodyViewer->process($this->templateData());
         // Install link tracking by replacing existing links with "newsletterlink" and hash-based reference.
         if ($this->config()->link_tracking_enabled && !$this->fakeRecipient && preg_match_all("/<a\\s[^>]*href=\"([^\"]*)\"[^>]*>(.*)<\\/a>/siU", $text, $matches)) {
             if (isset($matches[1]) && ($links = $matches[1])) {
                 $titles = isset($matches[2]) ? $matches[2] : array();
                 $id = (int) $this->newsletter->ID;
                 $replacements = array();
                 $current = array();
                 // workaround as we want to match the longest urls (/foo/bar/baz) before /foo/
                 array_unique($links);
                 $sorted = array_combine($links, array_map('strlen', $links));
                 arsort($sorted);
                 foreach ($sorted as $link => $length) {
                     $SQL_link = Convert::raw2sql($link);
                     $tracked = DataObject::get_one('Newsletter_TrackedLink', "\"NewsletterID\" = '" . $id . "' AND \"Original\" = '" . $SQL_link . "'");
                     if (!$tracked) {
                         // make one.
                         $tracked = new Newsletter_TrackedLink();
                         $tracked->Original = $link;
                         $tracked->NewsletterID = $id;
                         $tracked->write();
                     }
                     // replace the link
                     $replacements[$link] = $tracked->Link();
                     // track that this link is still active
                     $current[] = $tracked->ID;
                 }
                 // replace the strings
                 $text = str_ireplace(array_keys($replacements), array_values($replacements), $text);
             }
         }
         // replace the body
         $output = new HTMLText();
         $output->setValue($text);
         $this->body = $output;
     }
 }
开发者ID:tractorcow,项目名称:silverstripe-newsletter,代码行数:57,代码来源:NewsletterEmail.php

示例2: __construct

 /**
  * Loading all the neede variables
  * @throws Exceptions\SetupException
  */
 public function __construct()
 {
     $this->config = \SiteConfig::current_site_config();
     $vendShopName = $this->config->VendShopName;
     $this->url = "https://{$vendShopName}.vendhq.com";
     //config
     $this->client_id = \Config::inst()->get('VendAPI', 'clientID');
     $this->client_secret = \Config::inst()->get('VendAPI', 'clientSecret');
     $this->redirect_uri = \Director::absoluteBaseURLWithAuth() . \Config::inst()->get('VendAPI', 'redirectURI');
     if (is_null($this->client_id) || is_null($this->client_secret)) {
         throw new Exceptions\SetupException();
     }
 }
开发者ID:helpfulrobot,项目名称:heyday-silverstripe-vend,代码行数:17,代码来源:TokenManager.php

示例3: ServiceURL

 /**
  * @return string
  */
 function ServiceURL()
 {
     return Director::absoluteBaseURLWithAuth() . $this->class . '/';
 }
开发者ID:hamishcampbell,项目名称:silverstripe-sapphire,代码行数:7,代码来源:SapphireSoapServer.php

示例4: getAuthURL

 /**
  * Returns the URL needed for shop owner authorisation
  * @return string
  */
 public function getAuthURL()
 {
     $clientID = \Config::inst()->get('VendAPI', 'clientID');
     $redirectURI = \Director::absoluteBaseURLWithAuth() . \Config::inst()->get('VendAPI', 'redirectURI');
     return "https://secure.vendhq.com/connect?response_type=code&client_id={$clientID}&redirect_uri={$redirectURI}";
 }
开发者ID:helpfulrobot,项目名称:heyday-silverstripe-vend,代码行数:10,代码来源:SetupForm.php


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