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


PHP javascript_renderData函数代码示例

本文整理汇总了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)))) . '"';
    }
}
开发者ID:runderwood,项目名称:Nominatim,代码行数:23,代码来源:lib.php

示例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);
开发者ID:a4x,项目名称:Nominatim,代码行数:29,代码来源:address-json.php

示例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'])) {
开发者ID:alexasahis,项目名称:osm2pgsql,代码行数:31,代码来源:search-xml.php

示例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'));
开发者ID:a4x,项目名称:Nominatim,代码行数:30,代码来源:search-jsonv2.php

示例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'));
开发者ID:leforestier,项目名称:Nominatim,代码行数:30,代码来源:search-batch-json.php

示例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);
开发者ID:alexis779,项目名称:Nominatim,代码行数:13,代码来源:details-json.php

示例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']) {
开发者ID:physycom,项目名称:Nominatim,代码行数:31,代码来源:hierarchy.php


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