コード例 #1
0
 {
     return in_array(strtolower($needle), array_map('strtolower', $haystack));
 }
 /**
  Please send me: array( 'uri'=> '', 'method'=>''[, 'curloptions'=> array( ... ) ])
  I will throw an Exception if something goes wrong so no need to validate
  But you can decide whether you wnat me to do it or not
  */
 public static function sendRequest($arrayParms, $throwEx = true)
 {
     Utils::arrayKeyExists(array('url', 'method'), $arrayParms);
     $client = new \Zend\Http\Client($arrayParms['url']);
     $client->setMethod($arrayParms['method']);
     switch ($arrayParms['method']) {
         case POST:
             Utils::arrayKeyExists('payload', $arrayParms);
             $client->setParameterPost($arrayParms['payload']);
             break;
         case GET:
             Utils::arrayKeyExists('payload', $arrayParms);
             $client->setParameterGet($arrayParms['payload']);
             break;
     }
     $adapter = new \Zend\Http\Client\Adapter\Curl();
     $curloptions = array(CURLOPT_POST => 1, CURLOPT_HTTPAUTH => CURLAUTH_BASIC, CURLOPT_RETURNTRANSFER => 1, CURLOPT_SSL_VERIFYPEER => FALSE, CURLOPT_SSL_VERIFYHOST => FALSE);
     if (array_key_exists('curloptions', $arrayParms)) {
         $curloptions = array_merge($curloptions, $arrayParms['curloptions']);
     }
     $adapter->setOptions(array('curloptions' => $curloptions));
     $client->setAdapter($adapter);
     $response = $client->send();
     if ($response->isSuccess()) {
コード例 #2
0
     return $this->htmlMarkup;
 }
 public function getModel()
 {
     // TODO - Dynamically get the Model reading the Template
     try {
         Utils::arrayKeyExists($this->getParmKeys(), $this->getBodyParms());
         // fname, title, actionText
         $model = $this->getBodyParms();
         $config = $this->getConfig();
         $actionLink = $config['allowedOrigins']['ckpt'] . '/activate/' . $model['access_token'];
         $model = array_merge($model, array('title' => $this->translate('globals.messages.member_signup_confirmation_title'), 'actionText' => $this->translate('globals.messages.member_signup_confirmation_button_text_activate'), 'actionLink' => $actionLink));
         return $model;
     } catch (Exception $e) {
         throw new Exception(get_class() . ' - ' . __FUNCTION__ . ': ' . $e->getMessage(), 500);