本文整理汇总了PHP中oseJson::decode方法的典型用法代码示例。如果您正苦于以下问题:PHP oseJson::decode方法的具体用法?PHP oseJson::decode怎么用?PHP oseJson::decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oseJson
的用法示例。
在下文中一共展示了oseJson::decode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateDesc
function generateDesc($order_id)
{
$title = null;
$db = oseDB::instance();
$query = "SELECT * FROM `#__osemsc_order_item` WHERE `order_id` = '{$order_id}'";
$db->setQuery($query);
$obj = $db->loadObject();
$params = oseJson::decode($obj->params);
$msc_id = $obj->entry_id;
$query = "SELECT title FROM `#__osemsc_acl` WHERE `id` = " . (int) $msc_id;
$db->setQuery($query);
$msc_name = $db->loadResult();
$msc_option = $params->msc_option;
$query = "SELECT params FROM `#__osemsc_ext` WHERE `type` = 'payment' AND `id` = " . (int) $msc_id;
$db->setQuery($query);
$result = oseJson::decode($db->loadResult());
foreach ($result as $key => $value) {
if ($msc_option == $key) {
if ($value->recurrence_mode == 'period') {
if ($value->eternal) {
$title = 'Life Time Membership';
} else {
$title = $value->recurrence_num . ' ' . ucfirst($value->recurrence_unit) . ' Membership';
}
} else {
$start_date = date("l,d F Y", strtotime($value->start_date));
$expired_date = date("l,d F Y", strtotime($value->expired_date));
$title = $start_date . ' - ' . $expired_date . ' Membership';
}
}
}
$title = $msc_name . ' : ' . $title;
return $title;
}
示例2: add
public static function add($params)
{
$result = array();
$result['success'] = true;
if(empty($params))
{
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Register_Order.PAP');
return $result;
}
//unset($params['allow_work']);
if(!empty($_COOKIE['oseAffiliate']))
{
$orderParams = oseJson::decode($params['params']);
$oseAffiliate = oseJSON::decode($_COOKIE['oseAffiliate']);
$orderParams->oseaffiliateID = $oseAffiliate->oafid;
$orderParams->osebannerID = $oseAffiliate->obid;
$orderParams->first_ip = oseMscPublic::getIP();
//$orderParams->first_ip = oseMscPublic::getIP();
$params['params'] = oseJson::encode($orderParams);
return $params;
}
else
{
return $params;
}
}
示例3: add
public static function add($params)
{
$result = array();
$result['success'] = true;
if(empty($params))
{
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Register_Order.PAP');
return $result;
}
//unset($params['allow_work']);
if(!empty($_COOKIE['PAPVisitorId']))
{
$orderParams = oseJson::decode($params['params']);
$orderParams->pap_visitorid = $_COOKIE['PAPVisitorId'];
$orderParams->first_ip = oseMscPublic::getIP();
$params['params'] = oseJson::encode($orderParams);
return $params;
}
else
{
return $params;
}
}
示例4: getInstance
public static function getInstance($type)
{
static $instance;
$className = "osePaymentSC{$type}";
$arrayInstance = array();
$arrayInstance['MscList'] = 'osePaymentMscList';
$arrayInstance['View'] = 'osePaymentView';
$arrayInstance['Price'] = 'osePaymentPrice';
$arrayInstance['Tax'] = 'osePaymentTax';
$arrayInstance['GateWay'] = 'osePaymentGateWay';
if (isset($arrayInstance[$type])) {
if (strtolower($type) == 'price') {
$primaryCurrency = osePayment::getCurrencyInfo();
$instance = new osePaymentPrice($primaryCurrency->value, oseJson::decode($primaryCurrency->default));
return $instance;
}
$className = $arrayInstance[$type];
} else {
$className = "osePaymentSC{$type}";
}
if (!$instance instanceof $className) {
$instance = new $className();
}
return $instance;
}
示例5: activate
public static function activate($params)
{
$result = array();
$result['success'] = true;
if (empty($params['allow_work'])) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Error");
return $result;
}
unset($params['allow_work']);
//oseExit($params);
$db = oseDB::instance();
$post = JRequest::get('post');
$msc_id = $params['msc_id'];
$member_id = $params['member_id'];
if (empty($msc_id)) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Renew Msc: No Msc ID");
return $result;
}
// get the docman groups_id of msc
$query = "SELECT * FROM `#__osemsc_ext` WHERE `id` = '{$msc_id}' AND `type` = 'docman'";
$db->setQuery($query);
$data = $db->loadObject();
$data = oseJson::decode($data->params);
if (empty($data->groups_id) || $data->groups_id == '-1') {
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Done");
return $result;
}
$docman_group_id = $data->groups_id;
$query = "SELECT * FROM `#__docman_groups` WHERE `groups_id` = " . (int) $docman_group_id;
$db->setQuery($query);
$obj = $db->loadObject();
if (!empty($obj)) {
$newmembers[] = $member_id;
if (!empty($obj->groups_members)) {
$oldmembers = explode(",", $obj->groups_members);
if (count($oldmembers) > 0) {
$newmembers = array_merge($oldmembers, $newmembers);
}
}
$newmembers = array_unique($newmembers);
$newmembers = implode(",", $newmembers);
$query = "UPDATE `#__docman_groups` SET `groups_members` = '" . $newmembers . "' WHERE `groups_id` = " . (int) $docman_group_id;
$db->setQuery($query);
if (!$db->query()) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Error");
return $result;
}
}
return $result;
}
示例6: renew
public static function renew($params)
{
$result = array();
$result['success'] = true;
if (empty($params['allow_work'])) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Error");
return $result;
}
unset($params['allow_work']);
//oseExit($params);
$db = oseDB::instance();
$post = JRequest::get('post');
$msc_id = $params['msc_id'];
$member_id = $params['member_id'];
if (empty($msc_id)) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Renew Msc: No Msc ID");
return $result;
}
// get the plan id of msc
$query = "SELECT * FROM `#__osemsc_ext` WHERE `id` = '{$msc_id}' AND `type` = 'osecredit'";
$db->setQuery($query);
$data = $db->loadObject();
$data = oseJson::decode($data->params);
if (empty($data->osecredit_id) || empty($data->enable)) {
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Done");
return $result;
}
$query = "SELECT credit_amount FROM `#__ose_credit_plan` WHERE `id` = '{$data->osecredit_id}'";
$db->setQuery($query);
$amount = $db->loadResult();
$query = "SELECT * FROM `#__ose_credit_member` WHERE `member_id` = '{$member_id}'";
$db->setQuery($query);
$obj = $db->loadObject();
if (empty($obj)) {
$credit_params = oseJson::encode(array());
$query = " INSERT INTO `#__ose_credit_member` (`member_id`, `credit_amount`, `params`)" . " VALUES" . " ('{$member_id}', '{$amount}', '{$credit_params}')";
} else {
$amount = $amount + $obj->credit_amount;
$query = "UPDATE `#__ose_credit_member` SET `credit_amount` = '{$amount}' WHERE `id` = '{$obj->id}'";
}
$db->setQuery($query);
if (!$db->query()) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error');
return $result;
}
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Done");
return $result;
}
示例7: getItems
function getItems()
{
// Get a storage key.
$store = $this->getStoreId('getItems');
// Try to load the data from internal storage.
if (!empty($this->cache[$store])) {
return $this->cache[$store];
}
$search = $this->getState('filter.search');
$searchid = $this->getState('filter.searchid');
$searchpe = $this->getState('filter.searchpe');
// Load the list items.
$items = parent::getItems();
// If emtpy or an error, just return.
if (empty($items)) {
return array();
}
//oseExit($items);
$db = oseDB::instance();
// Inject the values back into the array.
foreach ($items as $k => $item) {
$order_id = null;
if ($item->msc_id > 0) {
$params = oseJson::decode($item->params);
$order_id = oseGetValue($params, 'order_id', 0);
$query = " SELECT `title` FROM `#__osemsc_acl`" . " WHERE `id` = '{$item->msc_id}'";
$db->setQuery($query);
$item->membership = $db->loadResult();
$query = " SELECT *" . " FROM `#__osemsc_order_fix`" . " WHERE `member_id` = '{$item->id}'";
$db->setQuery($query);
$ofItem = oseDB::loadItem('obj');
$item->paypal_email = oseObject::getValue($ofItem, 'email', $item->email);
} else {
$item->expired_date = null;
$item->status = '';
}
if (empty($search) && empty($searchid) && empty($searchpe)) {
//return array();
} else {
//$item->order_number = null;
if (!empty($order_id)) {
$query = " SELECT `order_id`,`order_number`,`payment_serial_number`,`order_status`" . " FROM `#__osemsc_order`" . " WHERE `order_id` = '{$order_id}'";
$db->setQuery($query);
$oItem = oseDB::loadItem('obj');
$item->order_number = $oItem->order_number;
$item->order_id = $oItem->order_id;
$item->payment_serial_number = $oItem->payment_serial_number;
$item->order_status = $oItem->order_status;
} else {
}
}
$items[$k] = $item;
}
// Add the items to the internal cache.
$this->cache[$store] = $items;
return $this->cache[$store];
}
示例8: PayFastOneOffPostForm
function PayFastOneOffPostForm($orderInfo, $params = array())
{
$pConfig = oseMscConfig::getConfig('payment', 'obj');
$merchantId = $pConfig->payfast_merchant_id;
$merchantKey = $pConfig->payfast_merchant_key;
$html = array();
$test_mode = $pConfig->payfast_testmode;
if (!$test_mode) {
if (empty($merchantId) || empty($merchantKey)) {
$html['form'] = "";
$html['url'] = "";
return $html;
}
}
if ($test_mode == true) {
$merchantId = '10000100';
$merchantKey = '46f0cd694581a';
$url = "https://sandbox.payfast.co.za/eng/process";
} else {
$url = "https://www.payfast.co.za/eng/process";
}
$db = oseDB::instance();
$member = oseRegistry::call('member');
$member->instance($orderInfo->user_id);
$payment = oseRegistry::call('payment');
$paymentOrder = $payment->getInstance('Order');
$billinginfo = $paymentOrder->getBillingInfo($orderInfo->user_id);
$amount = $orderInfo->payment_price;
$currency = $orderInfo->payment_currency;
$order_id = $orderInfo->order_id;
$order_number = $orderInfo->order_number;
$user =& JFactory::getUser($orderInfo->user_id);
$orderInfoParams = oseJson::decode($orderInfo->params);
$cancelUrl = JURI::base() . "index.php";
$notifyUrl = JURI::base() . "components/com_osemsc/ipn/payfast_notify.php";
$returnUrl = urldecode(JROUTE::_(JURI::base() . "index.php?option=com_osemsc&view=thankyou&order_id=" . $orderInfo->order_id));
$returnUrl = $returnUrl ? $returnUrl : JURI::base() . "index.php?option=com_osemsc&view=member&result=success&amount={$amount}&ordernumber={$order_number}";
// Create description
$description = '';
$vendor_image_url = "";
$app =& JFactory::getApplication();
$currentSession = JSession::getInstance('none', array());
$stores = $currentSession->getStores();
$html['form'] = '<form action="' . $url . '" method="post">';
// Construct variables for post
$post_variables = array('merchant_id' => $merchantId, 'merchant_key' => $merchantKey, 'return_url' => $returnUrl, 'cancel_url' => $cancelUrl, 'notify_url' => $notifyUrl, 'name_first' => substr($billinginfo->firstname, 0, 100), 'name_last' => substr($billinginfo->lastname, 0, 100), 'email_address' => substr($billinginfo->email, 0, 255), 'item_name' => JText::_('Order ID: ') . $order_id, 'item_description' => $description, 'amount' => number_format($amount, 2, '.', ''), 'm_payment_id' => $order_id, 'currency_code' => $currency, 'custom_str1' => $order_number, 'user_agent' => 'Open Source Membership Control V5');
$html['form'] .= '<input type="image" id="payfast_image" name="cartImage" src="' . "components/com_osemsc/assets/images/checkout.png" . '" alt="' . JText::_('Click to pay with PayFast') . '" />';
// Process payment variables;
$html['url'] = $url . "?";
foreach ($post_variables as $name => $value) {
$html['form'] .= '<input type="hidden" name="' . $name . '" value="' . htmlspecialchars($value) . '" />';
$html['url'] .= $name . "=" . urlencode($value) . "&";
}
$html['form'] .= '</form>';
return $html;
}
示例9: renew
public static function renew($params)
{
$result = array();
$result['success'] = true;
if (empty($params['allow_work'])) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Error");
return $result;
}
unset($params['allow_work']);
$db = oseDB::instance();
//$post = JRequest::get('post');
$msc_id = $params['msc_id'];
$member_id = $params['member_id'];
if (empty($msc_id)) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_("Join Msc: No Msc ID");
return $result;
}
// get the sobi2 credit of msc
$query = "SELECT * FROM `#__osemsc_ext` WHERE `id` = '{$msc_id}' AND `type` = 'sobi2credit'";
$db->setQuery($query);
$data = $db->loadObject();
$data = oseJson::decode($data->params);
if (empty($data->credit)) {
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Done");
return $result;
}
$query = "SELECT * FROM `#__osemsc_credit` WHERE `member_id` = '{$member_id}'";
$db->setQuery($query);
$obj = $db->loadObject();
if (empty($obj)) {
$query = " INSERT INTO `#__osemsc_credit`" . " (`member_id`, `credit`, `recharge_times`, `total_consume_amout`)" . " VALUES" . " ('{$member_id}', '{$data->credit}', '0', '0')";
} else {
$credit = $obj->credit + $data->credit;
$recharge_times = $obj->recharge_times + 1;
$query = "UPDATE `#__osemsc_credit` SET `credit` = '{$credit}', `recharge_times` = '{$recharge_times}' WHERE `member_id` = '{$member_id}'";
}
$db->setQuery($query);
if (!$db->query()) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error');
return $result;
}
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_("Done");
return $result;
}
示例10: save
public static function save($params)
{
$result = array();
$result['success'] = true;
//oseExit($params);
if (empty($params['allow_work'])) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Join.Idev');
return $result;
}
unset($params['allow_work']);
if ($params['join_from'] != 'payment') {
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_('Done Join.Order');
return $result;
}
$oseMscConfig = oseRegistry::call('msc')->getConfig('thirdparty', 'obj');
if (empty($oseMscConfig->idev_enable)) {
return $result;
}
if (empty($oseMscConfig->idev_url)) {
return $result;
}
$db = oseDB::instance();
//$post = JRequest::get('post');
$msc_id = $params['msc_id'];
$member_id = $params['member_id'];
$order_id = $params['order_id'];
$order_item_id = $params['order_item_id'];
$where = array();
$where[] = "order_id = {$order_id}";
$payment = oseRegistry::call('payment');
$curOrder = $payment->getOrder($where, 'obj');
$curOrderParams = oseJson::decode($curOrder->params);
$member = oseRegistry::call('member');
$member->instance($member_id);
$userInfo = $member->getUserInfo('obj');
$memParams = $member->getMemberInfo($msc_id, 'obj')->memParams;
$memParams = oseJSON::decode($memParams);
$memParams->first_ip = $curOrderParams->first_ip;
try {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $oseMscConfig->idev_url . "/sale.php?profile=72198&idev_saleamt={$curOrder->payment_price}&idev_ordernum={$order_id}&ip_address={$memParams->first_ip}");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
return $result;
} catch (Exception $e) {
return $result;
}
}
示例11: setParams
function setParams($item, $params)
{
$itemParams = oseGetValue($item, 'params', '{}');
$itemParams = oseJson::decode($itemParams);
if (!is_Array($params)) {
$params = (array) $params;
}
foreach ($params as $key => $value) {
$itemParams = oseSetValue($itemParams, $key, $value);
}
$itemParams = oseJson::encode($itemParams);
$item = oseSetValue($item, 'params', $itemParams);
return $item;
}
示例12: init
protected function init($item)
{
$item = empty($item) ? array() : (array) $item;
foreach ($item as $key => $value) {
if ($key == 'config') {
$value = empty($value) ? '{}' : $value;
$this->set($key, oseJson::decode($value));
} elseif ($key == 'params') {
$this->set($key, $this->getParams($item));
} else {
$this->set($key, $value);
}
}
}
示例13: getOrderMemInfo
function getOrderMemInfo()
{
$order_id = JRequest::getInt('order_id', 0);
$db = oseDB::instance();
$where = array();
$where[] = "`order_id` = " . $db->quote($order_id);
$payment = oseRegistry::call('payment');
$orderInfo = $payment->getOrder($where, 'obj');
$orderInfoParams = oseJson::decode($orderInfo->params);
$orderItems = $payment->getOrderItems($order_id, 'obj');
$orderItem = $orderItems[0];
$orderItemParams = oseJson::decode($orderItem->params);
$msc_id = $orderItemParams->msc_id;
$msc_option = $orderItemParams->msc_option;
$msc = oseRegistry::call('msc');
$mscInfo = $msc->getInfo($msc_id, 'obj');
$paymentInfos = $msc->getExtInfo($msc_id, 'payment');
$paymentInfo = $paymentInfos[$msc_option];
if (!empty($paymentInfo['optionname'])) {
$optionname = $paymentInfo['optionname'];
} else {
$optionname = $paymentInfo['recurrence_num'] . ' ' . $paymentInfo['recurrence_unit'] . ' membership';
}
$paymentOrder = $payment->getInstance('Order');
$billinginfo = $paymentOrder->getBillingInfo($orderInfo->user_id);
$query = " SELECT f.name,v.value FROM `#__osemsc_fields` AS f " . " INNER JOIN `#__osemsc_fields_values` AS v" . " ON f.`id` = v.`field_id`" . " WHERE `member_id` = " . $orderInfo->user_id;
$db->setQuery($query);
$profiles = $db->loadObjectList();
echo "<div style=\"color: #238db4; font-weight: bold; font-size:12px;\">" . JText::_('MEMBERSHIP_INFORMATION') . ":</div>";
echo "<div>" . JText::_('MEMBERSHIP') . " : " . $mscInfo->title . "</div>";
echo "<div>" . JText::_('MEMBERSHIP_OPTION') . " : " . $optionname . "</div>";
echo "</br>";
echo "<div style=\"color: #238db4; font-weight: bold; font-size:12px;\">" . JText::_('BILLING_INFORMATION') . ":</div>";
echo "<div>" . JText::_('FIRST_NAME') . " : " . $billinginfo->firstname . "</div>";
echo "<div>" . JText::_('LAST_NAME') . " : " . $billinginfo->lastname . "</div>";
echo "<div>" . JText::_('EMAIL') . " : " . $billinginfo->email . "</div>";
echo "<div>" . JText::_('ADDRESS') . " : " . $billinginfo->addr1 . " " . $billinginfo->addr2 . "</div>";
echo "<div>" . JText::_('CITY') . " : " . $billinginfo->city . "</div>";
echo "<div>" . JText::_('STATE') . " : " . $billinginfo->state . "</div>";
echo "<div>" . JText::_('COUNTRY') . " : " . $billinginfo->country . "</div>";
echo "<div>" . JText::_('ZIP_POSTAL_CODE') . " : " . $billinginfo->postcode . "</div>";
echo "<div>" . JText::_('PHONE') . " : " . $billinginfo->telephone . "</div>";
echo "</br>";
echo "<div style=\"color: #238db4; font-weight: bold; font-size:12px;\">" . JText::_('ADDITIONAL_INFORMATION') . ":</div>";
foreach ($profiles as $profile) {
echo "<div>" . $profile->name . " : " . $profile->value . "</div>";
}
oseExit();
}
示例14: add
public static function add($params)
{
$result = array();
$result['success'] = true;
if (empty($params)) {
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Register_Order.Idev');
return $result;
}
$orderParams = oseJson::decode($params['params']);
$orderParams->first_ip = oseMscPublic::getIP();
$params['params'] = oseJson::encode($orderParams);
return $params;
}
示例15: save
public static function save($params)
{
$result = array();
$result['success'] = true;
//oseExit($params);
if(empty($params['allow_work']))
{
$result['success'] = false;
$result['title'] = 'Error';
$result['content'] = JText::_('Error Join.Order.1');
return $result;
}
unset($params['allow_work']);
if( $params['join_from'] != 'payment')
{
$result['success'] = true;
$result['title'] = JText::_('Done');
$result['content'] = JText::_('Done Join.Order');
return $result;
}
$db = oseDB::instance();
//$post = JRequest::get('post');
$msc_id = $params['msc_id'];
$member_id = $params['member_id'];
$order_id = $params['order_id'];
$order_item_id = $params['order_item_id'];
$payment= oseRegistry :: call('payment');
$orderInfo= $payment->getInstance('Order')->getOrder(array("order_id = {$order_id}"), 'obj');
$orderInfoParams = oseJson::decode($orderInfo->params);
$array = array();
$array['id'] = $orderInfoParams->coupon_user_id;
if(!empty($array['id']))
{
$array['paid'] = 1;
$array['user_id'] = $member_id;
$updated = oseDB::update('#__osemsc_coupon_user','id',$array);
}
return $result;
}