Skip to content

Commit

Permalink
Fix #8: Remove extra dot in wall entry bottom links
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-farre committed Mar 19, 2024
1 parent 0ba8b3a commit e7eb173
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 21 deletions.
9 changes: 5 additions & 4 deletions Events.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

namespace humhub\modules\socialshare;

use humhub\modules\socialshare\widgets\ShareLink;
use Yii;
use yii\base\WidgetEvent;
use yii\helpers\Url;

class Events
Expand All @@ -17,10 +19,9 @@ public static function onTopMenuInit($event)
'isActive' => (Yii::$app->controller->module && Yii::$app->controller->module->id == 'socialshare'),
]);
}
public static function onWallEntryLinksInit($event)

public static function onWallEntryLinksAfterRun(WidgetEvent $event)
{
$event->sender->addWidget(widgets\ShareLink::class, ['object' => $event->sender->object], ['sortOrder' => 10]);
$event->result = ShareLink::widget(['object' => $event->sender->object]) . $event->result;
}

}
7 changes: 6 additions & 1 deletion config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,16 @@
use humhub\modules\content\widgets\WallEntryLinks;
use humhub\modules\socialshare\Events;
use humhub\modules\socialshare\Module;

return [
'id' => 'socialshare',
'class' => Module::class,
'namespace' => 'humhub\modules\socialshare',
'events' => [
['class' => WallEntryLinks::class, 'event' => WallEntryLinks::EVENT_INIT, 'callback' => [Events::class, 'onWallEntryLinksInit']],
[
'class' => WallEntryLinks::class,
'event' => WallEntryLinks::EVENT_AFTER_RUN,
'callback' => [Events::class, 'onWallEntryLinksAfterRun']
],
],
];
8 changes: 4 additions & 4 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

Unreleased
-----------------------
- Fix #8: Remove extra dot in wall entry bottom links

1.0.6 (10 March, 2023)
-----------------------
- Fix #5: PHP 8.2 compatibility
Expand All @@ -13,7 +17,3 @@ Changelog
1.0.2 (24 August, 2018)
-----------------------
- Fix: PHP 7.2 compatibility




22 changes: 10 additions & 12 deletions widgets/views/shareLink.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
<?php

use yii\helpers\Html;
use humhub\modules\socialshare\assets\Assets;
use yii\helpers\Html;

Assets::register($this);
?>
<span class="shareLinkContainer">
<div class="pull-right" id="">
<?php
$option = "
<div class="shareLinkContainer pull-right">
<?php
$option = "
var width = 575,
height = 400,
left = ($(window).width() - width) / 2,
Expand All @@ -25,10 +24,9 @@
return false;
";
?>
<?= Html::a('<i class="fa fa-facebook" style="font-size:16px;color:#3a5795">&nbsp;</i>', 'https://www.facebook.com/sharer/sharer.php?u=' . urlencode((string)$permalink) . '&description=' . urlencode((string)$object->getContentDescription()), ['onclick' => $option]); ?>
<?= Html::a('<i class="fa fa-twitter" style="font-size:16px;color:#55acee">&nbsp;</i>', 'https://twitter.com/intent/tweet?text=' . urlencode((string)$object->getContentDescription()) . '&url=' . urlencode((string)$permalink), ['onclick' => $option]); ?>
<?= Html::a('<i class="fa fa-linkedin-square" style="font-size:16px;color:#0177b5">&nbsp;</i>', 'https://www.linkedin.com/shareArticle?summary=&mini=true&source=&title=' . urlencode((string)$object->getContentDescription()) . '&url=' . urlencode((string)$permalink) . '&ro=false', ['onclick' => $option]); ?>
<?= Html::a('<i class="fa fa-share" style="font-size:16px;color:#00c300">&nbsp;</i>', 'https://social-plugins.line.me/lineit/share?' . '&text=' . urlencode((string)$object->getContentDescription()) . '&url=' . urlencode((string)$permalink), ['onclick' => $option]); ?>
</div>
</span>
?>
<?= Html::a('<i class="fa fa-facebook" style="font-size:16px;color:#3a5795">&nbsp;</i>', 'https://www.facebook.com/sharer/sharer.php?u=' . urlencode((string)$permalink) . '&description=' . urlencode((string)$object->getContentDescription()), ['onclick' => $option]); ?>
<?= Html::a('<i class="fa fa-twitter" style="font-size:16px;color:#55acee">&nbsp;</i>', 'https://twitter.com/intent/tweet?text=' . urlencode((string)$object->getContentDescription()) . '&url=' . urlencode((string)$permalink), ['onclick' => $option]); ?>
<?= Html::a('<i class="fa fa-linkedin-square" style="font-size:16px;color:#0177b5">&nbsp;</i>', 'https://www.linkedin.com/shareArticle?summary=&mini=true&source=&title=' . urlencode((string)$object->getContentDescription()) . '&url=' . urlencode((string)$permalink) . '&ro=false', ['onclick' => $option]); ?>
<?= Html::a('<i class="fa fa-share" style="font-size:16px;color:#00c300">&nbsp;</i>', 'https://social-plugins.line.me/lineit/share?' . '&text=' . urlencode((string)$object->getContentDescription()) . '&url=' . urlencode((string)$permalink), ['onclick' => $option]); ?>
</div>

0 comments on commit e7eb173

Please sign in to comment.