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


PHP Director::BaseURL方法代码示例

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


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

示例1: urlsToCache

 /**
  * Cache search with the home url to make sure it 
  * a. belongs to a subsite and
  * b. only gets cached once
  *
  * @return array
  */
 public function urlsToCache()
 {
     if ($this->owner->URLSegment == 'home') {
         $urls[Director::BaseURL() . 'search'] = 0;
     }
     $urls[$this->owner->Link()] = 0;
     return $urls;
 }
开发者ID:helpfulrobot,项目名称:adrexia-staticsearch,代码行数:15,代码来源:StaticSearchSiteTreeExtension.php

示例2: updateCMSFields

 public function updateCMSFields(FieldList $fields)
 {
     if ($this->owner->ID) {
         $uf = SiteTreeURLSegmentField::create("URLSegment", "URL Segment");
         $uf->setURLPrefix(Director::BaseURL() . $this->getURLPrefix());
         $fields->addFieldToTab("Root.Main", $uf, "Title");
     } else {
         $fields->removeByName("URLSegment");
     }
 }
开发者ID:KINKCreative,项目名称:actors,代码行数:10,代码来源:URLSegmentDecorator.php

示例3: finish

 function finish($data, $form)
 {
     parent::finish($data, $form);
     $savedSteps = $this->getSavedSteps();
     $savedData = array();
     foreach ($savedSteps as $step) {
         $savedData = array_merge($savedData, $step->loadData());
     }
     $fields = new FieldSet();
     $fields->push(new LiteralField("Heading", "<h3>You have submitted the following information:</h3>"));
     foreach ($savedData as $key => $value) {
         $fields->push(new LiteralField($key . '_copy', "<p><strong>{$key}</strong> {$value}</p>"));
     }
     Session::set("MultiFormMessage", "Your information has been submitted.");
     Director::redirect(Director::BaseURL() . $this->Controller()->URLSegment);
 }
开发者ID:normann,项目名称:silverstripe-frameworktest,代码行数:16,代码来源:TestMultiForm.php

示例4: onBeforeInit

 public function onBeforeInit()
 {
     /* =========================================
        * Combine JS
        =========================================*/
     Requirements::combine_files('combined.js', array('boilerplate/javascript/jquery.1.11.1.min.js', 'boilerplate/javascript/modernizr.2.8.3.js', 'boilerplate/javascript/bootstrap-3.2.0.min.js', 'boilerplate/javascript/script.js'));
     /* =========================================
        * CSS
        =========================================*/
     Requirements::css('boilerplate/css/main.min.css');
     //Requirements::css('themes/boilerplate/css/main.min.css');
     /* =========================================
        * IE Shivs
        =========================================*/
     $baseHref = Director::BaseURL();
     Requirements::insertHeadTags('<!--[if lt IE 9]>
         <script type="text/javascript" src="' . $baseHref . 'boilerplate/javascript/html5.js"></script>
         <script type="text/javascript" src="' . $baseHref . 'boilerplate/javascript/respond.min.js"></script>
     <![endif]-->');
 }
开发者ID:ormandroid,项目名称:ss_boilerplate,代码行数:20,代码来源:PageControllerExtension.php

示例5: view

 /**
  * ACTION /view
  * Fetch the requested product and render its product page.
  * If it doesn't exist, return HTTP 404.
  *
  * @return HTMLText
  */
 public function view()
 {
     /**
      * StoreSettings 
      */
     $conf = StoreSettings::get_settings();
     /**
      * Get the URLSegment of the Product from the request 
      */
     $URLSegment = $this->request->param('ID');
     /**
      * If URLSegment doesn't exist redirect with Error 404 redirect to the StoreFront.
      */
     if (!$URLSegment) {
         return $this->httpError(404);
     }
     /* The Product selected */
     $Product = DataObject::get_one("Product", "`URLSegment`='{$URLSegment}'");
     /**
      * If the Product doesn't exist, fail with httpError(404).
      */
     if (!$Product) {
         return $this->httpError(404);
     } else {
         /**
          * If product is out of stock, and admin has defined it should be completely
          * hidden, then return HTTP error 302 and temporarily redirect to the storefront.
          * Error 302 should prevent Search Engines modifying their entry for this product
          * whilst its hidden.
          */
         if ($Product->StockLevel <= $conf->Stock_OutOfStockThreshold && $conf->Stock_ProductOutOfStock == 1) {
             return $this->redirect(Director::BaseURL() . DataObject::get_one("SiteTree", "ClassName='Store'")->URLSegment, 302);
         }
         /**
          * If Product visibility is set to false return with httpError(404) otherwise
          * return the Product page with renderWith()
          */
         return !$Product->Visible ? $this->httpError(404) : $this->customise(array("Title" => $Product->Title, "Product" => $Product))->renderWith(array("Store_Product", "Page"));
     }
 }
开发者ID:micschk,项目名称:torindul-silverstripe-shop,代码行数:47,代码来源:Store_ProductController.php

示例6: init

 public function init()
 {
     $baseHref = Director::BaseURL();
     /** -----------------------------------------
      * Javascript
      * ----------------------------------------*/
     Requirements::insertHeadTags('<script type="text/javascript" src="' . $baseHref . project() . '/javascript/lib/modernizr.min.js"></script>', 'Modernizr');
     /**
      * Set All JS to be right before the closing </body> tag.
      */
     Requirements::set_force_js_to_bottom(true);
     if (Director::isDev()) {
         Requirements::javascript(project() . '/javascript/main.js');
     } else {
         Requirements::javascript(project() . '/javascript/main.min.js');
     }
     /** -----------------------------------------
      * CSS
      * ----------------------------------------*/
     Requirements::css(project() . '/css/main.min.css', 'all');
     parent::init();
 }
开发者ID:helpfulrobot,项目名称:toastnz-silverstripe-boilerplate-installer,代码行数:22,代码来源:Page.php

示例7: sendmeunsubscribelink

    /**
     * Show the lists for the user with the given email address
     */
    function sendmeunsubscribelink($data)
    {
        if (isset($data['Email']) && $data['Email']) {
            $member = DataObject::get_one("Member", "Email = '" . $data['Email'] . "'");
            if ($member) {
                if (!($from = Email::getAdminEmail())) {
                    $from = 'noreply@' . Director::BaseURL();
                }
                $to = $member->Email;
                $subject = "Unsubscribe Link";
                if ($member->AutoLoginHash) {
                    $member->AutoLoginExpired = date('Y-m-d', time() + 86400 * 2);
                    $member->write();
                } else {
                    $member->generateAutologinHash();
                }
                $link = Director::absoluteBaseURL() . $this->RelativeLink('index') . "/" . $member->AutoLoginHash;
                $membername = $member->getName();
                $body = $this->customise(array('Content' => <<<HTML
Dear {$membername},<br />
<p>Please click the link below to unsubscribe from our newsletters<br />
{$link}<br />
<br >
<br >
Thanks
</p>
HTML
))->renderWith('Page');
                $email = new Email($from, $to, $subject, $body);
                $result = $email->send();
                if ($result) {
                    Director::redirect(Director::absoluteBaseURL() . $this->RelativeLink('linksent') . "?SendEmail=" . $data['Email']);
                } else {
                    Director::redirect(Director::absoluteBaseURL() . $this->RelativeLink('linksent') . "?SendError=" . $data['Email']);
                }
            } else {
                $form = $this->EmailAddressForm();
                $message = sprintf(_t("Unsubscribe.NOTSIGNUP", "Sorry, '%s' doesn't appear to be an sign-up member with us"), $data['Email']);
                $form->sessionMessage($message, 'bad');
                Director::redirectBack();
            }
        } else {
            $form = $this->EmailAddressForm();
            $message = _t("Unsubscribe.NOEMAILGIVEN", "Sorry, please type in a valid email address");
            $form->sessionMessage($message, 'bad');
            Director::redirectBack();
        }
    }
开发者ID:nyeholt,项目名称:silverstripe-newsletter,代码行数:51,代码来源:UnsubscribeController.php

示例8: callback

 /**
  * This method can be called by a payment gateway to provide
  * automated integration.
  * 
  * This action performs some basic setup then hands control directly
  * to the payment handler's "callback" action.
  * 
  * @param $request Current Request Object
  */
 public function callback($request)
 {
     // If post data exists, process. Otherwise provide error
     if ($this->payment_handler === null) {
         // Redirect to error page
         return $this->redirect(Controller::join_links(Director::BaseURL(), $this->config()->url_segment, 'complete', 'error'));
     }
     // Hand the request over to the payment handler
     return $this->payment_handler->handleRequest($request, $this->model);
 }
开发者ID:i-lateral,项目名称:silverstripe-checkout,代码行数:19,代码来源:Payment_Controller.php

示例9: FileBasePath

 public function FileBasePath()
 {
     return Director::BaseURL() . "assets/tinymce_templates/";
 }
开发者ID:jelicanin,项目名称:silverstripe-htmleditorfield-content-templates,代码行数:4,代码来源:HtmlEditorFieldContentTemplate.php

示例10: callback

 /**
  * This method is what is called at the end of the transaction. It takes
  * either post data or get data and then sends it to the relevent payment
  * method for processing.
  */
 public function callback()
 {
     // If post data exists, process. Otherwise provide error
     if ($this->payment_handler !== null) {
         $callback = $this->payment_handler->callback();
     } else {
         // Redirect to error page
         return $this->redirect(Controller::join_links(Director::BaseURL(), $this->config()->url_segment, 'complete', 'error'));
     }
     return $callback;
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-commerce,代码行数:16,代码来源:Payment_Controller.php

示例11: subscribeverify

 public function subscribeverify()
 {
     if ($hash = $this->urlParams['ID']) {
         $recipient = DataObject::get_one("Recipient", "\"ValidateHash\" = '" . Convert::raw2sql($hash) . "'");
         if ($recipient && $recipient->exists()) {
             $now = date('Y-m-d H:i:s');
             if ($now <= $recipient->ValidateHashExpired) {
                 $recipient->Verified = true;
                 // extends the ValidateHashExpired so the a unsubscirbe link will stay alive in that peroid by law
                 $days = UnsubscribeController::get_days_unsubscribe_link_alive();
                 $recipient->ValidateHashExpired = date('Y-m-d H:i:s', time() + 86400 * $days);
                 $recipient->write();
                 $mailingLists = $recipient->MailingLists();
                 $ids = implode(",", $mailingLists->getIDList());
                 $templateData = array('FirstName' => $recipient->FirstName, 'MailingLists' => $mailingLists, 'UnsubscribeLink' => Director::BaseURL() . "unsubscribe/index/" . $recipient->ValidateHash . "/" . $ids, 'HashText' => $recipient->getHashText(), 'SiteConfig' => $this->SiteConfig());
                 //send notification email
                 if ($this->SendNotification) {
                     $email = new Email();
                     $email->setTo($recipient->Email);
                     $from = $this->NotificationEmailFrom ? $this->NotificationEmailFrom : Email::getAdminEmail();
                     $email->setFrom($from);
                     $email->setTemplate('SubscriptionConfirmationEmail');
                     $email->setSubject(_t('Newsletter.ConfirmSubject', "Confirmation of your subscription to our mailing lists"));
                     $email->populateTemplate($templateData);
                     $email->send();
                 }
                 $url = $this->Link('completed') . "/" . $recipient->ID;
                 $this->redirect($url);
             }
         }
         if ($recipient && $recipient->exists()) {
             $recipientData = $recipient->toMap();
         } else {
             $recipientData = array();
         }
         $daysExpired = SubscriptionPage::get_days_verification_link_alive();
         $recipientData['VerificationExpiredContent1'] = sprintf(_t('Newsletter.VerificationExpiredContent1', 'The verification link is only validate for %s days.'), $daysExpired);
         return $this->customise(array('Title' => _t('Newsletter.VerificationExpired', 'The verification link has been expired'), 'Content' => $this->customise($recipientData)->renderWith('VerificationExpired')))->renderWith('Page');
     }
 }
开发者ID:Zauberfisch,项目名称:silverstripe-newsletter,代码行数:40,代码来源:SubscriptionPage.php

示例12: Link

 /**
  * standard, required method
  * @param String $action
  * @return String link for the "Controller"
  */
 public function Link($action = null)
 {
     return Controller::join_links(Director::BaseURL(), 'dev/ecommerce/', $action);
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-ecommerce,代码行数:9,代码来源:EcommerceDatabaseAdmin.php

示例13: Link

 /** 
  * Override Link 
  */
 public function Link($action = null)
 {
     return Director::BaseURL() . "admin/store-orders/";
 }
开发者ID:micschk,项目名称:torindul-silverstripe-shop,代码行数:7,代码来源:StoreOrdersAdmin.php

示例14: Link

 public function Link($action = null)
 {
     return Controller::join_links(Director::BaseURL(), $this->config()->url_segment, $action);
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-commerce,代码行数:4,代码来源:Commerce_Controller.php

示例15: staticAbsoluteLink

 public static function staticAbsoluteLink($action = null)
 {
     return Controller::join_links(Director::absoluteURL(Director::BaseURL()), self::$url_segment, $action);
 }
开发者ID:helpfulrobot,项目名称:micschk-silverstripe-html5-media,代码行数:4,代码来源:Transcode_Controller.php


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