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


PHP Address::get方法代码示例

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


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

示例1: testShouldNotCreateBlankAddresses

 public function testShouldNotCreateBlankAddresses()
 {
     $beforeCount = Address::get()->count();
     $this->config->setData(array('BillingAddressBookCheckoutComponent_BillingAddressID' => $this->address1->ID));
     $this->assertEquals($this->cart->BillingAddressID, $this->address1->ID);
     $this->assertEquals($beforeCount, Address::get()->count());
 }
开发者ID:helpfulrobot,项目名称:silvershop-core,代码行数:7,代码来源:AddressBookCheckoutComponentTest.php

示例2: onAfterWrite

 public function onAfterWrite()
 {
     parent::onAfterWrite();
     //Make sure there is only one default address
     if ($this->Default == true) {
         $addrs = Address::get()->where("\"ClassName\" = '" . get_class($this) . "' AND \"MemberID\" = '{$this->MemberID}' AND \"Default\" = 1 AND \"ID\" != {$this->ID}");
         if ($addrs && $addrs->exists()) {
             foreach ($addrs as $addr) {
                 $addr->Default = 0;
                 $addr->write();
             }
         }
     }
 }
开发者ID:helpfulrobot,项目名称:swipestripe-swipestripe-addresses,代码行数:14,代码来源:Address.php

示例3: setData

 public function setData(Order $order, array $data)
 {
     if (!isset($data['Use'])) {
         parent::setData($order, $data);
         return;
     }
     $member = Member::currentUser() ?: $order->Member();
     if (strpos($data['Use'], 'address-') === 0) {
         $address = Address::get()->byID(substr($data['Use'], 8));
         if (!$address) {
             throw new ValidationException('That address does not exist');
         }
         if (isset($data[$data['Use']]) && isset($data[$data['Use']]['saveAsNew']) && $data[$data['Use']]['saveAsNew']) {
             if (!$address->canCreate()) {
                 throw new ValidationException('You do not have permission to add a new address');
             }
             $address = $address->duplicate();
         } else {
             if (isset($data[$data['Use']]) && !$address->canEdit() && $address->MemberID != $member->ID) {
                 throw new ValidationException('You do not have permission to use this address');
             }
         }
     } else {
         if (!singleton('Address')->canCreate()) {
             throw new ValidationException('You do not have permission to add a new address');
         }
         $address = Address::create();
     }
     if (isset($data[$data['Use']])) {
         $address->castedUpdate($data[$data['Use']]);
         // FIX for missing name fields
         $fields = array_intersect_key($data, array_flip(['FirstName', 'Surname', 'Name', 'Email']));
         foreach ($fields as $field => $value) {
             if (!$address->{$field}) {
                 $address->{$field} = $value;
             }
         }
         if ($country = ShopConfig::current()->SingleCountry) {
             $address->Country = $country;
         }
         if ($this->addtoaddressbook) {
             $address->MemberID = $member->ID;
         }
         $address->write();
         if (isset($data[$data['Use']]['useAsDefaultShipping']) && $data[$data['Use']]['useAsDefaultShipping']) {
             $member->DefaultShippingAddressID = $address->ID;
         }
         if (isset($data[$data['Use']]['useAsDefaultBilling']) && $data[$data['Use']]['useAsDefaultBilling']) {
             $member->DefaultBillingAddressID = $address->ID;
         }
         if ($member->isChanged()) {
             $member->write();
         }
     }
     if ($address->exists()) {
         if ($this->addresstype === 'Shipping') {
             ShopUserInfo::singleton()->setAddress($address);
             Zone::cache_zone_ids($address);
         }
         $order->{$this->addresstype . 'AddressID'} = $address->ID;
         if (!$order->BillingAddressID) {
             $order->BillingAddressID = $address->ID;
         }
         $order->write();
         $order->extend('onSet' . $this->addresstype . 'Address', $address);
     }
 }
开发者ID:milkyway-multimedia,项目名称:ss-shop-checkout-extras,代码行数:67,代码来源:AlternateAddressBookCheckoutComponent.php

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

示例5: Address

<?php

/*
* Created at 8/10/2015
* Page to add and display the addresses
* 
*/
require_once 'includes/header.php';
require_once 'classess/class.address.php';
/**
 *code to display all address from table
 */
$address = new Address();
$a_addresses = $address->get();
?>
<div class="col-md-12 no-padding">
	<div class="col-md-12 sub-container">
		<div class="row">
			<div class="row margine-top">
				<button type="button" class="btn btn-primary margine-bottom float-right" data-toggle="modal" data-target="#addForm">
				  Add Address
				</button>
				<div class="col-md-12">
					<div class="alert alert-success alert-dismissable hide" aria-hidden="true" id="address_success_alert"></div>
				</div>
				<input type="hidden" name="site_url" id="site_url" value="<?php 
echo SITE_URL;
?>
">
				<table class="table table_bordered" id="table_info">
					<thead>
开发者ID:aloha-git-dev,项目名称:sample-app,代码行数:31,代码来源:index.php

示例6: calculateBroadcastAddress

 /**
  * Calculate the broadcast address of a Block given an IPV4 network address and SubnetMask.
  *
  * @param \JAAulde\IP\V4\Address    $address    The IP address from which a broadcast address will be derived
  * @param \JAAulde\IP\V4\SubnetMask $subnetMask The subnet mask (in address form) used in the derivation
  *
  * @return \JAAulde\IP\V4\Address
  */
 public static function calculateBroadcastAddress(Address $address, SubnetMask $subnetMask)
 {
     return new Address($address->get() | ~$subnetMask->get());
 }
开发者ID:jaaulde,项目名称:php-ipv4,代码行数:12,代码来源:Block.php

示例7: contains

 /**
  * Determine if a given address is contained within the range.
  *
  * @param \JAAulde\IP\V4\Address $address The address we want to know about
  *
  * @return bool
  */
 public function contains(Address $address)
 {
     $addressValue = $address->get();
     return $addressValue >= $this->firstAddress->get() && $addressValue <= $this->lastAddress->get();
 }
开发者ID:jaaulde,项目名称:php-ipv4,代码行数:12,代码来源:Range.php

示例8: testOrderAddress

 public function testOrderAddress()
 {
     $order = $this->objFromFixture('Order', 'paid');
     // assert that order doesn't contain user information
     $this->assertNull($order->FirstName);
     $this->assertNull($order->Surname);
     $this->assertNull($order->Email);
     // The shipping address should use the members default shipping address
     $this->assertEquals('Joe Bloggs, 12 Foo Street, Bar, Farmville, New Sandwich, US', $order->getShippingAddress()->toString());
     $address = $this->objFromFixture('Address', 'pukekohe');
     $order->ShippingAddressID = $address->ID;
     $order->write();
     // Address doesn't have firstname and surname
     $this->assertNull(Address::get()->byID($order->ShippingAddressID)->FirstName);
     $this->assertNull(Address::get()->byID($order->ShippingAddressID)->Surname);
     // Shipping address should contain the name from the member object and new address information
     $this->assertEquals('Joe Bloggs, 1 Queen Street, Pukekohe, Auckland, 2120', $order->getShippingAddress()->toString());
     // changing fields on the Order will have precendence!
     $order->FirstName = 'Tester';
     $order->Surname = 'Mc. Testerson';
     $order->write();
     // Reset caches, otherwise the previously set name will persist (eg. Joe Bloggs)
     DataObject::reset();
     $this->assertEquals('Tester Mc. Testerson, 1 Queen Street, Pukekohe, Auckland, 2120', $order->getShippingAddress()->toString());
 }
开发者ID:burnbright,项目名称:silverstripe-shop,代码行数:25,代码来源:OrderTest.php

示例9: calculateCIDRToFit

 /**
  * Given two (2) IP (V4) addresses, calculate a CIDR prefix for the network which could contain them both.
  *
  * @param \JAAulde\IP\V4\Address $address1
  * @param \JAAulde\IP\V4\Address $address2
  */
 public static function calculateCIDRToFit(Address $address1, Address $address2)
 {
     return (int) floor(32 - log(($address1->get() ^ $address2->get()) + 1, 2));
 }
开发者ID:jaaulde,项目名称:php-ipv4,代码行数:10,代码来源:SubnetMask.php

示例10: testAddress

 public function testAddress()
 {
     //$address = new Address('63 Point West Circle', NULL, 'Little Rock', 'AR', '72211', NULL);
     $address = new Address('911 BROKHAVEN DR', NULL, 'RUSSELLVILLE', 'KY', '42276', NULL);
     $this->assertEquals('KY', $address->get('state'));
 }
开发者ID:philipwalter,项目名称:OnlineOrdersApp,代码行数:6,代码来源:AddressTest.php


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