[CORE] Core modules shouldn't show up in version action

This commit is contained in:
Diogo Cordeiro 2019-08-02 21:53:43 +01:00
parent 0c2c3ec862
commit d3c56897a3

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU Affero General Public License // You should have received a copy of the GNU Affero General Public License
// along with GNU social. If not, see <http://www.gnu.org/licenses/>. // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
defined('STATUSNET') || die(); defined('GNUSOCIAL') || die();
/** /**
* Version info page * Version info page
@ -33,7 +33,7 @@ defined('STATUSNET') || die();
*/ */
class VersionAction extends Action class VersionAction extends Action
{ {
var $pluginVersions = []; public $pluginVersions = [];
/** /**
* Return true since we're read-only. * Return true since we're read-only.
@ -42,7 +42,7 @@ class VersionAction extends Action
* *
* @return bool is read only action? * @return bool is read only action?
*/ */
function isReadOnly($args) public function isReadOnly($args)
{ {
return true; return true;
} }
@ -52,7 +52,7 @@ class VersionAction extends Action
* *
* @return string page title * @return string page title
*/ */
function title() public function title()
{ {
// TRANS: Title for version page. %1$s is the engine name, %2$s is the engine version. // TRANS: Title for version page. %1$s is the engine name, %2$s is the engine version.
return sprintf(_('%1$s %2$s'), GNUSOCIAL_ENGINE, GNUSOCIAL_VERSION); return sprintf(_('%1$s %2$s'), GNUSOCIAL_ENGINE, GNUSOCIAL_VERSION);
@ -67,6 +67,7 @@ class VersionAction extends Action
* @param array $args array misc. arguments * @param array $args array misc. arguments
* *
* @return bool true * @return bool true
* @throws ClientException
*/ */
protected function prepare(array $args = []) protected function prepare(array $args = [])
{ {
@ -83,9 +84,10 @@ class VersionAction extends Action
* Shows a page with the version information in the * Shows a page with the version information in the
* content area. * content area.
* *
* @param array $args ignored.
*
* @return void * @return void
* @throws ClientException
* @throws ReflectionException
* @throws ServerException
*/ */
protected function handle() protected function handle()
{ {
@ -99,13 +101,13 @@ class VersionAction extends Action
* *
* @return void * @return void
*/ */
function showContentBlock() public function showContentBlock()
{ {
$this->elementStart('div', array('id' => 'content', 'class' => 'h-entry')); $this->elementStart('div', ['id' => 'content', 'class' => 'h-entry']);
$this->showPageTitle(); $this->showPageTitle();
$this->showPageNoticeBlock(); $this->showPageNoticeBlock();
$this->elementStart('div', array('id' => 'content_inner', $this->elementStart('div', ['id' => 'content_inner',
'class' => 'e-content')); 'class' => 'e-content']);
// show the actual content (forms, lists, whatever) // show the actual content (forms, lists, whatever)
$this->showContent(); $this->showContent();
$this->elementEnd('div'); $this->elementEnd('div');
@ -117,9 +119,9 @@ class VersionAction extends Action
* *
* @return void * @return void
*/ */
function showPageTitle() public function showPageTitle()
{ {
$this->element('h1', array('class' => 'entry-title'), $this->title()); $this->element('h1', ['class' => 'entry-title'], $this->title());
} }
@ -127,54 +129,76 @@ class VersionAction extends Action
* Show version information * Show version information
* *
* @return void * @return void
* @throws Exception
*/ */
function showContent() public function showContent()
{ {
$this->elementStart('p'); $this->elementStart('p');
// TRANS: Content part of engine version page. // TRANS: Content part of engine version page.
// TRANS: %1$s is the engine name (GNU social) and %2$s is the GNU social version. // TRANS: %1$s is the engine name (GNU social) and %2$s is the GNU social version.
$this->raw(sprintf(_('This site is powered by %1$s version %2$s, ' . $this->raw(sprintf(
_('This site is powered by %1$s version %2$s, ' .
'Copyright 2010 Free Software Foundation, Inc.'), 'Copyright 2010 Free Software Foundation, Inc.'),
XMLStringer::estring('a', array('href' => GNUSOCIAL_ENGINE_URL), XMLStringer::estring(
'a',
['href' => GNUSOCIAL_ENGINE_URL],
// TRANS: Engine name. // TRANS: Engine name.
GNUSOCIAL_ENGINE), GNUSOCIAL_ENGINE
GNUSOCIAL_VERSION)); ),
GNUSOCIAL_VERSION
));
$this->elementEnd('p'); $this->elementEnd('p');
// TRANS: Header for engine software contributors section on the version page. // TRANS: Header for engine software contributors section on the version page.
$this->element('h2', null, _('Contributors')); $this->element('h2', null, _('Contributors'));
$this->elementStart('p'); $this->elementStart('p');
$this->raw(sprintf('See %s for a full list of contributors.', $this->raw(sprintf(
XMLStringer::estring('a', array('href' => 'https://notabug.org/diogo/gnu-social/src/nightly/CREDITS.md'), 'See %s for a full list of contributors.',
'https://notabug.org/diogo/gnu-social/src/nightly/CREDITS.md'))); XMLStringer::estring(
'a',
['href' => 'https://notabug.org/diogo/gnu-social/src/nightly/CREDITS.md'],
'https://notabug.org/diogo/gnu-social/src/nightly/CREDITS.md'
)
));
$this->elementEnd('p'); $this->elementEnd('p');
// TRANS: Header for engine software license section on the version page. // TRANS: Header for engine software license section on the version page.
$this->element('h2', null, _('License')); $this->element('h2', null, _('License'));
$this->element('p', null, $this->element(
'p',
null,
// TRANS: Content part of engine software version page. %1s is engine name // TRANS: Content part of engine software version page. %1s is engine name
sprintf(_('%1$s is free software: you can redistribute it and/or modify ' . sprintf(_('%1$s is free software: you can redistribute it and/or modify ' .
'it under the terms of the GNU Affero General Public License as published by ' . '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 ' . 'the Free Software Foundation, either version 3 of the License, or ' .
'(at your option) any later version.'), GNUSOCIAL_ENGINE)); '(at your option) any later version.'), GNUSOCIAL_ENGINE)
);
$this->element('p', null, $this->element(
'p',
null,
// TRANS: Content part of engine software version page. // TRANS: Content part of engine software version page.
_('This program is distributed in the hope that it will be useful, ' . _('This program is distributed in the hope that it will be useful, ' .
'but WITHOUT ANY WARRANTY; without even the implied warranty of ' . 'but WITHOUT ANY WARRANTY; without even the implied warranty of ' .
'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ' . 'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ' .
'GNU Affero General Public License for more details.')); 'GNU Affero General Public License for more details.')
);
$this->elementStart('p'); $this->elementStart('p');
// TRANS: Content part of engine version page. // TRANS: Content part of engine version page.
// TRANS: %s is a link to the AGPL license with link description "http://www.gnu.org/licenses/agpl.html". // TRANS: %s is a link to the AGPL license with link description "http://www.gnu.org/licenses/agpl.html".
$this->raw(sprintf(_('You should have received a copy of the GNU Affero General Public License ' . $this->raw(sprintf(
_('You should have received a copy of the GNU Affero General Public License ' .
'along with this program. If not, see %s.'), 'along with this program. If not, see %s.'),
XMLStringer::estring('a', array('href' => 'https://www.gnu.org/licenses/agpl.html'), XMLStringer::estring(
'https://www.gnu.org/licenses/agpl.html'))); 'a',
['href' => 'https://www.gnu.org/licenses/agpl.html'],
'https://www.gnu.org/licenses/agpl.html'
)
));
$this->elementEnd('p'); $this->elementEnd('p');
// XXX: Theme information? // XXX: Theme information?
@ -183,18 +207,18 @@ class VersionAction extends Action
// TRANS: Header for engine plugins section on the version page. // TRANS: Header for engine plugins section on the version page.
$this->element('h2', null, _('Plugins')); $this->element('h2', null, _('Plugins'));
$this->elementStart('table', array('id' => 'plugins_enabled')); $this->elementStart('table', ['id' => 'plugins_enabled']);
$this->elementStart('thead'); $this->elementStart('thead');
$this->elementStart('tr'); $this->elementStart('tr');
// TRANS: Column header for plugins table on version page. // TRANS: Column header for plugins table on version page.
$this->element('th', array('id' => 'plugin_name'), _m('HEADER', 'Name')); $this->element('th', ['id' => 'plugin_name'], _m('HEADER', 'Name'));
// TRANS: Column header for plugins table on version page. // TRANS: Column header for plugins table on version page.
$this->element('th', array('id' => 'plugin_version'), _m('HEADER', 'Version')); $this->element('th', ['id' => 'plugin_version'], _m('HEADER', 'Version'));
// TRANS: Column header for plugins table on version page. // TRANS: Column header for plugins table on version page.
$this->element('th', array('id' => 'plugin_authors'), _m('HEADER', 'Author(s)')); $this->element('th', ['id' => 'plugin_authors'], _m('HEADER', 'Author(s)'));
// TRANS: Column header for plugins table on version page. // TRANS: Column header for plugins table on version page.
$this->element('th', array('id' => 'plugin_description'), _m('HEADER', 'Description')); $this->element('th', ['id' => 'plugin_description'], _m('HEADER', 'Description'));
$this->elementEnd('tr'); $this->elementEnd('tr');
$this->elementEnd('thead'); $this->elementEnd('thead');
@ -203,8 +227,11 @@ class VersionAction extends Action
$this->elementStart('tr'); $this->elementStart('tr');
if (array_key_exists('homepage', $plugin)) { if (array_key_exists('homepage', $plugin)) {
$this->elementStart('th'); $this->elementStart('th');
$this->element('a', array('href' => $plugin['homepage']), $this->element(
$plugin['name']); 'a',
['href' => $plugin['homepage']],
$plugin['name']
);
$this->elementEnd('th'); $this->elementEnd('th');
} else { } else {
$this->element('th', null, $plugin['name']); $this->element('th', null, $plugin['name']);
@ -220,7 +247,7 @@ class VersionAction extends Action
$this->elementStart('td'); $this->elementStart('td');
$this->raw($plugin['rawdescription']); $this->raw($plugin['rawdescription']);
$this->elementEnd('td'); $this->elementEnd('td');
} else if (array_key_exists('description', $plugin)) { } elseif (array_key_exists('description', $plugin)) {
$this->element('td', null, $plugin['description']); $this->element('td', null, $plugin['description']);
} }
$this->elementEnd('tr'); $this->elementEnd('tr');
@ -228,6 +255,5 @@ class VersionAction extends Action
$this->elementEnd('tbody'); $this->elementEnd('tbody');
$this->elementEnd('table'); $this->elementEnd('table');
} }
} }
} }