Browse Source

attempt an appcache

pull/10/head
Aaron Parecki 5 years ago
parent
commit
c49835ad37
4 changed files with 27 additions and 5 deletions
  1. +7
    -3
      controllers/controllers.php
  2. +6
    -1
      lib/helpers.php
  3. +13
    -0
      views/appcache.php
  4. +1
    -1
      views/layout.php

+ 7
- 3
controllers/controllers.php View File

@ -238,7 +238,7 @@ $app->get('/new/options', function() use($app) {
$app->get('/map.png', function() use($app) {
$params = $app->request()->params();
$url = static_map($params['latitude'], $params['longitude']);
$url = get_static_map($_SERVER['QUERY_STRING']);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$img = curl_exec($ch);
@ -246,6 +246,12 @@ $app->get('/map.png', function() use($app) {
$app->response()->body($img);
});
$app->get('/teacup.appcache', function() use($app) {
$content = partial('appcache');
$app->response()['Content-type'] = 'text/cache-manifest';
$app->response()->body($content);
});
$app->get('/:domain', function($domain) use($app) {
$params = $app->request()->params();
@ -325,5 +331,3 @@ $app->get('/:domain/:entry', function($domain, $entry_id) use($app) {
));

+ 6
- 1
lib/helpers.php View File

@ -171,7 +171,12 @@ function get_syndication_targets(&$user) {
}
function static_map($latitude, $longitude, $height=174, $width=300, $zoom=14) {
return 'http://static-maps.pdx.esri.com/img.php?marker[]=lat:' . $latitude . ';lng:' . $longitude . ';icon:small-green-cutout&basemap=topo&width=' . $width . '&height=' . $height . '&zoom=' . $zoom;
#return 'http://static-maps.pdx.esri.com/img.php?marker[]=lat:' . $latitude . ';lng:' . $longitude . ';icon:small-green-cutout&basemap=topo&width=' . $width . '&height=' . $height . '&zoom=' . $zoom;
return '/map.png?marker[]=lat:' . $latitude . ';lng:' . $longitude . ';icon:small-green-cutout&basemap=topo&width=' . $width . '&height=' . $height . '&zoom=' . $zoom;
}
function get_static_map($query) {
return 'http://static-maps.pdx.esri.com/img.php?' . $query;
}
function relative_time($date) {

+ 13
- 0
views/appcache.php View File

@ -0,0 +1,13 @@
CACHE MANIFEST
/new
/bootstrap/css/bootstrap.min.css
/bootstrap/css/bootstrap-theme.css
/bootstrap/css/bootstrap-theme.css.map
/css/font-awesome/css/font-awesome.min.css
/css/style.css
/js/jquery-1.7.1.min.js
/images/teacup-logo-144.png
/images/spinner.gif
NETWORK:
*

+ 1
- 1
views/layout.php View File

@ -1,5 +1,5 @@
<!doctype html>
<html lang="en">
<html lang="en" manifest="teacup.appcache">
<head>
<title><?= $this->title ?></title>
<meta charset="utf-8">

Loading…
Cancel
Save