本文整理汇总了PHP中oseJson::encode方法的典型用法代码示例。如果您正苦于以下问题:PHP oseJson::encode方法的具体用法?PHP oseJson::encode怎么用?PHP oseJson::encode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oseJson
的用法示例。
在下文中一共展示了oseJson::encode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
}
示例2: display
function display($tpl = null)
{
$tmpl = JRequest::getVar('tmpl');
if (empty($tmpl)) {
JRequest::setVar('tmpl', 'component');
}
if (JOOMLA16 == false) {
require_once OSEMSC_B_PATH . DS . 'helpers' . DS . "extLanguage.php";
oseHTML::script(OSEMSC_F_URL . '/libraries/joomla.core.js', '1.5');
$strings = oseJson::encode(oseText::jsStrings());
$document = JFactory::getDocument();
$document->addScriptDeclaration('(function(){var strings=' . $strings . ';Joomla.JText.load(strings)})()');
}
$com = OSECPU_PATH_JS . '/com_ose_cpu/extjs';
oseHTML::initScript();
oseHTML::script($com . '/ose/app.msg.js', '1.5');
oseHTML::script(OSEMSC_F_URL . '/libraries/init.js', '1.5');
require_once OSEMSC_B_PATH . DS . 'helpers' . DS . "extLanguage.php";
$OSESoftHelper = new OSESoftHelper();
$footer = $OSESoftHelper->renderOSETM();
$this->assignRef('footer', $footer);
$preview_menus = $OSESoftHelper->getPreviewMenus();
$this->assignRef('preview_menus', $preview_menus);
$this->assignRef('OSESoftHelper', $OSESoftHelper);
$title = JText::_('OSE Membership™ Profile Management');
$this->assignRef('title', $title);
parent::display($tpl);
}
示例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['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;
}
}
示例4: getMSCs
public static function getMSCs()
{
$my = JFactory::getUser();
$member_id = $my->id;
$result = array();
$db= oseDB :: instance();
$query= " SELECT acl.id, acl.title FROM `#__osemsc_member_history` AS omh"
." INNER JOIN `#__osemsc_acl` AS acl"
." ON omh.`msc_id` = acl.`id`"
." WHERE omh.`member_id` = '{$member_id}'"
." GROUP BY acl.`id`";
$db->setQuery($query);
$items = oseDB :: loadList();
if(count($items) < 1)
{
$result['total'] = 0;
$result['results'] = '';
}else
{
$result['total'] = count($items);
$result['results'] = $items;
}
$result = oseJson :: encode($result);
oseExit($result);
}
示例5: 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;
}
示例6: oseCheckToken
function oseCheckToken()
{
$tokenCheck = JRequest::checkToken();
if (empty($tokenCheck)) {
$result['content'] = 'Token is invalid!';
$result = oseJson::encode($result);
oseExit($result);
}
}
示例7: add
function add($title)
{
$db = oseDB::instance();
$params = array('range' => 'all');
$params = $db->Quote(oseJson::encode($params));
$query = " INSERT INTO `#__osemsc_coupon` (`title`,`params`) VALUES ('{$title}',{$params})";
$db->setQuery($query);
return oseDB::query();
}
示例8: save
public static function save($params = array())
{
$db = oseDB::instance();
$post = JRequest::get('post');
$id = JRequest::getCmd('id', null);
$msc_id = JRequest::getInt('msc_id', 0);
if (empty($id)) {
$id = uniqid();
}
$extItem = oseRegistry::call('msc')->getExtInfoItem($msc_id, 'acymailing2', 'obj');
$extItem->params = empty($extItem->params) ? '{}' : $extItem->params;
$items = oseJson::decode($extItem->params, true);
$where = array();
$msc_id = isset($msc_id) ? $msc_id : null;
if (empty($msc_id)) {
return false;
// No membership exists in the addon
} else {
unset($post['msc_id']);
$where[] = 'id = ' . $db->Quote($msc_id);
}
$where[] = 'type = ' . $db->Quote('acymailing2');
$params = array();
$prefix = 'acymailing2_';
foreach ($post as $key => $value) {
if (strstr($key, $prefix)) {
$newKey = preg_replace("/{$prefix}/", '', $key, 1);
$params[$newKey] = $value;
}
}
ksort($params);
$params['id'] = $id;
$items[$id] = $params;
$newParams = $db->Quote(oseJson::encode($items));
$where = oseDB::implodeWhere($where);
$query = " SELECT * FROM `#__osemsc_ext` " . $where;
$db->setQuery($query);
$obj = oseDB::loadItem('obj');
if (empty($obj)) {
$query = " INSERT INTO `#__osemsc_ext` " . " (id,type,params)" . " VALUES " . " ({$msc_id}," . $db->Quote('acymailing2') . ",{$newParams}) ";
$db->setQuery($query);
//oseExit($db->_sql);
} else {
$query = " UPDATE `#__osemsc_ext` " . " SET " . " params = {$newParams} " . " WHERE id = {$obj->id}" . " AND type = " . $db->Quote('acymailing2');
$db->setQuery($query);
}
if (oseDB::query()) {
$result['success'] = true;
$result['title'] = JText::_('Finished');
$result['content'] = JText::_('Save Successfully!');
} else {
$result['success'] = false;
$result['title'] = JText::_('Error');
$result['content'] = JText::_('Error in Saving License Parameters');
}
return $result;
}
示例9: getTerm
function getTerm()
{
$id = JRequest::getInt('id',0);
$terms = oseRegistry::call('member')->getInstance('Email')->getTerm($id);
$terms = str_replace("../", JURI::root(), $terms);
$result = empty($terms)?'':$terms;
$result = oseJson::encode($result);
oseExit($result);
}
示例10: 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;
}
示例11: getOwnMsc
function getOwnMsc()
{
$model = $this->getModel('member');
$items = $model->getOwnMsc();
$total = count($items);
if ($total > 0) {
$result['total'] = $total;
$result['results'] = $items;
} else {
$result['total'] = 0;
$result['results'] = null;
}
$result = oseJson::encode($result);
oseExit($result);
}
示例12: 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;
}
示例13: getList
function getList()
{
$model = $this->getModel('levels');
$results = $model->getList();
$result = array();
if (count($results) > 0) {
$result['total'] = count($results);
$result['results'] = $results;
} else {
$result['total'] = 0;
$result['results'] = array();
}
$result = oseJson::encode($result);
oseExit($result);
}
示例14: getFaith
function getFaith()
{
$id = JRequest::getInt('id',0);
$db= oseDB::instance();
$query = " SELECT * FROM `#__osemsc_email` "
." WHERE type = 'faith' AND id = {$id} "
;
$db->setQuery($query);
$term = oseDB::loadItem();
$result = empty($term)?'':$term;
$result = oseJson::encode($result);
oseExit($result);
}
示例15: getList
public function getList()
{
$db = oseDB::instance();
$search = JRequest::getString('search', null);
$search = JString::strtolower($search);
$start = JRequest::getInt('start', 0);
$limit = JRequest::getInt('limit', 20);
$dir = JRequest::getCmd('dir', 'ASC');
$sortField = JRequest::getCmd('sort', 'domain');
$msc_id = JRequest::getInt('msc_id');
$user_id = JRequest::getInt('user_id');
$where = array();
$where[] = "`mscID` = '{$msc_id}'";
$where[] = "`userID` = '{$user_id}'";
if (!empty($search)) {
$searchQuery = $db->Quote('%' . $search . '%');
$where[] = "`domain` LIKE {$searchQuery}";
}
$where = oseDB::implodeWhere($where);
$query = " SELECT COUNT(*) " . " FROM `#__osetickets_domains` " . $where;
$db->setQuery($query);
$total = $db->loadResult();
$query = " SELECT *" . " FROM `#__osetickets_domains` " . $where . " ORDER BY {$sortField} {$dir}";
if ($start >= 0 && $limit >= 0) {
$db->setQuery($query, $start, $limit);
} else {
$db->setQuery($query);
}
$items = oseDB::loadList('obj');
$list = array();
foreach ($items as $key => $item) {
$list[$key] = $item;
}
$resul = array();
$result['total'] = $total;
$result['results'] = $list;
oseExit(oseJson::encode($result));
}