49 parent::__construct( $modelId, $formats );
64 return $content->getText();
84 if ( $myContent->
equals( $yourContent ) ) {
89 if ( $oldContent->
equals( $yourContent ) ) {
103 $ok =
wfMerge( $old, $mine, $yours, $result );
115 return $mergedContent;
128 return TextContent::class;
145 return new $class( $text );
157 return new $class(
'' );
170 $fields = parent::getFieldsForSearchIndex( $engine );
171 $fields[
'language'] =
183 $fields = parent::getDataForSearchIndex( $page, $output, $engine, $revision );
184 $fields[
'language'] =
193 '@phan-var TextContent $content';
195 $text = $content->getText();
200 return ( $text === $pst ) ? $content :
new $contentClass( $pst, $content->
getModel() );
230 '@phan-var TextContent $content';
231 if ( in_array( $content->
getModel(), $textModelsToParse ) ) {
246 if ( method_exists( $content,
'getHtml' ) ) {
247 $method =
new ReflectionMethod( $content,
'getHtml' );
248 $method->setAccessible(
true );
249 $html = $method->invoke( $content );
250 $html =
"<pre>$html</pre>";
253 $html = htmlspecialchars( $content->getText(), ENT_COMPAT );
254 $html =
"<pre>$html</pre>";
265class_alias( TextContentHandler::class,
'TextContentHandler' );
const CONTENT_FORMAT_TEXT
For future use, e.g.
wfMerge(string $old, string $mine, string $yours, ?string &$simplisticMergeAttempt, string &$mergeLeftovers=null)
wfMerge attempts to merge differences between three texts.
A content handler knows how do deal with a specific type of content on a wiki page.
checkFormat( $format)
Convenient for checking whether a format provided as a parameter is actually supported.
getPageLanguage(Title $title, Content $content=null)
Get the language in which the content of the given page is written.
getDefaultFormat()
The format used for serialization/deserialization by default by this ContentHandler.
Base content handler implementation for flat text contents.
getFieldsForSearchIndex(SearchEngine $engine)
Get fields definition for search index.
merge3(Content $oldContent, Content $myContent, Content $yourContent)
Attempts to merge differences between three versions.
getDataForSearchIndex(WikiPage $page, ParserOutput $output, SearchEngine $engine, ?RevisionRecord $revision=null)
preSaveTransform(Content $content, PreSaveTransformParams $pstParams)
Returns a $content object with pre-save transformations applied (or the same object if no transformat...
getContentClass()
Returns the name of the associated Content class, to be used when creating new objects.
fillParserOutput(Content $content, ContentParseParams $cpoParams, ParserOutput &$output)
Fills the provided ParserOutput object with information derived from the content.
unserializeContent( $text, $format=null)
Unserializes a Content object of the type supported by this ContentHandler.
makeEmptyContent()
Creates an empty TextContent object.
__construct( $modelId=CONTENT_MODEL_TEXT, $formats=[CONTENT_FORMAT_TEXT])
Constructor, initializing the ContentHandler instance with its model ID and a list of supported forma...
serializeContent(Content $content, $format=null)
Returns the content's text as-is.
static normalizeLineEndings( $text)
Do a "\\r\\n" -> "\\n" and "\\r" -> "\\n" transformation as well as trim trailing whitespace.
A class containing constants representing the names of configuration variables.
const TextModelsToParse
Name constant for the TextModelsToParse setting, for use with Config::get()
Contain a class for special pages.
makeSearchFieldMapping( $name, $type)
Create a search field definition.
Base representation for an editable wiki page.
getContent( $audience=RevisionRecord::FOR_PUBLIC, Authority $performer=null)
Get the content of the current revision.
getTitle()
Get the title object of the article.
Base interface for representing page content.
getModel()
Returns the ID of the content model used by this Content object.
equals(Content $that=null)
Returns true if this Content objects is conceptually equivalent to the given Content object.
Definition of a mapping for the search index field.
const INDEX_TYPE_KEYWORD
KEYWORD fields are indexed without any processing, so are appropriate for e.g.