コード例 #1
0
ファイル: Salesforce.php プロジェクト: surfyst/oasys
 /**
  * Response is always empty from this call. HTTP response code of 204 is success. Anything is an error.
  *
  * @param string $object
  * @param string $id
  * @param array  $fields
  *
  * @throws InternalServerErrorException
  * @return bool|mixed
  */
 public function updateObject($object, $id, $fields = array())
 {
     $_response = $this->fetch('/services/data/' . static::API_VERSION_TAG . '/sobjects/' . $object . '/' . $id, json_encode($fields), static::Patch);
     //	Curl error is false...
     if (false === $_response) {
         return false;
     }
     if (HttpResponse::NoContent == Curl::getLastHttpCode()) {
         return true;
     }
     //	Sometimes they send back xml...
     if (is_string($_response) && false !== stripos($_response, '<?xml')) {
         try {
             if (null === ($_response = Convert::toObject(simplexml_load_string($_response)))) {
                 throw new InternalServerErrorException('Unrecognizable response from server: ' . print_r($_response, true));
             }
             //	Otherwise we have a nice object which we return as json
         } catch (\Exception $_ex) {
             //	error...
             Log::error('Exception parsing response: ' . print_r($_response, true));
         }
     }
     return $_response;
 }
コード例 #2
0
ファイル: Bootstrap.php プロジェクト: kisma/kisma
    /**
     * @param string $legend
     * @param string $submitButton
     * @param array  $attributes
     *
     * @internal param bool $submit
     * @return string
     */
    public function renderForm($legend = null, $submitButton = 'Submit', array $attributes = array())
    {
        if (static::VerticalGroupPattern !== $this->_blockPattern) {
            $attributes['class'] = static::addValue(Option::get($attributes, 'class', array()), 'form' . $this->_formType);
        }
        $_html = Convert::kvpToString($attributes);
        if (!empty($legend)) {
            $legend = static::wrap('legend', $legend);
        }
        $_submit = null;
        if (!empty($submitButton)) {
            $_submit = $this->button('submit', array('text' => true === $submitButton ? 'Submit' : $submitButton));
        }
        $_html = <<<HTML
<form {$_html}>
\t{$legend}
\t{$this->_contents}
\t<div class="form-actions">
\t{$_submit}
\t</div>
\t{$this->_csrf}
</form>
HTML;
        $this->_contents = null;
        return $_html;
    }