hide version for bundled plugins because it's meaningless; for everything else support showing version using git (if about[0] is null)
This commit is contained in:
parent
1e6973307c
commit
20a844085f
|
@ -795,6 +795,7 @@ class Pref_Prefs extends Handler_Protected {
|
|||
|
||||
foreach ($tmppluginhost->get_plugins() as $name => $plugin) {
|
||||
$about = $plugin->about();
|
||||
$version = htmlspecialchars($this->_get_plugin_version($plugin));
|
||||
|
||||
if ($about[3] ?? false) {
|
||||
$is_checked = in_array($name, $system_enabled) ? "checked" : "";
|
||||
|
@ -811,9 +812,11 @@ class Pref_Prefs extends Handler_Protected {
|
|||
<i class='material-icons'>open_in_new</i> <?= __("More info...") ?></button>
|
||||
<?php } ?>
|
||||
|
||||
<div dojoType='dijit.Tooltip' connectId='PLABEL-<?= htmlspecialchars($name) ?>' position='after'>
|
||||
<?= htmlspecialchars(T_sprintf("v%.2f, by %s", $about[0], $about[2])) ?>
|
||||
</div>
|
||||
<?php if ($version) { ?>
|
||||
<div dojoType='dijit.Tooltip' connectId='PLABEL-<?= htmlspecialchars($name) ?>' position='after'>
|
||||
<?= $version ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</fieldset>
|
||||
<?php
|
||||
}
|
||||
|
@ -829,6 +832,7 @@ class Pref_Prefs extends Handler_Protected {
|
|||
|
||||
foreach ($tmppluginhost->get_plugins() as $name => $plugin) {
|
||||
$about = $plugin->about();
|
||||
$version = htmlspecialchars($this->_get_plugin_version($plugin));
|
||||
|
||||
if (empty($about[3]) || $about[3] == false) {
|
||||
|
||||
|
@ -875,9 +879,11 @@ class Pref_Prefs extends Handler_Protected {
|
|||
<i class='material-icons'>open_in_new</i> <?= __("More info...") ?></button>
|
||||
<?php } ?>
|
||||
|
||||
<div dojoType='dijit.Tooltip' connectId="PLABEL-<?= htmlspecialchars($name) ?>" position='after'>
|
||||
<?= htmlspecialchars(T_sprintf("v%.2f, by %s", $about[0], $about[2])) ?>
|
||||
</div>
|
||||
<?php if ($version) { ?>
|
||||
<div dojoType='dijit.Tooltip' connectId='PLABEL-<?= htmlspecialchars($name) ?>' position='after'>
|
||||
<?= $version ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
</fieldset>
|
||||
<?php
|
||||
|
@ -1093,6 +1099,49 @@ class Pref_Prefs extends Handler_Protected {
|
|||
set_pref(Prefs::_ENABLED_PLUGINS, $plugins);
|
||||
}
|
||||
|
||||
function _get_version_from_git(string $dir) {
|
||||
$descriptorspec = [
|
||||
1 => ["pipe", "w"], // STDOUT
|
||||
2 => ["pipe", "w"], // STDERR
|
||||
];
|
||||
|
||||
$proc = proc_open("git --no-pager log --pretty=\"%ct %h\" -n1 HEAD",
|
||||
$descriptorspec, $pipes, $dir);
|
||||
|
||||
if (is_resource($proc)) {
|
||||
$stdout = stream_get_contents($pipes[1]);
|
||||
$stderr = stream_get_contents($pipes[2]);
|
||||
$status = proc_close($proc);
|
||||
|
||||
if ($status == 0) {
|
||||
list($timestamp, $commit) = explode(" ", $stdout);
|
||||
return trim(strftime("%y.%m", (int)$timestamp) . "-$commit");
|
||||
} else {
|
||||
return T_sprintf("Git error [RC=%d]: %s", $status, $stderr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function _get_plugin_version(Plugin $plugin) {
|
||||
$about = $plugin->about();
|
||||
|
||||
if (!empty($about[0])) {
|
||||
return T_sprintf("v%.2f, by %s", $about[0], $about[2]);
|
||||
} else {
|
||||
$ref = new ReflectionClass(get_class($plugin));
|
||||
|
||||
$plugin_dir = dirname($ref->getFileName());
|
||||
|
||||
if (basename($plugin_dir) == "plugins") {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (is_dir("$plugin_dir/.git")) {
|
||||
return T_sprintf("v%s, by %s", $this->_get_version_from_git($plugin_dir), $about[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static function _get_updated_plugins() {
|
||||
$root_dir = dirname(dirname(__DIR__)); # we're in classes/pref/
|
||||
$plugin_dirs = array_filter(glob("$root_dir/plugins.local/*"), "is_dir");
|
||||
|
|
|
@ -5,7 +5,7 @@ class Af_Comics extends Plugin {
|
|||
private $filters = array();
|
||||
|
||||
function about() {
|
||||
return array(2.0,
|
||||
return array(null,
|
||||
"Fixes RSS feeds of assorted comic strips",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ class Af_Fsckportal extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Remove feedsportal spamlinks from article content",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ class Af_Proxy_Http extends Plugin {
|
|||
private $cache;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Loads media served over plain HTTP via built-in secure proxy",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ class Af_Psql_Trgm extends Plugin {
|
|||
private $default_min_length = 32;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Marks similar articles as read (requires pg_trgm)",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ class Af_Readability extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Try to inline article content using Readability",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ class Af_RedditImgur extends Plugin {
|
|||
private $fallback_preview_urls = [];
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Inline images (and other content) in Reddit RSS feeds",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ class Af_Unburn extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Resolves feedburner and similar feed redirector URLs (requires CURL)",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ class Af_Youtube_Embed extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Embed videos in Youtube RSS feeds (and whitelist Youtube iframes)",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ class Af_Zz_NoAutoPlay extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Don't autoplay HTML5 videos",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ class Af_Zz_VidMute extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Mute audio in HTML5 videos",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ class Auth_Internal extends Auth_Base {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Authenticates against internal tt-rss database",
|
||||
"fox",
|
||||
true);
|
||||
|
|
|
@ -4,7 +4,7 @@ class Auth_Remote extends Auth_Base {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Authenticates against remote password (e.g. supplied by Apache)",
|
||||
"fox",
|
||||
true);
|
||||
|
|
|
@ -5,7 +5,7 @@ class Auto_Assign_Labels extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Assign labels automatically based on article title, content, and tags",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ class Bookmarklets extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Easy feed subscription and web page sharing using bookmarklets",
|
||||
"fox",
|
||||
false,
|
||||
|
|
|
@ -8,7 +8,7 @@ class Cache_Starred_Images extends Plugin {
|
|||
private $max_cache_attempts = 5; // per-article
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Automatically cache media files in Starred articles",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ class Close_Button extends Plugin {
|
|||
}
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Adds a button to close article panel",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ class Hotkeys_Force_Top extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Force open article to the top",
|
||||
"itsamenathan");
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ class Hotkeys_Noscroll extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"n/p (and up/down) hotkeys move between articles without scrolling",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ class Hotkeys_Swap_JK extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Swap j and k hotkeys (for vi brethren)",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ class Mail extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Share article via email",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ class MailTo extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Share article via email (using mailto: links, invoking your mail client)",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ class No_Iframes extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Remove embedded iframes (unless whitelisted)",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ class No_Title_Counters extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Remove counters from window title (prevents tab flashing on new articles)",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ class No_URL_Hashes extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Disable URL hash usage (e.g. #f=10, etc)",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ class Note extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Adds support for setting article notes",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ class NSFW extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Hide article content based on tags",
|
||||
"fox",
|
||||
false);
|
||||
|
|
|
@ -21,7 +21,7 @@ class Scored_Oldest_First extends Plugin {
|
|||
}
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Consider article score while sorting by oldest first",
|
||||
"fox",
|
||||
false,
|
||||
|
|
|
@ -3,7 +3,7 @@ class Share extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Share article by unique URL",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ class Shorten_Expanded extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Shorten overly long articles in CDM/expanded",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ class Toggle_Sidebar extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Adds a main toolbar button to toggle sidebar",
|
||||
"fox");
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ class VF_Shared extends Plugin {
|
|||
private $host;
|
||||
|
||||
function about() {
|
||||
return array(1.0,
|
||||
return array(null,
|
||||
"Feed for all articles actively shared by URL",
|
||||
"fox",
|
||||
false);
|
||||
|
|
Loading…
Reference in New Issue