new methods for paths to plugin static files
This commit is contained in:
parent
ec93184d7b
commit
f06e661a9b
17
README
17
README
@ -1572,6 +1572,23 @@ proxy_user: Username to use for authenticating to the HTTP proxy. Default null.
|
||||
proxy_password: Password to use for authenticating to the HTTP proxy. Default null.
|
||||
proxy_auth_scheme: Scheme to use for authenticating to the HTTP proxy. Default null.
|
||||
|
||||
plugins
|
||||
-------
|
||||
|
||||
default: associative array mapping plugin name to array of arguments. To disable
|
||||
a default plugin, unset its value in this array.
|
||||
locale_path: path for finding plugin locale files. In the plugin's directory
|
||||
by default.
|
||||
server: Server to find static files for a plugin when the page is plain old HTTP.
|
||||
Defaults to site/server (same as pages). Use this to move plugin CSS and
|
||||
JS files to a CDN.
|
||||
sslserver: Server to find static files for a plugin when the page is HTTPS. Defaults
|
||||
to site/server (same as pages). Use this to move plugin CSS and JS files
|
||||
to a CDN.
|
||||
path: Path to the plugin files. defaults to site/path + '/plugins/'. Expects that
|
||||
each plugin will have a subdirectory at plugins/NameOfPlugin. Change this
|
||||
if you're using a CDN.
|
||||
|
||||
Plugins
|
||||
=======
|
||||
|
||||
|
@ -314,6 +314,9 @@ $default =
|
||||
'RSSCloud' => null,
|
||||
'OpenID' => null),
|
||||
'locale_path' => false, // Set to a path to use *instead of* each plugin's own locale subdirectories
|
||||
'server' => null,
|
||||
'sslserver' => null,
|
||||
'path' => null,
|
||||
),
|
||||
'admin' =>
|
||||
array('panels' => array('design', 'site', 'user', 'paths', 'access', 'sessions', 'sitenotice', 'license')),
|
||||
|
@ -110,11 +110,16 @@ class Plugin
|
||||
{
|
||||
$this->log(LOG_DEBUG, $msg);
|
||||
}
|
||||
|
||||
function name()
|
||||
{
|
||||
$cls = get_class($this);
|
||||
return mb_substr($cls, 0, -6);
|
||||
}
|
||||
|
||||
function onPluginVersion(&$versions)
|
||||
{
|
||||
$cls = get_class($this);
|
||||
$name = mb_substr($cls, 0, -6);
|
||||
$name = $this->name();
|
||||
|
||||
$versions[] = array('name' => $name,
|
||||
// TRANS: Displayed as version information for a plugin if no version information was found.
|
||||
@ -122,4 +127,38 @@ class Plugin
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function path($relative)
|
||||
{
|
||||
return self::staticPath($this->name(), $relative);
|
||||
}
|
||||
|
||||
static function staticPath($plugin, $relative)
|
||||
{
|
||||
$isHTTPS = StatusNet::isHTTPS();
|
||||
|
||||
if ($isHTTPS) {
|
||||
$server = common_config('plugins', 'sslserver');
|
||||
} else {
|
||||
$server = common_config('plugins', 'server');
|
||||
}
|
||||
|
||||
if (is_null($server)) {
|
||||
if ($isHTTPS) {
|
||||
$server = common_config('site', 'sslserver');
|
||||
} else {
|
||||
$server = common_config('site', 'server');
|
||||
}
|
||||
}
|
||||
|
||||
$path = common_config('plugins', 'path');
|
||||
|
||||
if (is_null($path)) {
|
||||
$path = common_config('site', 'path') . '/plugins/';
|
||||
}
|
||||
|
||||
$protocol = ($isHTTPS) ? 'https' : 'http';
|
||||
|
||||
return $protocol.'://'.$server.$path.$plugin.'/'.$relative;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user