[NOTICES] Add data-nosnippet attribute for notices by remote profiles
This commit is contained in:
parent
6833c9f1c2
commit
bec6fdc66a
|
@ -571,7 +571,15 @@ abstract class ActivityHandlerModule extends Module
|
||||||
|
|
||||||
protected function openNoticeListItemElement(NoticeListItem $nli)
|
protected function openNoticeListItemElement(NoticeListItem $nli)
|
||||||
{
|
{
|
||||||
|
// Build up the attributes
|
||||||
|
$attrs = [];
|
||||||
|
|
||||||
|
// -> The id
|
||||||
$id = (empty($nli->repeat)) ? $nli->notice->id : $nli->repeat->id;
|
$id = (empty($nli->repeat)) ? $nli->notice->id : $nli->repeat->id;
|
||||||
|
$id_decl = "notice-{$id}";
|
||||||
|
$attrs['id'] = $id_decl;
|
||||||
|
|
||||||
|
// -> The class
|
||||||
$class = 'h-entry notice ' . $this->tag();
|
$class = 'h-entry notice ' . $this->tag();
|
||||||
if ($nli->notice->scope != 0 && $nli->notice->scope != 1) {
|
if ($nli->notice->scope != 0 && $nli->notice->scope != 1) {
|
||||||
$class .= ' limited-scope';
|
$class .= ' limited-scope';
|
||||||
|
@ -581,10 +589,14 @@ abstract class ActivityHandlerModule extends Module
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// either source or what we filtered out was a zero-length string
|
// either source or what we filtered out was a zero-length string
|
||||||
}
|
}
|
||||||
$nli->out->elementStart(
|
$attrs['class'] = $class;
|
||||||
'li',
|
|
||||||
['class' => $class, 'id' => 'notice-' . $id]
|
// -> Robots
|
||||||
);
|
if (!$nli->notice->isLocal()) {
|
||||||
|
$attrs['data-nosnippet'] = 'true';
|
||||||
|
}
|
||||||
|
|
||||||
|
$nli->out->elementStart('li', $attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function closeNoticeListItemElement(NoticeListItem $nli)
|
protected function closeNoticeListItemElement(NoticeListItem $nli)
|
||||||
|
|
|
@ -564,7 +564,15 @@ abstract class ActivityHandlerPlugin extends Plugin
|
||||||
|
|
||||||
protected function openNoticeListItemElement(NoticeListItem $nli)
|
protected function openNoticeListItemElement(NoticeListItem $nli)
|
||||||
{
|
{
|
||||||
|
// Build up the attributes
|
||||||
|
$attrs = [];
|
||||||
|
|
||||||
|
// -> The id
|
||||||
$id = (empty($nli->repeat)) ? $nli->notice->id : $nli->repeat->id;
|
$id = (empty($nli->repeat)) ? $nli->notice->id : $nli->repeat->id;
|
||||||
|
$id_decl = "notice-{$id}";
|
||||||
|
$attrs['id'] = $id_decl;
|
||||||
|
|
||||||
|
// -> The class
|
||||||
$class = 'h-entry notice ' . $this->tag();
|
$class = 'h-entry notice ' . $this->tag();
|
||||||
if ($nli->notice->scope != 0 && $nli->notice->scope != 1) {
|
if ($nli->notice->scope != 0 && $nli->notice->scope != 1) {
|
||||||
$class .= ' limited-scope';
|
$class .= ' limited-scope';
|
||||||
|
@ -574,8 +582,14 @@ abstract class ActivityHandlerPlugin extends Plugin
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// either source or what we filtered out was a zero-length string
|
// either source or what we filtered out was a zero-length string
|
||||||
}
|
}
|
||||||
$nli->out->elementStart('li', array('class' => $class,
|
$attrs['class'] = $class;
|
||||||
'id' => 'notice-' . $id));
|
|
||||||
|
// -> Robots
|
||||||
|
if (!$nli->notice->isLocal()) {
|
||||||
|
$attrs['data-nosnippet'] = 'true';
|
||||||
|
}
|
||||||
|
|
||||||
|
$nli->out->elementStart('li', $attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function closeNoticeListItemElement(NoticeListItem $nli)
|
protected function closeNoticeListItemElement(NoticeListItem $nli)
|
||||||
|
|
|
@ -232,7 +232,16 @@ class NoticeListItem extends Widget
|
||||||
public function showStart()
|
public function showStart()
|
||||||
{
|
{
|
||||||
if (Event::handle('StartOpenNoticeListItemElement', [$this])) {
|
if (Event::handle('StartOpenNoticeListItemElement', [$this])) {
|
||||||
|
// Build up the attributes
|
||||||
|
$attrs = [];
|
||||||
|
|
||||||
|
// -> The id
|
||||||
$id = (empty($this->repeat)) ? $this->notice->id : $this->repeat->id;
|
$id = (empty($this->repeat)) ? $this->notice->id : $this->repeat->id;
|
||||||
|
$id_prefix = (strlen($this->id_prefix) ? $this->id_prefix . '-' : '');
|
||||||
|
$id_decl = "${id_prefix}notice-${id}";
|
||||||
|
$attrs['id'] = $id_decl;
|
||||||
|
|
||||||
|
// -> The class
|
||||||
$class = 'h-entry notice';
|
$class = 'h-entry notice';
|
||||||
if ($this->notice->scope != 0 && $this->notice->scope != 1) {
|
if ($this->notice->scope != 0 && $this->notice->scope != 1) {
|
||||||
$class .= ' limited-scope';
|
$class .= ' limited-scope';
|
||||||
|
@ -242,14 +251,14 @@ class NoticeListItem extends Widget
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
// either source or what we filtered out was a zero-length string
|
// either source or what we filtered out was a zero-length string
|
||||||
}
|
}
|
||||||
$id_prefix = (strlen($this->id_prefix) ? $this->id_prefix . '-' : '');
|
$attrs['class'] = $class;
|
||||||
$this->out->elementStart(
|
|
||||||
$this->item_tag,
|
// -> Robots
|
||||||
[
|
if (!$this->notice->isLocal()) {
|
||||||
'class' => $class,
|
$attrs['data-nosnippet'] = 'true';
|
||||||
'id' => "${id_prefix}notice-${id}",
|
}
|
||||||
]
|
|
||||||
);
|
$this->out->elementStart($this->item_tag, $attrs);
|
||||||
Event::handle('EndOpenNoticeListItemElement', [$this]);
|
Event::handle('EndOpenNoticeListItemElement', [$this]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -309,7 +318,7 @@ class NoticeListItem extends Widget
|
||||||
$this->out->element('a', $addr, $text);
|
$this->out->element('a', $addr, $text);
|
||||||
$this->out->elementEnd('li');
|
$this->out->elementEnd('li');
|
||||||
}
|
}
|
||||||
$this->out->elementEnd('ul', 'addressees');
|
$this->out->elementEnd('ul');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user