/** * get() method instantiate matched connector object * * @param string $sConnectorType * @param array $aParams * @return obj connector abstract type */ public static function get($sConnectorType, array $aParams = null) { // if valid connector if (in_array($sConnectorType, array_keys($GLOBALS[_FPC_MODULE_NAME . '_CONNECTORS']))) { // set module URI if (!empty($aParams['sURI'])) { self::$sModuleURI = $aParams['sURI']; } // include require_once $sConnectorType . '-connect_class.php'; require_once _FPC_PATH_LIB_COMMON . 'session.class.php'; // get session object self::$oSession = BT_FpcSession::create(array('sPrefix' => _FPC_MODULE_NAME . '_')); // check if back URI is set if (!empty($aParams['back'])) { // delete first self::$oSession->delete('back'); self::$oSession->set('back', $aParams['back']); } // set class name $sClassName = 'BT_' . ucfirst($sConnectorType) . 'Connect'; // get connector name self::$sName = $sConnectorType; return new $sClassName($aParams); } else { throw new BT_ConnectorException(FacebookPsConnect::$oModule->l('Internal server error => invalid connector', 'base-connector_class'), 520); } }