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


PHP SiteConfig::current_site_config方法代码示例

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


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

示例1: subscribe

 /**
  * Handles the action when subscribe is being done
  * 
  * @param  Array  $data
  * @param  Form   $form
  */
 public function subscribe(array $data, Form $form)
 {
     $settings = SiteConfig::current_site_config();
     $MailChimp = new \Drewm\MailChimp($settings->APIKey);
     $apiData = array('id' => $settings->MailChimpList()->filter(array('Code' => 'NEWSLETTER'))->First()->ListID, 'email' => array('email' => $data['Email']), 'double_optin' => false, 'update_existing' => false, 'replace_interests' => false, 'send_welcome' => false);
     $this->extend('updateAPIData', $apiData);
     $result = $MailChimp->call('lists/subscribe', $apiData);
     if (Director::is_ajax()) {
         if (isset($result['status']) && $result['status'] == 'error') {
             if ($result['code'] == 214) {
                 return json_encode(array('success' => false, 'message' => $data['Email'] . ' is already subscribed'));
             } else {
                 return json_encode(array('success' => false, 'message' => $result['error']));
             }
         } else {
             return json_encode(array('success' => true, 'message' => 'Thank you for subscribing to our newsletter'));
         }
     } else {
         if (isset($result['status']) && $result['status'] == 'error') {
             if ($result['code'] == 214) {
                 $this->sessionMessage($data['Email'] . ' is already subscribed.', 'bad');
             } else {
                 $this->sessionMessage($result['error'], 'bad');
             }
         } else {
             $this->sessionMessage('Thank you for subscribing to our newsletter', 'good');
         }
         Controller::curr()->redirectBack();
     }
 }
开发者ID:sentromedia,项目名称:letsfund,代码行数:36,代码来源:MailChimpForm.php

示例2: ProductList

 /**
  * Products function.
  * 
  * @access public
  * @return array
  */
 public function ProductList($limit = 10)
 {
     $config = SiteConfig::current_site_config();
     if ($config->ProductLimit > 0) {
         $limit = $config->ProductLimit;
     }
     if ($config->MultiGroup) {
         $entries = $this->Products()->sort('SortOrder');
     } else {
         $filter = '"ParentID" = ' . $this->ID;
         // Build a list of all IDs for ProductGroups that are children
         $holderIDs = $this->ProductGroupIDs();
         // If no ProductHolders, no ProductPages. So return false
         if ($holderIDs) {
             // Otherwise, do the actual query
             if ($filter) {
                 $filter .= ' OR ';
             }
             $filter .= '"ParentID" IN (' . implode(',', $holderIDs) . ")";
         }
         $order = '"SiteTree"."Title" ASC';
         $entries = ProductPage::get()->where($filter);
     }
     $list = new PaginatedList($entries, Controller::curr()->request);
     $list->setPageLength($limit);
     return $list;
 }
开发者ID:helpfulrobot,项目名称:dynamic-foxystripe,代码行数:33,代码来源:ProductHolder.php

示例3: testAddressBookWithReadonlyFieldForCountry

 public function testAddressBookWithReadonlyFieldForCountry()
 {
     $member = $this->objFromFixture("Member", "joebloggs");
     $this->logInAs($member);
     $this->controller->init();
     //reinit to connect up member
     // setup a single-country site
     $siteconfig = DataObject::get_one('SiteConfig');
     $siteconfig->AllowedCountries = "NZ";
     $siteconfig->write();
     $singlecountry = SiteConfig::current_site_config();
     $this->assertEquals("NZ", $singlecountry->getSingleCountry(), "Confirm that the website is setup as a single country site");
     // Open the Address Book page to test form submission with a readonly field
     $page = $this->get("account/addressbook/");
     // goto address book page
     $this->assertEquals(200, $page->getStatusCode(), "a page should load");
     $this->assertContains("Form_CreateAddressForm_Country_readonly", $page->getBody(), "The Country field is readonly");
     $this->assertNotContains("<option value=\"NZ\">New Zealand</option>", $page->getBody(), "Dropdown field is not shown");
     // Create an address
     $data = array("Address" => "234 Hereford Street", "City" => "Christchurch", "State" => "Canterbury", "PostalCode" => "8011");
     $this->submitForm("Form_CreateAddressForm", "action_saveaddress", $data);
     $this->assertEquals(200, $page->getStatusCode(), "a page should load");
     $nz_address = Address::get()->filter('PostalCode', '8011')->sort('ID')->last();
     $this->assertEquals("NZ", $nz_address->Country, "New address successfully saved; even with a Country readonly field in the form");
     $this->assertEquals("234 Hereford Street", $nz_address->Address, "Ensure that the Address is 234 Hereford Street");
 }
开发者ID:burnbright,项目名称:silverstripe-shop,代码行数:26,代码来源:AccountPageTest.php

示例4: postFacebook

 /**
  * @todo fix this BIG mess.
  */
 public static function postFacebook($message, $link = null, $impression = null)
 {
     $member = Member::currentUser();
     $postresult = false;
     $SiteConfig = SiteConfig::current_site_config();
     if ($member && $SiteConfig->FBAppID && $SiteConfig->FBSecret) {
         if ($link == null) {
             $link = Director::absoluteBaseURL();
         }
         $page = '/' . $SiteConfig->FBPageID . '/feed';
         $facebook = new Facebook(array('appId' => $SiteConfig->FBAppID, 'secret' => $SiteConfig->FBSecret));
         $token = $facebook->api('/me/accounts');
         foreach ($token['data'] as $pages) {
             if ($pages['id'] == $SiteConfig->FBPageID) {
                 $facebook->setAccessToken($pages['access_token']);
                 $verified = true;
                 break;
             }
         }
         if ($verified) {
             $data = array('message' => $message, 'link' => $link, 'picture' => $impression);
             $postresult = $facebook->api($page, 'post', $data);
         }
     }
     return $postresult;
 }
开发者ID:helpfulrobot,项目名称:firesphere-social,代码行数:29,代码来源:FacebookController.php

示例5: complete

 /**
  * Completes the job by zipping up the generated export and creating an
  * export record for it.
  */
 protected function complete()
 {
     $siteTitle = SiteConfig::current_site_config()->Title;
     $filename = preg_replace('/[^a-zA-Z0-9-.+]/', '-', sprintf('%s-%s.zip', $siteTitle, date('c')));
     $dir = Folder::findOrMake(SiteExportExtension::EXPORTS_DIR);
     $dirname = ASSETS_PATH . '/' . SiteExportExtension::EXPORTS_DIR;
     $pathname = "{$dirname}/{$filename}";
     SiteExportUtils::zip_directory($this->tempDir, "{$dirname}/{$filename}");
     Filesystem::removeFolder($this->tempDir);
     $file = new File();
     $file->ParentID = $dir->ID;
     $file->Title = $siteTitle . ' ' . date('c');
     $file->Filename = $dir->Filename . $filename;
     $file->write();
     $export = new SiteExport();
     $export->ParentClass = $this->rootClass;
     $export->ParentID = $this->rootId;
     $export->Theme = $this->theme;
     $export->BaseUrlType = ucfirst($this->baseUrlType);
     $export->BaseUrl = $this->baseUrl;
     $export->ArchiveID = $file->ID;
     $export->write();
     if ($this->email) {
         $email = new Email();
         $email->setTo($this->email);
         $email->setTemplate('SiteExportCompleteEmail');
         $email->setSubject(sprintf('Site Export For "%s" Complete', $siteTitle));
         $email->populateTemplate(array('SiteTitle' => $siteTitle, 'Link' => $file->getAbsoluteURL()));
         $email->send();
     }
 }
开发者ID:rodneyway,项目名称:silverstripe-siteexporter,代码行数:35,代码来源:SiteExportJob.php

示例6: run

 /**
  * @param	SS_HTTPRequest $request
  */
 public function run($request)
 {
     // Only allow execution from the command line (for simplicity).
     if (!Director::is_cli()) {
         echo "<p>Sorry, but this can only be run from the command line.</p>";
         return;
     }
     try {
         // Get and validate desired maintenance mode setting.
         $get = $request->getVars();
         if (empty($get["args"])) {
             throw new Exception("Please provide an argument (e.g. 'on' or 'off').", 1);
         }
         $arg = strtolower(current($get["args"]));
         if ($arg != "on" && $arg != "off") {
             throw new Exception("Invalid argument: '{$arg}' (expected 'on' or 'off')", 2);
         }
         // Get and write site configuration now.
         $config = SiteConfig::current_site_config();
         $previous = !empty($config->MaintenanceMode) ? "on" : "off";
         $config->MaintenanceMode = $arg == "on";
         $config->write();
         // Output status and exit.
         if ($arg != $previous) {
             $this->output("Maintenance mode is now '{$arg}'.");
         } else {
             $this->output("NOTE: Maintenance mode was already '{$arg}' (nothing has changed).");
         }
     } catch (Exception $e) {
         $this->output("ERROR: " . $e->getMessage());
         if ($e->getCode() <= 2) {
             $this->output("Usage:  sake dev/tasks/MaintenanceMode [on|off]");
         }
     }
 }
开发者ID:helpfulrobot,项目名称:thisisbd-silverstripe-maintenance-mode,代码行数:38,代码来源:MaintenanceMode.php

示例7: 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

示例8: updateEditForm

 function updateEditForm(&$form)
 {
     if ($form->getName() == 'RootForm' && SiteConfig::has_extension("Translatable")) {
         $siteConfig = SiteConfig::current_site_config();
         $form->Fields()->push(new HiddenField('Locale', '', $siteConfig->Locale));
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-translatable,代码行数:7,代码来源:TranslatableCMSMainExtension.php

示例9: index

 public function index()
 {
     $site = SiteConfig::current_site_config();
     $order = $this->order;
     // Setup the paypal gateway URL
     if (Director::isDev()) {
         $gateway_url = "https://www.sandbox.paypal.com/cgi-bin/webscr";
     } else {
         $gateway_url = "https://www.paypal.com/cgi-bin/webscr";
     }
     $callback_url = Controller::join_links(Director::absoluteBaseURL(), Payment_Controller::config()->url_segment, "callback", $this->payment_gateway->ID);
     $success_url = Controller::join_links(Director::absoluteBaseURL(), Payment_Controller::config()->url_segment, 'complete');
     $error_url = Controller::join_links(Director::absoluteBaseURL(), Payment_Controller::config()->url_segment, 'complete', 'error');
     $back_url = Controller::join_links(Director::absoluteBaseURL(), Checkout_Controller::config()->url_segment, "finish");
     $fields = new FieldList(HiddenField::create('business', null, $this->payment_gateway->BusinessID), HiddenField::create('item_name', null, $site->Title), HiddenField::create('cmd', null, "_cart"), HiddenField::create('paymentaction', null, "sale"), HiddenField::create('invoice', null, $order->OrderNumber), HiddenField::create('custom', null, $order->OrderNumber), HiddenField::create('upload', null, 1), HiddenField::create('discount_amount_cart', null, $order->DiscountAmount), HiddenField::create('amount', null, $order->Total), HiddenField::create('currency_code', null, $site->Currency()->GatewayCode), HiddenField::create('first_name', null, $order->FirstName), HiddenField::create('last_name', null, $order->Surname), HiddenField::create('address1', null, $order->Address1), HiddenField::create('address2', null, $order->Address2), HiddenField::create('city', null, $order->City), HiddenField::create('zip', null, $order->PostCode), HiddenField::create('country', null, $order->Country), HiddenField::create('email', null, $order->Email), HiddenField::create('return', null, $success_url), HiddenField::create('notify_url', null, $callback_url), HiddenField::create('cancel_return', null, $error_url));
     $i = 1;
     foreach ($order->Items() as $item) {
         $fields->add(HiddenField::create('item_name_' . $i, null, $item->Title));
         $fields->add(HiddenField::create('amount_' . $i, null, number_format($item->Price + $item->Tax, 2)));
         $fields->add(HiddenField::create('quantity_' . $i, null, $item->Quantity));
         $i++;
     }
     // Add shipping as an extra product
     $fields->add(HiddenField::create('item_name_' . $i, null, _t("Commerce.Postage", "Postage")));
     $fields->add(HiddenField::create('amount_' . $i, null, number_format($order->PostageCost + $order->PostageTax, 2)));
     $fields->add(HiddenField::create('quantity_' . $i, null, "1"));
     $actions = FieldList::create(LiteralField::create('BackButton', '<a href="' . $back_url . '" class="btn btn-red commerce-action-back">' . _t('Commerce.Back', 'Back') . '</a>'), FormAction::create('Submit', _t('Commerce.ConfirmPay', 'Confirm and Pay'))->addExtraClass('btn')->addExtraClass('btn-green'));
     $form = Form::create($this, 'Form', $fields, $actions)->addExtraClass('forms')->setFormMethod('POST')->setFormAction($gateway_url);
     $this->extend('updateForm', $form);
     return array("Title" => _t('Commerce.CheckoutSummary', "Summary"), "MetaTitle" => _t('Commerce.CheckoutSummary', "Summary"), "Form" => $form);
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-commerce,代码行数:31,代码来源:PayPalHandler.php

示例10: __construct

 /**
  * Create the new receipt 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 = SiteConfig::current_site_config();
     if ($customer->Email) {
         $this->to = $customer->Email;
     }
     if ($siteConfig->ReceiptSubject) {
         $this->subject = $siteConfig->ReceiptSubject . ' - Order #' . $order->ID;
     }
     if ($siteConfig->ReceiptBody) {
         $this->body = $siteConfig->ReceiptBody;
     }
     if ($siteConfig->ReceiptFrom) {
         $this->from = $siteConfig->ReceiptFrom;
     } elseif (Email::getAdminEmail()) {
         $this->from = Email::getAdminEmail();
     } else {
         $this->from = 'no-reply@' . $_SERVER['HTTP_HOST'];
     }
     if ($siteConfig->EmailSignature) {
         $this->signature = $siteConfig->EmailSignature;
     }
     //Get css for Email by reading css file and put css inline for emogrification
     $this->setTemplate('Order_ReceiptEmail');
     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));
     parent::__construct($from, null, $subject, $body, $bounceHandlerURL, $cc, $bcc);
 }
开发者ID:helpfulrobot,项目名称:swipestripe-swipestripe,代码行数:45,代码来源:ReceiptEmail.php

示例11: OpenGraphMetadata

 /**
  * @name OpenGraphMetadata
  */
 public function OpenGraphMetadata()
 {
     $self = $this->owner;
     if ($self->OpenGraphType != 'off') {
         // variables
         $config = SiteConfig::current_site_config();
         $metadata = $self->MarkupHeader('Open Graph');
         //// Type
         $metadata .= $self->MarkupFacebook('og:type', $self->OpenGraphType, false);
         //// Site Name
         $metadata .= $self->MarkupFacebook('og:site_name', $config->Title, true, $config->Charset);
         //// URL
         $metadata .= $self->MarkupFacebook('og:url', $self->AbsoluteLink(), false);
         //// Title
         $title = $self->OpenGraphTitle ? $self->OpenGraphTitle : $self->Title;
         $metadata .= $self->MarkupFacebook('og:title', $title, true, $config->Charset);
         //// Description
         $description = $self->OpenGraphDescription ? $self->OpenGraphDescription : $self->GenerateDescription();
         $metadata .= $self->MarkupFacebook('og:description', $description, true, $config->Charset);
         //// Image
         if ($self->OpenGraphImage()->exists()) {
             $metadata .= $self->MarkupFacebook('og:image', $self->OpenGraphImage()->getAbsoluteURL(), false);
         }
         //// og:locale
         //// article:author
         // in Core
         //// article:publisher
         // in Core
         // return
         return $metadata;
     } else {
         return false;
     }
 }
开发者ID:helpfulrobot,项目名称:graphiques-digitale-ssseo,代码行数:37,代码来源:SSSEO_OpenGraph_SiteTree_DataExtension.php

示例12: Subscribe

 /**
  * Submit the form
  *
  * @param $data
  * @param $form
  * @return bool|SS_HTTPResponse
  */
 public function Subscribe($data, $form)
 {
     /** @var Form $form */
     $data = $form->getData();
     /** Set the form state */
     Session::set('FormInfo.Form_' . $this->name . '.data', $data);
     $siteConfig = SiteConfig::current_site_config();
     /** Check if the API key, and List ID have been set. */
     if ($siteConfig->MailChimpAPI && $siteConfig->MailChimpListID) {
         $mailChimp = new \Drewm\MailChimp($siteConfig->MailChimpAPI);
         $result = $mailChimp->call('lists/subscribe', array('id' => $siteConfig->MailChimpListID, 'email' => array('email' => $data['Email'])));
     } else {
         /** If not, redirect back and display a flash error. */
         $this->controller->setFlash('Missing API key, or List ID', 'danger');
         return $this->controller->redirectBack();
     }
     /**
      * If the status of the request returns an error,
      * display the error
      */
     if (isset($result['status'])) {
         if ($result['status'] == 'error') {
             $this->controller->setFlash($result['error'], 'danger');
             return $this->controller->redirectBack();
         }
     }
     /** Clear the form state */
     Session::clear('FormInfo.Form_' . $this->name . '.data');
     if ($siteConfig->MailChimpSuccessMessage) {
         $this->controller->setFlash($siteConfig->MailChimpSuccessMessage, 'success');
     } else {
         $this->controller->setFlash('Your subscription has been received, you will be sent a confirmation email shortly.', 'success');
     }
     return $this->controller->redirect($this->controller->data()->Link());
 }
开发者ID:helpfulrobot,项目名称:ryanpotter-silverstripe-boilerplate,代码行数:42,代码来源:SubscriptionForm.php

示例13: testEachSubsiteHasAUniqueSiteConfig

 function testEachSubsiteHasAUniqueSiteConfig()
 {
     $subsite1 = $this->objFromFixture('Subsite', 'domaintest1');
     $subsite2 = $this->objFromFixture('Subsite', 'domaintest2');
     $this->assertTrue(is_array(singleton('SiteConfigSubsites')->extraStatics()));
     Subsite::changeSubsite(0);
     $sc = SiteConfig::current_site_config();
     $sc->Title = 'RootSite';
     $sc->write();
     Subsite::changeSubsite($subsite1->ID);
     $sc = SiteConfig::current_site_config();
     $sc->Title = 'Subsite1';
     $sc->write();
     Subsite::changeSubsite($subsite2->ID);
     $sc = SiteConfig::current_site_config();
     $sc->Title = 'Subsite2';
     $sc->write();
     Subsite::changeSubsite(0);
     $this->assertEquals(SiteConfig::current_site_config()->Title, 'RootSite');
     Subsite::changeSubsite($subsite1->ID);
     $this->assertEquals(SiteConfig::current_site_config()->Title, 'Subsite1');
     Subsite::changeSubsite($subsite2->ID);
     $this->assertEquals(SiteConfig::current_site_config()->Title, 'Subsite2');
     $keys = SiteConfig::current_site_config()->extend('cacheKeyComponent');
     $this->assertContains('subsite-' . $subsite2->ID, $keys);
 }
开发者ID:helpfulrobot,项目名称:mikenz-silverstripe-simplesubsites,代码行数:26,代码来源:SiteConfigSubsitesTest.php

示例14: getFormattedPhone

 /**
  * @return bool|mixed
  */
 public function getFormattedPhone()
 {
     if ($phone = (string) SiteConfig::current_site_config()->Phone) {
         return preg_replace('/\\s+/', '', $phone);
     }
     return false;
 }
开发者ID:toastnz,项目名称:quicksilver,代码行数:10,代码来源:SiteConfigExtension.php

示例15: gateway_data

 /**
  * Generate encrypted string to send to SagePay
  *
  */
 private function gateway_data()
 {
     $order = $this->order;
     $site = SiteConfig::current_site_config();
     $callback_url = Controller::join_links(Director::absoluteBaseURL(), Payment_Controller::config()->url_segment, "callback", $this->payment_gateway->ID);
     $post = array("VendorTxCode" => $order->OrderNumber, "Amount" => $order->Total, "Currency" => $site->Currency()->GatewayCode, "Description" => $this->payment_gateway->GatewayMessage, "SuccessURL" => $callback_url, "FailureURL" => $callback_url, "CustomerName" => $order->FirstName . " " . $order->Surname, "SendEMail" => $this->payment_gateway->SendEmail, "BillingFirstnames" => $order->FirstName, "BillingSurname" => $order->Surname, "BillingAddress1" => $order->Address1, "BillingAddress2" => $order->Address2, "BillingCity" => $order->City, "BillingPostCode" => $order->PostCode, "BillingCountry" => $order->Country, "DeliveryFirstnames" => $order->DeliveryFirstnames, "DeliverySurname" => $order->DeliverySurname, "DeliveryAddress1" => $order->DeliveryAddress1, "DeliveryAddress2" => $order->DeliveryAddress2, "DeliveryCity" => $order->DeliveryCity, "DeliveryPostCode" => $order->DeliveryPostCode, "DeliveryCountry" => $order->DeliveryCountry, "AllowGiftAid" => 0, "Apply3DSecure" => 0);
     // Add non required elements
     if ($order->Email) {
         $post["CustomerEMail"] = $order->Email;
     }
     if ($this->payment_gateway->EmailRecipient) {
         $post["VendorEMail"] = $this->payment_gateway->EmailRecipient;
     }
     if ($order->State) {
         $post["BillingState"] = $order->State;
     }
     if ($order->PhoneNumber) {
         $post["BillingPhone"] = $order->PhoneNumber;
     }
     if ($order->DeliveryState) {
         $post["DeliveryState"] = $order->DeliveryState;
     }
     if ($order->DeliveryPhone) {
         $post["DeliveryPhone"] = $order->DeliveryPhone;
     }
     $result = "";
     foreach ($post as $key => $value) {
         $result .= $key . "=" . $value . '&';
     }
     // Encrypt the plaintext string for inclusion in the hidden field
     $encrypted_data = StringEncryptor::create($result)->setHash($this->payment_gateway->EncryptedPassword)->setEncryption('MCRYPT')->encrypt()->get();
     // Send back variables to be rendered by the controller
     return '@' . $encrypted_data;
 }
开发者ID:helpfulrobot,项目名称:i-lateral-silverstripe-commerce,代码行数:38,代码来源:SagePayFormsHandler.php


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