示例#1
0
 /**
  * Setup Akismet
  *
  * @param array $options
  * @return Zend_Service_Akismet
  */
 protected function _setupService($options)
 {
     if (!isset($options['apiKey'])) {
         $message = 'option "apiKey" not found for Service_Akismet';
         throw new Robo47_Application_Resource_Exception($message);
     }
     if (!isset($options['blog'])) {
         $message = 'option "blog" not found for Service_Akismet';
         throw new Robo47_Application_Resource_Exception($message);
     }
     $akismet = new Zend_Service_Akismet($options['apiKey'], $options['blog']);
     if (isset($options['charset'])) {
         $akismet->setCharset($options['charset']);
     }
     if (isset($options['userAgent'])) {
         $akismet->setUserAgent($options['userAgent']);
     }
     if (isset($options['port'])) {
         // casting needed because of is_int in Zend_Service_Akismet::setPort
         $akismet->setPort((int) $options['port']);
     }
     if (isset($options['registryKey'])) {
         Zend_Registry::set($options['registryKey'], $akismet);
     }
     return $akismet;
 }