original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: Loads the configured providers.
docstring_tokens: Loads the configured providers .