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


PHP Director::absoluteURL方法代码示例

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


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

示例1: generatePDF

 function generatePDF()
 {
     // tempfolder
     $tmpBaseFolder = TEMP_FOLDER . '/shopsystem';
     $tmpFolder = project() ? "{$tmpBaseFolder}/" . project() : "{$tmpBaseFolder}/site";
     if (is_dir($tmpFolder)) {
         Filesystem::removeFolder($tmpFolder);
     }
     if (!file_exists($tmpFolder)) {
         Filesystem::makeFolder($tmpFolder);
     }
     $baseFolderName = basename($tmpFolder);
     //Get site
     Requirements::clear();
     $link = Director::absoluteURL($this->pdfLink() . "/?view=1");
     $response = Director::test($link);
     $content = $response->getBody();
     $content = utf8_decode($content);
     $contentfile = "{$tmpFolder}/" . $this->PublicURL . ".html";
     if (!file_exists($contentfile)) {
         // Write to file
         if ($fh = fopen($contentfile, 'w')) {
             fwrite($fh, $content);
             fclose($fh);
         }
     }
     return $contentfile;
 }
开发者ID:pstaender,项目名称:ShopSystem,代码行数:28,代码来源:ShopInvoice.php

示例2: analyse

 /**
  * Ajax call from browser
  * @param SS_HTTPRequest $request sent by browser
  * @return string json response to send to back to the browser
  */
 public function analyse(SS_HTTPRequest $request)
 {
     // Set the tenon options
     $tenon_options = $this->buildOptions($request);
     // Origin check
     if (strpos($request->postVar('tURL'), Director::absoluteURL(Director::baseURL())) === 0) {
         // Only proceed if the key is set
         if (strlen(trim($tenon_options["key"])) > 28 && ctype_xdigit(trim($tenon_options["key"]))) {
             // Store the page and create a hash of its contents
             $this->tenon_page = $request->postVar('tURL');
             $this->tenon_hash = $this->createHash($request);
             $this->log("TenonAjax.requestTenon", "url=" . $this->tenon_url . ", options=" . print_r($tenon_options, true));
             // If the page/hash combination has not already been checked, do it now
             if (!$this->existingPageHash()) {
                 if ($this->requestSend($tenon_options) && $this->responseSave() && $this->savePageHash()) {
                     $out = $this->jsonResponse(true);
                     $this->log("TenonAjax.analyse", "out={$out}");
                     return $out;
                 }
             }
         }
     } else {
         $this->log('Invalid request received by ' . Director::absoluteURL(Director::baseURL()) . ' from ' . $request->postVar('tURL'));
     }
     return $this->jsonResponse(false);
 }
开发者ID:helpfulrobot,项目名称:silverstripe-tenon,代码行数:31,代码来源:TenonAjax.php

示例3: forceNonWWW

 public static function forceNonWWW()
 {
     if (!Director::isDev() && !Director::isTest() && strpos($_SERVER['HTTP_HOST'], 'www') === 0) {
         $destURL = str_replace(Director::protocol() . 'www.', Director::protocol(), Director::absoluteURL($_SERVER['REQUEST_URI']));
         self::force_redirect($destURL);
     }
 }
开发者ID:micschk,项目名称:silverstripe-cmstweaks,代码行数:7,代码来源:ConfigHelpers.php

示例4: run

 /**
  * will ask the target server to return the file list and the data object list
  * @param type $request
  */
 public function run($request)
 {
     if (!$this->config()->target) {
         throw new Exception('Target not found in yml file. See readme.md for installation instructions.');
     }
     if (!$this->config()->key) {
         throw new Exception('Key not found in yml file. See readme.md for installation instructions.');
     }
     $myurl = Director::absoluteURL('/remoteassetdiff') . '/' . urlencode($this->config()->key);
     $downloadurl = Director::absoluteURL('/remoteassetdownload') . '/' . urlencode($this->config()->key) . '?m=' . time();
     // download without javascript
     if (Director::is_cli()) {
         ini_set('memory_limit', '1024M');
         set_time_limit(0);
         echo "Creating list of files to download" . PHP_EOL;
         $listoffiles = RemoteAssetTask::DownloadFile($myurl);
         $fullist = json_decode($listoffiles);
         if (!is_array($fullist->download)) {
             throw new Exception('Failure to download list of files');
         }
         foreach ($fullist->download as $file) {
             echo "Downloading {$file} ... ";
             try {
                 RemoteAssetTask::DownloadFile($downloadurl . '&download=' . $file);
                 echo "Success" . PHP_EOL;
             } catch (Exception $e) {
                 echo "Failure" . PHP_EOL;
             }
         }
         echo "Done" . PHP_EOL;
         return;
     }
     echo ArrayData::create(array('FetchURL' => $myurl, 'DownloadURL' => $downloadurl, 'Target' => $this->config()->target, 'ToMachine' => Director::absoluteURL('/')))->renderWith('RemoteAssetTask');
 }
开发者ID:otago,项目名称:remote-asset-download,代码行数:38,代码来源:RemoteAssetTask.php

示例5: dologin

 /**
  * Login form handler method
  *
  * This method is called when the user clicks on "Log in"
  *
  * @param array $data Submitted data
  */
 public function dologin($data)
 {
     if ($this->performLogin($data)) {
         $this->logInUserAndRedirect($data);
     } else {
         if (array_key_exists('Email', $data)) {
             Session::set('SessionForms.MemberLoginForm.Email', $data['Email']);
             Session::set('SessionForms.MemberLoginForm.Remember', isset($data['Remember']));
         }
         if (isset($_REQUEST['BackURL'])) {
             $backURL = $_REQUEST['BackURL'];
         } else {
             $backURL = null;
         }
         if ($backURL) {
             Session::set('BackURL', $backURL);
         }
         // Show the right tab on failed login
         $loginLink = Director::absoluteURL($this->controller->Link());
         if ($backURL) {
             $loginLink .= '?BackURL=' . urlencode($backURL);
         }
         $this->controller->redirect($loginLink . '#' . $this->FormName() . '_tab');
     }
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-commerce,代码行数:32,代码来源:CommerceLoginForm.php

示例6: __construct

 /**
  * constructor
  *
  * @param Controller $controller  the controller object
  * @param array      $params      additional parameters
  * @param array      $preferences array with preferences
  * @param bool       $barebone    is the form initialized completely?
  *
  * @return void
  *
  * @author Sebastian Diel <sdiel@pixeltricks.de>,
  *         Sascha Koehler <skoehler@pixeltricks.de>
  * @since 15.11.2014
  */
 public function __construct($controller, $params = null, $preferences = null, $barebone = false)
 {
     $member = SilvercartCustomer::currentUser();
     $checkoutData = $controller->getCombinedStepData();
     if (!$this->payment && $member) {
         if (array_key_exists('PaymentMethod', $checkoutData)) {
             $this->paymentMethodObj = DataObject::get_by_id('SilvercartPaymentMethod', $checkoutData['PaymentMethod']);
             if ($this->paymentMethodObj) {
                 $this->paymentMethodObj->setController($controller);
                 $this->paymentMethodObj->setCancelLink(Director::absoluteURL($controller->Link()) . 'GotoStep/2');
                 $this->paymentMethodObj->setReturnLink(Director::absoluteURL($controller->Link()));
                 $this->paymentMethodObj->setCustomerDetailsByCheckoutData($checkoutData);
                 $this->paymentMethodObj->setInvoiceAddressByCheckoutData($checkoutData);
                 $this->paymentMethodObj->setShippingAddressByCheckoutData($checkoutData);
                 $this->paymentMethodObj->setShoppingCart($member->getCart());
             }
         }
     }
     parent::__construct($controller, $params, $preferences, $barebone);
     if (!$barebone) {
         /*
          * redirect a user if his cart is empty and no order exists
          */
         $checkoutData = $this->controller->getCombinedStepData();
         if (!SilvercartCustomer::currentUser() || !SilvercartCustomer::currentUser()->getCart()->isFilled() && !array_key_exists('orderId', $checkoutData)) {
             $frontPage = SilvercartPage_Controller::PageByIdentifierCode();
             $this->getController()->redirect($frontPage->RelativeLink());
         }
     }
 }
开发者ID:silvercart,项目名称:silvercart,代码行数:44,代码来源:SilvercartCheckoutFormStepPaymentInit.php

示例7: run

 function run()
 {
     $batch_size = 15;
     if (isset($_GET['batch_size'])) {
         $batch_size = intval(trim(Convert::raw2sql($_GET['batch_size'])));
     }
     $surveys = DeploymentSurvey::getNotDigestSent($batch_size);
     $deployments = Deployment::getNotDigestSent($batch_size);
     if ($surveys) {
         foreach ($surveys as $survey) {
             $survey->SendDigest = 1;
             $survey->write();
         }
     }
     if ($deployments) {
         foreach ($deployments as $dep) {
             $dep->SendDigest = 1;
             $dep->write();
         }
     }
     if ((!is_null($surveys) && count($surveys)) > 0 || !is_null($deployments) && count($deployments)) {
         global $email_new_deployment;
         $email = EmailFactory::getInstance()->buildEmail($email_new_deployment, $email_new_deployment, $subject = 'New Deployments and Surveys');
         $email->setTemplate('NewDeploymentsSurveysEmail');
         $email->populateTemplate(array('SurveysUrl' => Director::absoluteURL('admin/deployments/DeploymentSurvey/EditForm/field/DeploymentSurvey/item'), 'DeploymentsUrl' => Director::absoluteURL('admin/deployments/Deployment/EditForm/field/Deployment/item'), 'SangriaDeploymentsUrl' => Director::absoluteURL('sangria/ViewDeploymentDetails'), 'Surveys' => $surveys, 'Deployments' => $deployments));
         $email->send();
     }
 }
开发者ID:Thingee,项目名称:openstack-org,代码行数:28,代码来源:DeploymentSurveyTask.php

示例8: getEditForm

 /**
  * @return Form
  */
 public function getEditForm($id = null, $fields = null)
 {
     $config = CodeBankConfig::CurrentConfig();
     $fields = $config->getCMSFields();
     $actions = new FieldList(FormAction::create('doSave', _t('CodeBank.SAVE', '_Save'))->addExtraClass('ss-ui-action-constructive')->setAttribute('data-icon', 'accept'), FormAction::create('doExportToClient', _t('CodeBank.EXPORT_TO_CLIENT', '_Export To Desktop Client'))->setAttribute('data-exporturl', Director::absoluteURL('code-bank-api/export-to-client'))->setAttribute('data-icon', 'export'));
     if (Permission::check('ADMIN')) {
         $actions->push(FormAction::create('doImportFromClient', _t('CodeBank.IMPORT_FROM_CLIENT', '_Import From Desktop Client'))->setAttribute('data-icon', 'import')->setAttribute('data-importurl', $this->Link('import-from-client')));
     }
     $form = CMSForm::create($this, 'EditForm', $fields, $actions)->setHTMLID('Form_EditForm');
     $form->addExtraClass('root-form');
     $form->addExtraClass('cms-edit-form center');
     // don't add data-pjax-fragment=CurrentForm, its added in the content template instead
     $form->setHTMLID('Form_EditForm');
     $form->loadDataFrom($config);
     $form->setTemplate($this->getTemplatesWithSuffix('_EditForm'));
     // Use <button> to allow full jQuery UI styling
     $actions = $actions->dataFields();
     if ($actions) {
         foreach ($actions as $action) {
             $action->setUseButtonTag(true);
         }
     }
     $this->extend('updateEditForm', $form);
     //Display message telling user to run dev/build because the version numbers are out of sync
     if (CB_VERSION != '@@VERSION@@' && CodeBankConfig::CurrentConfig()->Version != CB_VERSION . ' ' . CB_BUILD_DATE) {
         $form->setMessage(_t('CodeBank.UPDATE_NEEDED', '_A database upgrade is required please run {startlink}dev/build{endlink}.', array('startlink' => '<a href="dev/build?flush=all">', 'endlink' => '</a>')), 'error');
     } else {
         if ($this->hasOldTables()) {
             $form->setMessage(_t('CodeBank.MIGRATION_AVAILABLE', '_It appears you are upgrading from Code Bank 2.2.x, your old data can be migrated {startlink}click here to begin{endlink}, though it is recommended you backup your database first.', array('startlink' => '<a href="dev/tasks/CodeBankLegacyMigrate">', 'endlink' => '</a>')), 'warning');
         }
     }
     $form->Actions()->push(new LiteralField('CodeBankVersion', '<p class="codeBankVersion">Code Bank: ' . $this->getVersion() . '</p>'));
     return $form;
 }
开发者ID:helpfulrobot,项目名称:undefinedoffset-silverstripe-codebank,代码行数:37,代码来源:CodeBankSettings.php

示例9: validateStep

 /**
  * This does not actually perform any validation, but just creates the
  * initial registration object.
  */
 public function validateStep($data, $form)
 {
     $form = $this->getForm();
     $datetime = $form->getController()->getDateTime();
     $confirmation = $datetime->Event()->RegEmailConfirm;
     $registration = $this->getForm()->getSession()->getRegistration();
     // If we require email validation for free registrations, then send
     // out the email and mark the registration. Otherwise immediately
     // mark it as valid.
     if ($confirmation) {
         $email = new Email();
         $config = SiteConfig::current_site_config();
         $registration->TimeID = $datetime->ID;
         $registration->Status = 'Unconfirmed';
         $registration->write();
         if (Member::currentUserID()) {
             $details = array('Name' => Member::currentUser()->getName(), 'Email' => Member::currentUser()->Email);
         } else {
             $details = $form->getSavedStepByClass('EventRegisterTicketsStep');
             $details = $details->loadData();
         }
         $link = Controller::join_links($this->getForm()->getController()->Link(), 'confirm', $registration->ID, '?token=' . $registration->Token);
         $regLink = Controller::join_links($datetime->Event()->Link(), 'registration', $registration->ID, '?token=' . $registration->Token);
         $email->setTo($details['Email']);
         $email->setSubject(sprintf('Confirm Registration For %s (%s)', $datetime->getTitle(), $config->Title));
         $email->setTemplate('EventRegistrationConfirmationEmail');
         $email->populateTemplate(array('Name' => $details['Name'], 'Registration' => $registration, 'RegLink' => $regLink, 'Title' => $datetime->getTitle(), 'SiteConfig' => $config, 'ConfirmLink' => Director::absoluteURL($link)));
         $email->send();
         Session::set("EventRegistration.{$registration->ID}.message", $datetime->Event()->EmailConfirmMessage);
     } else {
         $registration->Status = 'Valid';
         $registration->write();
     }
     return true;
 }
开发者ID:tardinha,项目名称:silverstripe-eventmanagement,代码行数:39,代码来源:EventRegisterFreeConfirmationStep.php

示例10: __construct

 /**
  * Create the new notification email.
  * 
  * @param Member $customer
  * @param Order $order
  * @param String $from
  * @param String $to
  * @param String $subject
  * @param String $body
  * @param String $bounceHandlerURL
  * @param String $cc
  * @param String $bcc
  */
 public function __construct(Member $customer, Order $order, $from = null, $to = null, $subject = null, $body = null, $bounceHandlerURL = null, $cc = null, $bcc = null)
 {
     $siteConfig = ShopConfig::get()->first();
     if ($siteConfig->NotificationTo) {
         $this->to = $siteConfig->NotificationTo;
     }
     if ($siteConfig->NotificationSubject) {
         $this->subject = $siteConfig->NotificationSubject . ' - Order #' . $order->ID;
     }
     if ($siteConfig->NotificationBody) {
         $this->body = $siteConfig->NotificationBody;
     }
     if ($customer->Email) {
         $this->from = $customer->Email;
     } elseif (Email::getAdminEmail()) {
         $this->from = Email::getAdminEmail();
     } else {
         $this->from = 'no-reply@' . $_SERVER['HTTP_HOST'];
     }
     $this->signature = '';
     $adminLink = Director::absoluteURL('/admin/shop/');
     //Get css for Email by reading css file and put css inline for emogrification
     $this->setTemplate('Order_NotificationEmail');
     if (file_exists(Director::getAbsFile($this->ThemeDir() . '/css/ShopEmail.css'))) {
         $css = file_get_contents(Director::getAbsFile($this->ThemeDir() . '/css/ShopEmail.css'));
     } else {
         $css = file_get_contents(Director::getAbsFile('swipestripe/css/ShopEmail.css'));
     }
     $this->populateTemplate(array('Message' => $this->Body(), 'Order' => $order, 'Customer' => $customer, 'InlineCSS' => "<style>{$css}</style>", 'Signature' => $this->signature, 'AdminLink' => $adminLink));
     parent::__construct($from, null, $subject, $body, $bounceHandlerURL, $cc, $bcc);
 }
开发者ID:vinstah,项目名称:body,代码行数:44,代码来源:NotificationEmail.php

示例11: sendVerificationEmail

 /**
  * Send verification email to member.
  */
 public function sendVerificationEmail()
 {
     $validation_link = Controller::join_links(Director::absoluteURL('Security/validate-email'), $this->owner->VerificationString);
     $site_config = SiteConfig::current_site_config();
     $site_title = $site_config->Title;
     $admin_email = Config::inst()->get('Email', 'admin_email');
     $email_template_data = array('Member' => $this->owner, 'ValidationLink' => $validation_link, 'SiteConfig' => $site_config);
     $email_subject = _t('MemberEmailVerification.VERIFICATIONEMAILSUBJECT', "{site_title} Email Verification", array('site_title' => $site_title));
     if (!$admin_email) {
         // Fallback to a placeholder admin email if Email.admin_email is not set
         $admin_email = 'admin@domain.com';
     }
     $sender_email = self::get_formatted_email($site_title, $admin_email);
     $recipient_email = $this->owner->Email;
     $email_to_recipient = Email::create($sender_email, $recipient_email, $email_subject);
     $email_to_recipient->setTemplate('VerificationEmail');
     $email_to_recipient->populateTemplate($email_template_data);
     $email_status = $email_to_recipient->send();
     // Return true if the email was successfully sent
     // Mailer::email will return `true` or an array if the email was successfully sent
     if ($email_status === true || is_array($email_status)) {
         return true;
     }
     return false;
 }
开发者ID:jordanmkoncz,项目名称:silverstripe-memberemailverification,代码行数:28,代码来源:EmailVerificationMemberExtension.php

示例12: testHandleURLRedirectionWithQueryString

 function testHandleURLRedirectionWithQueryString()
 {
     $response = $this->get('query-test-with-query-string?foo=bar');
     $expected = $this->objFromFixture('RedirectedURL', 'redirect-with-query');
     $this->assertEquals(301, $response->getStatusCode());
     $this->assertEquals(Director::absoluteURL($expected->To), $response->getHeader('Location'));
 }
开发者ID:helpfulrobot,项目名称:silverstripe-redirectedurls,代码行数:7,代码来源:RedirectedURLHandlerTest.php

示例13: SiteTitle

 /**
  * @return String - title for project
  *
  *
  */
 function SiteTitle()
 {
     $sc = SiteConfig::current_site_config();
     if ($sc && $sc->Title) {
         return $sc->Title;
     }
     return Director::absoluteURL();
 }
开发者ID:helpfulrobot,项目名称:sunnysideup-templateoverview,代码行数:13,代码来源:CMSHelp.php

示例14: __construct

 public function __construct($page, $member, $offers)
 {
     $from = $page->EmailFrom;
     $to = $member->Email;
     $subject = $page->NewOffersNewsletterSubject;
     parent::__construct($from, $to, $subject);
     $this->populateTemplate(new ArrayData(array('Member' => $member, 'TaskPage' => $page, 'Offers' => $offers, '$SiteName' => SiteConfig::current_site_config()->Title, '$LoginLink' => Director::absoluteURL(singleton('Security')->Link('login')))));
 }
开发者ID:seraphia,项目名称:donationcollector,代码行数:8,代码来源:NewOffersNewsletterEmail.php

示例15: AbsoluteLink

 /**
  * Get the absolute URL for this page, including protocol and host.
  *
  * @param string $action See {@link Link()}
  * @return string
  */
 public function AbsoluteLink($action = null)
 {
     if ($this->hasMethod('alternateAbsoluteLink')) {
         return $this->alternateAbsoluteLink($action);
     } else {
         return Director::absoluteURL($this->Link($action));
     }
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-catalogue,代码行数:14,代码来源:CatalogueCategory.php


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