本文整理汇总了PHP中my_json_decode函数的典型用法代码示例。如果您正苦于以下问题:PHP my_json_decode函数的具体用法?PHP my_json_decode怎么用?PHP my_json_decode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了my_json_decode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ExportExcelRecord
function ExportExcelRecord($arrdata, $datatype, $numberRow, $objPHPExcel, $pageObj)
{
global $cCharset, $locale_info;
$col = -1;
$objASIndex = $objPHPExcel->setActiveSheetIndex(0);
$objASheet = $objPHPExcel->getActiveSheet();
$rowDim = $objASIndex->getRowDimension($numberRow + 1);
foreach ($arrdata as $field => $data) {
$col++;
$colLetter = PHPExcel_Cell::stringFromColumnIndex($col);
$colDim = $objASIndex->getColumnDimension($colLetter);
if ($datatype[$field] == "binary") {
if (!$data) {
continue;
}
if (!function_exists("imagecreatefromstring")) {
$objASIndex->setCellValueByColumnAndRow($col, $numberRow + 1, "LONG BINARY DATA - CANNOT BE DISPLAYED");
continue;
}
$error_handler = set_error_handler("empty_error_handler");
$gdImage = imagecreatefromstring($data);
if ($error_handler) {
set_error_handler($error_handler);
}
if ($gdImage) {
$objDrawing = new PHPExcel_Worksheet_MemoryDrawing();
$objDrawing->setImageResource($gdImage);
$objDrawing->setCoordinates($colLetter . ($row + 1));
$objDrawing->setWorksheet($objASheet);
$width = $objDrawing->getWidth() * 0.143;
$height = $objDrawing->getHeight() * 0.75;
if ($rowDim->getRowHeight() < $height) {
$rowDim->setRowHeight($height);
}
$colDimSh = $objASheet->getColumnDimension($colLetter);
$colDimSh->setAutoSize(false);
if ($colDim->getWidth() < $width) {
$colDim->setWidth($width);
}
}
} elseif ($datatype[$field] == "file") {
$arr = my_json_decode($row[$field]);
if (count($arr) == 0) {
$data = PHPExcel_Shared_String::ConvertEncoding($data, 'UTF-8', $cCharset);
if ($data == "<img src=\"images/no_image.gif\" />") {
$arr[] = array("name" => "images/no_image.gif");
} else {
if (substr($data, 0, 1) == '=') {
$data = '="' . str_replace('"', '""', $data) . '"';
}
$objASIndex->setCellValueByColumnAndRow($col, $numberRow + 1, $data);
continue;
}
}
$offsetY = 0;
$height = 0;
foreach ($arr as $img) {
if (!file_exists($img["name"]) || !$img["name"]) {
$data = PHPExcel_Shared_String::ConvertEncoding($data, 'UTF-8', $cCharset);
if (substr($data, 0, 1) == '=') {
$data = '="' . str_replace('"', '""', $data) . '"';
}
$objASIndex->setCellValueByColumnAndRow($col, $numberRow + 1, $data);
continue;
}
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setPath($img["name"]);
$objDrawing->setCoordinates($colLetter . ($numberRow + 1));
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
$objDrawing->setOffsetY($offsetY);
$width = $objDrawing->getWidth() * 0.143;
$height = $height + $objDrawing->getHeight() * 0.75;
$offsetY = $offsetY + $objDrawing->getHeight();
if ($rowDim->getRowHeight() < $height) {
$rowDim->setRowHeight($height);
}
$colDimSh = $objASheet->getColumnDimension($colLetter);
$colDimSh->setAutoSize(false);
if ($colDim->getWidth() < $width) {
$colDim->setWidth($width);
}
}
} else {
$data = PHPExcel_Shared_String::ConvertEncoding($data, 'UTF-8', $cCharset);
if (substr($data, 0, 1) == '=') {
$data = '="' . str_replace('"', '""', $data) . '"';
}
$objASIndex->setCellValueByColumnAndRow($col, $numberRow + 1, $data);
if ($datatype[$field] == "date") {
$objStyle = $objASIndex->getStyle($colLetter . ($numberRow + 1));
$objNumFrm = $objStyle->getNumberFormat();
$objNumFrm->setFormatCode($locale_info["LOCALE_SSHORTDATE"] . " hh:mm:ss");
}
}
}
}
示例2: buildControl
function buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data)
{
parent::buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data);
if ($this->pageObject->pageType == PAGE_SEARCH || $this->pageObject->pageType == PAGE_LIST) {
echo '<input id="' . $this->cfield . '" ' . $this->inputStyle . ' type="text" ' . ($mode == MODE_SEARCH ? 'autocomplete="off" ' : '') . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 == true ? 'alt="' . $this->strLabel . '" ' : '') . 'name="' . $this->cfield . '" ' . $this->pageObject->pSetEdit->getEditParams($this->field) . ' value="' . runner_htmlspecialchars($value) . '">';
$this->buildControlEnd($validate);
return;
}
if ($mode == MODE_SEARCH) {
$this->format = "";
}
$disp = "";
$strfilename = "";
$filename_size = 30;
if ($this->pageObject->pSetEdit->isUseTimestamp($this->field)) {
$filename_size = 50;
}
if ($mode == MODE_EDIT || $mode == MODE_INLINE_EDIT) {
// show current file
$newUploaderFilesData = my_json_decode($value);
$newUploaderWasUsed = is_array($newUploaderFilesData) && count($newUploaderFilesData) > 0;
$fileData = $newUploaderWasUsed ? $newUploaderFilesData[0] : array();
$fileName = $newUploaderWasUsed ? $fileData["usrName"] : $value;
$viewFormat = $this->pageObject->pSetEdit->getViewFormat($this->field);
if ($viewFormat == FORMAT_FILE || $viewFormat == FORMAT_FILE_IMAGE) {
$disp = $this->getFileOrImageMarkup($value, $fileName, $newUploaderWasUsed, $fileData) . "<br />";
}
// filename edit
$strfilename = '<input type=hidden name="filenameHidden_' . $this->cfieldname . '" value="' . runner_htmlspecialchars($fileName) . '"><br>' . "Filename" . ' <input type="text" style="background-color:gainsboro" disabled id="filename_' . $this->cfieldname . '" name="filename_' . $this->cfieldname . '" size="' . $filename_size . '" maxlength="100" value="' . runner_htmlspecialchars($fileName) . '">';
$strtype = '<br><input id="' . $this->ctype . '_keep" type="Radio" name="' . $this->ctype . '" value="upload0" checked class="rnr-uploadtype">' . "Keep";
if ((strlen($value) || $mode == MODE_INLINE_EDIT) && !$this->pageObject->pSetEdit->isRequired($this->field)) {
$strtype .= '<input id="' . $this->ctype . '_delete" type="Radio" name="' . $this->ctype . '" value="upload1" class="rnr-uploadtype">' . "Delete";
}
$strtype .= '<input id="' . $this->ctype . '_update" type="Radio" name="' . $this->ctype . '" value="upload2" class="rnr-uploadtype">' . "Update";
} else {
// if Adding record
$strtype = '<input id="' . $this->ctype . '" type="hidden" name="' . $this->ctype . '" value="upload2">';
$strfilename = '<br>' . "Filename" . ' <input type="text" id="filename_' . $this->cfieldname . '" name="filename_' . $this->cfieldname . '" size="' . $filename_size . '" maxlength="100">';
}
echo $disp . $strtype;
if ($mode == MODE_EDIT || $mode == MODE_INLINE_EDIT) {
echo '<br>';
}
echo '<input type="File" id="' . $this->cfield . '" ' . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 == true ? 'alt="' . $this->strLabel . '" ' : '') . ' name="' . $this->cfield . '" >' . $strfilename;
echo '<input type="Hidden" id="notempty_' . $this->cfieldname . '" value="' . (strlen($value) ? 1 : 0) . '">';
$this->buildControlEnd($validate);
}
示例3: getFilesArray
function getFilesArray($value)
{
$filesArray = my_json_decode($value);
if (!is_array($filesArray) || count($filesArray) == 0) {
if ($value == "") {
$filesArray = array();
} else {
$uploadedFile = $this->upload_handler->get_file_object($value);
if (is_null($uploadedFile)) {
$filesArray = array();
} else {
$filesArray = array(my_json_decode(my_json_encode($uploadedFile)));
}
}
}
return $filesArray;
}
示例4: lf_query
/** LF-API documentation http://www.public-software-group.org/liquid_feedback_frontend_api
/**
* Queries the LiquidFeeback instance provided by $lf with $query
* @params:
* $lf['base_dir'] :the base of the LiquidFeedback instance, e.g. 'lqpp.de/be'
* $lf['api_key'] :your LiquidFeeback API key
* $query :the query to sent, e.g. 'min_id=0' to get all initiatives
* @returns an array of initiatives
*
* As of now the LF-API throws an error when using the state selector.
*/
function lf_query($lf, $query)
{
$query = $lf['base_dir'] . '/api/initiative.html?key=' . $lf['api_key'] . '&api_engine=json&' . $query;
$ch = curl_init($query);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($httpcode != 200) {
log_this("error: tried to fetch \"{$query}\" from " . $lf['base_dir'], $response);
return false;
} else {
log_this("success: fetched \"{$query}\" from " . $lf['base_dir'], $response);
return my_json_decode($response);
}
}
示例5: shortlink
/**
* Shorens the provided url with bit.ly
* @params:
* $url :string, the url to be shortened
* @returns the shortened url or false
*/
function shortlink($url)
{
//Url verkürzen
$ch = curl_init('http://api.bit.ly/v3/shorten?login=' . BL_LOGIN . '&apiKey=' . BL_API_KEY . '&uri=' . urlencode($url) . '&format=json');
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$response = my_json_decode($response);
if ($httpcode != 200) {
log_this("error: tried to shorten '{$url}'", $reponse);
return false;
} else {
log_this("success: shortened '{$url}'", $reponse);
return stripslashes($response['data']['url']);
}
}
示例6: array
echo "OK";
exit;
}
if (postvalue("name") == "viewsql") {
$arr = array();
$arr = array(0, "", postvalue("output"));
$customSQL = $arr[2];
$_SESSION["customSQL"] = $customSQL;
$_SESSION["idSQL"] = $arr[0];
$_SESSION["nameSQL"] = $arr[1];
$_SESSION["object_sql"] = $customSQL;
echo $customSQL;
exit;
}
if (postvalue("name") == "getcustomsql") {
$arr = array();
$arr = WRgetCurrentCustomSQL(postvalue("output"));
$customSQL = $arr[2];
$_SESSION["customSQL"] = $customSQL;
$_SESSION["idSQL"] = $arr[0];
$_SESSION["nameSQL"] = $arr[1];
$_SESSION["object_sql"] = $customSQL;
echo $customSQL;
exit;
}
$arr = my_json_decode(DecodeUTF8(postvalue("output")));
$_connection->exec("delete from " . $_connection->addTableWrappers("webreport_admin"));
foreach ($arr as $val) {
$_connection->exec("insert into " . $_connection->addTableWrappers("webreport_admin") . " (" . $_connection->addFieldWrappers("tablename") . "," . $_connection->addFieldWrappers("db_type") . "," . $_connection->AddFieldWrappers("group_name") . ")" . " values (" . $_connection->prepareString($val["table"]) . ",'" . $val["db_type"] . "'," . $_connection->prepareString($val["group"]) . ")");
}
echo "OK";
示例7: my_json_decode
<?php
include "include/dbcommon.php";
$params = (array) my_json_decode(postvalue('params'));
$buttId = $params['buttId'];
// proccess table events
// proccess non table events
// create table and non table handlers
示例8: upload_File
upload_File($importFileData, $rnrTempImportFilePath);
}
// keep the temporary path in the SESSION variable
$_SESSION[$pageObject->sessionPrefix . "_tempImportFilePath"] = $rnrTempImportFilePath;
echo printJSON($returnJSON, postvalue("useXHR"));
exit;
}
if ($action == "importData") {
if ($eventObj->exists('BeforeImport')) {
if ($eventObj->BeforeImport($pageObject) === false) {
echo printJSON(array());
exit(0);
}
}
$rnrTempImportFilePath = $_SESSION[$pageObject->sessionPrefix . "_tempImportFilePath"];
$importData = my_json_decode(postvalue("importData"));
$resultData = $pageObject->ImportFromFile($rnrTempImportFilePath, $importData);
// remove a temporary import file
runner_delete_file($rnrTempImportFilePath);
if ($eventObj->exists('AfterImport')) {
$eventObj->AfterImport($goodlines, $resultData["unprocessedRecordsNumber"], $pageObject);
}
// keep all necessary data in SESSION variables
$_SESSION[$pageObject->sessionPrefix . "_tempImportLogFilePath"] = $resultData["logFilePath"];
if ($resultData["unprocessedRecordsNumber"]) {
$_SESSION[$pageObject->sessionPrefix . "_tempDataFilePath"] = $resultData["unprocessedFilePath"];
}
echo printJSON($resultData);
exit;
}
if ($action == "downloadReport") {
示例9: process_request
function process_request($req)
{
if ($req['o'] == 'get') {
$param = new stdClass();
if (isset($req['start'])) {
$param->start = $req['start'];
}
if (isset($req['limit'])) {
$param->limit = $req['limit'];
}
if (isset($req['sort'])) {
$param->sort = $req['sort'];
}
if (isset($req['dir'])) {
$param->dir = $req['dir'];
}
if (isset($req['filter'])) {
$filter = my_json_decode($req['filter']);
$param->filter = object_set::make_filter($filter);
}
$result = $this->get_items($param);
} else {
if ($req['o'] == 'count') {
$filter = NULL;
if (isset($req['filter'])) {
$filter = my_json_decode($req['filter']);
}
$result = $this->count_items($filter);
} else {
if ($req['o'] == 'add') {
$item = my_json_decode($req['item']);
$result = $this->add_item($item);
if (isset($result['data'])) {
// JosnStore需要一个记录集,即数组
//$result['data'] = array($result['data']);
}
} else {
if ($req['o'] == 'mod') {
$item = my_json_decode($req['item']);
$filter = NULL;
if (isset($req['filter'])) {
$filter = my_json_decode($req['filter']);
}
$result = $this->mod_item($item, $filter);
if (isset($result['data'])) {
// JosnStore需要一个记录集,即数组
//$result['data'] = array($result['data']);
}
} else {
if ($req['o'] == 'del') {
if (isset($req['id'])) {
$id = my_json_decode($req['id']);
$result = $this->del_item($id);
} else {
if (isset($req['ids'])) {
$ids = my_json_decode($req['ids']);
foreach ($ids as $id) {
$result[] = $this->del_item($id);
}
$result = array(success => true, data => $result);
}
}
} else {
$result = array(success => false, message => '未知请求类型');
}
}
}
}
}
return $result;
}
示例10: getOpenFilters
/**
* Extract the array containing the open search panel control's names
* from the Search panel coockie
* @return Array
*/
function getOpenFilters()
{
$panelsStates = my_json_decode(@$_COOKIE["searchPanel"]);
if (!is_array($panelsStates)) {
return array();
}
$panelKey = "panelState_" . GoodFieldName($this->pageObj->tName) . "_" . $this->pageObj->id;
if (!array_key_exists($panelKey, $panelsStates)) {
return array();
}
$panelStateObj = $panelsStates[$panelKey];
return $this->refineOpenFilters($panelStateObj["openFilters"]);
}
示例11: unset
unset($root['type']);
comlete_chart_session_default_values(true);
save_sql("webcharts");
}
}
} else {
if ($_POST['web'] == "webreports") {
save_sql("webreports");
}
if ($_POST['web'] == "webcharts") {
save_sql("webcharts");
}
}
echo "OK";
} elseif (isset($_POST['str_xml']) && isset($_POST['web']) && isset($_POST['save'])) {
$arr = my_json_decode(DecodeUTF8(postvalue('str_xml')));
if (count($arr["parameters"]) < 2 && $_POST['web'] == 'webcharts' && $_POST['name'] == 'parameters') {
echo "Debe seleccionar al menos una serie";
return;
}
if ($_POST['web'] == "webreports") {
Check_Crosstable_Group($arr, isset($_POST['save']));
$is_crosstable = $root["group_fields"][count($root["group_fields"]) - 1]["cross_table"];
Check_Crosstable_Totals($arr, $is_crosstable);
}
$saveas = false;
if (isset($_POST['saveas'])) {
$saveas = true;
}
foreach ($arr as $key => $val) {
$root[$key] = $val;
示例12: getFiltersState
/**
* Extract the array containing the filters
* states (expanded/collapsed) from the Filter panel coockie
* @return Array
*/
protected function getFiltersState()
{
$panelsStates = my_json_decode(@$_COOKIE["filterPanel"]);
if( !is_array($panelsStates) )
return array();
$panelKey = "filtersState_".GoodFieldName( $this->tName )."_".$this->id;
if( !array_key_exists($panelKey, $panelsStates) )
return array();
return $panelsStates[ $panelKey ];
}
示例13: postvalue
}
require_once "include/" . $mSTable . "_variables.php";
$dSTable = postvalue("dSTable");
if (!checkTableName($dSTable)) {
$respObj = array("success" => false, "error" => 'Wrong detail short table name');
echo my_json_encode($respObj);
return;
}
require_once "include/" . $dSTable . "_variables.php";
if (!isLogged() || !CheckSecurity(@$_SESSION["_" . $strTableName . "_OwnerID"], "Search")) {
$respObj = array("success" => false, "error" => '');
echo my_json_encode($respObj);
return;
}
require_once 'include/xtempl.php';
$mKeys = my_json_decode(postvalue("mKeys"));
$mTable = postvalue("mTable");
$dTable = postvalue("dTable");
$pageType = postvalue("pageType");
$xt = new Xtempl();
//array of params for classes
$params = array("pageType" => $pageType);
$params['xt'] =& $xt;
$params["tName"] = $mTable;
$params["needSearchClauseObj"] = false;
$pageObject = new RunnerPage($params);
//$pageObject->init();
for ($dInd = 0; $dInd < count($pageObject->allDetailsTablesArr); $dInd++) {
if ($pageObject->allDetailsTablesArr[$dInd]['dDataSourceTable'] == $dTable) {
break;
}
示例14: suggestValue
function suggestValue($value, $searchFor, &$response, &$row)
{
if (!$value) {
return;
}
$filesArray = my_json_decode($value);
if (!is_array($filesArray) || count($filesArray) == 0) {
$response[$value . ""] = $value . "";
} else {
for ($i = 0; $i < count($filesArray) && count($response) < 10; $i++) {
if ($this->pageObject->pSetEdit->getNCSearch()) {
if (stripos($filesArray[$i]["usrName"], $searchFor) !== false) {
$response[$filesArray[$i]["usrName"] . ""] = $filesArray[$i]["usrName"] . "";
}
} else {
if (strpos($filesArray[$i]["usrName"], $searchFor) !== false) {
$response[$filesArray[$i]["usrName"] . ""] = $filesArray[$i]["usrName"] . "";
}
}
}
}
}
示例15: array
//array of params for ReportPage constructor
$params = array();
$params["id"] = $id;
$params["xt"] =& $xt;
$params["mode"] = $pageMode;
$params["tName"] = $strTableName;
$params["pageType"] = PAGE_REPORT;
$params["isGroupSecurity"] = $isGroupSecurity;
$params["arrRecsPerPage"] = $gSettings->getRecordsPerPageArray();
$params["arrGroupsPerPage"] = $gSettings->getGroupsPerPageArray();
$params["masterTable"] = postvalue("mastertable");
if (postvalue("crosstable_refresh")) {
$params["crosstableRefresh"] = true;
}
if (isset($_REQUEST["masterKeys"])) {
$masterKeys = my_json_decode($_REQUEST["masterKeys"]);
}
$i = 0;
$params["masterKeysReq"] = array();
while (true) {
$i++;
if (isset($_REQUEST["masterkey" . $i])) {
$_masterKey = $_REQUEST["masterkey" . $i];
} elseif (isset($masterKeys["masterkey" . $i])) {
$_masterKey = $masterKeys["masterkey" . $i];
} else {
break;
}
$params["masterKeysReq"][$i] = $_masterKey;
}
if ($pageMode = REPORT_DASHBOARD) {