Merge branch '0.9.x' into activityatompub
@ -55,14 +55,14 @@ class StatusNet_URL_Mapper extends Net_URL_Mapper
|
||||
$result = null;
|
||||
if (Event::handle('StartConnectPath', array(&$path, &$defaults, &$rules, &$result))) {
|
||||
$result = parent::connect($path, $defaults, $rules);
|
||||
if (array_key_exists('action', $defaults)) {
|
||||
$action = $defaults['action'];
|
||||
} elseif (array_key_exists('action', $rules)) {
|
||||
$action = $rules['action'];
|
||||
} else {
|
||||
$action = null;
|
||||
}
|
||||
$this->_mapAction($action, $result);
|
||||
if (array_key_exists('action', $defaults)) {
|
||||
$action = $defaults['action'];
|
||||
} elseif (array_key_exists('action', $rules)) {
|
||||
$action = $rules['action'];
|
||||
} else {
|
||||
$action = null;
|
||||
}
|
||||
$this->_mapAction($action, $result);
|
||||
Event::handle('EndConnectPath', array($path, $defaults, $rules, $result));
|
||||
}
|
||||
return $result;
|
||||
@ -70,31 +70,31 @@ class StatusNet_URL_Mapper extends Net_URL_Mapper
|
||||
|
||||
protected function _mapAction($action, $path)
|
||||
{
|
||||
if (!array_key_exists($action, $this->_actionToPath)) {
|
||||
$this->_actionToPath[$action] = array();
|
||||
}
|
||||
$this->_actionToPath[$action][] = $path;
|
||||
return;
|
||||
if (!array_key_exists($action, $this->_actionToPath)) {
|
||||
$this->_actionToPath[$action] = array();
|
||||
}
|
||||
$this->_actionToPath[$action][] = $path;
|
||||
return;
|
||||
}
|
||||
|
||||
public function generate($values = array(), $qstring = array(), $anchor = '')
|
||||
{
|
||||
if (!array_key_exists('action', $values)) {
|
||||
return parent::generate($values, $qstring, $anchor);
|
||||
}
|
||||
if (!array_key_exists('action', $values)) {
|
||||
return parent::generate($values, $qstring, $anchor);
|
||||
}
|
||||
|
||||
$action = $values['action'];
|
||||
$action = $values['action'];
|
||||
|
||||
if (!array_key_exists($action, $this->_actionToPath)) {
|
||||
return parent::generate($values, $qstring, $anchor);
|
||||
}
|
||||
if (!array_key_exists($action, $this->_actionToPath)) {
|
||||
return parent::generate($values, $qstring, $anchor);
|
||||
}
|
||||
|
||||
$oldPaths = $this->paths;
|
||||
$this->paths = $this->_actionToPath[$action];
|
||||
$result = parent::generate($values, $qstring, $anchor);
|
||||
$this->paths = $oldPaths;
|
||||
$oldPaths = $this->paths;
|
||||
$this->paths = $this->_actionToPath[$action];
|
||||
$result = parent::generate($values, $qstring, $anchor);
|
||||
$this->paths = $oldPaths;
|
||||
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,19 +127,19 @@ class Router
|
||||
function __construct()
|
||||
{
|
||||
if (empty($this->m)) {
|
||||
if (!common_config('router', 'cache')) {
|
||||
if (!common_config('router', 'cache')) {
|
||||
$this->m = $this->initialize();
|
||||
} else {
|
||||
$k = self::cacheKey();
|
||||
$c = Cache::instance();
|
||||
$m = $c->get($k);
|
||||
if (!empty($m)) {
|
||||
$this->m = $m;
|
||||
} else {
|
||||
$this->m = $this->initialize();
|
||||
$c->set($k, $this->m);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$k = self::cacheKey();
|
||||
$c = Cache::instance();
|
||||
$m = $c->get($k);
|
||||
if (!empty($m)) {
|
||||
$this->m = $m;
|
||||
} else {
|
||||
$this->m = $this->initialize();
|
||||
$c->set($k, $this->m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -199,7 +199,7 @@ class Router
|
||||
'deleteuser',
|
||||
'geocode',
|
||||
'version',
|
||||
);
|
||||
);
|
||||
|
||||
foreach ($main as $a) {
|
||||
$m->connect('main/'.$a, array('action' => $a));
|
||||
@ -222,8 +222,8 @@ class Router
|
||||
array('action' => 'publicxrds'));
|
||||
$m->connect('.well-known/host-meta',
|
||||
array('action' => 'hostmeta'));
|
||||
$m->connect('main/xrd',
|
||||
array('action' => 'userxrd'));
|
||||
$m->connect('main/xrd',
|
||||
array('action' => 'userxrd'));
|
||||
|
||||
// these take a code
|
||||
|
||||
@ -248,19 +248,19 @@ class Router
|
||||
}
|
||||
|
||||
$m->connect('settings/oauthapps/show/:id',
|
||||
array('action' => 'showapplication'),
|
||||
array('id' => '[0-9]+')
|
||||
array('action' => 'showapplication'),
|
||||
array('id' => '[0-9]+')
|
||||
);
|
||||
$m->connect('settings/oauthapps/new',
|
||||
array('action' => 'newapplication')
|
||||
array('action' => 'newapplication')
|
||||
);
|
||||
$m->connect('settings/oauthapps/edit/:id',
|
||||
array('action' => 'editapplication'),
|
||||
array('id' => '[0-9]+')
|
||||
array('action' => 'editapplication'),
|
||||
array('id' => '[0-9]+')
|
||||
);
|
||||
$m->connect('settings/oauthapps/delete/:id',
|
||||
array('action' => 'deleteapplication'),
|
||||
array('id' => '[0-9]+')
|
||||
array('action' => 'deleteapplication'),
|
||||
array('id' => '[0-9]+')
|
||||
);
|
||||
|
||||
// search
|
||||
@ -951,14 +951,14 @@ class Router
|
||||
$qpos = strpos($url, '?');
|
||||
if ($qpos !== false) {
|
||||
$url = substr($url, 0, $qpos+1) .
|
||||
str_replace('?', '&', substr($url, $qpos+1));
|
||||
str_replace('?', '&', substr($url, $qpos+1));
|
||||
|
||||
// @fixme this is a hacky workaround for http_build_query in the
|
||||
// lower-level code and bad configs that set the default separator
|
||||
// to & instead of &. Encoded &s in parameters will not be
|
||||
// affected.
|
||||
$url = substr($url, 0, $qpos+1) .
|
||||
str_replace('&', '&', substr($url, $qpos+1));
|
||||
str_replace('&', '&', substr($url, $qpos+1));
|
||||
|
||||
}
|
||||
|
||||
|
10
lib/xrd.php
@ -130,14 +130,24 @@ class XRD
|
||||
|
||||
foreach ($this->links as $link) {
|
||||
$titles = array();
|
||||
$properties = array();
|
||||
if (isset($link['title'])) {
|
||||
$titles = $link['title'];
|
||||
unset($link['title']);
|
||||
}
|
||||
if (isset($link['property'])) {
|
||||
$properties = $link['property'];
|
||||
unset($link['property']);
|
||||
}
|
||||
$xs->elementStart('Link', $link);
|
||||
foreach ($titles as $title) {
|
||||
$xs->element('Title', null, $title);
|
||||
}
|
||||
foreach ($properties as $property) {
|
||||
$xs->element('Property',
|
||||
array('type' => $property['type']),
|
||||
$property['value']);
|
||||
}
|
||||
$xs->elementEnd('Link');
|
||||
}
|
||||
|
||||
|
@ -53,54 +53,67 @@ class XrdAction extends Action
|
||||
$xrd->subject = self::normalize($this->uri);
|
||||
}
|
||||
|
||||
if (Event::handle('StartXrdActionAliases', array(&$xrd, $this->user))) {
|
||||
if (Event::handle('StartXrdActionAliases', array(&$xrd, $this->user))) {
|
||||
|
||||
// Possible aliases for the user
|
||||
// Possible aliases for the user
|
||||
|
||||
$uris = array($this->user->uri, $profile->profileurl);
|
||||
$uris = array($this->user->uri, $profile->profileurl);
|
||||
|
||||
// FIXME: Webfinger generation code should live somewhere on its own
|
||||
// FIXME: Webfinger generation code should live somewhere on its own
|
||||
|
||||
$path = common_config('site', 'path');
|
||||
$path = common_config('site', 'path');
|
||||
|
||||
if (empty($path)) {
|
||||
$uris[] = sprintf('acct:%s@%s', $nick, common_config('site', 'server'));
|
||||
}
|
||||
if (empty($path)) {
|
||||
$uris[] = sprintf('acct:%s@%s', $nick, common_config('site', 'server'));
|
||||
}
|
||||
|
||||
foreach ($uris as $uri) {
|
||||
if ($uri != $xrd->subject) {
|
||||
$xrd->alias[] = $uri;
|
||||
}
|
||||
}
|
||||
foreach ($uris as $uri) {
|
||||
if ($uri != $xrd->subject) {
|
||||
$xrd->alias[] = $uri;
|
||||
}
|
||||
}
|
||||
|
||||
Event::handle('EndXrdActionAliases', array(&$xrd, $this->user));
|
||||
}
|
||||
Event::handle('EndXrdActionAliases', array(&$xrd, $this->user));
|
||||
}
|
||||
|
||||
if (Event::handle('StartXrdActionLinks', array(&$xrd, $this->user))) {
|
||||
if (Event::handle('StartXrdActionLinks', array(&$xrd, $this->user))) {
|
||||
|
||||
$xrd->links[] = array('rel' => self::PROFILEPAGE,
|
||||
'type' => 'text/html',
|
||||
'href' => $profile->profileurl);
|
||||
$xrd->links[] = array('rel' => self::PROFILEPAGE,
|
||||
'type' => 'text/html',
|
||||
'href' => $profile->profileurl);
|
||||
|
||||
// hCard
|
||||
$xrd->links[] = array('rel' => self::HCARD,
|
||||
'type' => 'text/html',
|
||||
'href' => common_local_url('hcard', array('nickname' => $nick)));
|
||||
// hCard
|
||||
$xrd->links[] = array('rel' => self::HCARD,
|
||||
'type' => 'text/html',
|
||||
'href' => common_local_url('hcard', array('nickname' => $nick)));
|
||||
|
||||
// XFN
|
||||
$xrd->links[] = array('rel' => 'http://gmpg.org/xfn/11',
|
||||
'type' => 'text/html',
|
||||
'href' => $profile->profileurl);
|
||||
// FOAF
|
||||
$xrd->links[] = array('rel' => 'describedby',
|
||||
'type' => 'application/rdf+xml',
|
||||
'href' => common_local_url('foaf',
|
||||
array('nickname' => $nick)));
|
||||
// XFN
|
||||
$xrd->links[] = array('rel' => 'http://gmpg.org/xfn/11',
|
||||
'type' => 'text/html',
|
||||
'href' => $profile->profileurl);
|
||||
// FOAF
|
||||
$xrd->links[] = array('rel' => 'describedby',
|
||||
'type' => 'application/rdf+xml',
|
||||
'href' => common_local_url('foaf',
|
||||
array('nickname' => $nick)));
|
||||
|
||||
$xrd->links[] = array('rel' => 'http://apinamespace.org/atom',
|
||||
'type' => 'application/atomsvc+xml',
|
||||
'href' => common_local_url('ApiAtomService', array('id' => $nick)));
|
||||
|
||||
Event::handle('EndXrdActionLinks', array(&$xrd, $this->user));
|
||||
}
|
||||
|
||||
if (common_config('site', 'fancy')) {
|
||||
$apiRoot = common_path('api/', true);
|
||||
} else {
|
||||
$apiRoot = common_path('index.php/api/', true);
|
||||
}
|
||||
|
||||
$xrd->links[] = array('rel' => 'http://apinamespace.org/twitter',
|
||||
'href' => $apiRoot,
|
||||
'property' => array(array('type' => 'http://apinamespace.org/twitter/username',
|
||||
'value' => $nick)));
|
||||
|
||||
Event::handle('EndXrdActionLinks', array(&$xrd, $this->user));
|
||||
}
|
||||
|
||||
header('Content-type: application/xrd+xml');
|
||||
print $xrd->toXML();
|
||||
|
197
plugins/InProcessCache/InProcessCachePlugin.php
Normal file
@ -0,0 +1,197 @@
|
||||
<?php
|
||||
/**
|
||||
* StatusNet - the distributed open-source microblogging tool
|
||||
* Copyright (C) 2010, StatusNet, Inc.
|
||||
*
|
||||
* Extra level of caching, in memory
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* @category Cache
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
if (!defined('STATUSNET')) {
|
||||
// This check helps protect against security problems;
|
||||
// your code file can't be executed directly from the web.
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extra level of caching
|
||||
*
|
||||
* This plugin adds an extra level of in-process caching to any regular
|
||||
* cache system like APC, XCache, or Memcache.
|
||||
*
|
||||
* Note that since most caching plugins return false for StartCache*
|
||||
* methods, you should add this plugin before them, i.e.
|
||||
*
|
||||
* addPlugin('InProcessCache');
|
||||
* addPlugin('XCache');
|
||||
*
|
||||
* @category Cache
|
||||
* @package StatusNet
|
||||
* @author Evan Prodromou <evan@status.net>
|
||||
* @copyright 2010 StatusNet, Inc.
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
|
||||
* @link http://status.net/
|
||||
*/
|
||||
|
||||
class InProcessCachePlugin extends Plugin
|
||||
{
|
||||
private $_items = array();
|
||||
private $_hits = array();
|
||||
|
||||
/**
|
||||
* Get an item from the cache
|
||||
*
|
||||
* Called before other cache systems are called (iif this
|
||||
* plugin was loaded correctly, see class comment). If we
|
||||
* have the data, return it, and don't hit the other cache
|
||||
* systems.
|
||||
*
|
||||
* @param string &$key Key to fetch
|
||||
* @param mixed &$value Resulting value or false for miss
|
||||
*
|
||||
* @return boolean false if found, else true
|
||||
*/
|
||||
|
||||
function onStartCacheGet(&$key, &$value)
|
||||
{
|
||||
if (array_key_exists($key, $this->_items)) {
|
||||
$value = $this->_items[$key];
|
||||
if (array_key_exists($key, $this->_hits)) {
|
||||
$this->_hits[$key]++;
|
||||
} else {
|
||||
$this->_hits[$key] = 1;
|
||||
}
|
||||
Event::handle('EndCacheGet', array($key, &$value));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called at the end of a cache get
|
||||
*
|
||||
* If we don't already have the data, we cache it. This
|
||||
* keeps us from having to call the external cache if the
|
||||
* key is requested again.
|
||||
*
|
||||
* @param string $key Key to fetch
|
||||
* @param mixed &$value Resulting value or false for miss
|
||||
*
|
||||
* @return boolean hook value, true
|
||||
*/
|
||||
|
||||
function onEndCacheGet($key, &$value)
|
||||
{
|
||||
if (!array_key_exists($key, $this->_items) ||
|
||||
$this->_items[$key] != $value) {
|
||||
$this->_items[$key] = $value;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called at the end of setting a cache element
|
||||
*
|
||||
* Always set the cache element; may overwrite existing
|
||||
* data.
|
||||
*
|
||||
* @param string $key Key to fetch
|
||||
* @param mixed $value Resulting value or false for miss
|
||||
* @param integer $flag ignored
|
||||
* @param integer $expiry ignored
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function onEndCacheSet($key, $value, $flag, $expiry)
|
||||
{
|
||||
$this->_items[$key] = $value;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Called at the end of deleting a cache element
|
||||
*
|
||||
* If stuff's deleted from the other cache, we
|
||||
* delete it too.
|
||||
*
|
||||
* @param string &$key Key to delete
|
||||
* @param boolean &$success Success flag; ignored
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function onStartCacheDelete(&$key, &$success)
|
||||
{
|
||||
if (array_key_exists($key, $this->_items)) {
|
||||
unset($this->_items[$key]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Version info
|
||||
*
|
||||
* @param array &$versions Array of version blocks
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function onPluginVersion(&$versions)
|
||||
{
|
||||
$url = 'http://status.net/wiki/Plugin:InProcessCache';
|
||||
|
||||
$versions[] = array('name' => 'InProcessCache',
|
||||
'version' => STATUSNET_VERSION,
|
||||
'author' => 'Evan Prodromou',
|
||||
'homepage' => $url,
|
||||
'description' =>
|
||||
_m('Additional in-process cache for plugins.'));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleanup function; called at end of process
|
||||
*
|
||||
* If the inprocess/stats config value is true, we dump
|
||||
* stats to the log file
|
||||
*
|
||||
* @return boolean true
|
||||
*/
|
||||
|
||||
function cleanup()
|
||||
{
|
||||
if (common_config('inprocess', 'stats')) {
|
||||
$this->log(LOG_INFO, "cache size: " .
|
||||
count($this->_items));
|
||||
$sum = 0;
|
||||
foreach ($this->_hits as $hitcount) {
|
||||
$sum += $hitcount;
|
||||
}
|
||||
$this->log(LOG_INFO, $sum . " hits on " .
|
||||
count($this->_hits) . " keys");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
14
plugins/Mapstraction/Makefile
Normal file
@ -0,0 +1,14 @@
|
||||
.fake: clean all
|
||||
|
||||
TARGETS=usermap-mxn-openlayers.min.js
|
||||
|
||||
CORE=js/mxn.js js/mxn.core.js
|
||||
USERMAP=usermap.js
|
||||
|
||||
all: $(TARGETS)
|
||||
|
||||
clean:
|
||||
rm -f $(TARGETS)
|
||||
|
||||
usermap-mxn-openlayers.min.js: $(CORE) js/mxn.openlayers.core.js $(USERMAP)
|
||||
cat $+ | yui-compressor -o $@ --type=js
|
@ -128,8 +128,8 @@ class MapstractionPlugin extends Plugin
|
||||
$action->script('http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6');
|
||||
break;
|
||||
case 'openlayers':
|
||||
// XXX: is this not nice...?
|
||||
$action->script('http://openlayers.org/api/OpenLayers.js');
|
||||
// Use our included stripped & minified OpenLayers.
|
||||
$action->script(common_path('plugins/Mapstraction/OpenLayers/OpenLayers.js'));
|
||||
break;
|
||||
case 'yahoo':
|
||||
$action->script(sprintf('http://api.maps.yahoo.com/ajaxymap?v=3.8&appid=%s',
|
||||
@ -140,11 +140,19 @@ class MapstractionPlugin extends Plugin
|
||||
return true;
|
||||
}
|
||||
|
||||
$action->script(sprintf('%s?(%s)',
|
||||
common_path('plugins/Mapstraction/js/mxn.js'),
|
||||
$this->provider));
|
||||
if ($this->provider == 'openlayers') {
|
||||
// We have an optimized path for our default case.
|
||||
//
|
||||
// Note that OpenLayers.js needs to be separate, or it won't
|
||||
// be able to find its UI images and styles.
|
||||
$action->script(common_path('plugins/Mapstraction/usermap-mxn-openlayers.min.js'));
|
||||
} else {
|
||||
$action->script(sprintf('%s?(%s)',
|
||||
common_path('plugins/Mapstraction/js/mxn.js'),
|
||||
$this->provider));
|
||||
|
||||
$action->script(common_path('plugins/Mapstraction/usermap.js'));
|
||||
$action->script(common_path('plugins/Mapstraction/usermap.js'));
|
||||
}
|
||||
|
||||
$action->inlineScript(sprintf('var _provider = "%s";', $this->provider));
|
||||
|
||||
|
15
plugins/Mapstraction/OpenLayers/Makefile
Normal file
@ -0,0 +1,15 @@
|
||||
.fake: clean all
|
||||
|
||||
TARGET=OpenLayers.js
|
||||
SOURCEDIR=OpenLayers-2.10/
|
||||
HERE=`pwd`
|
||||
|
||||
all: $(TARGET)
|
||||
|
||||
clean:
|
||||
rm -f $(TARGET)
|
||||
|
||||
$(TARGET): statusnet.cfg
|
||||
cp -f statusnet.cfg $(SOURCEDIR)/build/statusnet.cfg
|
||||
(cd $(SOURCEDIR)/build && ./build.py statusnet.cfg)
|
||||
yui-compressor $(SOURCEDIR)/build/OpenLayers.js -o $(TARGET)
|
1
plugins/Mapstraction/OpenLayers/OpenLayers.js
Normal file
14
plugins/Mapstraction/OpenLayers/README
Normal file
@ -0,0 +1,14 @@
|
||||
The default OpenLayers.js file, minified, weighs in at a whopping 943kb uncompressed.
|
||||
With gzip compression it's still over 200kb, so we're building a stripped-down copy
|
||||
with just what we need.
|
||||
|
||||
Docs on how the stripping process works:
|
||||
http://docs.openlayers.org/library/deploying.html
|
||||
|
||||
To recreate this OpenLayers.js file:
|
||||
|
||||
# get yui-compressor (install from apt, or set up a shell script or alias to the jar)
|
||||
# download and decompress OpenLayers-2.10 zip or tgz
|
||||
make clean && make
|
||||
|
||||
If necessary, change the relative path to the OpenLayers source directory in the Makefile.
|
BIN
plugins/Mapstraction/OpenLayers/img/blank.gif
Normal file
After Width: | Height: | Size: 42 B |
BIN
plugins/Mapstraction/OpenLayers/img/cloud-popup-relative.png
Executable file
After Width: | Height: | Size: 3.1 KiB |
BIN
plugins/Mapstraction/OpenLayers/img/drag-rectangle-off.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
plugins/Mapstraction/OpenLayers/img/drag-rectangle-on.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
plugins/Mapstraction/OpenLayers/img/east-mini.png
Normal file
After Width: | Height: | Size: 451 B |
BIN
plugins/Mapstraction/OpenLayers/img/layer-switcher-maximize.png
Normal file
After Width: | Height: | Size: 451 B |
BIN
plugins/Mapstraction/OpenLayers/img/layer-switcher-minimize.png
Normal file
After Width: | Height: | Size: 249 B |
BIN
plugins/Mapstraction/OpenLayers/img/marker-blue.png
Normal file
After Width: | Height: | Size: 992 B |
BIN
plugins/Mapstraction/OpenLayers/img/marker-gold.png
Normal file
After Width: | Height: | Size: 831 B |
BIN
plugins/Mapstraction/OpenLayers/img/marker-green.png
Normal file
After Width: | Height: | Size: 967 B |
BIN
plugins/Mapstraction/OpenLayers/img/marker.png
Normal file
After Width: | Height: | Size: 606 B |
BIN
plugins/Mapstraction/OpenLayers/img/measuring-stick-off.png
Normal file
After Width: | Height: | Size: 3.3 KiB |
BIN
plugins/Mapstraction/OpenLayers/img/measuring-stick-on.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
plugins/Mapstraction/OpenLayers/img/north-mini.png
Normal file
After Width: | Height: | Size: 484 B |
BIN
plugins/Mapstraction/OpenLayers/img/panning-hand-off.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
plugins/Mapstraction/OpenLayers/img/panning-hand-on.png
Normal file
After Width: | Height: | Size: 3.9 KiB |
BIN
plugins/Mapstraction/OpenLayers/img/slider.png
Normal file
After Width: | Height: | Size: 285 B |
BIN
plugins/Mapstraction/OpenLayers/img/south-mini.png
Normal file
After Width: | Height: | Size: 481 B |
BIN
plugins/Mapstraction/OpenLayers/img/west-mini.png
Normal file
After Width: | Height: | Size: 453 B |
BIN
plugins/Mapstraction/OpenLayers/img/zoom-minus-mini.png
Normal file
After Width: | Height: | Size: 359 B |
BIN
plugins/Mapstraction/OpenLayers/img/zoom-plus-mini.png
Normal file
After Width: | Height: | Size: 489 B |
BIN
plugins/Mapstraction/OpenLayers/img/zoom-world-mini.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
plugins/Mapstraction/OpenLayers/img/zoombar.png
Normal file
After Width: | Height: | Size: 463 B |
43
plugins/Mapstraction/OpenLayers/statusnet.cfg
Normal file
@ -0,0 +1,43 @@
|
||||
# Modified lite.cfg for building an OpenLayers subset for StatusNet's Mapstraction plugin.
|
||||
|
||||
# This file includes a small subset of OpenLayers code, designed to be
|
||||
# integrated into another application. It includes only the Layer types
|
||||
# neccesary to create tiled or untiled WMS, and does not include any Controls.
|
||||
# This is the result of what was at the time called "Webmap.js" at the FOSS4G
|
||||
# Web Mapping BOF.
|
||||
|
||||
[first]
|
||||
OpenLayers/SingleFile.js
|
||||
OpenLayers.js
|
||||
OpenLayers/BaseTypes.js
|
||||
OpenLayers/BaseTypes/Class.js
|
||||
OpenLayers/Util.js
|
||||
|
||||
[last]
|
||||
|
||||
[include]
|
||||
OpenLayers/Map.js
|
||||
OpenLayers/Layer/WMS.js
|
||||
|
||||
# Needed for Mapstraction on StatusNet
|
||||
OpenLayers/Feature.js
|
||||
OpenLayers/Feature/Vector.js
|
||||
OpenLayers/Geometry.js
|
||||
OpenLayers/Geometry/Point.js
|
||||
OpenLayers/Geometry/LinearRing.js
|
||||
OpenLayers/Geometry/LineString.js
|
||||
OpenLayers/Icon.js
|
||||
OpenLayers/Layer/Markers.js
|
||||
OpenLayers/Layer/TMS.js
|
||||
OpenLayers/Marker.js
|
||||
OpenLayers/Popup.js
|
||||
|
||||
# Default controls, needed to keep the map dynamic
|
||||
OpenLayers/Control/ArgParser.js
|
||||
OpenLayers/Control/Attribution.js
|
||||
OpenLayers/Control/Navigation.js
|
||||
OpenLayers/Control/PanZoom.js
|
||||
|
||||
[exclude]
|
||||
|
||||
|
10
plugins/Mapstraction/OpenLayers/theme/default/google.css
Normal file
@ -0,0 +1,10 @@
|
||||
.olLayerGoogleCopyright {
|
||||
right: 3px;
|
||||
bottom: 2px;
|
||||
left: auto;
|
||||
}
|
||||
.olLayerGooglePoweredBy {
|
||||
left: 2px;
|
||||
bottom: 2px;
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
.olControlZoomPanel div {
|
||||
background-image: url(img/zoom-panel-NOALPHA.png);
|
||||
}
|
||||
.olControlPanPanel div {
|
||||
background-image: url(img/pan-panel-NOALPHA.png);
|
||||
}
|
||||
|
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
BIN
plugins/Mapstraction/OpenLayers/theme/default/img/blank.gif
Normal file
After Width: | Height: | Size: 42 B |
BIN
plugins/Mapstraction/OpenLayers/theme/default/img/close.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 79 B |
After Width: | Height: | Size: 566 B |
BIN
plugins/Mapstraction/OpenLayers/theme/default/img/pan-panel.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
plugins/Mapstraction/OpenLayers/theme/default/img/pan_off.png
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
plugins/Mapstraction/OpenLayers/theme/default/img/pan_on.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.4 KiB |
BIN
plugins/Mapstraction/OpenLayers/theme/default/img/ruler.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 357 B |
After Width: | Height: | Size: 364 B |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.1 KiB |
BIN
plugins/Mapstraction/OpenLayers/theme/default/img/zoom-panel.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
397
plugins/Mapstraction/OpenLayers/theme/default/style.css
Normal file
@ -0,0 +1,397 @@
|
||||
div.olMap {
|
||||
z-index: 0;
|
||||
padding: 0px!important;
|
||||
margin: 0px!important;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
div.olMapViewport {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
div.olLayerDiv {
|
||||
-moz-user-select: none;
|
||||
}
|
||||
|
||||
.olLayerGoogleCopyright {
|
||||
left: 2px;
|
||||
bottom: 2px;
|
||||
}
|
||||
.olLayerGooglePoweredBy {
|
||||
left: 2px;
|
||||
bottom: 15px;
|
||||
}
|
||||
.olControlAttribution {
|
||||
font-size: smaller;
|
||||
right: 3px;
|
||||
bottom: 4.5em;
|
||||
position: absolute;
|
||||
display: block;
|
||||
}
|
||||
.olControlScale {
|
||||
right: 3px;
|
||||
bottom: 3em;
|
||||
display: block;
|
||||
position: absolute;
|
||||
font-size: smaller;
|
||||
}
|
||||
.olControlScaleLine {
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
bottom: 15px;
|
||||
font-size: xx-small;
|
||||
}
|
||||
.olControlScaleLineBottom {
|
||||
border: solid 2px black;
|
||||
border-bottom: none;
|
||||
margin-top:-2px;
|
||||
text-align: center;
|
||||
}
|
||||
.olControlScaleLineTop {
|
||||
border: solid 2px black;
|
||||
border-top: none;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.olControlPermalink {
|
||||
right: 3px;
|
||||
bottom: 1.5em;
|
||||
display: block;
|
||||
position: absolute;
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
div.olControlMousePosition {
|
||||
bottom: 0em;
|
||||
right: 3px;
|
||||
display: block;
|
||||
position: absolute;
|
||||
font-family: Arial;
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
.olControlOverviewMapContainer {
|
||||
position: absolute;
|
||||
bottom: 0px;
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
.olControlOverviewMapElement {
|
||||
padding: 10px 18px 10px 10px;
|
||||
background-color: #00008B;
|
||||
-moz-border-radius: 1em 0 0 0;
|
||||
}
|
||||
|
||||
.olControlOverviewMapMinimizeButton {
|
||||
right: 0px;
|
||||
bottom: 80px;
|
||||
}
|
||||
|
||||
.olControlOverviewMapMaximizeButton {
|
||||
right: 0px;
|
||||
bottom: 80px;
|
||||
}
|
||||
|
||||
.olControlOverviewMapExtentRectangle {
|
||||
overflow: hidden;
|
||||
background-image: url("img/blank.gif");
|
||||
cursor: move;
|
||||
border: 2px dotted red;
|
||||
}
|
||||
.olControlOverviewMapRectReplacement {
|
||||
overflow: hidden;
|
||||
cursor: move;
|
||||
background-image: url("img/overview_replacement.gif");
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
}
|
||||
|
||||
.olLayerGeoRSSDescription {
|
||||
float:left;
|
||||
width:100%;
|
||||
overflow:auto;
|
||||
font-size:1.0em;
|
||||
}
|
||||
.olLayerGeoRSSClose {
|
||||
float:right;
|
||||
color:gray;
|
||||
font-size:1.2em;
|
||||
margin-right:6px;
|
||||
font-family:sans-serif;
|
||||
}
|
||||
.olLayerGeoRSSTitle {
|
||||
float:left;font-size:1.2em;
|
||||
}
|
||||
|
||||
.olPopupContent {
|
||||
padding:5px;
|
||||
overflow: auto;
|
||||
}
|
||||
.olControlNavToolbar {
|
||||
width:0px;
|
||||
height:0px;
|
||||
}
|
||||
.olControlNavToolbar div {
|
||||
display:block;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
top: 300px;
|
||||
left: 6px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.olControlNavigationHistory {
|
||||
background-image: url("img/navigation_history.png");
|
||||
background-repeat: no-repeat;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
|
||||
}
|
||||
.olControlNavigationHistoryPreviousItemActive {
|
||||
background-position: 0px 0px;
|
||||
}
|
||||
.olControlNavigationHistoryPreviousItemInactive {
|
||||
background-position: 0px -24px;
|
||||
}
|
||||
.olControlNavigationHistoryNextItemActive {
|
||||
background-position: -24px 0px;
|
||||
}
|
||||
.olControlNavigationHistoryNextItemInactive {
|
||||
background-position: -24px -24px;
|
||||
}
|
||||
|
||||
.olControlNavToolbar .olControlNavigationItemActive {
|
||||
background-image: url("img/panning-hand-on.png");
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
.olControlNavToolbar .olControlNavigationItemInactive {
|
||||
background-image: url("img/panning-hand-off.png");
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
.olControlNavToolbar .olControlZoomBoxItemActive {
|
||||
background-image: url("img/drag-rectangle-on.png");
|
||||
background-color: orange;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
.olControlNavToolbar .olControlZoomBoxItemInactive {
|
||||
background-image: url("img/drag-rectangle-off.png");
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
.olControlEditingToolbar {
|
||||
float:right;
|
||||
right: 0px;
|
||||
height: 30px;
|
||||
width: 200px;
|
||||
}
|
||||
.olControlEditingToolbar div {
|
||||
background-image: url("img/editing_tool_bar.png");
|
||||
background-repeat: no-repeat;
|
||||
float:right;
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
margin: 5px;
|
||||
}
|
||||
.olControlEditingToolbar .olControlNavigationItemActive {
|
||||
background-position: -103px -23px;
|
||||
}
|
||||
.olControlEditingToolbar .olControlNavigationItemInactive {
|
||||
background-position: -103px -0px;
|
||||
}
|
||||
.olControlEditingToolbar .olControlDrawFeaturePointItemActive {
|
||||
background-position: -77px -23px;
|
||||
}
|
||||
.olControlEditingToolbar .olControlDrawFeaturePointItemInactive {
|
||||
background-position: -77px -0px;
|
||||
}
|
||||
.olControlEditingToolbar .olControlDrawFeaturePathItemInactive {
|
||||
background-position: -51px 0px;
|
||||
}
|
||||
.olControlEditingToolbar .olControlDrawFeaturePathItemActive {
|
||||
background-position: -51px -23px;
|
||||
}
|
||||
.olControlEditingToolbar .olControlDrawFeaturePolygonItemInactive {
|
||||
background-position: -26px 0px;
|
||||
}
|
||||
.olControlEditingToolbar .olControlDrawFeaturePolygonItemActive {
|
||||
background-position: -26px -23px ;
|
||||
}
|
||||
div.olControlSaveFeaturesItemActive {
|
||||
background-image: url(img/save_features_on.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0px 1px;
|
||||
}
|
||||
div.olControlSaveFeaturesItemInactive {
|
||||
background-image: url(img/save_features_off.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 0px 1px;
|
||||
}
|
||||
|
||||
.olHandlerBoxZoomBox {
|
||||
border: 2px solid red;
|
||||
position: absolute;
|
||||
background-color: white;
|
||||
opacity: 0.50;
|
||||
font-size: 1px;
|
||||
filter: alpha(opacity=50);
|
||||
}
|
||||
.olHandlerBoxSelectFeature {
|
||||
border: 2px solid blue;
|
||||
position: absolute;
|
||||
background-color: white;
|
||||
opacity: 0.50;
|
||||
font-size: 1px;
|
||||
filter: alpha(opacity=50);
|
||||
}
|
||||
|
||||
.olControlPanPanel {
|
||||
top: 10px;
|
||||
left: 5px;
|
||||
}
|
||||
|
||||
.olControlPanPanel div {
|
||||
background-image: url(img/pan-panel.png);
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
cursor: pointer;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.olControlPanPanel .olControlPanNorthItemInactive {
|
||||
top: 0px;
|
||||
left: 9px;
|
||||
background-position: 0px 0px;
|
||||
}
|
||||
.olControlPanPanel .olControlPanSouthItemInactive {
|
||||
top: 36px;
|
||||
left: 9px;
|
||||
background-position: 18px 0px;
|
||||
}
|
||||
.olControlPanPanel .olControlPanWestItemInactive {
|
||||
position: absolute;
|
||||
top: 18px;
|
||||
left: 0px;
|
||||
background-position: 0px 18px;
|
||||
}
|
||||
.olControlPanPanel .olControlPanEastItemInactive {
|
||||
top: 18px;
|
||||
left: 18px;
|
||||
background-position: 18px 18px;
|
||||
}
|
||||
|
||||
.olControlZoomPanel {
|
||||
top: 71px;
|
||||
left: 14px;
|
||||
}
|
||||
|
||||
.olControlZoomPanel div {
|
||||
background-image: url(img/zoom-panel.png);
|
||||
position: absolute;
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.olControlZoomPanel .olControlZoomInItemInactive {
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
background-position: 0px 0px;
|
||||
}
|
||||
|
||||
.olControlZoomPanel .olControlZoomToMaxExtentItemInactive {
|
||||
top: 18px;
|
||||
left: 0px;
|
||||
background-position: 0px -18px;
|
||||
}
|
||||
|
||||
.olControlZoomPanel .olControlZoomOutItemInactive {
|
||||
top: 36px;
|
||||
left: 0px;
|
||||
background-position: 0px 18px;
|
||||
}
|
||||
|
||||
.olPopupCloseBox {
|
||||
background: url("img/close.gif") no-repeat;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.olFramedCloudPopupContent {
|
||||
padding: 5px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.olControlNoSelect {
|
||||
-moz-user-select: none;
|
||||
}
|
||||
|
||||
.olImageLoadError {
|
||||
background-color: pink;
|
||||
opacity: 0.5;
|
||||
filter: alpha(opacity=50); /* IE */
|
||||
}
|
||||
|
||||
/**
|
||||
* Cursor styles
|
||||
*/
|
||||
|
||||
.olCursorWait {
|
||||
cursor: wait;
|
||||
}
|
||||
.olDragDown {
|
||||
cursor: move;
|
||||
}
|
||||
.olDrawBox {
|
||||
cursor: crosshair;
|
||||
}
|
||||
.olControlDragFeatureOver {
|
||||
cursor: move;
|
||||
}
|
||||
.olControlDragFeatureActive.olControlDragFeatureOver.olDragDown {
|
||||
cursor: -moz-grabbing;
|
||||
}
|
||||
|
||||
/**
|
||||
* Layer switcher
|
||||
*/
|
||||
.olControlLayerSwitcher {
|
||||
position: absolute;
|
||||
top: 25px;
|
||||
right: 0px;
|
||||
width: 20em;
|
||||
font-family: sans-serif;
|
||||
font-weight: bold;
|
||||
margin-top: 3px;
|
||||
margin-left: 3px;
|
||||
margin-bottom: 3px;
|
||||
font-size: smaller;
|
||||
color: white;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.olControlLayerSwitcher .layersDiv {
|
||||
padding-top: 5px;
|
||||
padding-left: 10px;
|
||||
padding-bottom: 5px;
|
||||
padding-right: 75px;
|
||||
background-color: darkblue;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.olControlLayerSwitcher .layersDiv .baseLbl,
|
||||
.olControlLayerSwitcher .layersDiv .dataLbl {
|
||||
margin-top: 3px;
|
||||
margin-left: 3px;
|
||||
margin-bottom: 3px;
|
||||
}
|
||||
|
||||
.olControlLayerSwitcher .layersDiv .baseLayersDiv,
|
||||
.olControlLayerSwitcher .layersDiv .dataLayersDiv {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
.olControlLayerSwitcher .maximizeDiv,
|
||||
.olControlLayerSwitcher .minimizeDiv {
|
||||
top: 5px;
|
||||
right: 0px;
|
||||
}
|
1
plugins/Mapstraction/usermap-mxn-openlayers.min.js
vendored
Normal file
@ -78,20 +78,28 @@ class PiwikAnalyticsPlugin extends Plugin
|
||||
*/
|
||||
function onEndShowScripts($action)
|
||||
{
|
||||
$piwikCode1 = <<<ENDOFPIWIK
|
||||
var pkBaseURL = (("https:" == document.location.protocol) ? "https://{$this->piwikroot}" : "http://{$this->piwikroot}");
|
||||
document.write(unescape("%3Cscript src='" + pkBaseURL + "piwik.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
ENDOFPIWIK;
|
||||
$piwikCode2 = <<<ENDOFPIWIK
|
||||
// Slight modification to the default code.
|
||||
// Loading the piwik.js file from a <script> created in a document.write
|
||||
// meant that the browser had no way to preload it, ensuring that its
|
||||
// loading will be synchronous, blocking further page rendering.
|
||||
//
|
||||
// User-agents understand protocol-relative links, so instead of the
|
||||
// URL produced in JS we can just give a universal one. Since it's
|
||||
// sitting there in the DOM ready to go, the browser can preload the
|
||||
// file for us and we're less likely to have to wait for it.
|
||||
$piwikUrl = '//' . $this->piwikroot . 'piwik.js';
|
||||
$piwikCode = <<<ENDOFPIWIK
|
||||
try {
|
||||
var pkBaseURL = (("https:" == document.location.protocol) ? "https://{$this->piwikroot}" : "http://{$this->piwikroot}");
|
||||
var piwikTracker = Piwik.getTracker(pkBaseURL + "piwik.php", {$this->piwikId});
|
||||
piwikTracker.trackPageView();
|
||||
piwikTracker.enableLinkTracking();
|
||||
} catch( err ) {}
|
||||
ENDOFPIWIK;
|
||||
|
||||
$action->inlineScript($piwikCode1);
|
||||
$action->inlineScript($piwikCode2);
|
||||
// Don't use $action->script() here; it'll try to preface the URL.
|
||||
$action->element('script', array('type' => 'text/javascript', 'src' => $piwikUrl), ' ');
|
||||
$action->inlineScript($piwikCode);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -30,6 +30,7 @@ class TwitterQueueHandler extends QueueHandler
|
||||
|
||||
function handle($notice)
|
||||
{
|
||||
return broadcast_twitter($notice);
|
||||
$ok = broadcast_twitter($notice);
|
||||
return $ok || common_config('twitter', 'ignore_errors');
|
||||
}
|
||||
}
|
||||
|