本文整理汇总了PHP中Am_Controller::decodeJson方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Controller::decodeJson方法的具体用法?PHP Am_Controller::decodeJson怎么用?PHP Am_Controller::decodeJson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Am_Controller
的用法示例。
在下文中一共展示了Am_Controller::decodeJson方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _process
public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result)
{
$req = new Am_HttpRequest(sprintf('https://gateway-japa.americanexpress.com/api/rest/version/23/merchant/%s/session', $this->getConfig('merchant')), Am_HttpRequest::METHOD_POST);
$req->setAuth('merchant.' . $this->getConfig('merchant'), $this->getConfig('password'));
$req->setBody(Am_Controller::getJson(array('apiOperation' => 'CREATE_PAYMENT_PAGE_SESSION', 'order' => array('id' => $invoice->public_id, 'amount' => $invoice->first_total, 'currency' => $invoice->currency), 'paymentPage' => array('cancelUrl' => $this->getCancelUrl(), 'returnUrl' => $this->getPluginUrl('thanks')))));
$this->logRequest($req);
$res = $req->send();
$this->logResponse($res);
if ($res->getStatus() != 201) {
$result->setFailed(sprintf('Incorrect Responce Status From Paysystem [%s]', $res->getStatus()));
return;
}
$msg = Am_Controller::decodeJson($res->getBody());
if ($msg['result'] == 'ERROR') {
$result->setFailed($msg['error']['explanation']);
return;
}
$invoice->data()->set(self::DATA_KEY, $msg['successIndicator'])->update();
$a = new Am_Paysystem_Action_Redirect(self::URL);
$a->{'merchant'} = $this->getConfig('merchant');
$a->{'order.description'} = $invoice->getLineDescription();
$a->{'paymentPage.merchant.name'} = $this->getDi()->config->get('site_title');
$a->{'session.id'} = $msg['session']['id'];
$this->logRequest($a);
$result->setAction($a);
}
示例2: setValue
public function setValue($value)
{
if (is_string($value)) {
$value = Am_Controller::decodeJson($value);
}
$this->value = (array) $value;
foreach ($this->value as &$row) {
if (empty($row['id'])) {
continue;
}
if (isset($row['config']) && is_string($row['config'])) {
parse_str($row['config'], $c);
if (get_magic_quotes_gpc()) {
$c = Am_Request::ss($c);
}
// remove quotes
$row['config'] = $c;
}
if ($brick = $this->getBrick($row['class'], $row['id'])) {
$brick->setFromRecord($row);
}
}
// handle special case - where there is a "multiple" brick and that is enabled
// we have to insert additional brick to "disabled", so new bricks of same
// type can be added in editor
$disabled = $this->getBricks(self::DISABLED);
foreach ($this->getBricks(self::ENABLED) as $brick) {
if (!$brick->isMultiple()) {
continue;
}
$found = false;
foreach ($disabled as $dBrick) {
if ($dBrick->getClass() == $brick->getClass()) {
$found = true;
break;
}
}
// create new disabled brick of same class
if (!$found) {
$this->getBrick($brick->getClass(), null);
}
}
}
示例3: upgradeFlowPlayerKey
function upgradeFlowPlayerKey()
{
if (version_compare($this->db_version, '4.2.16') < 0) {
echo "Update Flowplayer License Key...";
if (ob_get_level()) {
ob_end_flush();
}
$request = new Am_HttpRequest('https://www.amember.com/fplicense.php', Am_HttpRequest::METHOD_POST);
$request->addPostParameter('root_url', $this->getDi()->config->get('root_url'));
try {
$response = $request->send();
} catch (Exception $e) {
echo "request failed " . $e->getMessage() . "\n<br />";
return;
}
if ($response->getStatus() == 200) {
$body = $response->getBody();
$res = Am_Controller::decodeJson($body);
if ($res['status'] == 'OK' && $res['license']) {
Am_Config::saveValue('flowplayer_license', $res['license']);
}
}
echo "Done<br>\n";
}
}
示例4: cancelAction
public function cancelAction(Invoice $invoice, $actionName, Am_Paysystem_Result $result)
{
$this->invoice = $invoice;
list($payment) = $invoice->getPaymentRecords();
$params = array('key' => $this->getConfig('key'), 'ref' => $payment->receipt_id, 'uid' => $payment->user_id, 'type' => 2);
$params['sign'] = $this->calculateSignature($params, $this->getConfig('secret'));
$requst = new Am_HttpRequest(self::URL_TICKET, Am_HttpRequest::METHOD_POST);
$requst->addPostParameter($params);
$log = $this->logRequest($requst);
$responce = $requst->send();
$log->add($responce);
if ($responce->getStatus() != 200) {
$result->setFailed('Incorrect HTTP response status: ' . $responce->getStatus());
return;
}
$res = Am_Controller::decodeJson($responce->getBody());
if ($res['result'] == 1) {
$invoice->setCancelled();
$result->setSuccess();
return;
}
$result->setFailed($res['errors']);
}
示例5: getRawValue
public function getRawValue()
{
$value = parent::getRawValue();
return Am_Controller::decodeJson($value);
}
示例6: parseResponse
protected function parseResponse(HTTP_Request2_Response $response)
{
$this->params = Am_Controller::decodeJson($response->getBody());
}
示例7: validate
/** @return bool true on success, false and set internal error code on failure */
public function validate($response)
{
if (!$this->isConfigured()) {
throw new Am_Exception_Configuration("Brick: ReCaptcha error - recaptcha is not configured. Please go to aMember Cp -> Setup -> ReCaptcha and enter keys");
}
$req = new Am_HttpRequest('https://www.google.com/recaptcha/api/siteverify', Am_HttpRequest::METHOD_POST);
$req->addPostParameter('secret', Am_Di::getInstance()->config->get('recaptcha-private-key'));
$req->addPostParameter('remoteip', $_SERVER['REMOTE_ADDR']);
$req->addPostParameter('response', $response);
$response = $req->send();
if ($response->getStatus() == '200') {
$r = Am_Controller::decodeJson($response->getBody());
return $r['success'];
}
}
示例8: getFields
function getFields()
{
return (array) Am_Controller::decodeJson($this->fields);
}
示例9: init
function init()
{
$r = Am_Controller::decodeJson($this->request->getRawBody());
if ($r && isset($r['notification']) && isset($r['iv'])) {
$msg = trim(mcrypt_decrypt(MCRYPT_RIJNDAEL_128, substr(sha1($this->plugin->getConfig('secret')), 0, 32), base64_decode($r['notification']), MCRYPT_MODE_CBC, base64_decode($r['iv'])), "..");
$this->notification = Am_Controller::decodeJson($msg);
$this->plugin->logOther('DECODED NOTIFICATION', $this->notification);
}
}