public function getAPI()
    {
        if (!isset($this->_api)) {
            $session = AnRequest::get('session.oauth', 'raw', array());
            $session = new AnConfig($session);
            $api = pick($this->getRequest()->server, $session->api);

            if (!$api) {
                return;
            }

            //get the api server from the request
            $this->_api = $this->getService('com:connect.oauth.service.'.$api);

            if (!$this->_consumer) {
                $name = $this->_api->getName();
                $key = get_config_value('com_connect.'.$name.'_key');
                $secret = get_config_value('com_connect.'.$name.'_secret');
                $query = array(
                    'option=com_'.$this->_mixer->getIdentifier()->package,
                     'view='.$this->_mixer->getIdentifier()->name,
                     'server='.$this->server,
                     'get=accesstoken',
                );

                // if ($this->oid) {
                //    $query[] = 'oid='.$this->oid;
                // }

                $callback = route(implode($query, '&'), true);

                $this->_consumer = new ComConnectOauthConsumer(new AnConfig(array(
                    'key' => $key,
                    'secret' => $secret,
                    'callback_url' => (string) $callback,
                )));
            }

            //set the consumer
            $this->_api->setConsumer($this->_consumer);
            $this->_api->setToken($session->token);
        }

        return $this->_api;
    }
public function getAPI()
    {
        if (!isset($this->_api)) {
            $session = AnRequest::get('session.oauth', 'raw', array());
            $session = new AnConfig($session);
            $api = pick($this->getRequest()->server, $session->api);

            if (!$api) {
                return;
            }

            //get the api server from the request
            $this->_api = $this->getService('com:connect.oauth.service.'.$api);

            if (!$this->_consumer) {
                $name = $this->_api->getName();
                $key = get_config_value('com_connect.'.$name.'_key');
                $secret = get_config_value('com_connect.'.$name.'_secret');
                $query = array(
                    'option=com_'.$this->_mixer->getIdentifier()->package,
                     'view='.$this->_mixer->getIdentifier()->name,
                     'server='.$this->server,
                     'get=accesstoken',
                );

                // if ($this->oid) {
                //    $query[] = 'oid='.$this->oid;
                // }

                $callback = route(implode($query, '&'), true);

                $this->_consumer = new ComConnectOauthConsumer(new AnConfig(array(
                    'key' => $key,
                    'secret' => $secret,
                    'callback_url' => (string) $callback,
                )));
            }

            //set the consumer
            $this->_api->setConsumer($this->_consumer);
            $this->_api->setToken($session->token);
        }

        return $this->_api;
    }
public function getAPI ( ) { if ( ! isset ( $ this -> _api ) ) { $ session = AnRequest :: get ( 'session.oauth' , 'raw' , array ( ) ) ; $ session = new AnConfig ( $ session ) ; $ api = pick ( $ this -> getRequest ( ) -> server , $ session -> api ) ; if ( ! $ api ) { return ; } //get the api server from the request $ this -> _api = $ this -> getService ( 'com:connect.oauth.service.' . $ api ) ; if ( ! $ this -> _consumer ) { $ name = $ this -> _api -> getName ( ) ; $ key = get_config_value ( 'com_connect.' . $ name . '_key' ) ; $ secret = get_config_value ( 'com_connect.' . $ name . '_secret' ) ; $ query = array ( 'option=com_' . $ this -> _mixer -> getIdentifier ( ) -> package , 'view=' . $ this -> _mixer -> getIdentifier ( ) -> name , 'server=' . $ this -> server , 'get=accesstoken' , ) ; // if ($this->oid) { //    $query[] = 'oid='.$this->oid; // } $ callback = route ( implode ( $ query , '&' ) , true ) ; $ this -> _consumer = new ComConnectOauthConsumer ( new AnConfig ( array ( 'key' => $ key , 'secret' => $ secret , 'callback_url' => ( string ) $ callback , ) ) ) ; } //set the consumer $ this -> _api -> setConsumer ( $ this -> _consumer ) ; $ this -> _api -> setToken ( $ session -> token ) ; } return $ this -> _api ; }
Get the oatuh adapter using the controller name.

@return ComConnectOauthApiAbstract
Get the oatuh adapter using the controller name .