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


PHP vmJsApi::safe_json_encode方法代码示例

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


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

示例1: display

 function display($tpl = null)
 {
     $document = JFactory::getDocument();
     $document->setMimeEncoding('application/json');
     if ($virtuemart_media_id = vRequest::getInt('virtuemart_media_id')) {
         //JResponse::setHeader( 'Content-Disposition', 'attachment; filename="media'.$virtuemart_media_id.'.json"' );
         $model = VmModel::getModel('Media');
         $image = $model->createMediaByIds($virtuemart_media_id);
         if (isset($image[0]) and is_object($image[0])) {
             $image[0]->file_url_thumb_dyn = $image[0]->getFileUrlThumb();
             // 			echo '<pre>'.print_r($image,1).'</pre>';
             $this->json = $image[0];
             //echo json_encode($this->json);
             if (isset($this->json->file_url)) {
                 $this->json->file_root = JURI::root(true) . '/';
                 $this->json->msg = 'OK';
                 echo vmJsApi::safe_json_encode($this->json);
             } else {
                 $this->json->msg = '<b>' . vmText::_('COM_VIRTUEMART_NO_IMAGE_SET') . '</b>';
                 echo @json_encode($this->json);
             }
         }
     } else {
         if (!class_exists('VmMediaHandler')) {
             require VMPATH_ADMIN . DS . 'helpers' . DS . 'mediahandler.php';
         }
         $start = vRequest::getInt('start', 0);
         $type = vRequest::getCmd('mediatype', 0);
         $list = VmMediaHandler::displayImages($type, $start);
         echo vmJsApi::safe_json_encode($list);
     }
     jExit();
 }
开发者ID:virtuemart-fr,项目名称:virtuemart-fr,代码行数:33,代码来源:view.json.php

示例2: display

 function display($tpl = null)
 {
     $db = JFactory::getDBO();
     if ($virtuemart_media_id = vRequest::getInt('virtuemart_media_id')) {
         //$db = JFactory::getDBO();
         $query = 'SELECT `file_url`,`file_title` FROM `#__virtuemart_medias` where `virtuemart_media_id`=' . $virtuemart_media_id;
         $db->setQuery($query);
         $json = $db->loadObject();
         if (isset($json->file_url)) {
             $json->file_url = JURI::root() . $json->file_url;
             $json->msg = 'OK';
             echo vmJsApi::safe_json_encode($json);
         } else {
             $json->msg = '<b>' . vmText::_('COM_VIRTUEMART_NO_IMAGE_SET') . '</b>';
             echo json_encode($json);
         }
     } elseif ($custom_jplugin_id = vRequest::getInt('custom_jplugin_id')) {
         $table = '#__extensions';
         $ext_id = 'extension_id';
         $q = 'SELECT `params`,`element` FROM `' . $table . '` WHERE `' . $ext_id . '` = "' . $custom_jplugin_id . '"';
         $db->setQuery($q);
         $this->jCustom = $db->loadObject();
         $customModel = VmModel::getModel('custom');
         $this->custom = $customModel->getCustom();
         // Get the payment XML.
         $formFile = vRequest::filterPath(VMPATH_ROOT . DS . 'plugins' . DS . 'vmcustom' . DS . $this->jCustom->element . DS . $this->jCustom->element . '.xml');
         if (file_exists($formFile)) {
             VmConfig::loadJLang('plg_vmpsplugin', false);
             if (!class_exists('vmPlugin')) {
                 require VMPATH_PLUGINLIBS . DS . 'vmplugin.php';
             }
             $filename = 'plg_vmcustom_' . $this->jCustom->element;
             vmPlugin::loadJLang($filename, 'vmcustom', $this->jCustom->element);
             $this->custom = VmModel::getModel('custom')->getCustom();
             $varsToPush = vmPlugin::getVarsToPushByXML($formFile, 'customForm');
             $this->custom->form = JForm::getInstance($this->jCustom->element, $formFile, array(), false, '//vmconfig | //config[not(//vmconfig)]');
             $this->custom->params = new stdClass();
             foreach ($varsToPush as $k => $field) {
                 if (strpos($k, '_') != 0) {
                     $this->custom->params->{$k} = $field[0];
                 }
             }
             $this->custom->form->bind($this->custom->getProperties());
             $form = $this->custom->form;
             include VMPATH_ADMIN . DS . 'fields' . DS . 'formrenderer.php';
             echo '<input type="hidden" value="' . $this->jCustom->element . '" name="custom_value">';
         } else {
             $this->custom->form = null;
             //VmConfig::$echoDebug = 1;
             vmdebug('File does not exist ' . $formFile);
         }
     }
     jExit();
 }
开发者ID:cybershocik,项目名称:Darek,代码行数:54,代码来源:view.json.php

示例3: display

    function display($tpl = null)
    {
        $states = array();
        $db = JFactory::getDBO();
        //retrieving countries id
        $country_ids = vRequest::getString('tsmart_country_id');
        $country_ids = explode(',', $country_ids);
        foreach ($country_ids as $country_id) {
            $q = 'SELECT `tsmart_state_id`, `state_name` FROM `#__tsmart_states`  WHERE `tsmart_country_id`= "' . (int) $country_id . '"
				ORDER BY `#__tsmart_states`.`state_name`';
            $db->setQuery($q);
            $states[$country_id] = $db->loadAssocList();
        }
        echo vmJsApi::safe_json_encode($states);
    }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:15,代码来源:view.json.php

示例4: Plugin

 /**
  * Method to render the plugin datas
  * this is an entry point to plugin to easy renders json or html
  *
  *
  * @access	public
  */
 function Plugin()
 {
     $user = JFactory::getUser();
     if (!($user->authorise('core.admin', 'com_virtuemart') or $user->authorise('core.manage', 'com_virtuemart'))) {
         return false;
     }
     $type = vRequest::getCmd('type', 'vmcustom');
     $typeWhiteList = array('vmshopper', 'vmcustom', 'vmcalculation', 'vmpayment', 'vmshipment', 'vmuserfield');
     if (!in_array($type, $typeWhiteList)) {
         return false;
     }
     $name = vRequest::getString('name', '');
     JPluginHelper::importPlugin($type, $name);
     $dispatcher = JDispatcher::getInstance();
     // if you want only one render simple in the plugin use jExit();
     // or $render is an array of code to echo as html or json Object!
     $render = null;
     $dispatcher->trigger('plgVmOnSelfCallBE', array($type, $name, &$render));
     if ($render) {
         // Get the document object.
         $document = JFactory::getDocument();
         if (vRequest::getCmd('cache', 'no')) {
             JResponse::setHeader('Cache-Control', 'no-cache, must-revalidate');
             JResponse::setHeader('Expires', 'Mon, 6 Jul 2000 10:00:00 GMT');
         }
         $format = vRequest::getCmd('format', 'json');
         if ($format == 'json') {
             $document->setMimeEncoding('application/json');
             // Change the suggested filename.
             JResponse::setHeader('Content-Disposition', 'attachment;filename="' . $type . '".json"');
             echo vmJsApi::safe_json_encode($render);
         } else {
             echo $render;
         }
     }
     return true;
 }
开发者ID:cybershocik,项目名称:Darek,代码行数:44,代码来源:plugin.php

示例5: updateCustomsOrderItems

 public function updateCustomsOrderItems()
 {
     $q = 'SELECT `product_attribute` FROM `#__virtuemart_order_items` LIMIT ';
     $do = true;
     $db = JFactory::getDbo();
     $start = 0;
     $hunk = 1000;
     while ($do) {
         $db->setQuery($q . $start . ',' . $hunk);
         $items = $db->loadColumn();
         if (!$items) {
             vmdebug('updateCustomsOrderItems Reached end after ' . $start / $hunk . ' loops');
             break;
         }
         //The stored result in vm2.0.14 looks like this {"48":{"textinput":{"comment":"test"}}}
         //{"96":"18"} download plugin
         // 46 is virtuemart_customfield_id
         //{"46":" <span class=\"costumTitle\">Cap Size<\/span><span class=\"costumValue\" >S<\/span>","110":{"istraxx_customsize":{"invala":"10","invalb":"10"}}}
         //and now {"32":[{"invala":"100"}]}
         foreach ($items as $field) {
             if (strpos($field, '{') !== FALSE) {
                 $jsField = json_decode($field);
                 $fieldProps = get_object_vars($jsField);
                 vmdebug('updateCustomsOrderItems', $fieldProps);
                 $nJsField = array();
                 foreach ($fieldProps as $k => $props) {
                     if (is_object($props)) {
                         $props = (array) $props;
                         foreach ($props as $ke => $prop) {
                             if (!is_numeric($ke)) {
                                 vmdebug('Found old param style', $ke, $prop);
                                 if (is_object($prop)) {
                                     $prop = (array) $prop;
                                     $nJsField[$k] = $prop;
                                     /*foreach($prop as $name => $propvalue){
                                     			$nJsField[$k][$name] = $propvalue;
                                     		}*/
                                 }
                             } else {
                                 //$nJsField[$k][$name] = $prop;
                             }
                         }
                     } else {
                         if (is_numeric($k) and is_numeric($props)) {
                             $nJsField[$props] = $k;
                         } else {
                             $nJsField[$k] = $props;
                         }
                     }
                 }
                 $nJsField = vmJsApi::safe_json_encode($nJsField);
                 vmdebug('updateCustomsOrderItems json $field encoded', $field, $nJsField);
             } else {
                 vmdebug('updateCustomsOrderItems $field', $field);
             }
         }
         if (count($items) < $hunk) {
             vmdebug('Reached end');
             break;
         }
         $start += $hunk;
     }
     // Create the view object
     $view = $this->getView('orders', 'html');
     $view->display();
 }
开发者ID:thumbs-up-sign,项目名称:TuVanDuAn,代码行数:66,代码来源:orders.php

示例6: fixCustomsParams

 public function fixCustomsParams()
 {
     $this->checkPermissionForTools();
     $q = 'SELECT `virtuemart_customfield_id` FROM `#__virtuemart_product_customfields` LEFT JOIN `#__virtuemart_customs` USING (`virtuemart_custom_id`) ';
     $q = 'SELECT `virtuemart_customfield_id`,`customfield_params` FROM `#__virtuemart_product_customfields` ';
     $q .= ' WHERE `customfield_params`!="" ';
     $db = JFactory::getDbo();
     $db->setQuery($q);
     $rows = $db->loadAssocList();
     foreach ($rows as $fields) {
         $store = '';
         $json = @json_decode($fields['customfield_params']);
         if ($json) {
             $vars = get_object_vars($json);
             foreach ($vars as $key => $value) {
                 $store .= $key . '=' . vmJsApi::safe_json_encode($value) . '|';
             }
             if (!empty($store)) {
                 $q = 'UPDATE `#__virtuemart_product_customfields` SET `customfield_params` = "' . $db->escape($store) . '" WHERE `virtuemart_customfield_id` = "' . $fields['virtuemart_customfield_id'] . '" ';
                 $db->setQuery($q);
                 $db->execute();
             }
         }
     }
     $msg = 'Executed';
     $this->setredirect($this->redirectPath, $msg);
 }
开发者ID:sam-akopyan,项目名称:hamradio,代码行数:27,代码来源:updatesmigration.php

示例7: array

			jQuery("input[name=\'"+fname+"[update_lines]\']").prop("checked",update_lines);
			jQuery("textarea[name=\'"+fname+"[comments]\']").text(comments);
			console.log("Mist ",jQuery("input[name=\'"+fname+"[comments]\']"));
			jQuery("#order_status"+i).val(newStatus).trigger("chosen:updated").trigger("liszt:updated");
		}
	}

}';
vmJsApi::addJScript('set2status', $j);
$j = "jQuery('.show_comment').click(function() {\n\t\tjQuery(this).prev('.element-hidden').show();\n\t\treturn false\n\t\t});\n\t\tjQuery('.element-hidden').mouseleave(function() {\n\t\tjQuery(this).hide();\n\t\t});\n\t\tjQuery('.element-hidden').mouseout(function() {\n\t\tjQuery(this).hide();\n\t});";
vmJsApi::addJScript('show_comment', $j);
$orderstatusForShopperEmail = VmConfig::get('email_os_s', array('U', 'C', 'S', 'R', 'X'));
if (!is_array($orderstatusForShopperEmail)) {
    $orderstatusForShopperEmail = array($orderstatusForShopperEmail);
}
$jsOrderStatusShopperEmail = vmJsApi::safe_json_encode($orderstatusForShopperEmail);
$j = '
	jQuery(document).ready(function() {
		jQuery(".orderstatus_select").change( function() {

			var name = jQuery(this).attr("name");
			var brindex = name.indexOf("orders[");
			if ( brindex >= 0){
				//yeh, yeh, maybe not the most elegant way, but it does, what it should
				var s = name.indexOf("[")+1;
				var e = name.indexOf("]");
				var id = name.substring(s,e);

				var orderstatus = ' . $jsOrderStatusShopperEmail . ';
				var selected = jQuery(this).val();
				var selStr = "[name=\\"orders["+id+"][customer_notified]\\"]";
开发者ID:virtuemart-fr,项目名称:virtuemart-fr,代码行数:31,代码来源:orders.php

示例8: _createOrderLines

 /**
  * Create the ordered item records
  *
  * @author Oscar van Eijk
  * @author Kohl Patrick
  * @param integer $_id integer Order ID
  * @param object $_cart array The cart data
  * @return boolean True on success
  */
 private function _createOrderLines($virtuemart_order_id, $cart)
 {
     $_orderItems = $this->getTable('order_items');
     foreach ($cart->products as $priceKey => $product) {
         $_orderItems->product_attribute = vmJsApi::safe_json_encode($product->customProductData);
         $_orderItems->virtuemart_order_item_id = null;
         $_orderItems->virtuemart_order_id = $virtuemart_order_id;
         $_orderItems->virtuemart_vendor_id = $product->virtuemart_vendor_id;
         $_orderItems->virtuemart_product_id = $product->virtuemart_product_id;
         $_orderItems->order_item_sku = $product->product_sku;
         $_orderItems->order_item_name = $product->product_name;
         $_orderItems->product_quantity = $product->quantity;
         $_orderItems->product_item_price = $product->allPrices[$product->selectedPrice]['basePriceVariant'];
         $_orderItems->product_basePriceWithTax = $product->allPrices[$product->selectedPrice]['basePriceWithTax'];
         //$_orderItems->product_tax = $_cart->pricesUnformatted[$priceKey]['subtotal_tax_amount'];
         $_orderItems->product_tax = $product->allPrices[$product->selectedPrice]['taxAmount'];
         $_orderItems->product_final_price = $product->allPrices[$product->selectedPrice]['salesPrice'];
         $_orderItems->product_subtotal_discount = $product->allPrices[$product->selectedPrice]['subtotal_discount'];
         $_orderItems->product_subtotal_with_tax = $product->allPrices[$product->selectedPrice]['subtotal_with_tax'];
         $_orderItems->product_priceWithoutTax = $product->allPrices[$product->selectedPrice]['priceWithoutTax'];
         $_orderItems->product_discountedPriceWithoutTax = $product->allPrices[$product->selectedPrice]['discountedPriceWithoutTax'];
         $_orderItems->order_status = 'P';
         if (!$_orderItems->check()) {
             return false;
         }
         // Save the record to the database
         if (!$_orderItems->store()) {
             return false;
         }
         $product->virtuemart_order_item_id = $_orderItems->virtuemart_order_item_id;
         $this->handleStockAfterStatusChangedPerProduct($_orderItems->order_status, 'N', $_orderItems, $_orderItems->product_quantity);
     }
     return true;
 }
开发者ID:thumbs-up-sign,项目名称:TuVanDuAn,代码行数:43,代码来源:orders.php

示例9: storeParams

 function storeParams()
 {
     if (!empty($this->_xParams) and !empty($this->_varsToPushParam)) {
         $paramFieldName = $this->_xParams;
         $this->{$paramFieldName} = '';
         $this->_tmpParams = array();
         foreach ($this->_varsToPushParam as $key => $v) {
             if (isset($this->{$key})) {
                 $this->{$paramFieldName} .= $key . '=' . vmJsApi::safe_json_encode($this->{$key}) . '|';
                 $this->_tmpParams[$key] = $this->{$key};
             } else {
                 $this->{$paramFieldName} .= $key . '=' . vmJsApi::safe_json_encode($v[0]) . '|';
                 $this->_tmpParams[$key] = $v[0];
             }
             unset($this->{$key});
         }
     }
     return true;
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:19,代码来源:tsmtable.php

示例10: ajax_waitinglist

 public function ajax_waitinglist()
 {
     $tsmart_product_id = vRequest::getInt('tsmart_product_id');
     if (is_array($tsmart_product_id) && count($tsmart_product_id) > 0) {
         $tsmart_product_id = (int) $tsmart_product_id[0];
     } else {
         $tsmart_product_id = (int) $tsmart_product_id;
     }
     $waitinglistmodel = tmsModel::getModel('waitinglist');
     $waitinglist = $waitinglistmodel->getWaitingusers($tsmart_product_id);
     if (empty($waitinglist)) {
         $waitinglist = array();
     }
     echo vmJsApi::safe_json_encode($waitinglist);
     exit;
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:16,代码来源:product.php

示例11: paste

 /**
  * Paste the table  in json format
  *
  */
 public function paste()
 {
     // TODO Test user ?
     $json = array();
     $json['fields'] = 'error';
     $json['msg'] = 'Invalid Token';
     $json['structure'] = 'empty';
     if (!vRequest::vmCheckToken(-1)) {
         echo json_encode($json);
         jexit();
     }
     $lang = vRequest::getvar('lg');
     $langs = tsmConfig::get('active_languages', array());
     $language = JFactory::getLanguage();
     if (!in_array($lang, $langs)) {
         $json['msg'] = 'Invalid language ! ' . $lang;
         $json['langs'] = $langs;
         echo json_encode($json);
         jexit();
     }
     $lang = strtolower($lang);
     // Remove tag if defaut or
     // if ($language->getDefault() == $lang ) $dblang ='';
     $dblang = strtr($lang, '-', '_');
     tsmConfig::$vmlang = $dblang;
     $id = vRequest::getInt('id', 0);
     $viewKey = vRequest::getCmd('editView');
     // TODO temp trick for vendor
     if ($viewKey == 'vendor') {
         $id = 1;
     }
     $tables = array('category' => 'categories', 'product' => 'products', 'manufacturer' => 'manufacturers', 'manufacturercategories' => 'manufacturercategories', 'vendor' => 'vendors', 'paymentmethod' => 'paymentmethods', 'shipmentmethod' => 'shipmentmethods');
     if (!array_key_exists($viewKey, $tables)) {
         $json['msg'] = "Invalid view " . $viewKey;
         echo json_encode($json);
         jExit();
     }
     $tableName = '#__tsmart_' . $tables[$viewKey] . '_' . $dblang;
     $m = tmsModel::getModel('coupon');
     $table = $m->getTable($tables[$viewKey]);
     //Todo create method to load lang fields only
     $table->load($id);
     $vs = $table->loadFieldValues();
     $lf = $table->getTranslatableFields();
     $json['fields'] = array();
     foreach ($lf as $v) {
         if (isset($vs[$v])) {
             $json['fields'][$v] = $vs[$v];
         }
     }
     //if ($json['fields'] = $db->loadAssoc()) {
     if ($table->getLoaded()) {
         $json['structure'] = 'filled';
         $json['msg'] = tsmText::_('com_tsmart_SELECTED_LANG') . ':' . $lang;
     } else {
         $db = JFactory::getDBO();
         $json['structure'] = 'empty';
         $db->setQuery('SHOW COLUMNS FROM ' . $tableName);
         $tableDescribe = $db->loadAssocList();
         array_shift($tableDescribe);
         $fields = array();
         foreach ($tableDescribe as $key => $val) {
             $fields[$val['Field']] = $val['Field'];
         }
         $json['fields'] = $fields;
         $json['msg'] = tsmText::sprintf('com_tsmart_LANG_IS_EMPTY', $lang, tsmText::_('com_tsmart_' . strtoupper($viewKey)));
     }
     echo vmJsApi::safe_json_encode($json);
     jExit();
 }
开发者ID:cuongnd,项目名称:etravelservice,代码行数:74,代码来源:translate.php


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