noticelistitem.php 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749
  1. <?php
  2. // This file is part of GNU social - https://www.gnu.org/software/social
  3. //
  4. // GNU social is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Affero General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // GNU social is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Affero General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Affero General Public License
  15. // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
  16. /**
  17. * An item in a notice list
  18. *
  19. * @category Widget
  20. * @package GNUsocial
  21. * @author Evan Prodromou <evan@status.net>
  22. * @copyright 2010 StatusNet, Inc.
  23. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  24. */
  25. defined('GNUSOCIAL') || die();
  26. /**
  27. * widget for displaying a single notice
  28. *
  29. * This widget has the core smarts for showing a single notice: what to display,
  30. * where, and under which circumstances. Its key method is show(); this is a recipe
  31. * that calls all the other show*() methods to build up a single notice. The
  32. * ProfileNoticeListItem subclass, for example, overrides showAuthor() to skip
  33. * author info (since that's implicit by the data in the page).
  34. *
  35. * @category UI
  36. * @package GNUsocial
  37. * @author Evan Prodromou <evan@status.net>
  38. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  39. * @see NoticeList
  40. * @see ProfileNoticeListItem
  41. */
  42. class NoticeListItem extends Widget
  43. {
  44. /** The notice this item will show. */
  45. public $notice = null;
  46. /** The notice that was repeated. */
  47. public $repeat = null;
  48. /** The profile of the author of the notice, extracted once for convenience. */
  49. public $profile = null;
  50. protected $addressees = true;
  51. protected $attachments = true;
  52. protected $id_prefix = null;
  53. protected $options = true;
  54. protected $maxchars = 0; // if <= 0 it means use full posts
  55. protected $item_tag = 'li';
  56. protected $pa = null;
  57. /**
  58. * constructor
  59. *
  60. * Also initializes the profile attribute.
  61. *
  62. * @param Notice $notice The notice we'll display
  63. * @param Action|null $out
  64. * @param array $prefs
  65. */
  66. public function __construct(Notice $notice, Action $out = null, array $prefs = [])
  67. {
  68. parent::__construct($out);
  69. if (!empty($notice->repeat_of)) {
  70. $original = Notice::getKV('id', $notice->repeat_of);
  71. if (!$original instanceof Notice) { // could have been deleted
  72. $this->notice = $notice;
  73. } else {
  74. $this->notice = $original;
  75. $this->repeat = $notice;
  76. }
  77. } else {
  78. $this->notice = $notice;
  79. }
  80. $this->profile = $this->notice->getProfile();
  81. // integer preferences
  82. foreach (['maxchars'] as $key) {
  83. if (array_key_exists($key, $prefs)) {
  84. $this->$key = (int)$prefs[$key];
  85. }
  86. }
  87. // boolean preferences
  88. foreach (['addressees', 'attachments', 'options'] as $key) {
  89. if (array_key_exists($key, $prefs)) {
  90. $this->$key = (bool)$prefs[$key];
  91. }
  92. }
  93. // string preferences
  94. foreach (['id_prefix', 'item_tag'] as $key) {
  95. if (array_key_exists($key, $prefs)) {
  96. $this->$key = $prefs[$key];
  97. }
  98. }
  99. }
  100. /**
  101. * recipe function for displaying a single notice.
  102. *
  103. * This uses all the other methods to correctly display a notice. Override
  104. * it or one of the others to fine-tune the output.
  105. *
  106. * @return void
  107. */
  108. public function show()
  109. {
  110. if (empty($this->notice)) {
  111. common_log(LOG_WARNING, "Trying to show missing notice; skipping.");
  112. return;
  113. } elseif (empty($this->profile)) {
  114. common_log(LOG_WARNING, "Trying to show missing profile (" . $this->notice->profile_id . "); skipping.");
  115. return;
  116. }
  117. $this->showStart();
  118. if (Event::handle('StartShowNoticeItem', array($this))) {
  119. $this->showNotice();
  120. Event::handle('EndShowNoticeItem', array($this));
  121. }
  122. $this->showEnd();
  123. }
  124. public function showNotice()
  125. {
  126. if (Event::handle('StartShowNoticeItemNotice', array($this))) {
  127. $this->showNoticeHeaders();
  128. $this->showContent();
  129. $this->showNoticeFooter();
  130. Event::handle('EndShowNoticeItemNotice', array($this));
  131. }
  132. }
  133. public function showNoticeHeaders()
  134. {
  135. $this->elementStart('section', ['class' => 'notice-headers']);
  136. $this->showNoticeTitle();
  137. $this->showAuthor();
  138. if (!empty($this->notice->reply_to) || count($this->getProfileAddressees()) > 0) {
  139. $this->elementStart('div', array('class' => 'parents'));
  140. try {
  141. $this->showParent();
  142. } catch (NoParentNoticeException $e) {
  143. // no parent notice
  144. } catch (InvalidUrlException $e) {
  145. // parent had an invalid URL so we can't show it
  146. }
  147. if ($this->addressees) {
  148. $this->showAddressees();
  149. }
  150. $this->elementEnd('div');
  151. }
  152. $this->elementEnd('section');
  153. }
  154. public function showNoticeFooter()
  155. {
  156. $this->elementStart('footer');
  157. $this->showNoticeInfo();
  158. if ($this->options) {
  159. $this->showNoticeOptions();
  160. }
  161. if ($this->attachments) {
  162. $this->showNoticeAttachments();
  163. }
  164. $this->elementEnd('footer');
  165. }
  166. public function showNoticeTitle()
  167. {
  168. if (Event::handle('StartShowNoticeTitle', array($this))) {
  169. $nameClass = $this->notice->getTitle(false) ? 'p-name ' : '';
  170. $this->element(
  171. 'a',
  172. [
  173. 'href' => $this->notice->getUri(),
  174. 'class' => $nameClass . 'u-uid',
  175. ],
  176. $this->notice->getTitle()
  177. );
  178. Event::handle('EndShowNoticeTitle', array($this));
  179. }
  180. }
  181. public function showNoticeInfo()
  182. {
  183. if (Event::handle('StartShowNoticeInfo', array($this))) {
  184. $this->showContextLink();
  185. $this->showNoticeLink();
  186. $this->showNoticeSource();
  187. $this->showNoticeLocation();
  188. $this->showPermalink();
  189. Event::handle('EndShowNoticeInfo', array($this));
  190. }
  191. }
  192. public function showNoticeOptions()
  193. {
  194. if (Event::handle('StartShowNoticeOptions', array($this))) {
  195. $user = common_current_user();
  196. if ($user) {
  197. $this->out->elementStart('div', 'notice-options');
  198. if (Event::handle('StartShowNoticeOptionItems', array($this))) {
  199. $this->showReplyLink();
  200. $this->showDeleteLink();
  201. Event::handle('EndShowNoticeOptionItems', array($this));
  202. }
  203. $this->out->elementEnd('div');
  204. }
  205. Event::handle('EndShowNoticeOptions', array($this));
  206. }
  207. }
  208. /**
  209. * start a single notice.
  210. *
  211. * @return void
  212. */
  213. public function showStart()
  214. {
  215. if (Event::handle('StartOpenNoticeListItemElement', [$this])) {
  216. // Build up the attributes
  217. $attrs = [];
  218. // -> The id
  219. $id = (empty($this->repeat)) ? $this->notice->id : $this->repeat->id;
  220. $id_prefix = (strlen($this->id_prefix) ? $this->id_prefix . '-' : '');
  221. $id_decl = "${id_prefix}notice-${id}";
  222. $attrs['id'] = $id_decl;
  223. // -> The class
  224. $class = 'h-entry notice';
  225. if ($this->notice->scope != 0 && $this->notice->scope != 1) {
  226. $class .= ' limited-scope';
  227. }
  228. try {
  229. $class .= ' notice-source-' . common_to_alphanumeric($this->notice->source);
  230. } catch (Exception $e) {
  231. // either source or what we filtered out was a zero-length string
  232. }
  233. $attrs['class'] = $class;
  234. // -> Robots
  235. if (!$this->notice->isLocal()) {
  236. $attrs['data-nosnippet'] = 'true';
  237. }
  238. $this->out->elementStart($this->item_tag, $attrs);
  239. Event::handle('EndOpenNoticeListItemElement', [$this]);
  240. }
  241. }
  242. /**
  243. * show the author of a notice
  244. *
  245. * By default, this shows the avatar and (linked) nickname of the author.
  246. *
  247. * @return void
  248. */
  249. public function showAuthor()
  250. {
  251. $attrs = [
  252. 'href' => $this->profile->getUrl(),
  253. 'class' => 'h-card',
  254. 'title' => $this->profile->getHtmlTitle(),
  255. ];
  256. if (empty($this->repeat)) {
  257. $attrs['class'] .= ' p-author';
  258. }
  259. if (Event::handle('StartShowNoticeItemAuthor', array($this->profile, $this->out, &$attrs))) {
  260. $this->out->elementStart('a', $attrs);
  261. $this->showAvatar($this->profile);
  262. $this->out->text($this->profile->getStreamName());
  263. $this->out->elementEnd('a');
  264. Event::handle('EndShowNoticeItemAuthor', array($this->profile, $this->out));
  265. }
  266. }
  267. public function showParent()
  268. {
  269. $this->out->element(
  270. 'a',
  271. array(
  272. 'href' => $this->notice->getParent()->getUrl(),
  273. 'class' => 'u-in-reply-to',
  274. 'rel' => 'in-reply-to'
  275. ),
  276. 'in reply to'
  277. );
  278. }
  279. public function showAddressees()
  280. {
  281. $pa = $this->getProfileAddressees();
  282. if (!empty($pa)) {
  283. $this->out->elementStart('ul', 'addressees');
  284. $first = true;
  285. foreach ($pa as $addr) {
  286. $this->out->elementStart('li');
  287. $text = $addr['text'];
  288. unset($addr['text']);
  289. $this->out->element('a', $addr, $text);
  290. $this->out->elementEnd('li');
  291. }
  292. $this->out->elementEnd('ul');
  293. }
  294. }
  295. public function getProfileAddressees()
  296. {
  297. if ($this->pa) {
  298. return $this->pa;
  299. }
  300. $this->pa = array();
  301. $attentions = $this->getAttentionProfiles();
  302. foreach ($attentions as $attn) {
  303. if ($attn->isGroup()) {
  304. $class = 'group';
  305. $profileurl = common_local_url('groupbyid', array('id' => $attn->getGroup()->getID()));
  306. } else {
  307. $class = 'account';
  308. $profileurl = common_local_url('userbyid', array('id' => $attn->getID()));
  309. }
  310. $this->pa[] = [
  311. 'href' => $profileurl,
  312. 'title' => $attn->getHtmlTitle(),
  313. 'class' => "addressee {$class} p-name u-url",
  314. 'text' => $attn->getStreamName(),
  315. ];
  316. }
  317. return $this->pa;
  318. }
  319. public function getAttentionProfiles()
  320. {
  321. return $this->notice->getAttentionProfiles();
  322. }
  323. /**
  324. * show the nickname of the author
  325. *
  326. * Links to the author's profile page
  327. *
  328. * @return void
  329. */
  330. public function showNickname()
  331. {
  332. $this->out->raw(
  333. '<span class="p-name">' .
  334. htmlspecialchars($this->profile->getNickname()) .
  335. '</span>'
  336. );
  337. }
  338. /**
  339. * show the content of the notice
  340. *
  341. * Shows the content of the notice. This is pre-rendered for efficiency
  342. * at save time. Some very old notices might not be pre-rendered, so
  343. * they're rendered on the spot.
  344. *
  345. * @return void
  346. */
  347. public function showContent()
  348. {
  349. // FIXME: URL, image, video, audio
  350. $nameClass = $this->notice->getTitle(false) ? '' : 'p-name ';
  351. $this->out->elementStart('article', array('class' => $nameClass . 'e-content'));
  352. if (Event::handle('StartShowNoticeContent', array($this->notice, $this->out, $this->out->getScoped()))) {
  353. if ($this->maxchars > 0 && mb_strlen($this->notice->content) > $this->maxchars) {
  354. $this->out->text(mb_substr($this->notice->content, 0, $this->maxchars) . '[…]');
  355. } else {
  356. $this->out->raw($this->notice->getRendered());
  357. }
  358. Event::handle('EndShowNoticeContent', array($this->notice, $this->out, $this->out->getScoped()));
  359. }
  360. $this->out->elementEnd('article');
  361. }
  362. public function showNoticeAttachments()
  363. {
  364. if (common_config('attachments', 'show_thumbs')) {
  365. $al = new InlineAttachmentList($this->notice, $this->out);
  366. $al->show();
  367. }
  368. }
  369. /**
  370. * show the link to the main page for the notice
  371. *
  372. * Displays a local link to the rendered notice, with "relative" time.
  373. *
  374. * @return void
  375. */
  376. public function showNoticeLink()
  377. {
  378. $this->out->element(
  379. 'time',
  380. [
  381. 'class' => 'dt-published',
  382. 'datetime' => common_date_iso8601($this->notice->created),
  383. 'title' => common_exact_date($this->notice->created),
  384. ],
  385. common_date_string($this->notice->created)
  386. );
  387. }
  388. /**
  389. * show the notice location
  390. *
  391. * shows the notice location in the correct language.
  392. *
  393. * If an URL is available, makes a link. Otherwise, just a span.
  394. *
  395. * @return void
  396. */
  397. public function showNoticeLocation()
  398. {
  399. try {
  400. $location = Notice_location::locFromStored($this->notice);
  401. } catch (NoResultException $e) {
  402. return;
  403. } catch (ServerException $e) {
  404. return;
  405. }
  406. $name = $location->getName();
  407. $lat = $location->lat;
  408. $lon = $location->lon;
  409. $latlon = (!empty($lat) && !empty($lon)) ? $lat . ';' . $lon : '';
  410. if (empty($name)) {
  411. $latdms = $this->decimalDegreesToDMS(abs($lat));
  412. $londms = $this->decimalDegreesToDMS(abs($lon));
  413. // TRANS: Used in coordinates as abbreviation of north.
  414. $north = _('N');
  415. // TRANS: Used in coordinates as abbreviation of south.
  416. $south = _('S');
  417. // TRANS: Used in coordinates as abbreviation of east.
  418. $east = _('E');
  419. // TRANS: Used in coordinates as abbreviation of west.
  420. $west = _('W');
  421. $name = sprintf(
  422. // TRANS: Coordinates message.
  423. // TRANS: %1$s is lattitude degrees, %2$s is lattitude minutes,
  424. // TRANS: %3$s is lattitude seconds, %4$s is N (north) or S (south) depending on lattitude,
  425. // TRANS: %5$s is longitude degrees, %6$s is longitude minutes,
  426. // TRANS: %7$s is longitude seconds, %8$s is E (east) or W (west) depending on longitude,
  427. _('%1$u°%2$u\'%3$u"%4$s %5$u°%6$u\'%7$u"%8$s'),
  428. $latdms['deg'],
  429. $latdms['min'],
  430. $latdms['sec'],
  431. ($lat > 0 ? $north : $south),
  432. $londms['deg'],
  433. $londms['min'],
  434. $londms['sec'],
  435. ($lon > 0 ? $east : $west)
  436. );
  437. }
  438. $url = $location->getUrl();
  439. $this->out->text(' ');
  440. $this->out->elementStart('span', array('class' => 'location'));
  441. // TRANS: Followed by geo location.
  442. $this->out->text(_('at'));
  443. $this->out->text(' ');
  444. if (empty($url)) {
  445. $this->out->element(
  446. 'abbr',
  447. [
  448. 'class' => 'geo',
  449. 'title' => $latlon,
  450. ],
  451. $name
  452. );
  453. } else {
  454. $xstr = new XMLStringer(false);
  455. $xstr->elementStart(
  456. 'a',
  457. ['href' => $url, 'rel' => 'external']
  458. );
  459. $xstr->element(
  460. 'abbr',
  461. ['class' => 'geo', 'title' => $latlon],
  462. $name
  463. );
  464. $xstr->elementEnd('a');
  465. $this->out->raw($xstr->getString());
  466. }
  467. $this->out->elementEnd('span');
  468. }
  469. /**
  470. * @param number $dec decimal degrees
  471. * @return array split into 'deg', 'min', and 'sec'
  472. */
  473. public function decimalDegreesToDMS($dec)
  474. {
  475. $deg = intval($dec);
  476. $tempma = abs($dec) - abs($deg);
  477. $tempma = $tempma * 3600;
  478. $min = floor($tempma / 60);
  479. $sec = $tempma - ($min * 60);
  480. return ['deg' => $deg, 'min' => $min, 'sec' => $sec];
  481. }
  482. /**
  483. * Show the source of the notice
  484. *
  485. * Either the name (and link) of the API client that posted the notice,
  486. * or one of other other channels.
  487. *
  488. * @return void
  489. * @throws Exception
  490. */
  491. public function showNoticeSource()
  492. {
  493. $ns = $this->notice->getSource();
  494. if (!$ns instanceof Notice_source) {
  495. return;
  496. }
  497. // TRANS: A possible notice source (web interface).
  498. $source_name = (empty($ns->name)) ? ($ns->code ? _($ns->code) : _m('SOURCE', 'web')) : _($ns->name);
  499. $this->out->text(' ');
  500. $this->out->elementStart('span', 'source');
  501. // @todo FIXME: probably i18n issue. If "from" is followed by text, that should be a parameter to "from" (from %s).
  502. // TRANS: Followed by notice source.
  503. $this->out->text(_('from'));
  504. $this->out->text(' ');
  505. $name = $source_name;
  506. $url = $ns->url;
  507. $title = null;
  508. if (Event::handle('StartNoticeSourceLink', array($this->notice, &$name, &$url, &$title))) {
  509. $name = $source_name;
  510. $url = $ns->url;
  511. }
  512. Event::handle('EndNoticeSourceLink', array($this->notice, &$name, &$url, &$title));
  513. // if $ns->name and $ns->url are populated we have
  514. // configured a source attr somewhere
  515. if (!empty($name) && !empty($url)) {
  516. $this->out->elementStart('span', 'device');
  517. $attrs = array(
  518. 'href' => $url,
  519. 'rel' => 'external'
  520. );
  521. if (!empty($title)) {
  522. $attrs['title'] = $title;
  523. }
  524. $this->out->element('a', $attrs, $name);
  525. $this->out->elementEnd('span');
  526. } else {
  527. $this->out->element('span', 'device', $name);
  528. }
  529. $this->out->elementEnd('span');
  530. }
  531. /**
  532. * show link to single-notice view for this notice item
  533. *
  534. * A permalink that goes to this specific object and nothing else
  535. *
  536. * @return void
  537. */
  538. public function showPermalink()
  539. {
  540. $class = 'permalink u-url';
  541. if (!$this->notice->isLocal()) {
  542. $class .= ' external';
  543. }
  544. try {
  545. if ($this->repeat) {
  546. $this->out->element(
  547. 'a',
  548. [
  549. 'href' => $this->repeat->getUrl(),
  550. 'class' => 'u-url',
  551. ],
  552. ''
  553. );
  554. $class = str_replace('u-url', 'u-repost-of', $class);
  555. }
  556. } catch (InvalidUrlException $e) {
  557. // no permalink available
  558. }
  559. try {
  560. $this->out->element(
  561. 'a',
  562. [
  563. 'href' => $this->notice->getUrl(true),
  564. 'class' => $class,
  565. ],
  566. // TRANS: Addition in notice list item for single-notice view.
  567. _('permalink')
  568. );
  569. } catch (InvalidUrlException $e) {
  570. // no permalink available
  571. }
  572. }
  573. /**
  574. * Show link to conversation view.
  575. */
  576. public function showContextLink()
  577. {
  578. $this->out->element(
  579. 'a',
  580. [
  581. 'rel' => 'bookmark',
  582. 'class' => 'timestamp',
  583. 'href' => Conversation::getUrlFromNotice($this->notice),
  584. ],
  585. // TRANS: A link to the conversation view of a notice, on the local server.
  586. _('In conversation')
  587. );
  588. }
  589. /**
  590. * show a link to reply to the current notice
  591. *
  592. * Should either do the reply in the current notice form (if available), or
  593. * link out to the notice-posting form. A little flakey, doesn't always work.
  594. *
  595. * @return void
  596. */
  597. public function showReplyLink()
  598. {
  599. if (common_logged_in()) {
  600. $this->out->text(' ');
  601. $reply_url = common_local_url(
  602. 'newnotice',
  603. [
  604. 'replyto' => $this->profile->getNickname(),
  605. 'inreplyto' => $this->notice->id,
  606. ]
  607. );
  608. $this->out->elementStart(
  609. 'a',
  610. [
  611. 'href' => $reply_url,
  612. 'class' => 'notice_reply',
  613. // TRANS: Link title in notice list item to reply to a notice.
  614. 'title' => _('Reply to this notice.'),
  615. ]
  616. );
  617. // TRANS: Link text in notice list item to reply to a notice.
  618. $this->out->text(_('Reply'));
  619. $this->out->text(' ');
  620. $this->out->element('span', 'notice_id', $this->notice->id);
  621. $this->out->elementEnd('a');
  622. }
  623. }
  624. /**
  625. * if the user is the author, let them delete the notice
  626. *
  627. * @return void
  628. * @throws Exception
  629. */
  630. public function showDeleteLink()
  631. {
  632. $user = common_current_user();
  633. $todel = (empty($this->repeat)) ? $this->notice : $this->repeat;
  634. if (!empty($user) &&
  635. !$this->notice->isVerb([ActivityVerb::DELETE]) &&
  636. ($todel->profile_id == $user->id || $user->hasRight(Right::DELETEOTHERSNOTICE))) {
  637. $this->out->text(' ');
  638. $deleteurl = common_local_url(
  639. 'deletenotice',
  640. ['notice' => $todel->id]
  641. );
  642. $this->out->element(
  643. 'a',
  644. [
  645. 'href' => $deleteurl,
  646. 'class' => 'notice_delete popup',
  647. // TRANS: Link title in notice list item to delete a notice.
  648. 'title' => _m('Delete this notice from the timeline.'),
  649. ],
  650. // TRANS: Link text in notice list item to delete a notice.
  651. _m('Delete')
  652. );
  653. }
  654. }
  655. /**
  656. * finish the notice
  657. *
  658. * Close the last elements in the notice list item
  659. *
  660. * @return void
  661. */
  662. public function showEnd()
  663. {
  664. if (Event::handle('StartCloseNoticeListItemElement', [$this])) {
  665. $this->out->elementEnd('li');
  666. Event::handle('EndCloseNoticeListItemElement', [$this]);
  667. }
  668. }
  669. /**
  670. * Get the notice in question
  671. *
  672. * For hooks, etc., this may be useful
  673. *
  674. * @return Notice The notice we're showing
  675. */
  676. public function getNotice()
  677. {
  678. return $this->notice;
  679. }
  680. }