MediaWiki REL1_30
CommentStoreComment.php
Go to the documentation of this file.
1<?php
24
31
33 public $id;
34
36 public $text;
37
39 public $message;
40
42 public $data;
43
51 public function __construct( $id, $text, Message $message = null, array $data = null ) {
52 $this->id = $id;
53 $this->text = $text;
54 $this->message = $message ?: new RawMessage( '$1', [ $text ] );
55 $this->data = $data;
56 }
57
67 public static function newUnsavedComment( $comment, array $data = null ) {
68 global $wgContLang;
69
70 if ( $comment instanceof CommentStoreComment ) {
71 return $comment;
72 }
73
74 if ( $data !== null ) {
75 foreach ( $data as $k => $v ) {
76 if ( substr( $k, 0, 1 ) === '_' ) {
77 throw new InvalidArgumentException( 'Keys in $data beginning with "_" are reserved' );
78 }
79 }
80 }
81
82 if ( $comment instanceof Message ) {
83 $message = clone $comment;
84 $text = $message->inLanguage( $wgContLang ) // Avoid $wgForceUIMsgAsContentMsg
85 ->setInterfaceMessageFlag( true )
86 ->text();
87 return new CommentStoreComment( null, $text, $message, $data );
88 } else {
89 return new CommentStoreComment( null, $comment, null, $data );
90 }
91 }
92}
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
Basic database interface for live and lazy-loaded relation database handles.
Definition IDatabase.php:40