Enh: "Powered by" message handling by widget

This commit is contained in:
Lucas Bartholemy 2018-10-23 14:05:28 +02:00
parent 6748aaa39e
commit 185a21ef50
8 changed files with 70 additions and 7 deletions

View File

@ -6,6 +6,7 @@ HumHub Change Log
---------------------------
- Enh: Added maximum username length & maximum/minimum space url length (rekollekt)
- Fix: Error message during database installation
- Enh: "Powered by" message handling by widget
1.3.6 (October 11, 2018)

View File

@ -2,6 +2,7 @@
use yii\helpers\Html;
use humhub\assets\AppAsset;
use humhub\widgets\PoweredBy;
/* @var $this \yii\web\View */
/* @var $content string */
@ -37,7 +38,7 @@ AppAsset::register($this);
<?php echo $content; ?>
<div class="text text-center powered">
Powered by <a href="http://www.humhub.org" target="_blank">HumHub</a>
<?= PoweredBy::widget(); ?>
<br/>
<br/>
</div>
@ -47,4 +48,4 @@ AppAsset::register($this);
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>
<?php $this->endPage() ?>

View File

@ -3,6 +3,7 @@
use humhub\widgets\FooterMenu;
use yii\helpers\Url;
use yii\helpers\Html;
use humhub\widgets\PoweredBy;
?>
@ -696,7 +697,7 @@ use yii\helpers\Html;
<span style="text-decoration: none; color:<?= $soft2Color ?>;">
<?= FooterMenu::widget(['location' => FooterMenu::LOCATION_EMAIL]); ?>
Powered by <a href="http://www.humhub.org" style="text-decoration: none; color: <?= $soft2Color ?>;">HumHub</a>
<?= PoweredBy::widget(['linkOptions' => ['style' => 'text-decoration:none;color:'.$soft2Color]]); ?>
</span>
</td>

View File

@ -7,4 +7,4 @@
<?= Yii::t('base', 'Unsubscribe') ?>: <?= $url ?>
<?php endif; ?>
Powered by HumHub (http://www.humhub.org)
<?= \humhub\widgets\PoweredBy::widget(['textOnly' => true]); ?>

View File

@ -0,0 +1,57 @@
<?php
/**
* @link https://www.humhub.org/
* @copyright Copyright (c) 2018 HumHub GmbH & Co. KG
* @license https://www.humhub.com/licences
*/
namespace humhub\widgets;
use humhub\components\Widget;
use humhub\libs\Html;
use Yii;
/**
* PoweredBy widget
*
* @since 1.3.7
* @author Luke
*/
class PoweredBy extends Widget
{
/**
* @var bool return text link only
*/
public $textOnly = false;
/**
* @var array link tag HTML options
*/
public $linkOptions = [];
/**
* @inheritdoc
*/
public function run()
{
if (isset(Yii::$app->params['hidePoweredBy'])) {
return '';
}
if ($this->textOnly) {
return Yii::t('base', 'Powered by {name}', ['name' => 'HumHub (https://humhub.org)']);
}
if (!isset($this->linkOptions['target'])) {
$this->linkOptions['target'] = '_blank';
}
return Yii::t('base', 'Powered by {name}', [
'name' => Html::a('HumHub', 'https://humhub.org', $this->linkOptions)
]);
}
}

View File

@ -5,6 +5,7 @@
* @license https://www.humhub.com/licences
*/
use humhub\widgets\PoweredBy;
use yii\helpers\Html;
?>
@ -15,7 +16,7 @@ use yii\helpers\Html;
<?php foreach ($items as $item): ?>
<?= Html::a($item['label'], $item['url']); ?>&nbsp;&middot;&nbsp;
<?php endforeach; ?>
Powered by <?= Html::a('HumHub', 'https://humhub.org'); ?>&nbsp;
<?= PoweredBy::widget(); ?>
</small>
</div>
<br/>

View File

@ -6,6 +6,7 @@
*/
use yii\helpers\Html;
use humhub\widgets\PoweredBy;
$i = 0;
?>
@ -22,5 +23,5 @@ $i = 0;
<?php endforeach; ?>
<br/><br/>
<?php endif; ?>
Powered by <?= Html::a('HumHub', 'https://humhub.org'); ?>&nbsp;
<?= PoweredBy::widget(); ?>
</div>

View File

@ -6,6 +6,7 @@
*/
use yii\helpers\Html;
use humhub\widgets\PoweredBy;
$i = 0;
?>
@ -22,7 +23,7 @@ $i = 0;
<?php endif; ?>
<?php endforeach; ?>
&middot; Powered&nbsp;by&nbsp;<?= Html::a('HumHub', 'https://humhub.org'); ?>&nbsp;
&middot; <?= PoweredBy::widget(); ?>
</small>
</div>
<br />