You are here

public static function UcAddressesAddressBook::get in Ubercart Addresses 7

Same name and namespace in other branches
  1. 6.2 class/UcAddressesAddressBook.class.php \UcAddressesAddressBook::get()

Returns address book for the given user.

@access public @static

Parameters

mixed $user: Either an user id or an user object.

Return value

UcAddressesAddressBook An instance of this class.

20 calls to UcAddressesAddressBook::get()
UcAddressesAddress::__wakeup in class/UcAddressesAddress.class.php
Restore variables when the address is unserialized.
UcAddressesAddressBook::loadStatic in class/UcAddressesAddressBook.class.php
Loads a single address from the database if not already loaded.
UcAddressesAddressBook::setAddressOwner in class/UcAddressesAddressBook.class.php
Sets the owner of an address if the owner was previously unknown.
UcAddressesAddressBookTestCase::doOtherUsersAddressTests in tests/uc_addresses.addressbook.test
Does basic tests for viewing, editing and deleting other ones addresses.
UcAddressesApiTestCase::testAddressFormatWithoutDefaultCountry in tests/uc_addresses.api.test
Tests if a proper address format is generated when there is no default country set.

... See full list

File

class/UcAddressesAddressBook.class.php, line 142
Contains the UcAddressesAddressBook class.

Class

UcAddressesAddressBook
The address book class

Code

public static function get($user) {
  if (is_object($user)) {
    $user = $user->uid;
  }
  if (isset(self::$singleton[$user])) {
    $instance = self::$singleton[$user];
    if ($instance) {
      return $instance;
    }
  }
  $singleton = self::$singleton[$user] = new UcAddressesAddressBook($user);
  return $singleton;
}