/**
  * Obtains a list of valid servers
  *
  * @return	array
  */
 public static function getServerList($counter = 0)
 {
     // do the call
     $responseString = self::doCall('getServerList', array(), self::$serverHost, $counter);
     // validate
     if (!isset($responseString->params->param->value->array->data->value)) {
         throw new Exception('Invalid response in getServerList.');
     }
     // loop servers and add them
     foreach ($responseString->params->param->value->array->data->value as $server) {
         self::$serverList[] = (string) $server->string;
     }
     if (count(self::$serverList) == 0) {
         self::$serverList = array('http://xmlrpc3.mollom.com', 'http://xmlrpc2.mollom.com', 'http://xmlrpc1.mollom.com');
     }
     // return
     return self::$serverList;
 }
Beispiel #2
0
 /**
  * Obtains a list of valid servers
  *
  * @return	array
  */
 private static function getServerList($forcedRefresh = false)
 {
     // if the refresh isn't forced by mollom,
     // try to load the servers from the cache first
     if (!$forcedRefresh && self::$serverListCache != null) {
         self::$serverList = self::$serverListCache->load();
         if (count(self::$serverList) > 0) {
             return;
         }
     }
     // add generic server, so we can bootstrap
     self::$serverList[] = 'http://xmlrpc.mollom.com';
     try {
         // do the call
         $serverList = self::doCall('getServerList', array());
     } catch (Excepion $e) {
         $serverList = array();
     }
     // something went wrong, use the generic server
     if (count($serverList) == 0) {
         $serverList = array('http://xmlrpc.mollom.com');
     }
     // store the updated list in the cache
     if (self::$serverListCache != null) {
         self::$serverListCache->store($serverList);
     }
     // return
     self::$serverList = $serverList;
     return $serverList;
 }
 /**
  * Obtains a list of valid servers
  *
  * @return	array
  */
 public static function getServerList($counter = 0)
 {
     // do the call
     foreach (array('xmlrpc1.mollom.com', 'xmlrpc2.mollom.com', 'xmlrpc3.mollom.com') as $startingServer) {
         try {
             $responseString = self::doCall('getServerList', array(), $startingServer, $counter);
         } catch (Exception $e) {
             continue;
         }
         // validate
         if (isset($responseString->params->param->value->array->data->value)) {
             // loop servers and add them
             foreach ($responseString->params->param->value->array->data->value as $server) {
                 self::$serverList[] = (string) $server->string;
             }
             break;
         }
     }
     if (count(self::$serverList) == 0) {
         self::$serverList = array('http://xmlrpc3.mollom.com', 'http://xmlrpc2.mollom.com', 'http://xmlrpc1.mollom.com');
     }
     // return
     return self::$serverList;
 }