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


PHP Director::absoluteBaseUrl方法代码示例

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


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

示例1: connect

 public function connect()
 {
     if (!($member = Member::currentUser())) {
         /** @var stdClass $params */
         $params = $this->getAccessToken($this->request->getVar('code'));
         // member is not currently logged into SilverStripe. Look up
         // for a member with the UID which matches first.
         $member = Member::get()->filter(array("VkUID" => $params->user_id))->first();
         if (!$member) {
             // see if we have a match based on email. From a
             // security point of view, users have to confirm their
             // email address in facebook so doing a match up is fine
             $email = $params->email;
             if ($email) {
                 $member = Member::get()->filter(array('Email' => $email))->first();
             }
         }
         if (!$member) {
             $member = Injector::inst()->create('Member');
             $member->syncVkDetails($this->getUserInfo());
         }
     }
     $member->logIn(true);
     // redirect the user to the provided url, otherwise take them
     // back to the route of the website.
     if ($url = Session::get(VkControllerExtension::SESSION_REDIRECT_URL_FLAG)) {
         return $this->redirect($url);
     } else {
         return $this->redirect(Director::absoluteBaseUrl());
     }
 }
开发者ID:helpfulrobot,项目名称:rchntrl-silverstripe-vk-connect,代码行数:31,代码来源:VkConnectAuthCallback.php

示例2: doContinue

 public function doContinue($data)
 {
     Session::set('Checkout.PaymentMethodID', $data['PaymentMethodID']);
     Session::set("Checkout.PostageID", $data["PostageID"]);
     $url = Controller::join_links(Director::absoluteBaseUrl(), Payment_Controller::config()->url_segment);
     return $this->controller->redirect($url);
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-checkout,代码行数:7,代码来源:PostagePaymentForm.php

示例3: connect

 public function connect()
 {
     // check we have a valid session
     $appId = Config::inst()->get('FacebookControllerExtension', 'app_id');
     $secret = Config::inst()->get('FacebookControllerExtension', 'api_secret');
     $session = $this->getFacebookHelper()->getSessionFromRedirect();
     if ($session) {
         $token = $session->getAccessToken();
         // get a long lived token by default. Access token is saved in
         // session.
         try {
             $long = $token->extend($appId, $secret);
             if ($long) {
                 $accessTokenValue = (string) $long;
             } else {
                 $accessTokenValue = (string) $token;
             }
         } catch (Exception $e) {
             $accessTokenValue = (string) $token;
         }
         try {
             Session::set(FacebookControllerExtension::FACEBOOK_ACCESS_TOKEN, $accessTokenValue);
             $fields = Config::inst()->get('FacebookControllerExtension', 'facebook_fields');
             $user = (new FacebookRequest($session, 'GET', '/me', array('fields' => implode(',', $fields))))->execute()->getGraphObject(GraphUser::className());
             if (!($member = Member::currentUser())) {
                 // member is not currently logged into SilverStripe. Look up
                 // for a member with the UID which matches first.
                 $member = Member::get()->filter(array("FacebookUID" => $user->getId()))->first();
                 if (!$member) {
                     // see if we have a match based on email. From a
                     // security point of view, users have to confirm their
                     // email address in facebook so doing a match up is fine
                     $email = $user->getProperty('email');
                     if ($email) {
                         $member = Member::get()->filter(array('Email' => $email))->first();
                     }
                 }
                 if (!$member) {
                     $member = Injector::inst()->create('Member');
                 }
             }
             $member->syncFacebookDetails($user);
             $member->logIn();
             // redirect the user to the provided url, otherwise take them
             // back to the route of the website.
             if ($url = Session::get(FacebookControllerExtension::SESSION_REDIRECT_URL_FLAG)) {
                 return $this->redirect($url);
             } else {
                 return $this->redirect(Director::absoluteBaseUrl());
             }
         } catch (Exception $e) {
             SS_Log::log($e, SS_Log::ERR);
         }
     } else {
         return $this->httpError(400);
     }
     return $this->httpError(400);
 }
开发者ID:wilr,项目名称:silverstripe-facebookconnect,代码行数:58,代码来源:FacebookConnectAuthCallback.php

示例4: testUrlsToPathsWithAbsoluteUrls

 function testUrlsToPathsWithAbsoluteUrls()
 {
     $fsp = new FilesystemPublisher('.', 'html');
     $url = Director::absoluteBaseUrl();
     $this->assertEquals($fsp->urlsToPaths(array($url)), array($url => './index.html'), 'Root URL path mapping');
     $url = Director::absoluteBaseUrl() . 'about-us';
     $this->assertEquals($fsp->urlsToPaths(array($url)), array($url => './about-us.html'), 'URLsegment path mapping');
     $url = Director::absoluteBaseUrl() . 'parent/child';
     $this->assertEquals($fsp->urlsToPaths(array($url)), array($url => 'parent/child.html'), 'Nested URLsegment path mapping');
 }
开发者ID:nzjoel,项目名称:silverstripe-cms,代码行数:10,代码来源:FilesystemPublisherTest.php

示例5: description

 public function description()
 {
     $viewer = new DocumentationViewer();
     if (!$viewer->canView()) {
         return Security::permissionFailure($this);
     }
     if (!Config::inst()->get('DocumentationSearch', 'enabled')) {
         return $this->httpError('404');
     }
     $data = DocumentationSearch::get_meta_data();
     $link = Director::absoluteBaseUrl() . ($data['SearchPageLink'] = Controller::join_links($viewer->Link(), 'results/?Search={searchTerms}&start={startIndex}&length={count}&action_results=1'));
     $data['SearchPageAtom'] = $data['SearchPageLink'] . '&format=atom';
     return $this->customise(new ArrayData($data))->renderWith(array('OpenSearchDescription'));
 }
开发者ID:Jellygnite,项目名称:silverstripe-docsviewer,代码行数:14,代码来源:DocumentationOpenSearchController.php

示例6: __construct

 public function __construct($member = null)
 {
     $member = $member ? $member : Member::currentUser();
     $link = Director::absoluteBaseUrl();
     $host = parse_url($link, PHP_URL_HOST);
     $this->subject = _t('WelcomeEmail.SUBJECT', "Welcome to {Website}", 'Email subject', ['Website' => SiteConfig::current_site_config()->Title]);
     if ($member) {
         $this->to = $member->Email;
         if ($member->FirstName) {
             $name = trim($member->FirstName . ' ' . $member->Surname);
             $this->to = $name . ' <' . $member->Email . '>';
         }
     }
     parent::__construct();
     $this->populateTemplate(new ArrayData(['Member' => $member, 'AbsoluteWebsiteLink' => $link, 'WebsiteLink' => $host]));
 }
开发者ID:lekoala,项目名称:silverstripe-foundation-emails,代码行数:16,代码来源:WelcomeEmail.php

示例7: templateArray

 protected function templateArray()
 {
     global $project;
     $config = SiteConfig::current_site_config();
     if ($config->Theme) {
         Config::inst()->update('SSViewer', 'theme_enabled', true);
         Config::inst()->update('SSViewer', 'theme', $config->Theme);
     }
     $theme = $config->Theme;
     $manifest = SS_TemplateLoader::instance()->getManifest();
     $templateList = array();
     foreach ($manifest->getTemplates() as $template_name => $templateInfo) {
         $projectexists = isset($templateInfo[$project]) && isset($templateInfo[$project]['Patterns']);
         $themeexists = $theme && isset($templateInfo['themes'][$theme]) && isset($templateInfo['themes'][$theme]['Patterns']);
         //always use project template files, and grab template files if not already used
         if ($projectexists || $themeexists && !isset($templateList[$template_name])) {
             $templateList[$template_name] = array('Link' => Controller::join_links(Director::absoluteBaseUrl(), 'patterns', 'index', $template_name), 'Name' => $this->stripeTemplateName($template_name), 'Template' => $template_name);
         }
     }
     ksort($templateList);
     return $templateList;
 }
开发者ID:dnadesign,项目名称:silverstripe-patternlab,代码行数:22,代码来源:PatternLab.php

示例8: getVkCallbackLink

 /**
  * @return string
  */
 public function getVkCallbackLink()
 {
     return Controller::join_links(Director::absoluteBaseUrl(), 'VkConnectAuthCallback/connect');
 }
开发者ID:rchntrl,项目名称:silverstripe-vk-connect,代码行数:7,代码来源:VkControllerExtension.php

示例9: baseurl

 function baseurl()
 {
     return Director::absoluteBaseUrl() . "\n";
 }
开发者ID:ramziammar,项目名称:websites,代码行数:4,代码来源:SapphireInfo.php

示例10: ItemEditForm

 public function ItemEditForm()
 {
     Requirements::javascript("orders/javascript/entwine.orders.js");
     $form = parent::ItemEditForm();
     $fields = $form->Fields();
     $actions = $form->Actions();
     $record = $this->record;
     $member = Member::currentUser();
     $can_view = $this->record->canView();
     $can_edit = $this->record->canEdit();
     $can_change_status = $this->record->canChangeStatus();
     $can_delete = $this->record->canDelete();
     $can_create = $this->record->canCreate();
     // First remove the delete button
     $actions->removeByName("action_doDelete");
     // Deal with Estimate objects
     if ($record->ClassName == "Estimate") {
         if ($record->ID && $record->AccessKey) {
             $frontend_url = Controller::join_links(Director::absoluteBaseUrl(), "OrdersFront", "quote", $record->ID, $record->AccessKey);
             $html = '<a href="' . $frontend_url . '" ';
             $html .= 'target="_blank" ';
             $html .= 'class="action ss-ui-button ui-button ui-corner-all open-external" ';
             $html .= '>' . _t('Orders.ViewQuote', 'View Quote') . '</a>';
             $actions->insertAfter(LiteralField::create('openQuote', $html), "action_doSave");
         }
         if ($record->ID && $can_edit) {
             $actions->insertAfter(FormAction::create('doConvert', _t('Orders.ConvertToOrder', 'Convert To Order'))->setUseButtonTag(true), "action_doSave");
         }
     }
     // Deal with Order objects
     if ($record->ClassName == "Order") {
         // Set our status field as a dropdown (has to be here to
         // ignore canedit)
         // Allow users to change status (as long as they have permission)
         if ($can_edit || $can_change_status) {
             $status_field = DropdownField::create('Status', null, $record->config()->statuses);
             // Set default status if we can
             if (!$record->Status && !$record->config()->default_status) {
                 $status_field->setValue($record->config()->default_status);
             } else {
                 $status_field->setValue($record->Status);
             }
             $fields->replaceField("Status", $status_field);
         }
         // Setup order history
         if (Permission::check(array('COMMERCE_ORDER_HISTORY', 'ADMIN'), 'any', $member)) {
             $versions = $record->AllVersions();
             $first_version = $versions->First();
             $curr_version = $first_version ? $versions->First() : null;
             $message = "";
             foreach ($versions as $version) {
                 $i = $version->Version;
                 $name = "History_{$i}";
                 if ($i > 0) {
                     $frm = Versioned::get_version($record->class, $record->ID, $i - 1);
                     $to = Versioned::get_version($record->class, $record->ID, $i);
                     $diff = new DataDifferencer($frm, $to);
                     if ($version->Author()) {
                         $message = "<p>{$version->Author()->FirstName} ({$version->LastEdited})</p>";
                     } else {
                         $message = "<p>Unknown ({$version->LastEdited})</p>";
                     }
                     if ($diff->ChangedFields()->exists()) {
                         $message .= "<ul>";
                         // Now loop through all changed fields and track as message
                         foreach ($diff->ChangedFields() as $change) {
                             if ($change->Name != "LastEdited") {
                                 $message .= "<li>{$change->Title}: {$change->Diff}</li>";
                             }
                         }
                         $message .= "</ul>";
                     }
                     $fields->addFieldToTab("Root.History", LiteralField::create($name, "<div class=\"field\">{$message}</div>"));
                 }
             }
         }
         // Is user cannot edit, but can change status, add change
         // status button
         if ($record->ID && !$can_edit && $can_change_status) {
             $actions->push(FormAction::create('doChangeStatus', _t('Orders.Save', 'Save'))->setUseButtonTag(true)->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'));
         }
         if ($record->ID && $record->AccessKey) {
             $frontend_url = Controller::join_links(Director::absoluteBaseUrl(), "OrdersFront", "invoice", $record->ID, $record->AccessKey);
             $html = '<a href="' . $frontend_url . '" ';
             $html .= 'target="_blank" ';
             $html .= 'class="action ss-ui-button ui-button ui-corner-all open-external" ';
             $html .= '>' . _t('Orders.ViewInvoice', 'View Invoice') . '</a>';
             $link_field = LiteralField::create('openQuote', $html);
             if ($actions->find("Name", "action_doSave")) {
                 $actions->insertAfter($link_field, "action_doSave");
             }
             if ($actions->find("Name", "action_doChangeStatus")) {
                 $actions->insertAfter($link_field, "action_doChangeStatus");
             }
         }
     }
     // Add a duplicate button, either after the save button or
     // the change status "save" button.
     if ($record->ID) {
         $duplicate_button = FormAction::create('doDuplicate', _t('Orders.Duplicate', 'Duplicate'))->setUseButtonTag(true);
//.........这里部分代码省略.........
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-orders,代码行数:101,代码来源:OrdersGridFieldDetailForm.php

示例11: AbsoluteLink

 /**
  * @return string
  */
 public function AbsoluteLink($action)
 {
     return Controller::join_links(Director::absoluteBaseUrl(), $this->Link($action));
 }
开发者ID:Jellygnite,项目名称:silverstripe-docsviewer,代码行数:7,代码来源:DocumentationViewer.php


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