public function get($store = null)
    {
        if (!$this->db->isInitialized()) {
            return array();
        }

        if (!isset($store)) {
            $url = $this->server->httpHost();
            $basepath = trim($this->request->base(true), '/');
            $store = trim("$url/$basepath", '/');
        }

        $result = &gplcart_static("store.get.$store");

        if (isset($result)) {
            return $result;
        }

        $this->hook->attach('store.get.before', $store, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $conditions = array();

        if (is_numeric($store)) {
            $conditions['store_id'] = $store;
        } else if (strpos($store, '/') === false) {
            $conditions['domain'] = $store;
        } else {
            list($domain, $basepath) = explode('/', $store, 2);
            $conditions['domain'] = $domain;
            $conditions['basepath'] = $basepath;
        }

        $conditions['limit'] = array(0, 1);
        $list = (array) $this->getList($conditions);
        $result = empty($list) ? array() : reset($list);

        if (isset($result['data'])) {
            $result['data'] += $this->getDefaultData();
        }

        $this->hook->attach('store.get.after', $store, $result, $this);
        return $result;
    }
public function get($store = null)
    {
        if (!$this->db->isInitialized()) {
            return array();
        }

        if (!isset($store)) {
            $url = $this->server->httpHost();
            $basepath = trim($this->request->base(true), '/');
            $store = trim("$url/$basepath", '/');
        }

        $result = &gplcart_static("store.get.$store");

        if (isset($result)) {
            return $result;
        }

        $this->hook->attach('store.get.before', $store, $result, $this);

        if (isset($result)) {
            return $result;
        }

        $conditions = array();

        if (is_numeric($store)) {
            $conditions['store_id'] = $store;
        } else if (strpos($store, '/') === false) {
            $conditions['domain'] = $store;
        } else {
            list($domain, $basepath) = explode('/', $store, 2);
            $conditions['domain'] = $domain;
            $conditions['basepath'] = $basepath;
        }

        $conditions['limit'] = array(0, 1);
        $list = (array) $this->getList($conditions);
        $result = empty($list) ? array() : reset($list);

        if (isset($result['data'])) {
            $result['data'] += $this->getDefaultData();
        }

        $this->hook->attach('store.get.after', $store, $result, $this);
        return $result;
    }
public function get ( $ store = null ) { if ( ! $ this -> db -> isInitialized ( ) ) { return array ( ) ; } if ( ! isset ( $ store ) ) { $ url = $ this -> server -> httpHost ( ) ; $ basepath = trim ( $ this -> request -> base ( true ) , '/' ) ; $ store = trim ( "$url/$basepath" , '/' ) ; } $ result = & gplcart_static ( "store.get.$store" ) ; if ( isset ( $ result ) ) { return $ result ; } $ this -> hook -> attach ( 'store.get.before' , $ store , $ result , $ this ) ; if ( isset ( $ result ) ) { return $ result ; } $ conditions = array ( ) ; if ( is_numeric ( $ store ) ) { $ conditions [ 'store_id' ] = $ store ; } else if ( strpos ( $ store , '/' ) === false ) { $ conditions [ 'domain' ] = $ store ; } else { list ( $ domain , $ basepath ) = explode ( '/' , $ store , 2 ) ; $ conditions [ 'domain' ] = $ domain ; $ conditions [ 'basepath' ] = $ basepath ; } $ conditions [ 'limit' ] = array ( 0 , 1 ) ; $ list = ( array ) $ this -> getList ( $ conditions ) ; $ result = empty ( $ list ) ? array ( ) : reset ( $ list ) ; if ( isset ( $ result [ 'data' ] ) ) { $ result [ 'data' ] += $ this -> getDefaultData ( ) ; } $ this -> hook -> attach ( 'store.get.after' , $ store , $ result , $ this ) ; return $ result ; }
Loads a store
@param integer|string|null $store
@return array
Loads a store