本文整理汇总了PHP中javascript_renderData函数的典型用法代码示例。如果您正苦于以下问题:PHP javascript_renderData函数的具体用法?PHP javascript_renderData怎么用?PHP javascript_renderData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了javascript_renderData函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: javascript_renderData
function javascript_renderData($xVal, $bForceHash = false)
{
if (is_array($xVal)) {
$aVals = array();
if (javascript_isarray($xVal) && !$bForceHash) {
foreach ($xVal as $sKey => $xData) {
$aVals[] = javascript_renderData($xData);
}
return '[' . join(',', $aVals) . ']';
} else {
foreach ($xVal as $sKey => $xData) {
$aVals[] = '"' . addslashes($sKey) . '"' . ':' . javascript_renderData($xData);
}
return '{' . join(',', $aVals) . '}';
}
} else {
if (is_bool($xVal)) {
return $xVal ? 'true' : 'false';
}
// if (is_numeric($xVal)) return $xVal;
return '"' . str_replace('>', '\\>', str_replace(array("\n", "\r"), '\\n', str_replace(array("\n\r", "\r\n"), '\\n', str_replace('"', '\\"', $xVal)))) . '"';
}
}
示例2: array
$aFilteredPlaces = array();
if (!sizeof($aPlace)) {
if (isset($sError)) {
$aFilteredPlaces['error'] = $sError;
} else {
$aFilteredPlaces['error'] = 'Unable to geocode';
}
} else {
if ($aPlace['place_id']) {
$aFilteredPlaces['place_id'] = $aPlace['place_id'];
}
$aFilteredPlaces['licence'] = "Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright";
$sOSMType = $aPlace['osm_type'] == 'N' ? 'node' : ($aPlace['osm_type'] == 'W' ? 'way' : ($aPlace['osm_type'] == 'R' ? 'relation' : ''));
if ($sOSMType) {
$aFilteredPlaces['osm_type'] = $sOSMType;
$aFilteredPlaces['osm_id'] = $aPlace['osm_id'];
}
if (isset($aPlace['lat'])) {
$aFilteredPlaces['lat'] = $aPlace['lat'];
}
if (isset($aPlace['lon'])) {
$aFilteredPlaces['lon'] = $aPlace['lon'];
}
$aFilteredPlaces['display_name'] = $aPlace['langaddress'];
if ($bShowAddressDetails) {
$aFilteredPlaces['address'] = $aPlace['aAddress'];
}
}
javascript_renderData($aFilteredPlaces);
示例3: javascript_renderData
echo "<place place_id='" . $aResult['place_id'] . "'";
$sOSMType = $aResult['osm_type'] == 'N' ? 'node' : ($aResult['osm_type'] == 'W' ? 'way' : ($aResult['osm_type'] == 'R' ? 'relation' : ''));
if ($sOSMType) {
echo " osm_type='{$sOSMType}'";
echo " osm_id='" . $aResult['osm_id'] . "'";
}
if (isset($aResult['aBoundingBox'])) {
echo ' boundingbox="';
echo $aResult['aBoundingBox'][0];
echo ',' . $aResult['aBoundingBox'][1];
echo ',' . $aResult['aBoundingBox'][2];
echo ',' . $aResult['aBoundingBox'][3];
echo '"';
if ($bShowPolygons) {
echo ' polygonpoints=\'';
echo javascript_renderData($aResult['aPolyPoints']);
echo '\'';
}
}
if (isset($aResult['zoom'])) {
echo " zoom='" . $aResult['zoom'] . "'";
}
echo " lat='" . $aResult['lat'] . "'";
echo " lon='" . $aResult['lon'] . "'";
echo " display_name='" . htmlspecialchars($aResult['name'], ENT_QUOTES) . "'";
echo " class='" . htmlspecialchars($aResult['class']) . "'";
echo " type='" . htmlspecialchars($aResult['type']) . "'";
if ($aResult['icon']) {
echo " icon='" . htmlspecialchars($aResult['icon'], ENT_QUOTES) . "'";
}
if (isset($aResult['address'])) {
示例4: json_decode
$aPlace['zoom'] = $aPointDetails['zoom'];
}
$aPlace['lat'] = $aPointDetails['lat'];
$aPlace['lon'] = $aPointDetails['lon'];
$aPlace['display_name'] = $aPointDetails['name'];
$aPlace['place_rank'] = $aPointDetails['rank_search'];
$aPlace['category'] = $aPointDetails['class'];
$aPlace['type'] = $aPointDetails['type'];
$aPlace['importance'] = $aPointDetails['importance'];
if (isset($aPointDetails['icon'])) {
$aPlace['icon'] = $aPointDetails['icon'];
}
if (isset($aPointDetails['address']) && sizeof($aPointDetails['address']) > 0) {
$aPlace['address'] = $aPointDetails['address'];
}
if (isset($aPointDetails['asgeojson'])) {
$aPlace['geojson'] = json_decode($aPointDetails['asgeojson']);
}
if (isset($aPointDetails['assvg'])) {
$aPlace['svg'] = $aPointDetails['assvg'];
}
if (isset($aPointDetails['astext'])) {
$aPlace['geotext'] = $aPointDetails['astext'];
}
if (isset($aPointDetails['askml'])) {
$aPlace['geokml'] = $aPointDetails['askml'];
}
$aFilteredPlaces[] = $aPlace;
}
javascript_renderData($aFilteredPlaces, array('geojson'));
示例5: json_decode
$aPlace['lat'] = $aPointDetails['lat'];
$aPlace['lon'] = $aPointDetails['lon'];
$aPlace['display_name'] = $aPointDetails['name'];
$aPlace['place_rank'] = $aPointDetails['rank_search'];
$aPlace['category'] = $aPointDetails['class'];
$aPlace['type'] = $aPointDetails['type'];
$aPlace['importance'] = $aPointDetails['importance'];
if (isset($aPointDetails['icon'])) {
$aPlace['icon'] = $aPointDetails['icon'];
}
if (isset($aPointDetails['address']) && sizeof($aPointDetails['address']) > 0) {
$aPlace['address'] = $aPointDetails['address'];
}
if (isset($aPointDetails['asgeojson'])) {
$aPlace['geojson'] = json_decode($aPointDetails['asgeojson']);
}
if (isset($aPointDetails['assvg'])) {
$aPlace['svg'] = $aPointDetails['assvg'];
}
if (isset($aPointDetails['astext'])) {
$aPlace['geotext'] = $aPointDetails['astext'];
}
if (isset($aPointDetails['askml'])) {
$aPlace['geokml'] = $aPointDetails['askml'];
}
$aFilteredPlaces[] = $aPlace;
}
$aOutput['batch'][] = $aFilteredPlaces;
}
javascript_renderData($aOutput, array('geojson'));
示例6: array
<?php
$details = array();
$details['lat'] = $aPointDetails['lat'];
$details['lon'] = $aPointDetails['lon'];
$details['address'] = array();
foreach ($aAddressLines as $aAddressLine) {
if (!is_null($aAddressLine["admin_level"])) {
$addressElement = array("localname" => $aAddressLine["localname"], "place_id" => $aAddressLine["place_id"], "osm_type" => $aAddressLine["osm_type"], "osm_id" => $aAddressLine["osm_id"], "type" => $aAddressLine["type"], "admin_level" => $aAddressLine["admin_level"]);
array_push($details['address'], $addressElement);
}
}
javascript_renderData($details);
示例7: array
$sOSMType = $aPlace['osm_type'] == 'N' ? 'node' : ($aPlace['osm_type'] == 'W' ? 'way' : ($aPlace['osm_type'] == 'R' ? 'relation' : ''));
$sOSMUrl = 'http://www.openstreetmap.org/browse/' . $sOSMType . '/' . $aPlace['osm_id'];
if ($sOutputFormat == 'html') {
if ($i) {
echo " > ";
}
}
if ($sOutputFormat == 'html') {
echo '<a href="' . $sPlaceUrl . '">' . $aPlace['localname'] . '</a> (<a href="' . $sOSMUrl . '">osm</a>)';
}
}
$aDetails = array();
$aDetails['breadcrumbs'] = $aBreadcrums;
if ($sOutputFormat == 'json') {
header("content-type: application/json; charset=UTF-8");
javascript_renderData($aDetails);
exit;
}
$aRelatedPlaceIDs = $oDB->getCol($sSQL = "select place_id from placex where linked_place_id = {$iPlaceID} or place_id = {$iPlaceID}");
$sSQL = "select obj.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, ST_GeometryType(geometry) in ('ST_Polygon','ST_MultiPolygon') as isarea, st_area(geometry) as area, ";
$sSQL .= " get_name_by_language(name,{$sLanguagePrefArraySQL}) as localname, length(name::text) as namelength ";
$sSQL .= " from (select placex.place_id, osm_type, osm_id, class, type, housenumber, admin_level, rank_address, rank_search, geometry, name from placex ";
$sSQL .= " where parent_place_id in (" . join(',', $aRelatedPlaceIDs) . ") and name is not null order by rank_address asc,rank_search asc limit 500) as obj";
$sSQL .= " order by rank_address asc,rank_search asc,localname,class, type,housenumber";
$aParentOfLines = $oDB->getAll($sSQL);
if (sizeof($aParentOfLines)) {
echo '<h2>Parent Of:</h2>';
$aClassType = getClassTypesWithImportance();
$aGroupedAddressLines = array();
foreach ($aParentOfLines as $aAddressLine) {
if (isset($aClassType[$aAddressLine['class'] . ':' . $aAddressLine['type'] . ':' . $aAddressLine['admin_level']]['label']) && $aClassType[$aAddressLine['class'] . ':' . $aAddressLine['type'] . ':' . $aAddressLine['admin_level']]['label']) {