noticelistitem.php 23 KB

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