MediaWiki REL1_31
CommentStoreComment.php
Go to the documentation of this file.
1<?php
29
31 public $id;
32
34 public $text;
35
37 public $message;
38
40 public $data;
41
49 public function __construct( $id, $text, Message $message = null, array $data = null ) {
50 $this->id = $id;
51 $this->text = $text;
52 $this->message = $message ?: new RawMessage( '$1', [ $text ] );
53 $this->data = $data;
54 }
55
65 public static function newUnsavedComment( $comment, array $data = null ) {
66 global $wgContLang;
67
68 if ( $comment instanceof CommentStoreComment ) {
69 return $comment;
70 }
71
72 if ( $data !== null ) {
73 foreach ( $data as $k => $v ) {
74 if ( substr( $k, 0, 1 ) === '_' ) {
75 throw new InvalidArgumentException( 'Keys in $data beginning with "_" are reserved' );
76 }
77 }
78 }
79
80 if ( $comment instanceof Message ) {
81 $message = clone $comment;
82 $text = $message->inLanguage( $wgContLang ) // Avoid $wgForceUIMsgAsContentMsg
83 ->setInterfaceMessageFlag( true )
84 ->text();
85 return new CommentStoreComment( null, $text, $message, $data );
86 } else {
87 return new CommentStoreComment( null, $comment, null, $data );
88 }
89 }
90}
CommentStoreComment represents a comment stored by CommentStore.
string $text
Text version of the comment.
static newUnsavedComment( $comment, array $data=null)
Create a new, unsaved CommentStoreComment.
int null $id
Comment ID, if any.
__construct( $id, $text, Message $message=null, array $data=null)
Message $message
Message version of the comment.
array null $data
Structured data of the comment.
The Message class provides methods which fulfil two basic services:
Definition Message.php:159
inLanguage( $lang)
Request the message in any language that is supported.
Definition Message.php:728
Variant of the Message class.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
Definition design.txt:57