/** * Singleton * * @return MyProject_Social_Vkontakte */ public static function getInstance() { if (null === self::$_instance) { self::$_instance = new self(); } return self::$_instance; }
/** * Makes URI * * @param string $urn * @return string */ public function uri($urn) { // the api object $api = MyProject_Social_Vkontakte::getInstance(); // auth urn return $api->getUid() ? $urn : $api->getAuthUri($urn); }
/** * Default action */ public function indexAction() { // no default output here $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); // the api object $api = MyProject_Social_Vkontakte::getInstance(); // we haven't error, closing and forward if (is_null($this->getParam('error'))) { if ($api->authorize($this->getParam('code'))) { return $this->_exit($this->getParam('forward')); } } // let's close popup, something wrong return $this->_exit(); }