[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 committed by Diogo Peralta Cordeiro
parent 20a6f1d4f4
commit fa28646d43

View File

@ -14,7 +14,7 @@
// 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/>.
defined('STATUSNET') || die();
defined('GNUSOCIAL') || die();
/**
* Version info page
@ -33,7 +33,7 @@ defined('STATUSNET') || die();
*/
class VersionAction extends Action
{
var $pluginVersions = [];
public $pluginVersions = [];
/**
* Return true since we're read-only.
@ -42,7 +42,7 @@ class VersionAction extends Action
*
* @return bool is read only action?
*/
function isReadOnly($args)
public function isReadOnly($args)
{
return true;
}
@ -52,7 +52,7 @@ class VersionAction extends Action
*
* @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.
return sprintf(_('%1$s %2$s'), GNUSOCIAL_ENGINE, GNUSOCIAL_VERSION);
@ -67,6 +67,7 @@ class VersionAction extends Action
* @param array $args array misc. arguments
*
* @return bool true
* @throws ClientException
*/
protected function prepare(array $args = [])
{
@ -83,9 +84,10 @@ class VersionAction extends Action
* Shows a page with the version information in the
* content area.
*
* @param array $args ignored.
*
* @return void
* @throws ClientException
* @throws ReflectionException
* @throws ServerException
*/
protected function handle()
{
@ -99,13 +101,13 @@ class VersionAction extends Action
*
* @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->showPageNoticeBlock();
$this->elementStart('div', array('id' => 'content_inner',
'class' => 'e-content'));
$this->elementStart('div', ['id' => 'content_inner',
'class' => 'e-content']);
// show the actual content (forms, lists, whatever)
$this->showContent();
$this->elementEnd('div');
@ -117,9 +119,9 @@ class VersionAction extends Action
*
* @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
*
* @return void
* @throws Exception
*/
function showContent()
public function showContent()
{
$this->elementStart('p');
// TRANS: Content part of engine version page.
// 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.'),
XMLStringer::estring('a', array('href' => GNUSOCIAL_ENGINE_URL),
XMLStringer::estring(
'a',
['href' => GNUSOCIAL_ENGINE_URL],
// TRANS: Engine name.
GNUSOCIAL_ENGINE),
GNUSOCIAL_VERSION));
GNUSOCIAL_ENGINE
),
GNUSOCIAL_VERSION
));
$this->elementEnd('p');
// TRANS: Header for engine software contributors section on the version page.
$this->element('h2', null, _('Contributors'));
$this->elementStart('p');
$this->raw(sprintf('See %s for a full list of contributors.',
XMLStringer::estring('a', array('href' => 'https://notabug.org/diogo/gnu-social/src/nightly/CREDITS.md'),
'https://notabug.org/diogo/gnu-social/src/nightly/CREDITS.md')));
$this->raw(sprintf(
'See %s for a full list of contributors.',
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');
// TRANS: Header for engine software license section on the version page.
$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
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 ' .
'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.
_('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.'));
'GNU Affero General Public License for more details.')
);
$this->elementStart('p');
// 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".
$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.'),
XMLStringer::estring('a', array('href' => 'https://www.gnu.org/licenses/agpl.html'),
'https://www.gnu.org/licenses/agpl.html')));
XMLStringer::estring(
'a',
['href' => 'https://www.gnu.org/licenses/agpl.html'],
'https://www.gnu.org/licenses/agpl.html'
)
));
$this->elementEnd('p');
// XXX: Theme information?
@ -183,18 +207,18 @@ class VersionAction extends Action
// TRANS: Header for engine plugins section on the version page.
$this->element('h2', null, _('Plugins'));
$this->elementStart('table', array('id' => 'plugins_enabled'));
$this->elementStart('table', ['id' => 'plugins_enabled']);
$this->elementStart('thead');
$this->elementStart('tr');
// 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.
$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.
$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.
$this->element('th', array('id' => 'plugin_description'), _m('HEADER', 'Description'));
$this->element('th', ['id' => 'plugin_description'], _m('HEADER', 'Description'));
$this->elementEnd('tr');
$this->elementEnd('thead');
@ -203,8 +227,11 @@ class VersionAction extends Action
$this->elementStart('tr');
if (array_key_exists('homepage', $plugin)) {
$this->elementStart('th');
$this->element('a', array('href' => $plugin['homepage']),
$plugin['name']);
$this->element(
'a',
['href' => $plugin['homepage']],
$plugin['name']
);
$this->elementEnd('th');
} else {
$this->element('th', null, $plugin['name']);
@ -228,6 +255,5 @@ class VersionAction extends Action
$this->elementEnd('tbody');
$this->elementEnd('table');
}
}
}