コード例 #1
0
ファイル: ptlist.php プロジェクト: dieterdreist/OpenLinkMap
<?php

/*
OpenLinkMap Copyright (C) 2010 Alexander Matheisen
This program comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it under certain conditions.
See http://wiki.openstreetmap.org/wiki/OpenLinkMap for details.
*/
require_once "functions.php";
$bbox = $_GET['bbox'];
$callback = $_GET['callback'];
$format = $_GET['format'];
// correct bbox
$coordinates = getBbox($bbox);
if (!$coordinates) {
    exit;
}
$connection = connectToDatabase("nextobjects");
if (!$connection) {
    exit;
}
$list = getPtForBbox($connection, $coordinates);
if ($list) {
    header("Content-Type: text/plain; charset=UTF-8");
    if ($format == "json") {
        $data = array();
        foreach ($list as $line) {
            array_push($data, $line);
        }
        $jsonData = json_encode($data);
        // JSONP request?
コード例 #2
0
ファイル: copy_bounds.php プロジェクト: januslinhc/cufon
<?php

define('BBOX_MARKER', '"bbox":');
function getBbox($content)
{
    $bboxStartPos = strpos($content, BBOX_MARKER) + strlen(BBOX_MARKER) + 1;
    $bboxEndPos = strpos($content, '"', $bboxStartPos + 1) - 1;
    return substr($content, $bboxStartPos, $bboxEndPos - $bboxStartPos);
}
$fontFiles = scandir('fonts/js');
if ($fontFiles !== FALSE) {
    foreach ($fontFiles as $fontFile) {
        if ($fontFile != '.' && $fontFile != '..') {
            $content = file_get_contents("fonts/js/{$fontFile}");
            $oldContent = file_get_contents("oldfonts/js/{$fontFile}");
            $bbox = getBbox($content);
            $oldBbox = getBbox($oldContent);
            if ($bbox != $oldBbox) {
                echo "Updating bbox for {$fontFile} from {$bbox} to {$oldBbox}";
                $modifiedContent = str_replace(BBOX_MARKER . '"' . $bbox, BBOX_MARKER . '"' . $oldBbox, $content);
                file_put_contents("fonts/js/{$fontFile}", $modifiedContent);
            }
        }
    }
}