当前位置: 首页>>代码示例>>PHP>>正文


PHP Tools::jsonDecode方法代码示例

本文整理汇总了PHP中Tools::jsonDecode方法的典型用法代码示例。如果您正苦于以下问题:PHP Tools::jsonDecode方法的具体用法?PHP Tools::jsonDecode怎么用?PHP Tools::jsonDecode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tools的用法示例。


在下文中一共展示了Tools::jsonDecode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderContent

 /**
  *
  */
 public function renderContent($setting)
 {
     $t = array('categorytab' => '', 'categoryBox' => '', 'limit' => 6, 'itemsperpage' => 4, 'columns' => 4, 'order_by' => 'date_add DESC', 'list_mode' => 'grid', 'display_mode' => 'carousel', 'nbr_desktops' => 4, 'nbr_tablets' => 2, 'nbr_mobile' => 1);
     $setting = array_merge($t, $setting);
     $porder = preg_split('#\\s+#', $setting['order_by']);
     if (!isset($porder[1])) {
         $porder[1] = null;
     }
     $output = array();
     $context = Context::getContext();
     $categories = $setting['categoryBox'] ? explode(',', $setting['categoryBox']) : false;
     $categorytab = $setting['categorytab'] ? Tools::jsonDecode($setting['categorytab'], true) : array();
     if ($categories) {
         $tg = array();
         foreach ($categories as $id_category) {
             $obj = new Category($id_category, $context->language->id);
             $tg['category_info'] = isset($categorytab[$id_category]) ? $categorytab[$id_category] : '';
             if (is_file(_PAGEBUILDER_IMAGE_DIR_ . $tg['category_info']['icon'])) {
                 $tg['category_info']['icon'] = _PAGEBUILDER_IMAGE_URL_ . $tg['category_info']['icon'];
             } else {
                 $tg['category_info']['icon'] = '';
             }
             $tg['category_obj'] = $obj;
             $tg['products'] = $obj->getProducts($context->language->id, 0, $setting['limit'], $porder[0], $porder[1]);
             $output[] = $tg;
         }
     }
     $setting['list_mode_tpl'] = $this->getProductListStyleFile($setting['list_mode'], $setting['product_style']);
     $setting['categories_tabs'] = $output;
     $output = array('type' => 'categoriestabs', 'data' => $setting);
     return $output;
 }
开发者ID:vuduykhuong1412,项目名称:GitHub,代码行数:35,代码来源:categoriestabs.php

示例2: initContent

 /**
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     $this->display_column_left = false;
     $this->display_column_center = true;
     $this->display_column_right = false;
     $valid_payments = array();
     if (Configuration::get('PIGMBH_PAYMILL_DEBIT')) {
         $valid_payments[] = 'debit';
     }
     if (Configuration::get('PIGMBH_PAYMILL_CREDITCARD')) {
         $valid_payments[] = 'creditcard';
     }
     if (!in_array(Tools::getValue('payment'), $valid_payments)) {
         Tools::redirectLink($this->context->link->getPageLink('order', true, null, array('step' => '1')));
     }
     $db_data = $this->getPaymillUserData();
     $this->updatePaymillClient($db_data);
     $cart = $this->context->cart;
     foreach ($this->module->getCurrency((int) $cart->id_currency) as $currency) {
         if ($currency['id_currency'] == $cart->id_currency) {
             $iso_currency = $currency['iso_code'];
             break;
         }
     }
     $brands = array();
     foreach (Tools::jsonDecode(Configuration::get('PIGMBH_PAYMILL_ACCEPTED_BRANDS'), true) as $brand_key => $brand_value) {
         $brands[str_replace('-', '', $brand_key)] = $brand_value;
     }
     $data = array('use_backward_compatible_checkout' => _PS_VERSION_ < '1.6', 'nbProducts' => $cart->nbProducts(), 'cust_currency' => $cart->id_currency, 'currencies' => $this->module->getCurrency((int) $cart->id_currency), 'currency_iso' => $iso_currency, 'total' => (int) round($cart->getOrderTotal(true, Cart::BOTH) * 100), 'displayTotal' => $cart->getOrderTotal(true, Cart::BOTH), 'this_path' => $this->module->getPathUri(), 'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->module->name . '/', 'public_key' => Configuration::get('PIGMBH_PAYMILL_PUBLICKEY'), 'payment' => Tools::getValue('payment'), 'paymill_debugging' => (int) Configuration::get('PIGMBH_PAYMILL_DEBUG') == 'on', 'modul_base' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/pigmbhpaymill/', 'customer' => $this->context->customer->firstname . ' ' . $this->context->customer->lastname, 'prefilledFormData' => $this->updatePaymillPayment($db_data), 'acceptedBrands' => Configuration::get('PIGMBH_PAYMILL_ACCEPTED_BRANDS'), 'acceptedBrandsDecoded' => $brands);
     $this->context->smarty->assign($data);
     parent::initContent();
     $this->setTemplate('paymill_checkout.tpl');
 }
开发者ID:paymill,项目名称:pigmbhpaymill,代码行数:36,代码来源:payment.php

示例3: renderContent

 public function renderContent($setting)
 {
     $t = array('categorytab' => '', 'categoryBox' => '', 'show_image' => 1, 'show_cat_title' => 1, 'show_description' => 0, 'limit_description' => 25, 'show_sub_category' => 0, 'limit_subcategory' => 5, 'show_nb_product' => 0, 'show_products' => 0, 'limit' => 6, 'columns' => 4, 'list_mode' => 'grid', 'display_mode' => 'carousel', 'nbr_desktops' => 4, 'nbr_tablets' => 2, 'nbr_mobile' => 1);
     $setting = array_merge($t, $setting);
     $context = Context::getContext();
     //$categories = $setting['categoryBox'] ? explode(',', $setting['categoryBox']) : false;
     $categorytab = $setting['categorytab'] ? Tools::jsonDecode($setting['categorytab'], true) : array();
     //echo "<pre>".print_r($categorytab,1); die;
     $categories = $this->getCategories($setting['categoryBox'], $context->language->id);
     if ($categories) {
         foreach ($categories as &$category) {
             $obj = new Category($category['id_category']);
             $category['nb_products'] = $obj->getProducts($context->language->id, 0, 1, null, null, true);
             $category['products'] = $obj->getProducts($context->language->id, 0, $setting['limit'], null, null, false);
             $category['id_image'] = file_exists(_PS_CAT_IMG_DIR_ . (int) $category['id_category'] . '.jpg') ? (int) $category['id_category'] : false;
             $category['subcategories'] = $this->getSubCategories($category['id_category'], $setting['limit_subcategory'], $context->language->id);
             $tg = isset($categorytab[$category['id_category']]) ? $categorytab[$category['id_category']] : '';
             if (is_file(_PAGEBUILDER_IMAGE_DIR_ . $tg['icon'])) {
                 $category['icon'] = _PAGEBUILDER_IMAGE_URL_ . $tg['icon'];
             } else {
                 $category['icon'] = '';
             }
             $category['icon_class'] = $tg['icon_class'];
         }
     }
     $setting['list_mode_tpl'] = $this->getProductListStyleFile($setting['list_mode'], $setting['product_style']);
     $setting['categories_info'] = $categories;
     $output = array('type' => 'categoriesinfo', 'data' => $setting);
     return $output;
 }
开发者ID:vuduykhuong1412,项目名称:GitHub,代码行数:30,代码来源:categoriesinfo.php

示例4: getFilterQuery

 protected function getFilterQuery($keys_array = array(), $table)
 {
     $sql = '';
     foreach ($keys_array as $key) {
         if ($this->context->cookie->{$table . 'Filter_' . $key} !== '' && $this->context->cookie->{$table . 'Filter_' . $key} !== false) {
             $value = $this->context->cookie->{$table . 'Filter_' . $key};
             if ($key == 'id_manifest') {
                 $sql .= '`id_manifest` ' . ($value ? '!=' : '=') . ' "0" AND ';
             } elseif (is_array(Tools::jsonDecode($value))) {
                 $date = Tools::jsonDecode($value);
                 $date = array_filter($date);
                 if (!$date) {
                     continue;
                 }
                 if (!empty($date[0])) {
                     $sql .= '`' . bqSQL($key) . '` > "' . pSQL($date[0]) . '" AND ';
                 }
                 if (!empty($date[1])) {
                     $sql .= '`' . bqSQL($key) . '` < "' . pSQL($date[1]) . '" AND ';
                 }
             } else {
                 $sql .= '`' . bqSQL($key) . '` LIKE "%' . pSQL($value) . '%" AND ';
             }
         }
     }
     if ($sql) {
         $sql = ' HAVING ' . Tools::substr($sql, 0, -4);
     }
     // remove 'AND ' from the end of query
     return $sql;
 }
开发者ID:remixaz,项目名称:dpdgroup,代码行数:31,代码来源:Controller.php

示例5: executeCronTask

 public static function executeCronTask()
 {
     $ts_module = new TrustedShops();
     $ts_common = new TSCommon();
     $common_count = 0;
     if (is_array(TSCommon::$available_languages)) {
         $to_remove = array();
         foreach (array_keys(TSCommon::$available_languages) as $iso) {
             $alerts_infos = RatingAlert::getAlertsInformations($iso);
             ///print_r($alerts_infos);
             if ($alerts_infos != false) {
                 $common_count += count($alerts_infos);
                 foreach ($alerts_infos as $infos) {
                     $cert = Configuration::get(TSCommon::PREFIX_TABLE . 'CERTIFICATE_' . Tools::strtoupper($infos['iso']));
                     $certificate = (array) Tools::jsonDecode(Tools::htmlentitiesDecodeUTF8($cert));
                     $subject = $ts_module->l('title_part_1') . ' ' . Configuration::get('PS_SHOP_NAME') . $ts_module->l('title_part_2');
                     $template_vars = array('{ts_id}' => $certificate['tsID'], '{button_url}' => TSCommon::getHttpHost(true, true) . _MODULE_DIR_ . $ts_module->name . '/views/img', '{rating_url}' => $ts_common->getRatingUrlWithBuyerEmail($infos['id_lang'], $infos['id_order'], $infos['email']));
                     $result = Mail::Send((int) $infos['id_lang'], self::MAIL_TEMPLATE, $subject, $template_vars, $infos['email'], null, Configuration::get('PS_SHOP_EMAIL'), Configuration::get('PS_SHOP_NAME'), null, null, dirname(__FILE__) . '/../mails/');
                     if ($result) {
                         $to_remove[] = (int) $infos['id_alert'];
                     }
                 }
             }
         }
         if (count($to_remove) > 0) {
             self::removeAlerts($to_remove);
         }
     }
     return count($to_remove) == $common_count;
 }
开发者ID:alexsimple,项目名称:trustedshops,代码行数:30,代码来源:RatingAlert.php

示例6: hookDisplayHome

 public function hookDisplayHome($params)
 {
     !isset($params['tpl']) && ($params['tpl'] = 'hookHome');
     $config = Tools::jsonDecode(Configuration::get($this->name), true);
     $this->smarty->assign($config);
     return $this->display(__FILE__, $params['tpl'] . '.tpl');
 }
开发者ID:villers,项目名称:PHP_avance_II_My_Presta,代码行数:7,代码来源:myyoutubemodule.php

示例7: processMessage

/**
 * @param unknown_type $message
 * @param Db $db
 * @return void|boolean
 */
function processMessage($message, $db)
{
    //$message = Tools::jsonDecode('{"id_event":5,"date_event":"2012-03-14 13:07:18","reference":"274","id_customer":"10687"}', true);
    //$message = Tools::jsonDecode($response->body->ReceiveMessageResult->Message->Body, true);
    $message = Tools::jsonDecode($message, true);
    $id_event = $message['id_event'];
    if ($id_event == ONLINE_ORDER) {
        VBRewards::addRewardPoints($message['id_customer'], $id_event, 0, 100, 'Online payment bonus - Order no ' . $message['reference'], $message['reference'], $message['date_event']);
        return;
    }
    if ($id_event == EVENT_REGISTRATION) {
        VBRewards::addRewardPoints($message['id_customer'], $id_event, 0, 50, 'Registration/Sign-up', $message['reference'], $message['date_event']);
        return;
    }
    if (isset($message['first_order']) && $message['first_order']) {
        VBRewards::addRewardPoints($message['id_customer'], $id_event, 7, 50, 'First Order Bonus - Order no ' . $message['reference'], $message['reference'], $message['date_event']);
        return;
    }
    if (isset($message['first_review']) && $message['first_review']) {
        VBRewards::addRewardPoints($message['id_customer'], $id_event, 9, 50, 'Product Review - First review bonus', $message['reference'], $message['date_event']);
        return;
    }
    $res = $db->ExecuteS("select le.id_event, le.name as 'event_name', r.id_rule, r.name as 'rule_name', re.execute_sequence\n\t\t\t\t\t\t\tfrom vb_rules r\n\t\t\t\t\t\t\tinner join vb_loyalty_rule_events re on (r.id_rule = re.id_rule)\n\t\t\t\t\t\t\tinner join vb_loyalty_events le on le.id_event = re.id_event\n\t\t\t\t\t\t\twhere le.id_event = " . $message['id_event'] . " order by le.id_event, re.execute_sequence");
    foreach ($res as $rule_row) {
        if ($rule_row['id_rule'] == 9 || $rule_row['id_rule'] == 7) {
            continue;
        }
        $rewards_rule = RewardRules::getRule($rule_row['rule_name']);
        $rewards_rule->init($db);
        $rewards_rule->processEvent($db, $message);
        echo PHP_EOL;
    }
    return false;
}
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:39,代码来源:rules_backlog.php

示例8: send

 /**
  * WS call APP
  * @param type $data : data array
  * @return array : WS return JSON decoded
  */
 public static function send($url, $data)
 {
     // add data for trackers if not empty
     if (!empty(self::$trackers_data)) {
         $data['data']['trackers_data'] = self::$trackers_data;
     }
     $url = 'http://' . $url . 'ws/';
     $enc = self::encodeData($data);
     $dat = 'k=' . $enc['key'] . '&d=' . $enc['data'];
     if (function_exists('curl_init')) {
         // if curl active
         $c = curl_init($url);
         curl_setopt($c, CURLOPT_POST, true);
         curl_setopt($c, CURLOPT_POSTFIELDS, $dat);
         curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
         $res = curl_exec($c);
         curl_close($c);
     } else {
         // otherwise : file_get_contents
         $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $dat));
         $context = stream_context_create($opts);
         $res = Tools::file_get_contents($url, false, $context);
     }
     $ret = Tools::jsonDecode($res, true);
     if ($ret != null) {
         Configuration::updateValue('checkyourdata_last_errors', implode(', ', $ret['errors']));
     }
     if (!empty($ret['data']['demoEnd'])) {
         Configuration::updateValue('checkyourdata_demo_end', $ret['data']['demoEnd']);
     }
     return $ret;
 }
开发者ID:adesse,项目名称:checkyourdata,代码行数:37,代码来源:wshelper.inc.php

示例9: loadConfiguration

 public function loadConfiguration()
 {
     if ($this->configuration === null) {
         $data = Configuration::get(self::ADMIN_CONFIGURATION_KEY);
         $this->configuration = Tools::jsonDecode($data, true);
     }
     return $this->configuration;
 }
开发者ID:invipay,项目名称:invipay-prestashop,代码行数:8,代码来源:Helper.php

示例10: queryAll

 /**
  * query all warehouse addresses
  * @params $resultFormat string objectList or arrayList
  * @return array
  */
 public static function queryAll()
 {
     $result = Tools::file_get_contents(self::WAREHOUSE_ADDRESS_PATH);
     if (empty($result)) {
         return array();
     }
     $array = Tools::jsonDecode($result, true);
     return $array;
 }
开发者ID:pilibaba,项目名称:pilipay-for-prestashop,代码行数:14,代码来源:PilipayWarehouseAddress.php

示例11: queryAll

 /**
  * query all pilibaba supported currency
  * 
  * @return array
  */
 public static function queryAll()
 {
     $result = Tools::file_get_contents(self::PILIPAY_CURRENCY_PATH);
     if (empty($result)) {
         return array();
     }
     $array = Tools::jsonDecode($result, true);
     return $array;
 }
开发者ID:pilibaba,项目名称:pilipay-for-prestashop,代码行数:14,代码来源:PilipayCurrency.php

示例12: hookDisplayHome

 public function hookDisplayHome($params)
 {
     !isset($params['tpl']) && ($params['tpl'] = 'hookHome');
     $config = Tools::jsonDecode(Configuration::get($this->name), true);
     $html = '';
     if ($config['show_barcode']) {
         $html .= '<script type="text/javascript" src="' . $this->_path . 'js/mylabelgenerator.js" ></script>';
     }
     return $html;
 }
开发者ID:villers,项目名称:PHP_avance_II_My_Presta,代码行数:10,代码来源:mylabelgenerator.php

示例13: ajaxProcessIntegrationModuleCheckForUpdates

 public function ajaxProcessIntegrationModuleCheckForUpdates()
 {
     $this->content_only = true;
     $status = 'error';
     if ($json = Tools::getValue('json')) {
         $request = Tools::jsonDecode($json, true);
         $status = $this->module->setupInstance()->downloadExtraModule($request['module'], $request['ver']);
     }
     $json = array('status' => $status);
     $this->content = Tools::jsonEncode($json);
 }
开发者ID:Oldwo1f,项目名称:yakaboutique,代码行数:11,代码来源:AdminPpropertiesController.php

示例14: postProcess

 public function postProcess()
 {
     $method = Tools::getValue('method');
     $path = Tools::getValue('path');
     $data = Tools::getValue('data');
     $data = Tools::jsonDecode($data);
     if (!$data) {
         $data = array();
     }
     $response = $this->aplazame->callToRest($method, $path, $data);
     die(Tools::jsonEncode($response['payload']));
 }
开发者ID:aplazame,项目名称:prestashop,代码行数:12,代码来源:AdminAplazameApiProxyController.php

示例15: getList

 /**
  * Gets a list of all flash messages from the users cookie by type.
  *
  * @param string $type the type of messages (use class constants).
  * @return array the message array.
  */
 public function getList($type)
 {
     $flash_messages = array();
     $cookie = Context::getContext()->cookie;
     $cookie_data = isset($cookie->nostotagging) ? Tools::jsonDecode($cookie->nostotagging, true) : array();
     if (isset($cookie_data['flash_messages'][$type])) {
         $flash_messages = $cookie_data['flash_messages'][$type];
         unset($cookie_data['flash_messages'][$type]);
         $cookie->nostotagging = Tools::jsonEncode($cookie_data);
     }
     return $flash_messages;
 }
开发者ID:silbersaiten,项目名称:nostotagging,代码行数:18,代码来源:flash-message.php


注:本文中的Tools::jsonDecode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。