private function _loadProviders($fromRecord = false)
    {
        if($this->_providersLoaded)
        {
            return;
        }

        $providerSources = $this->_getProviders();

        foreach($providerSources as $providerSource)
        {
            // handle
            $handle = $providerSource->getHandle();

            // get provider record
            $record = $this->_getProviderRecordByHandle($providerSource->getHandle());

            // create provider (from record if any)
            $providerInfos = Oauth_ProviderInfosModel::populateModel($record);


            // override provider infos from config

            $oauthConfig = craft()->config->get('providerInfos', 'oauth');

            if($oauthConfig && !$fromRecord)
            {
                if(!empty($oauthConfig[$providerSource->getHandle()]['clientId']))
                {
                    $providerInfos->clientId = $oauthConfig[$providerSource->getHandle()]['clientId'];
                }

                if(!empty($oauthConfig[$providerSource->getHandle()]['clientSecret']))
                {
                    $providerInfos->clientSecret = $oauthConfig[$providerSource->getHandle()]['clientSecret'];
                }

                if(!empty($oauthConfig[$providerSource->getHandle()]['config']))
                {
                    $providerInfos->config = $oauthConfig[$providerSource->getHandle()]['config'];
                }
            }

            $providerSource->setInfos($providerInfos);

            if($providerSource->isConfigured())
            {
                $this->_configuredProviders[$handle] = $providerSource;
            }

            // add to _allProviders array
            $this->_allProviders[$handle] = $providerSource;
        }

        // providers are now loaded
        $this->_providersLoaded = true;
    }
private function _loadProviders($fromRecord = false)
    {
        if($this->_providersLoaded)
        {
            return;
        }

        $providerSources = $this->_getProviders();

        foreach($providerSources as $providerSource)
        {
            // handle
            $handle = $providerSource->getHandle();

            // get provider record
            $record = $this->_getProviderRecordByHandle($providerSource->getHandle());

            // create provider (from record if any)
            $providerInfos = Oauth_ProviderInfosModel::populateModel($record);


            // override provider infos from config

            $oauthConfig = craft()->config->get('providerInfos', 'oauth');

            if($oauthConfig && !$fromRecord)
            {
                if(!empty($oauthConfig[$providerSource->getHandle()]['clientId']))
                {
                    $providerInfos->clientId = $oauthConfig[$providerSource->getHandle()]['clientId'];
                }

                if(!empty($oauthConfig[$providerSource->getHandle()]['clientSecret']))
                {
                    $providerInfos->clientSecret = $oauthConfig[$providerSource->getHandle()]['clientSecret'];
                }

                if(!empty($oauthConfig[$providerSource->getHandle()]['config']))
                {
                    $providerInfos->config = $oauthConfig[$providerSource->getHandle()]['config'];
                }
            }

            $providerSource->setInfos($providerInfos);

            if($providerSource->isConfigured())
            {
                $this->_configuredProviders[$handle] = $providerSource;
            }

            // add to _allProviders array
            $this->_allProviders[$handle] = $providerSource;
        }

        // providers are now loaded
        $this->_providersLoaded = true;
    }
private function _loadProviders ( $ fromRecord = false ) { if ( $ this -> _providersLoaded ) { return ; } $ providerSources = $ this -> _getProviders ( ) ; foreach ( $ providerSources as $ providerSource ) { // handle $ handle = $ providerSource -> getHandle ( ) ; // get provider record $ record = $ this -> _getProviderRecordByHandle ( $ providerSource -> getHandle ( ) ) ; // create provider (from record if any) $ providerInfos = Oauth_ProviderInfosModel :: populateModel ( $ record ) ; // override provider infos from config $ oauthConfig = craft ( ) -> config -> get ( 'providerInfos' , 'oauth' ) ; if ( $ oauthConfig && ! $ fromRecord ) { if ( ! empty ( $ oauthConfig [ $ providerSource -> getHandle ( ) ] [ 'clientId' ] ) ) { $ providerInfos -> clientId = $ oauthConfig [ $ providerSource -> getHandle ( ) ] [ 'clientId' ] ; } if ( ! empty ( $ oauthConfig [ $ providerSource -> getHandle ( ) ] [ 'clientSecret' ] ) ) { $ providerInfos -> clientSecret = $ oauthConfig [ $ providerSource -> getHandle ( ) ] [ 'clientSecret' ] ; } if ( ! empty ( $ oauthConfig [ $ providerSource -> getHandle ( ) ] [ 'config' ] ) ) { $ providerInfos -> config = $ oauthConfig [ $ providerSource -> getHandle ( ) ] [ 'config' ] ; } } $ providerSource -> setInfos ( $ providerInfos ) ; if ( $ providerSource -> isConfigured ( ) ) { $ this -> _configuredProviders [ $ handle ] = $ providerSource ; } // add to _allProviders array $ this -> _allProviders [ $ handle ] = $ providerSource ; } // providers are now loaded $ this -> _providersLoaded = true ; }
Loads the configured providers.
Loads the configured providers .