Original: https://www.mediawiki.org/wiki/Extension:Comments Das hier ist eine an https://znil.net angepasste Version.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CommentsLogFormatter.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. /**
  3. * Logging formatter for Comments' log entries.
  4. *
  5. * @file
  6. * @date 28 July 2013
  7. */
  8. class CommentsLogFormatter extends WikitextLogFormatter {
  9. /**
  10. * Formats parameters intented for action message from
  11. * array of all parameters. There are three hardcoded
  12. * parameters (array is zero-indexed, this list not):
  13. * - 1: user name with premade link
  14. * - 2: usable for gender magic function
  15. * - 3: target page with premade link
  16. * @return array
  17. */
  18. protected function getMessageParameters() {
  19. if ( isset( $this->parsedParameters ) ) {
  20. return $this->parsedParameters;
  21. }
  22. $entry = $this->entry;
  23. $params = $this->extractParameters();
  24. $commentId = $params[3]; // = $4, because array numbering starts from 0
  25. $params[0] = Message::rawParam( $this->getPerformerElement() );
  26. $params[1] = $this->canView( LogPage::DELETED_USER ) ? $entry->getPerformer()->getName() : '';
  27. $title = $entry->getTarget();
  28. if ( $title instanceof Title ) { // healthy paranoia
  29. $title->setFragment( '#comment-' . $commentId );
  30. }
  31. $params[2] = Message::rawParam( $this->makePageLink( $title ) );
  32. // Bad things happens if the numbers are not in correct order
  33. ksort( $params );
  34. return $this->parsedParameters = $params;
  35. }
  36. }